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

« back to all changes in this revision

Viewing changes to dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.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.system.deletion;
 
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 org.hisp.dhis.chart.Chart;
 
31
import org.hisp.dhis.datadictionary.DataDictionary;
 
32
import org.hisp.dhis.dataelement.DataElement;
 
33
import org.hisp.dhis.dataelement.DataElementCategory;
 
34
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 
35
import org.hisp.dhis.dataelement.DataElementCategoryOption;
 
36
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 
37
import org.hisp.dhis.dataelement.DataElementDimensionColumnOrder;
 
38
import org.hisp.dhis.dataelement.DataElementDimensionRowOrder;
 
39
import org.hisp.dhis.dataelement.DataElementGroup;
 
40
import org.hisp.dhis.datamart.DataMartExport;
 
41
import org.hisp.dhis.dataset.CompleteDataSetRegistration;
 
42
import org.hisp.dhis.dataset.DataEntryForm;
 
43
import org.hisp.dhis.dataset.DataSet;
 
44
import org.hisp.dhis.dataset.FrequencyOverrideAssociation;
 
45
import org.hisp.dhis.dataset.Section;
 
46
import org.hisp.dhis.datavalue.DataValue;
 
47
import org.hisp.dhis.expression.Expression;
 
48
import org.hisp.dhis.indicator.Indicator;
 
49
import org.hisp.dhis.indicator.IndicatorGroup;
 
50
import org.hisp.dhis.indicator.IndicatorType;
 
51
import org.hisp.dhis.minmax.MinMaxDataElement;
 
52
import org.hisp.dhis.olap.OlapURL;
 
53
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 
54
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
 
55
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 
56
import org.hisp.dhis.period.Period;
 
57
import org.hisp.dhis.report.Report;
 
58
import org.hisp.dhis.reporttable.ReportTable;
 
59
import org.hisp.dhis.source.Source;
 
60
import org.hisp.dhis.user.User;
 
61
import org.hisp.dhis.user.UserAuthorityGroup;
 
62
import org.hisp.dhis.user.UserCredentials;
 
63
import org.hisp.dhis.user.UserSetting;
 
64
import org.hisp.dhis.validation.ValidationRule;
 
65
import org.hisp.dhis.validation.ValidationRuleGroup;
 
66
 
 
67
/**
 
68
 * A DeletionHandler should override methods for objects that, when deleted,
 
69
 * will affect the current object in any way. Eg. a DeletionHandler for
 
70
 * DataElementGroup should override the deleteDataElement(..) method which
 
71
 * should remove the DataElement from all DataElementGroups. Also, it should
 
72
 * override the allowDeleteDataElement() method and return false if there exists
 
73
 * objects that are dependent on the DataElement and are considered not be
 
74
 * deleted.
 
75
 * 
 
76
 * @author Lars Helge Overland
 
77
 * @version $Id$
 
78
 */
 
79
@SuppressWarnings( "unused" )
 
80
public abstract class DeletionHandler
 
81
{
 
82
    // -------------------------------------------------------------------------
 
83
    // Abstract methods
 
84
    // -------------------------------------------------------------------------
 
85
 
 
86
    protected abstract String getClassName();
 
87
 
 
88
    // -------------------------------------------------------------------------
 
89
    // Public methods
 
90
    // -------------------------------------------------------------------------
 
91
 
 
92
    public void deleteChart( Chart chart )
 
93
    {   
 
94
    }
 
95
    
 
96
    public boolean allowDeleteChart( Chart chart )
 
97
    {
 
98
        return true;
 
99
    }
 
100
    
 
101
    public void deleteDataDictionary( DataDictionary dataDictionary )
 
102
    {   
 
103
    }
 
104
    
 
105
    public boolean allowDeleteDataDictionary( DataDictionary dataDictionary )
 
106
    {
 
107
        return true;
 
108
    }
 
109
    
 
110
    public void deleteDataElement( DataElement dataElement )
 
111
    {
 
112
    }
 
113
    
 
114
    public boolean allowDeleteDataElement( DataElement dataElement )
 
115
    {
 
116
        return true;
 
117
    }
 
118
    
 
119
    public void deleteDataElementGroup( DataElementGroup dataElementGroup )
 
120
    {
 
121
    }
 
122
 
 
123
    public boolean allowDeleteDataElementGroup( DataElementGroup dataElementGroup )
 
124
    {
 
125
        return true;
 
126
    }
 
127
    
 
128
    public void deleteDataElementCategory( DataElementCategory category )
 
129
    {
 
130
    }
 
131
 
 
132
    public boolean allowDeleteDataElementCategory( DataElementCategory category )
 
133
    {
 
134
        return true;
 
135
    }
 
136
    
 
137
    public void deleteDataElementCategoryOption( DataElementCategoryOption categoryOption )
 
138
    {
 
139
    }
 
140
 
 
141
    public boolean allowDeleteDataElementCategoryOption( DataElementCategoryOption categoryOption )
 
142
    {
 
143
        return true;
 
144
    }
 
145
    
 
146
    public void deleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
 
147
    {
 
148
    }
 
149
 
 
150
    public boolean allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
 
151
    {
 
152
        return true;
 
153
    }
 
154
    
 
155
    public void deleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo categoryOptionCombo )
 
