Revision c4a57e04
Added by Andreas Müller almost 2 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/RegistrationWorkingSet.java | ||
---|---|---|
18 | 18 |
|
19 | 19 |
import org.joda.time.DateTime; |
20 | 20 |
|
21 |
import eu.etaxonomy.cdm.api.service.exception.RegistrationValidationException;
|
|
21 |
import eu.etaxonomy.cdm.api.service.exception.TypeDesignationSetException;
|
|
22 | 22 |
import eu.etaxonomy.cdm.model.name.Registration; |
23 | 23 |
import eu.etaxonomy.cdm.model.name.RegistrationStatus; |
24 | 24 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
... | ... | |
49 | 49 |
|
50 | 50 |
} |
51 | 51 |
|
52 |
public RegistrationWorkingSet(List<RegistrationDTO> registrationDTOs) throws RegistrationValidationException {
|
|
52 |
public RegistrationWorkingSet(List<RegistrationDTO> registrationDTOs) throws TypeDesignationSetException {
|
|
53 | 53 |
validateAndAddDTOs(registrationDTOs, null); |
54 | 54 |
} |
55 | 55 |
|
56 | 56 |
/** |
57 | 57 |
* @param candidated |
58 |
* @throws RegistrationValidationException
|
|
58 |
* @throws TypeDesignationSetException
|
|
59 | 59 |
* |
60 | 60 |
*/ |
61 |
private void validateAndAdd(Set<Registration> candidates) throws RegistrationValidationException {
|
|
61 |
private void validateAndAdd(Set<Registration> candidates) throws TypeDesignationSetException {
|
|
62 | 62 |
List<RegistrationDTO> dtos = new ArrayList<>(registrationDTOs.size()); |
63 | 63 |
candidates.forEach(reg -> dtos.add(new RegistrationDTO(reg))); |
64 | 64 |
validateAndAddDTOs(dtos, null); |
... | ... | |
70 | 70 |
* citation of the {@link TypeDesignations}. In case the citation is a section and this section is |
71 | 71 |
* having an in-reference the in-reference will be used instead. |
72 | 72 |
* Registration with a differing publication are not added to |
73 |
* the working set, instead a {@link RegistrationValidationException} is thrown which is a container for
|
|
73 |
* the working set, instead a {@link TypeDesignationSetException} is thrown which is a container for
|
|
74 | 74 |
* all validation problems. |
75 | 75 |
* |
76 | 76 |
* @param candidates |
77 | 77 |
* @param problems |
78 | 78 |
* Problems detected in prior validation and processing passed to this method to be completed. Can be <code>null</code>. |
79 |
* @throws RegistrationValidationException
|
|
79 |
* @throws TypeDesignationSetException
|
|
80 | 80 |
*/ |
81 |
private void validateAndAddDTOs(List<RegistrationDTO> candidates, List<String> problems) throws RegistrationValidationException {
|
|
81 |
private void validateAndAddDTOs(List<RegistrationDTO> candidates, List<String> problems) throws TypeDesignationSetException {
|
|
82 | 82 |
if(problems == null){ |
83 | 83 |
problems = new ArrayList<>(); |
84 | 84 |
} |
... | ... | |
100 | 100 |
} |
101 | 101 |
|
102 | 102 |
if(!problems.isEmpty()){ |
103 |
throw new RegistrationValidationException("", problems);
|
|
103 |
throw new TypeDesignationSetException("", problems);
|
|
104 | 104 |
} |
105 | 105 |
|
106 | 106 |
} |
... | ... | |
122 | 122 |
|
123 | 123 |
/** |
124 | 124 |
* @param reg |
125 |
* @throws RegistrationValidationException
|
|
125 |
* @throws TypeDesignationSetException
|
|
126 | 126 |
*/ |
127 |
public void add(Registration reg) throws RegistrationValidationException {
|
|
127 |
public void add(Registration reg) throws TypeDesignationSetException {
|
|
128 | 128 |
Set<Registration> candidates = new HashSet<>(); |
129 | 129 |
candidates.add(reg); |
130 | 130 |
validateAndAdd(candidates); |
131 | 131 |
} |
132 | 132 |
|
133 |
public void add(RegistrationDTO regDTO) throws RegistrationValidationException {
|
|
133 |
public void add(RegistrationDTO regDTO) throws TypeDesignationSetException {
|
|
134 | 134 |
validateAndAddDTOs(Arrays.asList(regDTO), null); |
135 | 135 |
} |
136 | 136 |
|
Also available in: Unified diff
cleanup and rename RegistrationValidationException to TypeDesignationSetException