View Javadoc
1   package fr.ifremer.tutti.service.pupitri.csv;
2   
3   /*
4    * #%L
5    * Tutti :: Service
6    * %%
7    * Copyright (C) 2012 - 2014 Ifremer
8    * %%
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU General Public License as
11   * published by the Free Software Foundation, either version 3 of the 
12   * License, or (at your option) any later version.
13   * 
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Public License for more details.
18   * 
19   * You should have received a copy of the GNU General Public 
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/gpl-3.0.html>.
22   * #L%
23   */
24  
25  import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
26  import fr.ifremer.tutti.service.pupitri.BoxType;
27  import fr.ifremer.tutti.service.pupitri.Directions;
28  import fr.ifremer.tutti.service.pupitri.Signs;
29  import org.apache.commons.lang3.time.DateUtils;
30  
31  import java.io.Serializable;
32  import java.util.Date;
33  
34  /**
35   * @author Kevin Morin - kmorin@codelutin.com
36   * @since 1.2
37   */
38  public class CarrouselRow implements Serializable {
39  
40      private static final long serialVersionUID = 1L;
41  
42      public static final String PROPERTY_FILE_ORIGIN = "fileOrigin";
43  
44      public static final String PROPERTY_DATE = "date";
45  
46      public static final String PROPERTY_TIME = "time";
47  
48      public static final String PROPERTY_BALANCE_ID = "balanceId";
49  
50      public static final String PROPERTY_TO_CONFIRM = "toConfirm";
51  
52      public static final String PROPERTY_OPERATION_CODE = "operationCode";
53  
54      public static final String PROPERTY_RIG_NUMBER = "rigNumber";
55  
56      public static final String PROPERTY_BOX_TYPE = "boxType";
57  
58      public static final String PROPERTY_SPECIES_ID = "speciesId";
59  
60      public static final String PROPERTY_SIGN = "sign";
61  
62      public static final String PROPERTY_DIRECTION = "direction";
63  
64      public static final String PROPERTY_WEIGHT = "weight";
65  
66      protected String operationCode;
67  
68      protected Date date;
69  
70      protected String speciesId;
71  
72      protected Signs sign;
73  
74      protected Directions direction;
75  
76      protected Float weight;
77  
78      protected BoxType boxType;
79  
80      public boolean acceptOperation(FishingOperation operation) {
81          return operationCode.equals(operation.getStationNumber())
82                 && DateUtils.isSameDay(date, operation.getGearShootingStartDate());
83      }
84  
85      public String getOperationCode() {
86          return operationCode;
87      }
88  
89      public void setOperationCode(String operationCode) {
90          this.operationCode = operationCode;
91      }
92  
93      public Date getDate() {
94          return date;
95      }
96  
97      public void setDate(Date date) {
98          this.date = date;
99      }
100 
101     public String getSpeciesId() {
102         return speciesId;
103     }
104 
105     public void setSpeciesId(String speciesId) {
106         this.speciesId = speciesId;
107     }
108 
109     public Signs getSign() {
110         return sign;
111     }
112 
113     public void setSign(Signs sign) {
114         if (Signs.UNSORTED.equals(sign)) {
115 
116             // Not use this sign (see https://forge.codelutin.com/issues/5085)
117             sign = Signs.DEFAULT;
118         }
119         this.sign = sign;
120     }
121 
122     public Directions getDirection() {
123         return direction;
124     }
125 
126     public void setDirection(Directions direction) {
127         this.direction = direction;
128     }
129 
130     public Float getWeight() {
131         return weight;
132     }
133 
134     public void setWeight(Float weight) {
135         this.weight = weight;
136     }
137 
138     public boolean isSorted() {
139 
140         return Directions.VAT == direction;
141 
142     }
143 
144     public BoxType getBoxType() {
145         return boxType;
146     }
147 
148     public void setBoxType(BoxType boxType) {
149         this.boxType = boxType;
150     }
151 }