Revision a3960fa7
Added by Katja Luther almost 9 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TimePeriod.java | ||
---|---|---|
410 | 410 |
if (partial == null){ |
411 | 411 |
partial = new Partial(); |
412 | 412 |
} |
413 |
if (value == null){ |
|
413 |
if (value == null || value == 0){
|
|
414 | 414 |
return partial.without(type); |
415 | 415 |
}else{ |
416 | 416 |
checkFieldValues(value, type, partial); |
... | ... | |
446 | 446 |
int max = 9999999; |
447 | 447 |
if (type.equals(MONTH_TYPE)){ |
448 | 448 |
max = 12; |
449 |
if (value == 0 && partial.indexOf(DAY_TYPE) == -1){ |
|
450 |
return; |
|
451 |
} |
|
449 | 452 |
} |
450 | 453 |
if (type.equals(DAY_TYPE)){ |
454 |
if (value == 0){ |
|
455 |
return; |
|
456 |
} |
|
451 | 457 |
max = 31; |
452 | 458 |
Integer month = null; |
453 | 459 |
if (partial.isSupported(MONTH_TYPE)){ |
... | ... | |
461 | 467 |
} |
462 | 468 |
} |
463 | 469 |
} |
470 |
if (type.equals(YEAR_TYPE)){ |
|
471 |
if (value == 0 && partial.getValue(partial.indexOf(MONTH_TYPE)) == 0){ |
|
472 |
return; |
|
473 |
} |
|
474 |
} |
|
475 |
|
|
464 | 476 |
if ( (value < 1 || value > max) ){ |
465 | 477 |
throw new IndexOutOfBoundsException("Value must be between 1 and " + max); |
466 | 478 |
} |
Also available in: Unified diff
accept the change from a number to null in TimePeriod fields #5319