1
|
/**
|
2
|
* Copyright (C) 2019 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.vaadin.data.validator;
|
10
|
|
11
|
import com.vaadin.data.Validator;
|
12
|
|
13
|
import eu.etaxonomy.cdm.model.common.TimePeriod;
|
14
|
|
15
|
/**
|
16
|
* @author a.kohlbecker
|
17
|
* @since Mar 27, 2019
|
18
|
*
|
19
|
*/
|
20
|
public class TimePeriodCompletenesValidator implements Validator {
|
21
|
|
22
|
private static final long serialVersionUID = 4651375734846907644L;
|
23
|
|
24
|
PartialCompletenesValidator partialValidator = new PartialCompletenesValidator();
|
25
|
|
26
|
@Override
|
27
|
public void validate(Object value) throws InvalidValueException {
|
28
|
if(value != null){
|
29
|
TimePeriod timePeriod = (TimePeriod)value;
|
30
|
if(timePeriod .getStart() != null){
|
31
|
partialValidator.validate(timePeriod.getEndDay());
|
32
|
}
|
33
|
if(timePeriod.getEnd() != null){
|
34
|
partialValidator.validate(timePeriod.getEnd());
|
35
|
}
|
36
|
}
|
37
|
}
|
38
|
}
|