1
|
/**
|
2
|
* Copyright (C) 2015 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.persistence.dao.validation;
|
10
|
|
11
|
import java.util.List;
|
12
|
|
13
|
import javax.validation.ConstraintValidator;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.validation.EntityConstraintViolation;
|
16
|
import eu.etaxonomy.cdm.model.validation.EntityValidation;
|
17
|
import eu.etaxonomy.cdm.model.validation.Severity;
|
18
|
import eu.etaxonomy.cdm.persistence.dao.common.ICdmEntityDao;
|
19
|
import eu.etaxonomy.cdm.persistence.validation.EntityValidationTaskBase;
|
20
|
|
21
|
/**
|
22
|
* A DAO for accessing the error tables populated as a consequence of entity
|
23
|
* validation errors. In general you can view errors from the perspective of the
|
24
|
* constraints being violated, irrespective of the entities that violated them.
|
25
|
* Or you can focus on the entities themselves, with all constraints they
|
26
|
* violated. This interface provides the latter perspective while
|
27
|
* {@link IEntityConstraintViolationDao} provides the former perspective.
|
28
|
* Together these methods provide all persistency operations required internally
|
29
|
* by the CVI (notably {@link EntityValidationTaskBase}s) and by clients. In
|
30
|
* fact, strictly speaking implementors should override methods from the
|
31
|
* superclass by throwing an exception. They should in any case not be exposed
|
32
|
* via a service.
|
33
|
*
|
34
|
* @author ayco_holleman
|
35
|
*
|
36
|
*/
|
37
|
public interface IEntityValidationDao extends IEntityValidationCrud, ICdmEntityDao<EntityValidation> {
|
38
|
|
39
|
/**
|
40
|
* Get the validation result for a particular entity.
|
41
|
*
|
42
|
* @param validatedEntityClass
|
43
|
* The fully qualified class name of the entity's class.
|
44
|
* @param validatedEntityId
|
45
|
* The id of the entity
|
46
|
* @return The {@code EntityValidation} or null if the entity has not
|
47
|
* been validated yet
|
48
|
*
|
49
|
*/
|
50
|
EntityValidation getEntityValidation(String validatedEntityClass, int validatedEntityId);
|
51
|
|
52
|
/**
|
53
|
* Get all validation results for all validated entities. The results are
|
54
|
* sorted according the type and id of the validated entities.
|
55
|
*
|
56
|
* @return The {@code EntityValidation}s
|
57
|
*/
|
58
|
List<EntityValidation> getEntityValidations();
|
59
|
|
60
|
/**
|
61
|
* Get all validation results for all validated entities of the specified
|
62
|
* type. The results are sorted according to the type and id of the
|
63
|
* validated entities.
|
64
|
*
|
65
|
* @param validatedEntityClass
|
66
|
* The fully qualified class name of the entity class
|
67
|
*
|
68
|
* @return The {@code EntityValidation}s
|
69
|
*/
|
70
|
List<EntityValidation> getEntityValidations(String validatedEntityClass);
|
71
|
|
72
|
/**
|
73
|
* Get all entities that violated a particular constraint. The results are
|
74
|
* sorted according to the type and id of the validated entities. Note that
|
75
|
* the {@code validatorClass} argument is a {@code String} (like all the
|
76
|
* {@code ***Class} arguments). This is because it is stored as such in the
|
77
|
* database, and also because the {@code Class} object itself may not be on
|
78
|
* the caller's classpath - e.g. when called from the TaxEditor.
|
79
|
*
|
80
|
* @param validatorClass
|
81
|
* The fully qualified class name of the
|
82
|
* {@link ConstraintValidator}.
|
83
|
*
|
84
|
* @return The {@code EntityValidation}s
|
85
|
*/
|
86
|
List<EntityValidation> getEntitiesViolatingConstraint(String validatorClass);
|
87
|
|
88
|
/**
|
89
|
* Get all validation results for all entities of the specified type. Only
|
90
|
* constraint violations of the specified severity are returned as part of
|
91
|
* the validation result. The results are sorted according to the type and
|
92
|
* id of the validated entities.
|
93
|
*
|
94
|
* @param validatedEntityClass
|
95
|
* The fully qualified class name of the entity class.
|
96
|
* @param severity
|
97
|
* The severity of the {@link EntityConstraintViolation}s
|
98
|
* associated with the {@code EntityValidation}
|
99
|
*
|
100
|
* @return The {@code EntityValidation}s
|
101
|
*/
|
102
|
List<EntityValidation> getEntityValidations(String validatedEntityClass, Severity severity);
|
103
|
|
104
|
/**
|
105
|
* Get all validation results. Only constraint violations of the specified
|
106
|
* severity are returned as part of the validation result. The results are
|
107
|
* sorted according the type and id of the validated entities.
|
108
|
*
|
109
|
* @param severity
|
110
|
* The severity of the {@link EntityConstraintViolation}s
|
111
|
* associated with the {@code EntityValidation}
|
112
|
*
|
113
|
* @return The {@code EntityValidation}s
|
114
|
*/
|
115
|
List<EntityValidation> getEntityValidations(Severity severity);
|
116
|
|
117
|
}
|