~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.hisp.dhis.validation;
 
2
 
 
3
/*
 
4
 * Copyright (c) 2004-2007, University of Oslo
 
5
 * All rights reserved.
 
6
 *
 
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.
 
17
 *
 
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.
 
28
 */
 
29
 
 
30
import java.util.Collection;
 
31
import java.util.Date;
 
32
 
 
33
import org.hisp.dhis.dataset.DataSet;
 
34
import org.hisp.dhis.period.Period;
 
35
import org.hisp.dhis.source.Source;
 
36
 
 
37
/**
 
38
 * @author Margrethe Store
 
39
 * @version $Id: ValidationRuleService.java 5434 2008-06-18 18:57:59Z larshelg $
 
40
 */
 
41
public interface ValidationRuleService
 
42
{
 
43
    String ID = ValidationRuleService.class.getName();
 
44
 
 
45
    // -------------------------------------------------------------------------
 
46
    // ValidationRule business logic
 
47
    // -------------------------------------------------------------------------
 
48
 
 
49
    /**
 
50
     * Validate DataValues.
 
51
     * 
 
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. 
 
56
     */
 
57
    Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<? extends Source> sources );
 
58
    
 
59
    /**
 
60
     * Validate DataValues.
 
61
     * 
 
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. 
 
67
     */
 
68
    Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<? extends Source> sources, ValidationRuleGroup group );
 
69
    
 
70
    /**
 
71
     * Validate DataValues.
 
72
     * 
 
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. 
 
77
     */
 
78
    Collection<ValidationResult> validate( DataSet dataSet, Period period, Source source );
 
79
 
 
80
    /**
 
81
     * Validate DataValues.
 
82
     * 
 
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. 
 
87
     */
 
88
    Collection<ValidationResult> validate( Date startDate, Date endDate, Source source );
 
89
 
 
90
    // -------------------------------------------------------------------------
 
91
    // ValidationRule
 
92
    // -------------------------------------------------------------------------
 
93
 
 
94
    /**
 
95
     * Adds a ValidationRule to the database.
 
96
     * 
 
97
     * @param validationRule the ValidationRule to add.
 
98
     * @return the generated unique identifier for the ValidationRule.
 
99
     */
 
100
    int addValidationRule( ValidationRule validationRule );
 
101
 
 
102
    /**
 
103
     * Delete a validation rule with the given identifiers from the database.
 
104
     * 
 
105
     * @param validationRule the ValidationRule to delete.
 
106
     */
 
107
    void deleteValidationRule( ValidationRule validationRule );
 
108
 
 
109
    /**
 
110
     * Update a validation rule with the given identifiers.
 
111
     * 
 
112
     * @param validationRule the ValidationRule to update.
 
113
     */
 
114
    void updateValidationRule( ValidationRule validationRule );
 
115
 
 
116
    /**
 
117
     * Get ValidationRule with the given identifier.
 
118
     * 
 
119
     * @param id the unique identifier of the ValidationRule.
 
120
     * @return the ValidationRule or null if it doesn't exist.
 
121
     */
 
122
    ValidationRule getValidationRule( int id );
 
123
 
 
124
    /**
 
125
     * Get all validation rules.
 
126
     * 
 
127
     * @return a Collection of ValidationRule or null if it there are no validation rules.
 
128
     */    
 
129
    Collection<ValidationRule> getAllValidationRules();
 
130
 
 
131
    /**
 
132
     * Get a validation rule with the given name.
 
133
     * 
 
134
     * @param name the name of the validation rule.
 
135
     */
 
136
    ValidationRule getValidationRuleByName( String name );
 
137
    
 
138
    // -------------------------------------------------------------------------
 
139
    // ValidationRuleGroup
 
140
    // -------------------------------------------------------------------------
 
141
 
 
142
    /**
 
143
     * Adds a ValidationRuleGroup to the database.
 
144
     * 
 
145
     * @param validationRuleGroup the ValidationRuleGroup to add.
 
146
     * @return the generated unique identifier for the ValidationRuleGroup.
 
147
     */
 
148
    int addValidationRuleGroup( ValidationRuleGroup validationRuleGroup );
 
149
 
 
150
    /**
 
151
     * Delete a ValidationRuleGroup with the given identifiers from the database.
 
152
     * 
 
153
     * @param id the ValidationRuleGroup to delete.
 
154
     */
 
155
    void deleteValidationRuleGroup( ValidationRuleGroup validationRuleGroup );
 
156
 
 
157
    /**
 
158
     * Update a ValidationRuleGroup with the given identifiers.
 
159
     * 
 
160
     * @param validationRule the ValidationRule to update.
 
161
     */
 
162
    void updateValidationRuleGroup( ValidationRuleGroup validationRuleGroup );
 
163
 
 
164
    /**
 
165
     * Get ValidationRuleGroup with the given identifier.
 
166
     * 
 
167
     * @param id the unique identifier of the ValidationRuleGroup.
 
168
     * @return the ValidationRule or null if it doesn't exist.
 
169
     */
 
170
    ValidationRuleGroup getValidationRuleGroup( int id );
 
171
 
 
172
    /**
 
173
     * Get all ValidationRuleGroups.
 
174
     * 
 
175
     * @return a Collection of ValidationRuleGroup or null if it there are no ValidationRuleGroups.
 
176
     */    
 
177
    Collection<ValidationRuleGroup> getAllValidationRuleGroups();
 
178
    
 
179
    /**
 
180
     * Get a ValidationRuleGroup with the given name.
 
181
     * 
 
182
     * @param name the name of the ValidationRuleGroup.
 
183
     */
 
184
    ValidationRuleGroup getValidationRuleGroupByName( String name );    
 
185
}