Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
8 changed files:
- t3-domain/src/main/java/fr/ird/t3/entities/type/T3Date.java
- t3-domain/src/main/resources/db/migration/V_2_3_03-spatialize-ocean.sql → t3-domain/src/main/resources/db/migration/V2_3_03-spatialize-ocean.sql
- t3-domain/src/main/resources/db/migration/V_2_3_04-add-WeightCategoryLogbook-unknown.sql → t3-domain/src/main/resources/db/migration/V2_3_04-add-WeightCategoryLogbook-unknown.sql
- t3-domain/src/main/resources/db/migration/V_2_3_05-spatialize-harbour.sql → t3-domain/src/main/resources/db/migration/V2_3_05-spatialize-harbour.sql
- t3-domain/src/main/resources/db/migration/V_2_3_05_change-Activity-stratum-type.sql → t3-domain/src/main/resources/db/migration/V2_3_05_change-Activity-stratum-type.sql
- t3-domain/src/main/resources/db/migration/V_2_4_01_delete_idx.sql → t3-domain/src/main/resources/db/migration/V2_4_01_delete_idx.sql
- t3-domain/src/main/resources/db/migration/V_2_4_02-spatialize-ocean.sql → t3-domain/src/main/resources/db/migration/V2_4_02-spatialize-ocean.sql
- t3-domain/src/main/resources/db/migration/V_2_4_03-review-referential.sql → t3-domain/src/main/resources/db/migration/V2_4_03-review-referential.sql
Changes:
| ... | ... | @@ -20,14 +20,13 @@ |
| 20 | 20 |
*/
|
| 21 | 21 |
package fr.ird.t3.entities.type;
|
| 22 | 22 |
|
| 23 |
-import com.google.common.base.Preconditions;
|
|
| 24 | 23 |
import com.google.common.collect.Sets;
|
| 24 |
+ |
|
| 25 | 25 |
import java.io.Serializable;
|
| 26 | 26 |
import java.util.Calendar;
|
| 27 | 27 |
import java.util.Date;
|
| 28 | 28 |
import java.util.Set;
|
| 29 | 29 |
|
| 30 |
- |
|
| 31 | 30 |
import static org.nuiton.i18n.I18n.n;
|
| 32 | 31 |
|
| 33 | 32 |
public class T3Date implements Comparable<T3Date>, Serializable {
|
| ... | ... | @@ -152,15 +151,15 @@ public class T3Date implements Comparable<T3Date>, Serializable { |
| 152 | 151 |
}
|
| 153 | 152 |
|
| 154 | 153 |
public void fromT3Date(T3Date date) {
|
| 155 |
- |
|
| 156 | 154 |
month = date.getMonth();
|
| 157 | 155 |
year = date.getYear();
|
| 158 | 156 |
}
|
| 159 | 157 |
|
| 160 | 158 |
public T3Date incrementsMonths(int nbMonth) {
|
| 161 |
- Preconditions.checkArgument(
|
|
| 162 |
- nbMonth > 0,
|
|
| 163 |
- "nbMonth must be a strict positif integer but was : " + nbMonth);
|
|
| 159 |
+ if (nbMonth==0) {
|
|
| 160 |
+ // ok just return this date
|
|
| 161 |
+ return this;
|
|
| 162 |
+ }
|
|
| 164 | 163 |
int nmonth = getMonth();
|
| 165 | 164 |
int nyear = getYear();
|
| 166 | 165 |
int nbMonthCount = nbMonth;
|
| ... | ... | @@ -176,9 +175,9 @@ public class T3Date implements Comparable<T3Date>, Serializable { |
| 176 | 175 |
}
|
| 177 | 176 |
|
| 178 | 177 |
public T3Date decrementsMonths(int nbMonth) {
|
| 179 |
- Preconditions.checkArgument(
|
|
| 180 |
- nbMonth > 0,
|
|
| 181 |
- "nbMonth must be a strict positif integer but was : " + nbMonth);
|
|
| 178 |
+ if (nbMonth == 0) {
|
|
| 179 |
+ return this;
|
|
| 180 |
+ }
|
|
| 182 | 181 |
|
| 183 | 182 |
int nmonth = getMonth();
|
| 184 | 183 |
int nyear = getYear();
|
| ... | ... | @@ -201,7 +200,7 @@ public class T3Date implements Comparable<T3Date>, Serializable { |
| 201 | 200 |
}
|
| 202 | 201 |
|
| 203 | 202 |
@Override
|
| 204 |
- public int compareTo(T3Date date) {
|
|
| 203 |
+ public int compareTo(@SuppressWarnings("NullableProblems") T3Date date) {
|
|
| 205 | 204 |
int result = year - date.year;
|
| 206 | 205 |
if (result != 0) {
|
| 207 | 206 |
return result;
|