156
    {
 
157
    }
 
158
 
 
159
    public boolean allowDeleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo categoryOptionCombo )
 
160
    {
 
161
        return true;
 
162
    }
 
163
    
 
164
    public void deleteDataElementDimensionRowOrder( DataElementDimensionRowOrder rowOrder )
 
165
    {
 
166
    }
 
167
    
 
168
    public boolean allowDeleteDataElementDimensionRowOrder( DataElementDimensionRowOrder rowOrder )
 
169
    {
 
170
        return true;
 
171
    }
 
172
    
 
173
    public void deleteDataElementDimensionColumnOrder( DataElementDimensionColumnOrder columnOrder )
 
174
    {   
 
175
    }
 
176
    
 
177
    public boolean allowDataElementDimensionColumnOrder( DataElementDimensionColumnOrder columnOrder )
 
178
    {
 
179
        return true;
 
180
    }
 
181
    
 
182
    public void deleteDataSet( DataSet dataSet )
 
183
    {
 
184
    }
 
185
 
 
186
    public boolean allowDeleteDataSet( DataSet dataSet )
 
187
    {
 
188
        return true;
 
189
    }
 
190
    
 
191
    public void deleteSection( Section section )
 
192
    {   
 
193
    }
 
194
 
 
195
    public boolean allowDeleteSection( Section section )
 
196
    {
 
197
        return true;
 
198
    }
 
199
    
 
200
    public void deleteCompleteDataSetRegistration( CompleteDataSetRegistration registration )
 
201
    {   
 
202
    }
 
203
    
 
204
    public boolean allowDeleteCompleteDataSetRegistration( CompleteDataSetRegistration registration )
 
205
    {
 
206
        return true;
 
207
    }
 
208
    
 
209
    public void deleteDataValue( DataValue dataValue )
 
210
    {
 
211
    }
 
212
 
 
213
    public boolean allowDeleteDataValue( DataValue dataValue )
 
214
    {
 
215
        return true;
 
216
    }
 
217
    
 
218
    public void deleteExpression( Expression expression )
 
219
    {
 
220
    }
 
221
 
 
222
    public boolean allowDeleteExpression( Expression expression )
 
223
    {
 
224
        return true;
 
225
    }
 
226
    
 
227
    public void deleteMinMaxDataElement( MinMaxDataElement minMaxDataElement )
 
228
    {   
 
229
    }
 
230
 
 
231
    public boolean allowDeleteMinMaxDataElement( MinMaxDataElement minMaxDataElement )
 
232
    {
 
233
        return true;
 
234
    }
 
235
    
 
236
    public void deleteIndicator( Indicator indicator )
 
237
    {
 
238
    }
 
239
 
 
240
    public boolean allowDeleteIndicator( Indicator indicator )
 
241
    {
 
242
        return true;
 
243
    }
 
244
    
 
245
    public void deleteIndicatorGroup( IndicatorGroup indicatorGroup )
 
246
    {
 
247
    }
 
248
 
 
249
    public boolean allowDeleteIndicatorGroup( IndicatorGroup indicatorGroup )
 
250
    {
 
251
        return true;
 
252
    }
 
253
    
 
254
    public void deleteIndicatorType( IndicatorType indicatorType )
 
255
    {   
 
256
    }
 
257
 
 
258
    public boolean allowDeleteIndicatorType( IndicatorType indicatorType )
 
259
    {
 
260
        return true;
 
261
    }
 
262
    
 
263
    public void deletePeriod( Period period )
 
264
    {
 
265
    }
 
266
 
 
267
    public boolean allowDeletePeriod( Period period )
 
268
    {
 
269
        return true;
 
270
    }
 
