Coverage Report - org.jtheque.films.services.impl.utils.search.FilmSearch
 
Classes in this File Line Coverage Branch Coverage Complexity
FilmSearch
0 %
0/79
N/A
1
 
 1  
 package org.jtheque.films.services.impl.utils.search;
 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.utils.db.Note;
 20  
 import org.jtheque.films.persistence.od.ActorImpl;
 21  
 import org.jtheque.films.persistence.od.FilmImpl;
 22  
 import org.jtheque.films.persistence.od.RealizerImpl;
 23  
 import org.jtheque.primary.od.LanguageImpl;
 24  
 import org.jtheque.primary.od.KindImpl;
 25  
 import org.jtheque.primary.od.TypeImpl;
 26  
 
 27  
 /**
 28  
  * A search of films.
 29  
  *
 30  
  * @author Baptiste Wicht
 31  
  */
 32  
 public final class FilmSearch extends AbstractSearch<FilmImpl> {
 33  
     private boolean mustCheckKind;
 34  
     private boolean mustCheckActor;
 35  
     private boolean mustCheckType;
 36  
     private boolean mustCheckYear;
 37  
     private boolean mustCheckRealizer;
 38  
     private boolean mustCheckLanguage;
 39  
     private boolean mustCheckNote;
 40  
     private boolean mustCheckDuration;
 41  
 
 42  
     /* Search's criteria */
 43  
     private KindImpl kind;
 44  
     private ActorImpl actor;
 45  
     private TypeImpl type;
 46  
     private int startYear;
 47  
     private int endYear;
 48  
     private RealizerImpl realizer;
 49  
     private LanguageImpl language;
 50  
     private Note note;
 51  
     private int startDuration;
 52  
     private int endDuration;
 53  
 
 54  
     /**
 55  
      * Construct a new <code>FilmSearch</code>.
 56  
      */
 57  
     public FilmSearch() {
 58  0
         super();
 59  
 
 60  0
         setSearcher(new FilmSearcher());
 61  0
     }
 62  
 
 63  
     /**
 64  
      * Return the actor of the search.
 65  
      *
 66  
      * @return The actor of the search.
 67  
      */
 68  
     public ActorImpl getActor() {
 69  0
         return actor;
 70  
     }
 71  
 
 72  
     /**
 73  
      * Set the actor of the search.
 74  
      *
 75  
      * @param actor The actor of the search.
 76  
      */
 77  
     public void setActor(ActorImpl actor) {
 78  0
         this.actor = actor;
 79  0
     }
 80  
 
 81  
     /**
 82  
      * Return the end year of the search.
 83  
      *
 84  
      * @return The end year of the search.
 85  
      */
 86  
     public int getEndYear() {
 87  0
         return endYear;
 88  
     }
 89  
 
 90  
     /**
 91  
      * Set the end year of the search.
 92  
      *
 93  
      * @param anneeA The end year of the search.
 94  
      */
 95  
     public void setEndYear(int anneeA) {
 96  0
         endYear = anneeA;
 97  0
     }
 98  
 
 99  
 
 100  
     /**
 101  
      * Return the end year of the search.
 102  
      *
 103  
      * @return The start year of the search.
 104  
      */
 105  
     public int getStartYear() {
 106  0
         return startYear;
 107  
     }
 108  
 
 109  
     /**
 110  
      * Set the start year of the search.
 111  
      *
 112  
      * @param anneeDe The start year of the search.
 113  
      */
 114  
     public void setStartYear(int anneeDe) {
 115  0
         startYear = anneeDe;
 116  0
     }
 117  
 
 118  
     /**
 119  
      * Return the end duration of the search.
 120  
      *
 121  
      * @return The end duration of the search.
 122  
      */
 123  
     public int getEndDuration() {
 124  0
         return endDuration;
 125  
     }
 126  
 
 127  
     /**
 128  
      * Set the end duration of the search.
 129  
      *
 130  
      * @param dureeA The end duration of the search.
 131  
      */
 132  
     public void setEndDuration(int dureeA) {
 133  0
         endDuration = dureeA;
 134  0
     }
 135  
 
 136  
     /**
 137  
      * Return the start duration of the search.
 138  
      *
 139  
      * @return The start duration of the search.
 140  
      */
 141  
     public int getStartDuration() {
 142  0
         return startDuration;
 143  
     }
 144  
 
 145  
     /**
 146  
      * Set the start duration of the search.
 147  
      *
 148  
      * @param dureeDe The start duration of the search.
 149  
      */
 150  
     public void setStartDuration(int dureeDe) {
 151  0
         startDuration = dureeDe;
 152  0
     }
 153  
 
 154  
     /**
 155  
      * Return the kind of the search.
 156  
      *
 157  
      * @return The kind of the search.
 158  
      */
 159  
     public KindImpl getKind() {
 160  0
         return kind;
 161  
     }
 162  
 
 163  
     /**
 164  
      * Set the kind of the search.
 165  
      *
 166  
      * @param kind The kind of the search.
 167  
      */
 168  
     public void setKind(KindImpl kind) {
 169  0
         this.kind = kind;
 170  0
     }
 171  
 
 172  
     /**
 173  
      * Return the language of the search.
 174  
      *
 175  
      * @return The language of the search.
 176  
      */
 177  
     public LanguageImpl getLanguage() {
 178  0
         return language;
 179  
     }
 180  
 
 181  
     /**
 182  
      * Set the language of the search.
 183  
      *
 184  
      * @param language The language of the search.
 185  
      */
 186  
     public void setLanguage(LanguageImpl language) {
 187  0
         this.language = language;
 188  0
     }
 189  
 
 190  
     /**
 191  
      * Return the note of the search.
 192  
      *
 193  
      * @return The note of the search.
 194  
      */
 195  
     public Note getNote() {
 196  0
         return note;
 197  
     }
 198  
 
 199  
     /**
 200  
      * Set the note of the search.
 201  
      *
 202  
      * @param note The note of the search.
 203  
      */
 204  
     public void setNote(Note note) {
 205  0
         this.note = note;
 206  0
     }
 207  
 
 208  
     /**
 209  
      * Return the realizer of the search.
 210  
      *
 211  
      * @return The realizer of the search.
 212  
      */
 213  
     public RealizerImpl getRealizer() {
 214  0
         return realizer;
 215  
     }
 216  
 
 217  
     /**
 218  
      * Set the realizer of the search.
 219  
      *
 220  
      * @param realizer The realizer of the search.
 221  
      */
 222  
     public void setRealizer(RealizerImpl realizer) {
 223  0
         this.realizer = realizer;
 224  0
     }
 225  
 
 226  
     /**
 227  
      * Return the type of the search.
 228  
      *
 229  
      * @return The type of the search.
 230  
      */
 231  
     public TypeImpl getType() {
 232  0
         return type;
 233  
     }
 234  
 
 235  
     /**
 236  
      * Set the type of the search.
 237  
      *
 238  
      * @param type The type of the search.
 239  
      */
 240  
     public void setType(TypeImpl type) {
 241  0
         this.type = type;
 242  0
     }
 243  
 
 244  
     /**
 245  
      * Indicate if we must check actor or not.
 246  
      *
 247  
      * @return true if we must check actor else false.
 248  
      */
 249  
     public boolean isMustCheckActor() {
 250  0
         return mustCheckActor;
 251  
     }
 252  
 
 253  
     /**
 254  
      * Set boolean flag indicating if we must check actor or not.
 255  
      *
 256  
      * @param mustCheckActeur A boolean indicating if we must check actor or not.
 257  
      */
 258  
     public void setMustCheckActor(boolean mustCheckActeur) {
 259  0
         mustCheckActor = mustCheckActeur;
 260  0
     }
 261  
 
 262  
     /**
 263  
      * Indicate if we must check year or not.
 264  
      *
 265  
      * @return true if we must check year else false.
 266  
      */
 267  
     public boolean isMustCheckYear() {
 268  0
         return mustCheckYear;
 269  
     }
 270  
 
 271  
     /**
 272  
      * Set boolean flag indicating if we must check year or not.
 273  
      *
 274  
      * @param mustCheckAnnee A boolean indicating if we must check year or not.
 275  
      */
 276  
     public void setMustCheckYear(boolean mustCheckAnnee) {
 277  0
         mustCheckYear = mustCheckAnnee;
 278  0
     }
 279  
 
 280  
     /**
 281  
      * Indicate if we must check duration or not.
 282  
      *
 283  
      * @return true if we must check duration else false.
 284  
      */
 285  
     public boolean isMustCheckDuration() {
 286  0
         return mustCheckDuration;
 287  
     }
 288  
 
 289  
     /**
 290  
      * Set boolean flag indicating if we must check duration or not.
 291  
      *
 292  
      * @param mustCheckDuree A boolean indicating if we must check duration or not.
 293  
      */
 294  
     public void setMustCheckDuration(boolean mustCheckDuree) {
 295  0
         mustCheckDuration = mustCheckDuree;
 296  0
     }
 297  
 
 298  
     /**
 299  
      * Indicate if we must check kind or not.
 300  
      *
 301  
      * @return true if we must check kind else false.
 302  
      */
 303  
     public boolean isMustCheckKind() {
 304  0
         return mustCheckKind;
 305  
     }
 306  
 
 307  
     /**
 308  
      * Set boolean flag indicating if we must check kind or not.
 309  
      *
 310  
      * @param mustCheckGenre A boolean indicating if we must check kind or not.
 311  
      */
 312  
     public void setMustCheckKind(boolean mustCheckGenre) {
 313  0
         mustCheckKind = mustCheckGenre;
 314  0
     }
 315  
 
 316  
     /**
 317  
      * Indicate if we must check language or not.
 318  
      *
 319  
      * @return true if we must check language else false.
 320  
      */
 321  
     public boolean isMustCheckLanguage() {
 322  0
         return mustCheckLanguage;
 323  
     }
 324  
 
 325  
     /**
 326  
      * Set boolean flag indicating if we must check language or not.
 327  
      *
 328  
      * @param mustCheckLangue A boolean indicating if we must check language or not.
 329  
      */
 330  
     public void setMustCheckLanguage(boolean mustCheckLangue) {
 331  0
         mustCheckLanguage = mustCheckLangue;
 332  0
     }
 333  
 
 334  
     /**
 335  
      * Indicate if we must check note or not.
 336  
      *
 337  
      * @return true if we must check note else false.
 338  
      */
 339  
     public boolean isMustCheckNote() {
 340  0
         return mustCheckNote;
 341  
     }
 342  
 
 343  
     /**
 344  
      * Set boolean flag indicating if we must check note or not.
 345  
      *
 346  
      * @param mustCheckNote A boolean indicating if we must check note or not.
 347  
      */
 348  
     public void setMustCheckNote(boolean mustCheckNote) {
 349  0
         this.mustCheckNote = mustCheckNote;
 350  0
     }
 351  
 
 352  
     /**
 353  
      * Indicate if we must check realizer or not.
 354  
      *
 355  
      * @return true if we must check realizer else false.
 356  
      */
 357  
     public boolean isMustCheckRealizer() {
 358  0
         return mustCheckRealizer;
 359  
     }
 360  
 
 361  
     /**
 362  
      * Set boolean flag indicating if we must check realizer or not.
 363  
      *
 364  
      * @param mustCheckRealisateur A boolean indicating if we must check realizer or not.
 365  
      */
 366  
     public void setMustCheckRealizer(boolean mustCheckRealisateur) {
 367  0
         mustCheckRealizer = mustCheckRealisateur;
 368  0
     }
 369  
 
 370  
     /**
 371  
      * Indicate if we must check type or not.
 372  
      *
 373  
      * @return true if we must check type else false.
 374  
      */
 375  
     public boolean isMustCheckType() {
 376  0
         return mustCheckType;
 377  
     }
 378  
 
 379  
     /**
 380  
      * Set boolean flag indicating if we must check type or not.
 381  
      *
 382  
      * @param mustCheckType A boolean indicating if we must check type or not.
 383  
      */
 384  
     public void setMustCheckType(boolean mustCheckType) {
 385  0
         this.mustCheckType = mustCheckType;
 386  0
     }
 387  
 
 388  
     @Override
 389  
     public String toString() {
 390  0
         StringBuilder builder = new StringBuilder("FilmSearch : \n");
 391  
 
 392  0
         builder.append("Must : \n");
 393  0
         builder.append("\t Acteur : ").append(mustCheckActor).append(" \n");
 394  0
         builder.append("\t Year : ").append(mustCheckYear).append(" \n");
 395  0
         builder.append("\t Duration : ").append(mustCheckDuration).append(" \n");
 396  0
         builder.append("\t Kind : ").append(mustCheckKind).append(" \n");
 397  0
         builder.append("\t Note : ").append(mustCheckNote).append(" \n");
 398  0
         builder.append("\t Realizer : ").append(mustCheckRealizer).append(" \n");
 399  0
         builder.append("\t Type : ").append(mustCheckType).append(" \n");
 400  0
         builder.append("\t Language : ").append(mustCheckLanguage).append(" \n");
 401  
 
 402  0
         builder.append("Values :  \n");
 403  0
         builder.append("\t Acteur : ").append(actor).append(" \n");
 404  0
         builder.append("\t Year From : ").append(startYear).append(" \n");
 405  0
         builder.append("\t Year To : ").append(endYear).append(" \n");
 406  0
         builder.append("\t Duration From : ").append(startDuration).append(" \n");
 407  0
         builder.append("\t Duration To : ").append(endDuration).append(" \n");
 408  0
         builder.append("\t Kind : ").append(kind).append(" \n");
 409  0
         builder.append("\t Note : ").append(note).append(" \n");
 410  0
         builder.append("\t Realizer : ").append(realizer).append(" \n");
 411  0
         builder.append("\t Type : ").append(type).append(" \n");
 412  0
         builder.append("\t Language : ").append(language).append(" \n");
 413  
 
 414  0
         return builder.toString();
 415  
     }
 416  
 }