1
package org.hisp.dhis.validation;
4
* Copyright (c) 2004-2007, University of Oslo
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions are met:
9
* * Redistributions of source code must retain the above copyright notice, this
10
* list of conditions and the following disclaimer.
11
* * Redistributions in binary form must reproduce the above copyright notice,
12
* this list of conditions and the following disclaimer in the documentation
13
* and/or other materials provided with the distribution.
14
* * Neither the name of the HISP project nor the names of its contributors may
15
* be used to endorse or promote products derived from this software without
16
* specific prior written permission.
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
import java.util.Collection;
31
import java.util.Date;
33
import org.hisp.dhis.dataset.DataSet;
34
import org.hisp.dhis.period.Period;
35
import org.hisp.dhis.source.Source;
38
* @author Margrethe Store
39
* @version $Id: ValidationRuleService.java 5434 2008-06-18 18:57:59Z larshelg $
41
public interface ValidationRuleService
43
String ID = ValidationRuleService.class.getName();
45
// -------------------------------------------------------------------------
46
// ValidationRule business logic
47
// -------------------------------------------------------------------------
50
* Validate DataValues.
52
* @param startDate the start date.
53
* @param endDate the end date.
54
* @param sources a collection of Sources.
55
* @return a collection of ValidationResults for each validation violation.
57
Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<? extends Source> sources );
60
* Validate DataValues.
62
* @param startDate the start date.
63
* @param endDate the end date.
64
* @param sources a collection of Sources.
65
* @param group a group of ValidationRules.
66
* @return a collection of ValidationResults for each validation violation.
68
Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<? extends Source> sources, ValidationRuleGroup group );
71
* Validate DataValues.
73
* @param dataSet the DataSet.
74
* @param period the Period.
75
* @param source the Source.
76
* @return a collection of ValidationResults for each validation violation.
78
Collection<ValidationResult> validate( DataSet dataSet, Period period, Source source );
81
* Validate DataValues.
83
* @param startDate the start date.
84
* @param endDate the end date.
85
* @param source the Source.
86
* @return a collection of ValidationResults for each validation violation.
88
Collection<ValidationResult> validate( Date startDate, Date endDate, Source source );
90
// -------------------------------------------------------------------------
92
// -------------------------------------------------------------------------
95
* Adds a ValidationRule to the database.
97
* @param validationRule the ValidationRule to add.
98
* @return the generated unique identifier for the ValidationRule.
100
int addValidationRule( ValidationRule validationRule );
103
* Delete a validation rule with the given identifiers from the database.
105
* @param validationRule the ValidationRule to delete.
107
void deleteValidationRule( ValidationRule validationRule );
110
* Update a validation rule with the given identifiers.
112
* @param validationRule the ValidationRule to update.
114
void updateValidationRule( ValidationRule validationRule );
117
* Get ValidationRule with the given identifier.
119
* @param id the unique identifier of the ValidationRule.
120
* @return the ValidationRule or null if it doesn't exist.
122
ValidationRule getValidationRule( int id );
125
* Get all validation rules.
127
* @return a Collection of ValidationRule or null if it there are no validation rules.
129
Collection<ValidationRule> getAllValidationRules();
132
* Get a validation rule with the given name.
134
* @param name the name of the validation rule.
136
ValidationRule getValidationRuleByName( String name );
138
// -------------------------------------------------------------------------
139
// ValidationRuleGroup
140
// -------------------------------------------------------------------------
143
* Adds a ValidationRuleGroup to the database.
145
* @param validationRuleGroup the ValidationRuleGroup to add.
146
* @return the generated unique identifier for the ValidationRuleGroup.
148
int addValidationRuleGroup( ValidationRuleGroup validationRuleGroup );
151
* Delete a ValidationRuleGroup with the given identifiers from the database.
153
* @param id the ValidationRuleGroup to delete.
155
void deleteValidationRuleGroup( ValidationRuleGroup validationRuleGroup );
158
* Update a ValidationRuleGroup with the given identifiers.
160
* @param validationRule the ValidationRule to update.
162
void updateValidationRuleGroup( ValidationRuleGroup validationRuleGroup );
165
* Get ValidationRuleGroup with the given identifier.
167
* @param id the unique identifier of the ValidationRuleGroup.
168
* @return the ValidationRule or null if it doesn't exist.
170
ValidationRuleGroup getValidationRuleGroup( int id );
173
* Get all ValidationRuleGroups.
175
* @return a Collection of ValidationRuleGroup or null if it there are no ValidationRuleGroups.
177
Collection<ValidationRuleGroup> getAllValidationRuleGroups();
180
* Get a ValidationRuleGroup with the given name.
182
* @param name the name of the ValidationRuleGroup.
184
ValidationRuleGroup getValidationRuleGroupByName( String name );