271
    
 
272
    public void deleteSource( Source source )
 
273
    {
 
274
    }
 
275
 
 
276
    public boolean allowDeleteSource( Source source )
 
277
    {
 
278
        return true;
 
279
    }
 
280
    
 
281
    public void deleteValidationRule( ValidationRule validationRule )
 
282
    {
 
283
    }
 
284
 
 
285
    public boolean allowDeleteValidationRule( ValidationRule validationRule )
 
286
    {
 
287
        return true;
 
288
    }
 
289
    
 
290
    public void deleteValidationRuleGroup( ValidationRuleGroup validationRuleGroup )
 
291
    {   
 
292
    }
 
293
 
 
294
    public boolean allowDeleteValidationRuleGroup( ValidationRuleGroup validationRuleGroup )
 
295
    {
 
296
        return true;
 
297
    }
 
298
    
 
299
    public void deleteFrequencyOverrideAssociation( FrequencyOverrideAssociation association )
 
300
    {   
 
301
    }
 
302
 
 
303
    public boolean allowDeleteFrequencyOverrideAssociation( FrequencyOverrideAssociation association )
 
304
    {
 
305
        return true;
 
306
    }
 
307
    
 
308
    public void deleteDataEntryForm( DataEntryForm form )
 
309
    {   
 
310
    }
 
311
 
 
312
    public boolean allowDeleteDataEntryForm( DataEntryForm form )
 
313
    {
 
314
        return true;
 
315
    }
 
316
    
 
317
    public void deleteOrganisationUnitGroup( OrganisationUnitGroup group )
 
318
    {   
 
319
    }
 
320
 
 
321
    public boolean allowDeleteOrganisationUnitGroup( OrganisationUnitGroup group )
 
322
    {
 
323
        return true;
 
324
    }
 
325
    
 
326
    public void deleteOrganisationUnitGroupSet( OrganisationUnitGroupSet groupSet )
 
327
    {
 
328
    }
 
329
 
 
330
    public boolean allowDeleteOrganisationUnitGroupSet( OrganisationUnitGroupSet groupSet )
 
331
    {
 
332
        return true;
 
333
    }
 
334
    
 
335
    public void deleteOrganisationUnitLevel( OrganisationUnitLevel level )
 
336
    {   
 
337
    }
 
338
 
 
339
    public boolean allowDeleteOrganisationUnitLevel( OrganisationUnitLevel level )
 
340
    {
 
341
        return true;
 
342
    }
 
343
    
 
344
    public void deleteReport( Report report )
 
345
    {   
 
346
    }
 
347
    
 
348
    public boolean allowDeleteReport( Report report )
 
349
    {
 
350
        return true;
 
351
    }
 
352
    
 
353
    public void deleteReportTable( ReportTable reportTable )
 
354
    {   
 
355
    }
 
356
 
 
357
    public boolean allowDeleteReportTable( ReportTable reportTable )
 
358
    {
 
359
        return true;
 
360
    }
 
361
    
 
362
    public void deleteUser( User user )
 
363
    {   
 
364
    }
 
365
    
 
366
    public boolean allowDeleteUser( User user )
 
367
    {
 
368
        return true;
 
369
    }
 
370
    
 
371
    public void deleteUserCredentials( UserCredentials credentials )
 
372
    {   
 
373
    }
 
374
    
 
375
    public boolean allowDeleteUserCredentials( UserCredentials credentials )
 
376
    {
 
377
        return true;
 
378
    }
 
379
    
 
380
    public void deleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
 
381
    {   
 
382
    }
 
383
    
 
384
    public boolean allowDeleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
 
385
    {
 
386
        return true;
 
387
    }
 
388
    
 
389
    public void deleteUserSetting( UserSetting userSetting )
 
390
    {   
 
391
    }
 
392
    
 
393
    public boolean allowDeleteUserSetting( UserSetting userSetting )
 
394
    {
 
395
        return true;
 
396
    }
 
397
    
 
398
    public void deleteDataMartExport( DataMartExport dataMartExport )
 
399
    {   
 
400
    }
 
401
    
 
402
    public boolean allowDeleteDataMartExport( DataMartExport dataMartExport )
 
403
    {
 
404
        return true;
 
405
    }
 
406
    
 
407
    public void deleteOlapURL( OlapURL olapURL )
 
408
    {   
 
409
    }
 
410
    
 
411
    public boolean allowDeleteOlapURL( OlapURL olapURL )
 
412
    {
 
413
        return true;
 
414
    }
 
415
}