1
package org.hisp.dhis.system.deletion;
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 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;
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
76
* @author Lars Helge Overland
79
@SuppressWarnings( "unused" )
80
public abstract class DeletionHandler
82
// -------------------------------------------------------------------------
84
// -------------------------------------------------------------------------
86
protected abstract String getClassName();
88
// -------------------------------------------------------------------------
90
// -------------------------------------------------------------------------
92
public void deleteChart( Chart chart )
96
public boolean allowDeleteChart( Chart chart )
101
public void deleteDataDictionary( DataDictionary dataDictionary )
105
public boolean allowDeleteDataDictionary( DataDictionary dataDictionary )
110
public void deleteDataElement( DataElement dataElement )
114
public boolean allowDeleteDataElement( DataElement dataElement )
119
public void deleteDataElementGroup( DataElementGroup dataElementGroup )
123
public boolean allowDeleteDataElementGroup( DataElementGroup dataElementGroup )
128
public void deleteDataElementCategory( DataElementCategory category )
132
public boolean allowDeleteDataElementCategory( DataElementCategory category )
137
public void deleteDataElementCategoryOption( DataElementCategoryOption categoryOption )
141
public boolean allowDeleteDataElementCategoryOption( DataElementCategoryOption categoryOption )
146
public void deleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
150
public boolean allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
155
public void deleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo categoryOptionCombo )
159
public boolean allowDeleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo categoryOptionCombo )
164
public void deleteDataElementDimensionRowOrder( DataElementDimensionRowOrder rowOrder )
168
public boolean allowDeleteDataElementDimensionRowOrder( DataElementDimensionRowOrder rowOrder )
173
public void deleteDataElementDimensionColumnOrder( DataElementDimensionColumnOrder columnOrder )
177
public boolean allowDataElementDimensionColumnOrder( DataElementDimensionColumnOrder columnOrder )
182
public void deleteDataSet( DataSet dataSet )
186
public boolean allowDeleteDataSet( DataSet dataSet )
191
public void deleteSection( Section section )
195
public boolean allowDeleteSection( Section section )
200
public void deleteCompleteDataSetRegistration( CompleteDataSetRegistration registration )
204
public boolean allowDeleteCompleteDataSetRegistration( CompleteDataSetRegistration registration )
209
public void deleteDataValue( DataValue dataValue )
213
public boolean allowDeleteDataValue( DataValue dataValue )
218
public void deleteExpression( Expression expression )
222
public boolean allowDeleteExpression( Expression expression )
227
public void deleteMinMaxDataElement( MinMaxDataElement minMaxDataElement )
231
public boolean allowDeleteMinMaxDataElement( MinMaxDataElement minMaxDataElement )
236
public void deleteIndicator( Indicator indicator )
240
public boolean allowDeleteIndicator( Indicator indicator )
245
public void deleteIndicatorGroup( IndicatorGroup indicatorGroup )
249
public boolean allowDeleteIndicatorGroup( IndicatorGroup indicatorGroup )
254
public void deleteIndicatorType( IndicatorType indicatorType )
258
public boolean allowDeleteIndicatorType( IndicatorType indicatorType )
263
public void deletePeriod( Period period )
267
public boolean allowDeletePeriod( Period period )
272
public void deleteSource( Source source )
276
public boolean allowDeleteSource( Source source )
281
public void deleteValidationRule( ValidationRule validationRule )
285
public boolean allowDeleteValidationRule( ValidationRule validationRule )
290
public void deleteValidationRuleGroup( ValidationRuleGroup validationRuleGroup )
294
public boolean allowDeleteValidationRuleGroup( ValidationRuleGroup validationRuleGroup )
299
public void deleteFrequencyOverrideAssociation( FrequencyOverrideAssociation association )
303
public boolean allowDeleteFrequencyOverrideAssociation( FrequencyOverrideAssociation association )
308
public void deleteDataEntryForm( DataEntryForm form )
312
public boolean allowDeleteDataEntryForm( DataEntryForm form )
317
public void deleteOrganisationUnitGroup( OrganisationUnitGroup group )
321
public boolean allowDeleteOrganisationUnitGroup( OrganisationUnitGroup group )
326
public void deleteOrganisationUnitGroupSet( OrganisationUnitGroupSet groupSet )
330
public boolean allowDeleteOrganisationUnitGroupSet( OrganisationUnitGroupSet groupSet )
335
public void deleteOrganisationUnitLevel( OrganisationUnitLevel level )
339
public boolean allowDeleteOrganisationUnitLevel( OrganisationUnitLevel level )
344
public void deleteReport( Report report )
348
public boolean allowDeleteReport( Report report )
353
public void deleteReportTable( ReportTable reportTable )
357
public boolean allowDeleteReportTable( ReportTable reportTable )
362
public void deleteUser( User user )
366
public boolean allowDeleteUser( User user )
371
public void deleteUserCredentials( UserCredentials credentials )
375
public boolean allowDeleteUserCredentials( UserCredentials credentials )
380
public void deleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
384
public boolean allowDeleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
389
public void deleteUserSetting( UserSetting userSetting )
393
public boolean allowDeleteUserSetting( UserSetting userSetting )
398
public void deleteDataMartExport( DataMartExport dataMartExport )
402
public boolean allowDeleteDataMartExport( DataMartExport dataMartExport )
407
public void deleteOlapURL( OlapURL olapURL )
411
public boolean allowDeleteOlapURL( OlapURL olapURL )