Coverage Report - org.jtheque.films.utils.Constants
 
Classes in this File Line Coverage Branch Coverage Complexity
Constants
0 %
0/2
N/A
4.6
Constants$Files
N/A
N/A
4.6
Constants$Files$FileType
0 %
0/29
0 %
0/18
4.6
Constants$Files$JT
N/A
N/A
4.6
Constants$Files$Versions
N/A
N/A
4.6
Constants$Files$Versions$JTF
N/A
N/A
4.6
Constants$Files$Versions$XML
N/A
N/A
4.6
Constants$Properties
N/A
N/A
4.6
Constants$Properties$Film
N/A
N/A
4.6
Constants$Properties$Form001
N/A
N/A
4.6
Constants$Properties$Kind
N/A
N/A
4.6
Constants$Properties$Person
N/A
N/A
4.6
Constants$Properties$Publication
N/A
N/A
4.6
Constants$Properties$Saga
N/A
N/A
4.6
Constants$Properties$Type
N/A
N/A
4.6
Constants$Report
N/A
N/A
4.6
Constants$Report$Form001_Parameters
N/A
N/A
4.6
Constants$Site
0 %
0/10
N/A
4.6
 
 1  
 package org.jtheque.films.utils;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.core.managers.Managers;
 20  
 
 21  
 /**
 22  
  * Contains the constants of the application.
 23  
  *
 24  
  * @author Baptiste Wicht
 25  
  */
 26  
 public final class Constants {
 27  
     public static final int MINIATURE_WIDTH = 100;
 28  
 
 29  
     public static final String IMAGE_BASE_NAME = "org/jtheque/films/images";
 30  
 
 31  
     public static final String BORROWERS = "AbstractBorrower";
 32  
     public static final String YEAR = "Year";
 33  
 
 34  
     public static final String FILM_ICON = "film";
 35  
 
 36  
     public static final double A_QUARTER = 0.25;
 37  
     public static final double AN_HALF = 0.25;
 38  
     
 39  
     /**
 40  
      * Construct a new Constants. This class isn't instanciable.
 41  
      */
 42  
     private Constants() {
 43  0
         super();
 44  0
     }
 45  
 
 46  
     /**
 47  
      * A properties class for data.
 48  
      *
 49  
      * @author Baptiste Wicht
 50  
      */
 51  
     public interface Properties {
 52  
         /**
 53  
          * Contains properties of film.
 54  
          *
 55  
          * @author Baptiste Wicht
 56  
          */
 57  
         interface Film {
 58  
             String KIND = "film.kind";
 59  
             String TITLE = "film.title";
 60  
             String TYPE = "film.type";
 61  
             String REALIZER = "film.realizer";
 62  
             String YEAR = "film.year";
 63  
             String DURATION = "film.duration";
 64  
             String LANGUAGE = "film.language";
 65  
             String ACTORS = "film.actors";
 66  
             String RESUME = "film.resume";
 67  
             String COMMENT = "film.comment";
 68  
             String IMAGE = "film.image";
 69  
             String FILE_PATH = "film.filepath";
 70  
             String SAGA = "film.saga";
 71  
             String NOTE = "film.note";
 72  
 
 73  
             int TITLE_MAX_LENGTH = 150;
 74  
             int RESUME_MAX_LENGTH = 2000;
 75  
             int COMMENT_MAX_LENGTH = 2000;
 76  
             int YEAR_MAX_LENGTH = 4;
 77  
             int DURATION_MAX_LENGTH = 4;
 78  
             int IMAGE_MAX_LENGTH = 200;
 79  
             int FILE_PATH_MAX_LENGTH = 200;
 80  
         }
 81  
 
 82  
         /**
 83  
          * Kind constants.
 84  
          *
 85  
          * @author Baptiste Wicht
 86  
          */
 87  
         interface Kind {
 88  
             String NAME = "kind.name";
 89  
             int NAME_MAX_LENGTH = 100;
 90  
         }
 91  
 
 92  
         /**
 93  
          * Type constants.
 94  
          *
 95  
          * @author Baptiste Wicht
 96  
          */
 97  
         interface Type {
 98  
             String NAME = "type.name";
 99  
             int NAME_MAX_LENGTH = 100;
 100  
         }
 101  
 
 102  
         /**
 103  
          * Saga constants.
 104  
          *
 105  
          * @author Baptiste Wicht
 106  
          */
 107  
         interface Saga {
 108  
             String NAME = "saga.name";
 109  
             int NAME_MAX_LENGTH = 100;
 110  
         }
 111  
 
 112  
         /**
 113  
          * Contains properties of publication.
 114  
          *
 115  
          * @author Baptiste Wicht
 116  
          */
 117  
         interface Publication {
 118  
             String HOST = "publication.host";
 119  
             String USER = "publication.user";
 120  
             String PASSWORD = "publication.password";
 121  
             String PATH = "publication.path";
 122  
             String PORT = "publication.port";
 123  
 
 124  
             int HOST_MAX_LENGTH = 100;
 125  
             int USER_MAX_LENGTH = 100;
 126  
             int PASSWORD_MAX_LENGTH = 100;
 127  
             int PATH_MAX_LENGTH = 200;
 128  
             int PORT_MAX_LENGTH = 12;
 129  
         }
 130  
 
 131  
         /**
 132  
          * Contains properties of person.
 133  
          *
 134  
          * @author Baptiste Wicht
 135  
          */
 136  
         interface Person {
 137  
             String NAME = "person.name";
 138  
             String FIRST_NAME = "person.firstname";
 139  
             String COUNTRY = "person.country";
 140  
             String NOTE = "person.note";
 141  
 
 142  
             int NAME_MAX_LENGTH = 100;
 143  
             int FIRST_NAME_MAX_LENGTH = 100;
 144  
         }
 145  
 
 146  
         /**
 147  
          * Contains properties of the Form001.
 148  
          *
 149  
          * @author Baptiste Wicht
 150  
          */
 151  
         interface Form001 {
 152  
             String TITLE = "reports.films.title";
 153  
         }
 154  
     }
 155  
 
 156  
     /**
 157  
      * Contains all the reports of the module.
 158  
      *
 159  
      * @author Baptiste Wicht
 160  
      */
 161  
     public interface Report {
 162  
         String FORM001_TABLE = "org/jtheque/films/reports/Form001_Table.jrxml";
 163  
         String FORM001_TEXT = "org/jtheque/films/reports/Form001_Text.jrxml";
 164  
         String FORM001_PAGE = "org/jtheque/films/reports/Form001_Page.jrxml";
 165  
         String FORM001_WEB = "org/jtheque/films/reports/Form001_Web.jrxml";
 166  
         String FORM001_DATA = "org/jtheque/films/reports/Form001_Data.jrxml";
 167  
 
 168  
         String FORM002_DVD_STANDARD = "Form002_DVD_Standard.jrxml";
 169  
         String FORM002_DVD_SLIM = "Form002_DVD_Slim.jrxml";
 170  
         String FORM002_CD_STANDARD = "Form002_CD_Standard.jrxml";
 171  
         String FORM002_CD_SLIM = "Form002_CD_Slim.jrxml";
 172  
 
 173  
         /**
 174  
          * Contains the parameters of the form001.
 175  
          *
 176  
          * @author Baptiste Wicht
 177  
          */
 178  
         interface Form001_Parameters {
 179  
             String TITLE = "REPORT_TITLE";
 180  
             String KIND = "REPORT_KIND";
 181  
             String FILM = "REPORT_FILM";
 182  
             String TYPE = "REPORT_TYPE";
 183  
             String REALIZER = "REPORT_REALIZER";
 184  
             String YEAR = "REPORT_YEAR";
 185  
             String DURATION = "REPORT_DURATION";
 186  
             String LANGUAGE = "REPORT_LANGUAGE";
 187  
             String ACTORS = "REPORT_ACTORS";
 188  
         }
 189  
     }
 190  
 
 191  
     /**
 192  
      * A properties class for all file's properties.
 193  
      *
 194  
      * @author Baptiste Wicht
 195  
      */
 196  
     public interface Files {
 197  
         String MINIATURE_FOLDER = Managers.getCore().getFolders().getApplicationFolder() + "/miniatures/";
 198  
 
 199  
         /**
 200  
          * A properties class for file's types.
 201  
          *
 202  
          * @author Baptiste Wicht
 203  
          */
 204  0
         enum FileType {
 205  0
             XML,
 206  0
             XLS,
 207  0
             PDF,
 208  0
             TXT,
 209  0
             HTML,
 210  0
             JTF,
 211  0
             CSV,
 212  0
             RTF,
 213  0
             JTFE;
 214  
 
 215  
             /**
 216  
              * Return the FileType enum value from the String value.
 217  
              *
 218  
              * @param fileType The string value of the enum.
 219  
              * @return The FileType enum value.
 220  
              */
 221  
             public static FileType fromString(String fileType) {
 222  0
                 if ("xls".equalsIgnoreCase(fileType)) {
 223  0
                     return XLS;
 224  0
                 } else if ("xml".equalsIgnoreCase(fileType)) {
 225  0
                     return XML;
 226  0
                 } else if ("pdf".equalsIgnoreCase(fileType)) {
 227  0
                     return PDF;
 228  0
                 } else if ("txt".equalsIgnoreCase(fileType)) {
 229  0
                     return TXT;
 230  0
                 } else if ("html".equalsIgnoreCase(fileType)) {
 231  0
                     return JTF;
 232  0
                 } else if ("jtf".equalsIgnoreCase(fileType)) {
 233  0
                     return JTF;
 234  0
                 } else if ("csv".equalsIgnoreCase(fileType)) {
 235  0
                     return CSV;
 236  0
                 } else if ("rtf".equalsIgnoreCase(fileType)) {
 237  0
                     return RTF;
 238  0
                 } else if ("jtfe".equalsIgnoreCase(fileType)) {
 239  0
                     return JTFE;
 240  
                 }
 241  
 
 242  0
                 return null;
 243  
             }
 244  
         }
 245  
 
 246  
         /**
 247  
          * A properties class for versions of file.
 248  
          *
 249  
          * @author Baptiste Wicht
 250  
          */
 251  
         interface Versions {
 252  
             /**
 253  
              * A properties class for versions of XML File.
 254  
              *
 255  
              * @author Baptiste Wicht
 256  
              */
 257  
             interface XML {
 258  
                 int FIRST = 1;
 259  
                 int SECOND = 2;
 260  
                 int THIRD = 3;
 261  
             }
 262  
 
 263  
             /**
 264  
              * A properties class for versions of JTF File.
 265  
              *
 266  
              * @author Baptiste Wicht
 267  
              */
 268  
             interface JTF {
 269  
                 int FIRST = 1;
 270  
                 int SECOND = 1;
 271  
             }
 272  
         }
 273  
 
 274  
         /**
 275  
          * A properties class for JT's File.
 276  
          *
 277  
          * @author Baptiste Wicht
 278  
          */
 279  
         interface JT {
 280  
             long JTCATEGORYSEPARATOR = -89569876428459544L;
 281  
             long JTINTERNSEPARATOR = -95684111123647897L;
 282  
 
 283  
             int CONTENT = 5;
 284  
             int NO_CONTENT = 10;
 285  
 
 286  
             String JTKEY = "1W@JTHEQUE@W1";
 287  
         }
 288  
     }
 289  
 
 290  
     /**
 291  
      * A properties class for sites.
 292  
      *
 293  
      * @author Baptiste Wicht
 294  
      */
 295  0
     public enum Site {
 296  0
         CINEMOVIES("Cinemovies"),
 297  0
         ALLOCINE("Allocine"),
 298  0
         MOVIESCOVERS("MoviesCovers"),
 299  0
         DVDFR("DVDFr");
 300  
 
 301  
         private final String value;
 302  
 
 303  
         /**
 304  
          * Construct a new Site.
 305  
          *
 306  
          * @param value The string value of the site.
 307  
          */
 308  0
         Site(String value) {
 309  0
             this.value = value;
 310  0
         }
 311  
 
 312  
         /**
 313  
          * Return the string value of the site.
 314  
          *
 315  
          * @return The string value of the site.
 316  
          */
 317  
         public String value() {
 318  0
             return value;
 319  
         }
 320  
 
 321  
         @Override
 322  
         public String toString() {
 323  0
             return value;
 324  
         }
 325  
     }
 326  
 }