dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14234
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4761: Deletion handler: made the allowDelete* methods return a String rather than boolean. Should be us...
------------------------------------------------------------
revno: 4761
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-09-29 09:41:04 +0200
message:
Deletion handler: made the allowDelete* methods return a String rather than boolean. Should be used to indicate which object is denying the delete. Will give more helpful feedback messages in the UI.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DeleteNotAllowedException.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/ArchivedDataValueDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryComboDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java
dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionDeletionHandler.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueDeletionHandler.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramStageDataElementDeletionHandler.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartDeletionHandler.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/ReportDeletionHandler.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/ReportTableDeletionHandler.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DefaultDeletionManager.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemovePatientAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/VerifyOrganisationUnitHasParentAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeOptionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/constant/RemoveConstantAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/RemoveDataElementCategoryAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/RemoveDataElementCategoryComboAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/concept/RemoveConceptAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/RemoveDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/RemoveDataElementGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/RemoveIndicatorAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/RemoveIndicatorGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/RemoveIndicatorTypeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/RemoveOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/RemovePatientAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/RemovePatientIdentifierTypeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserGroupAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/RemoveChartGroupAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportgroup/action/RemoveReportGroupAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reporttablegroup/action/RemoveReportTableGroupAction.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DeleteNotAllowedException.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DeleteNotAllowedException.java 2011-05-05 21:14:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DeleteNotAllowedException.java 2011-09-29 07:41:04 +0000
@@ -40,23 +40,12 @@
public static final String ERROR_ASSOCIATED_BY_OTHER_OBJECTS = "Object associated by other objects";
- private static final String SEPARATOR = "-";
-
private String errorCode;
- private String className;
-
- public DeleteNotAllowedException( String errorCode, String className )
+ public DeleteNotAllowedException( String errorCode, String message )
{
- super( errorCode + SEPARATOR + className );
-
+ super( message );
this.errorCode = errorCode;
- this.className = className;
- }
-
- public String getClassName()
- {
- return className;
}
public String getErrorCode()
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/ArchivedDataValueDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/ArchivedDataValueDeletionHandler.java 2011-04-22 21:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/ArchivedDataValueDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -61,34 +61,34 @@
}
@Override
- public boolean allowDeleteDataElement( DataElement dataElement )
+ public String allowDeleteDataElement( DataElement dataElement )
{
String sql = "SELECT COUNT(*) FROM datavaluearchive where dataelementid=" + dataElement.getId();
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
@Override
- public boolean allowDeletePeriod( Period period )
+ public String allowDeletePeriod( Period period )
{
String sql = "SELECT COUNT(*) FROM datavaluearchive where periodid=" + period.getId();
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
@Override
- public boolean allowDeleteOrganisationUnit( OrganisationUnit unit )
+ public String allowDeleteOrganisationUnit( OrganisationUnit unit )
{
String sql = "SELECT COUNT(*) FROM datavaluearchive where sourceid=" + unit.getId();
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
@Override
- public boolean allowDeleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo combo )
+ public String allowDeleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo combo )
{
String sql = "SELECT COUNT(*) FROM datavaluearchive where categoryoptioncomboid=" + combo.getId();
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryComboDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryComboDeletionHandler.java 2011-01-07 11:38:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryComboDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -58,16 +58,16 @@
}
@Override
- public boolean allowDeleteDataElementCategory( DataElementCategory category )
+ public String allowDeleteDataElementCategory( DataElementCategory category )
{
for ( DataElementCategoryOptionCombo categoryOptionCombo : categoryService.getAllDataElementCategoryOptionCombos() )
{
if ( categoryOptionCombo.getCategoryCombo().getCategories().contains( category ) )
{
- return false;
+ return categoryOptionCombo.getCategoryCombo().getName();
}
}
- return true;
+ return null;
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDeletionHandler.java 2011-09-27 18:03:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -68,7 +68,7 @@
}
@Override
- public boolean allowDeleteConcept( Concept concept )
+ public String allowDeleteConcept( Concept concept )
{
for ( DataElementCategory category : categoryService.getAllDataElementCategories() )
{
@@ -78,12 +78,12 @@
{
if ( categoryConcept.equals( concept ) )
{
- return false;
+ return category.getName();
}
}
}
- return true;
+ return null;
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboDeletionHandler.java 2011-09-27 18:03:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -70,7 +70,7 @@
}
@Override
- public boolean allowDeleteDataElementCategoryOption( DataElementCategoryOption categoryOption )
+ public String allowDeleteDataElementCategoryOption( DataElementCategoryOption categoryOption )
{
final String sql =
"select count(*) from datavalue dv " +
@@ -78,11 +78,11 @@
"select cc.categoryoptioncomboid from categoryoptioncombos_categoryoptions cc " +
"where cc.categoryoptionid = " + categoryOption.getId() + " );";
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
@Override
- public boolean allowDeleteDataElementCategory( DataElementCategory category )
+ public String allowDeleteDataElementCategory( DataElementCategory category )
{
final String sql =
"select count(*) from datavalue dv " +
@@ -91,11 +91,11 @@
"where cc.categoryoptionid = co.categoryoptionid " +
"and co.categoryid=" + category.getId() + " );";
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
@Override
- public boolean allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
+ public String allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
{
final String sql =
"select count(*) from datavalue dv " +
@@ -103,7 +103,7 @@
"select co.categoryoptioncomboid from categorycombos_optioncombos co " +
"where co.categorycomboid=" + categoryCombo.getId() + " );";
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationDeletionHandler.java 2011-04-22 18:38:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -75,11 +75,11 @@
}
@Override
- public boolean allowDeletePeriod( Period period )
+ public String allowDeletePeriod( Period period )
{
String sql = "SELECT COUNT(*) FROM completedatasetregistration where periodid=" + period.getId();
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueDeletionHandler.java 2011-04-22 21:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -63,34 +63,34 @@
}
@Override
- public boolean allowDeleteDataElement( DataElement dataElement )
+ public String allowDeleteDataElement( DataElement dataElement )
{
String sql = "SELECT COUNT(*) FROM datavalue where dataelementid=" + dataElement.getId();
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
@Override
- public boolean allowDeletePeriod( Period period )
+ public String allowDeletePeriod( Period period )
{
String sql = "SELECT COUNT(*) FROM datavalue where periodid=" + period.getId();
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
@Override
- public boolean allowDeleteOrganisationUnit( OrganisationUnit unit )
+ public String allowDeleteOrganisationUnit( OrganisationUnit unit )
{
String sql = "SELECT COUNT(*) FROM datavalue where sourceid=" + unit.getId();
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
@Override
- public boolean allowDeleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo combo )
+ public String allowDeleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo combo )
{
String sql = "SELECT COUNT(*) FROM datavalue where categoryoptioncomboid=" + combo.getId();
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java 2011-09-22 13:25:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/IndicatorDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -98,17 +98,17 @@
}
@Override
- public boolean allowDeleteIndicatorType( IndicatorType indicatorType )
+ public String allowDeleteIndicatorType( IndicatorType indicatorType )
{
for ( Indicator indicator : indicatorService.getAllIndicators() )
{
if ( indicator.getIndicatorType().equals( indicatorType ) )
{
- return false;
+ return indicator.getName();
}
}
- return true;
+ return null;
}
@Override
@@ -148,7 +148,7 @@
}
@Override
- public boolean allowDeleteDataElement( DataElement dataElement )
+ public String allowDeleteDataElement( DataElement dataElement )
{
for ( Indicator indicator : indicatorService.getAllIndicators() )
{
@@ -156,22 +156,22 @@
if ( daels != null && daels.contains( dataElement ) )
{
- return false;
+ return indicator.getName();
}
daels = expressionService.getDataElementsInExpression( indicator.getDenominator() );
if ( daels != null && daels.contains( dataElement ) )
{
- return false;
+ return indicator.getName();
}
}
- return true;
+ return null;
}
@Override
- public boolean allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
+ public String allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
{
for ( Indicator indicator : indicatorService.getAllIndicators() )
{
@@ -181,7 +181,7 @@
if ( optionCombos != null && optionCombos.size() > 0 )
{
- return false;
+ return indicator.getName();
}
optionCombos = expressionService.getOptionCombosInExpression( indicator.getDenominator() );
@@ -189,10 +189,10 @@
if ( optionCombos != null && optionCombos.size() > 0 )
{
- return false;
+ return indicator.getName();
}
}
- return true;
+ return null;
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java 2011-09-22 13:25:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -72,7 +72,6 @@
@Override
public void deleteUser( User user )
{
- // Delete attributeValues
Iterator<AttributeValue> iterator = user.getAttributeValues().iterator();
while ( iterator.hasNext() )
@@ -98,7 +97,7 @@
}
@Override
- public boolean allowDeleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
+ public String allowDeleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
{
for ( UserCredentials credentials : userService.getAllUserCredentials() )
{
@@ -108,12 +107,12 @@
{
if ( role.equals( authorityGroup ) )
{
- return false;
+ return credentials.getName();
}
}
}
}
- return true;
+ return null;
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java 2011-08-21 10:33:32 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/MapViewDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -64,19 +64,19 @@
}
@Override
- public boolean allowDeletePeriod( Period period )
+ public String allowDeletePeriod( Period period )
{
for ( MapView mapView : mappingService.getAllMapViews() )
{
if ( mapView.getPeriod().equals( period ) )
{
- return false;
+ return mapView.getName();
}
}
- return true;
+ return null;
}
-
+
@Override
public void deleteIndicatorGroup( IndicatorGroup indicatorGroup )
{
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionDeletionHandler.java 2011-07-01 07:26:42 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -65,14 +65,14 @@
}
@Override
- public boolean allowDeleteDataElement( DataElement dataElement )
+ public String allowDeleteDataElement( DataElement dataElement )
{
Collection<CaseAggregationCondition> conditions = aggregationConditionService
.getCaseAggregationCondition( dataElement );
if ( conditions != null && conditions.size() > 0 )
{
- return false;
+ return ERROR;
}
conditions = aggregationConditionService.getAllCaseAggregationCondition();
@@ -84,23 +84,23 @@
if ( dataElements != null && dataElements.contains( dataElement ) )
{
- return false;
+ return ERROR;
}
}
- return true;
+ return null;
}
@Override
- public boolean allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
+ public String allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
{
Collection<CaseAggregationCondition> conditions = aggregationConditionService.getAllCaseAggregationCondition();
for ( CaseAggregationCondition condition : conditions )
{
- if( categoryCombo.getOptionCombos().contains( condition.getOptionCombo() ) )
+ if ( categoryCombo.getOptionCombos().contains( condition.getOptionCombo() ) )
{
- return false;
+ return ERROR;
}
Collection<DataElementCategoryOptionCombo> optionCombos = aggregationConditionService
@@ -110,11 +110,11 @@
if ( optionCombos != null && optionCombos.size() > 0 )
{
- return false;
+ return ERROR;
}
}
- return true;
+ return null;
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java 2011-05-26 03:43:41 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -61,7 +61,7 @@
{
Collection<Patient> representatives = patientService.getRepresentatives(patient);
- for(Patient representative : representatives )
+ for ( Patient representative : representatives )
{
representative.setRepresentative( null );
representative.setUnderAge( false );
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueDeletionHandler.java 2011-06-24 07:55:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientdatavalue/PatientDataValueDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -61,10 +61,10 @@
}
@Override
- public boolean allowDeleteDataElement( DataElement dataElement )
+ public String allowDeleteDataElement( DataElement dataElement )
{
String sql = "SELECT COUNT(*) FROM patientdatavalue where dataelementid=" + dataElement.getId();
- return jdbcTemplate.queryForInt( sql ) == 0;
+ return jdbcTemplate.queryForInt( sql ) == 0 ? null : ERROR;
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramStageDataElementDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramStageDataElementDeletionHandler.java 2011-07-06 08:04:17 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/ProgramStageDataElementDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -104,19 +104,24 @@
}
@Override
- public boolean allowDeleteDataElement ( DataElement dataElement )
+ public String allowDeleteDataElement ( DataElement dataElement )
{
- Collection<ProgramStageDataElement> psDataElements = programStageDEService.getAllProgramStageDataElements();
- for ( ProgramStageDataElement psDataElement : psDataElements )
+ if ( dataElement != null && DataElement.DOMAIN_TYPE_PATIENT.equals( dataElement.getDomainType() ) )
{
- Collection<DataElement> dataElements = programStageDEService.getListDataElement( psDataElement.getProgramStage() );
-
- if ( dataElements.contains( dataElement ) )
+ //TODO use a query which will be more efficient
+
+ Collection<ProgramStageDataElement> psDataElements = programStageDEService.getAllProgramStageDataElements();
+ for ( ProgramStageDataElement psDataElement : psDataElements )
{
- return false;
+ Collection<DataElement> dataElements = programStageDEService.getListDataElement( psDataElement.getProgramStage() );
+
+ if ( dataElements.contains( dataElement ) )
+ {
+ return ERROR;
+ }
}
}
- return true;
+ return null;
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartDeletionHandler.java 2011-04-22 21:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -61,31 +61,31 @@
}
@Override
- public boolean allowDeleteIndicator( Indicator indicator )
+ public String allowDeleteIndicator( Indicator indicator )
{
for ( Chart chart : chartService.getAllCharts() )
{
if ( chart.getIndicators().contains( indicator ) )
{
- return false;
+ return chart.getName();
}
}
- return true;
+ return null;
}
@Override
- public boolean allowDeletePeriod( Period period )
+ public String allowDeletePeriod( Period period )
{
for ( Chart chart : chartService.getAllCharts() )
{
if ( chart.getPeriods().contains( period ) )
{
- return false;
+ return chart.getName();
}
}
- return true;
+ return null;
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/ReportDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/ReportDeletionHandler.java 2011-02-22 23:05:45 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/ReportDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -58,16 +58,16 @@
}
@Override
- public boolean allowDeleteReportTable( ReportTable reportTable )
+ public String allowDeleteReportTable( ReportTable reportTable )
{
for ( Report report : reportService.getAllReports() )
{
if ( report.getReportTable() != null && report.getReportTable().equals( report ) )
{
- return false;
+ return report.getName();
}
}
- return true;
+ return null;
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/ReportTableDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/ReportTableDeletionHandler.java 2011-04-22 21:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/ReportTableDeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -64,59 +64,59 @@
}
@Override
- public boolean allowDeleteDataElement( DataElement dataElement )
+ public String allowDeleteDataElement( DataElement dataElement )
{
for ( ReportTable reportTable : reportTableService.getAllReportTables() )
{
if ( reportTable.getDataElements().contains( dataElement ) )
{
- return false;
+ return reportTable.getName();
}
}
- return true;
+ return null;
}
@Override
- public boolean allowDeleteIndicator( Indicator indicator )
+ public String allowDeleteIndicator( Indicator indicator )
{
for ( ReportTable reportTable : reportTableService.getAllReportTables() )
{
if ( reportTable.getIndicators().contains( indicator ) )
{
- return false;
+ return reportTable.getName();
}
}
- return true;
+ return null;
}
@Override
- public boolean allowDeleteDataSet( DataSet dataSet )
+ public String allowDeleteDataSet( DataSet dataSet )
{
for ( ReportTable reportTable : reportTableService.getAllReportTables() )
{
if ( reportTable.getDataSets().contains( dataSet ) )
{
- return false;
+ return reportTable.getName();
}
}
- return true;
+ return null;
}
@Override
- public boolean allowDeletePeriod( Period period )
+ public String allowDeletePeriod( Period period )
{
for ( ReportTable reportTable : reportTableService.getAllReportTables() )
{
if ( reportTable.getPeriods().contains( period ) )
{
- return false;
+ return reportTable.getName();
}
}
- return true;
+ return null;
}
@Override
@@ -132,7 +132,7 @@
}
@Override
- public boolean allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
+ public String allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
{
for ( ReportTable reportTable : reportTableService.getAllReportTables() )
{
@@ -140,10 +140,10 @@
if ( eachCatCombo != null && eachCatCombo.equals( categoryCombo ) )
{
- return false;
+ return reportTable.getName();
}
}
- return true;
+ return null;
}
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DefaultDeletionManager.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DefaultDeletionManager.java 2011-04-22 21:04:14 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DefaultDeletionManager.java 2011-09-29 07:41:04 +0000
@@ -87,11 +87,15 @@
{
currentHandler = handler.getClass().getSimpleName();
- boolean allow = (Boolean) allowMethod.invoke( handler, object );
+ Object allow = allowMethod.invoke( handler, object );
- if ( !allow )
+ if ( allow != null )
{
- throw new DeleteNotAllowedException( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS, handler.getClassName() );
+ String hint = String.valueOf( allow );
+
+ String message = handler.getClassName() + ( hint.isEmpty() ? "" : ( " (" + hint + ")" ) );
+
+ throw new DeleteNotAllowedException( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS, message );
}
}
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2011-09-23 18:54:49 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2011-09-29 07:41:04 +0000
@@ -94,15 +94,17 @@
* will affect the current object in any way. Eg. a DeletionHandler for
* DataElementGroup should override the deleteDataElement(..) method which
* should remove the DataElement from all DataElementGroups. Also, it should
- * override the allowDeleteDataElement() method and return false if there exists
- * objects that are dependent on the DataElement and are considered not be
- * deleted.
+ * override the allowDeleteDataElement() method and return a non-null String value
+ * if there exists objects that are dependent on the DataElement and are
+ * considered not be deleted. The return value could be a hint for which object
+ * is denying the delete, like the name.
*
* @author Lars Helge Overland
- * @version $Id$
*/
public abstract class DeletionHandler
{
+ protected final String ERROR = "";
+
// -------------------------------------------------------------------------
// Abstract methods
// -------------------------------------------------------------------------
@@ -117,546 +119,548 @@
{
}
- public boolean allowDeleteChart( Chart chart )
+ public String allowDeleteChart( Chart chart )
{
- return true;
+ return null;
}
public void deleteChartGroup( ChartGroup group )
{
}
- public boolean allowDeleteChartGroup( ChartGroup group )
+ public String allowDeleteChartGroup( ChartGroup group )
{
- return true;
+ return null;
}
public void deleteDataDictionary( DataDictionary dataDictionary )
{
}
- public boolean allowDeleteDataDictionary( DataDictionary dataDictionary )
+ public String allowDeleteDataDictionary( DataDictionary dataDictionary )
{
- return true;
+ return null;
}
public void deleteDataElement( DataElement dataElement )
{
}
- public boolean allowDeleteDataElement( DataElement dataElement )
+ public String allowDeleteDataElement( DataElement dataElement )
{
- return true;
+ return null;
}
public void deleteDataElementGroup( DataElementGroup dataElementGroup )
{
}
- public boolean allowDeleteDataElementGroup( DataElementGroup dataElementGroup )
+ public String allowDeleteDataElementGroup( DataElementGroup dataElementGroup )
{
- return true;
+ return null;
}
public void deleteDataElementGroupSet( DataElementGroupSet dataElementGroupSet )
{
}
- public boolean allowDeleteDataElementGroupSet( DataElementGroupSet dataElementGroupSet )
+ public String allowDeleteDataElementGroupSet( DataElementGroupSet dataElementGroupSet )
{
- return true;
+ return null;
}
public void deleteDataElementCategory( DataElementCategory category )
{
}
- public boolean allowDeleteDataElementCategory( DataElementCategory category )
+ public String allowDeleteDataElementCategory( DataElementCategory category )
{
- return true;
+ return null;
}
public void deleteDataElementCategoryOption( DataElementCategoryOption categoryOption )
{
}
- public boolean allowDeleteDataElementCategoryOption( DataElementCategoryOption categoryOption )
+ public String allowDeleteDataElementCategoryOption( DataElementCategoryOption categoryOption )
{
- return true;
+ return null;
}
public void deleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
{
}
- public boolean allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
+ public String allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
{
- return true;
+ return null;
}
public void deleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo categoryOptionCombo )
{
}
- public boolean allowDeleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo categoryOptionCombo )
+ public String allowDeleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo categoryOptionCombo )
{
- return true;
+ return null;
}
public void deleteDataSet( DataSet dataSet )
{
}
- public boolean allowDeleteDataSet( DataSet dataSet )
+ public String allowDeleteDataSet( DataSet dataSet )
{
- return true;
+ return null;
}
public void deleteSection( Section section )
{
}
- public boolean allowDeleteSection( Section section )
+ public String allowDeleteSection( Section section )
{
- return true;
+ return null;
}
public void deleteCompleteDataSetRegistration( CompleteDataSetRegistration registration )
{
}
- public boolean allowDeleteCompleteDataSetRegistration( CompleteDataSetRegistration registration )
+ public String allowDeleteCompleteDataSetRegistration( CompleteDataSetRegistration registration )
{
- return true;
+ return null;
}
public void deleteDataValue( DataValue dataValue )
{
}
- public boolean allowDeleteDataValue( DataValue dataValue )
+ public String allowDeleteDataValue( DataValue dataValue )
{
- return true;
+ return null;
}
public void deleteExpression( Expression expression )
{
}
- public boolean allowDeleteExpression( Expression expression )
+ public String allowDeleteExpression( Expression expression )
{
- return true;
+ return null;
}
public void deleteMinMaxDataElement( MinMaxDataElement minMaxDataElement )
{
}
- public boolean allowDeleteMinMaxDataElement( MinMaxDataElement minMaxDataElement )
+ public String allowDeleteMinMaxDataElement( MinMaxDataElement minMaxDataElement )
{
- return true;
+ return null;
}
public void deleteIndicator( Indicator indicator )
{
}
- public boolean allowDeleteIndicator( Indicator indicator )
+ public String allowDeleteIndicator( Indicator indicator )
{
- return true;
+ return null;
}
public void deleteIndicatorGroup( IndicatorGroup indicatorGroup )
{
}
- public boolean allowDeleteIndicatorGroup( IndicatorGroup indicatorGroup )
+ public String allowDeleteIndicatorGroup( IndicatorGroup indicatorGroup )
{
- return true;
+ return null;
}
public void deleteIndicatorType( IndicatorType indicatorType )
{
}
- public boolean allowDeleteIndicatorType( IndicatorType indicatorType )
+ public String allowDeleteIndicatorType( IndicatorType indicatorType )
{
- return true;
+ return null;
}
public void deleteIndicatorGroupSet( IndicatorGroupSet indicatorGroupSet )
{
}
- public boolean allowDeleteIndicatorGroupSet( IndicatorGroupSet indicatorGroupSet )
+ public String allowDeleteIndicatorGroupSet( IndicatorGroupSet indicatorGroupSet )
{
- return true;
+ return null;
}
public void deletePeriod( Period period )
{
}
- public boolean allowDeletePeriod( Period period )
+ public String allowDeletePeriod( Period period )
{
- return true;
+ return null;
}
public void deleteValidationRule( ValidationRule validationRule )
{
}
- public boolean allowDeleteValidationRule( ValidationRule validationRule )
+ public String allowDeleteValidationRule( ValidationRule validationRule )
{
- return true;
+ return null;
}
public void deleteValidationRuleGroup( ValidationRuleGroup validationRuleGroup )
{
}
- public boolean allowDeleteValidationRuleGroup( ValidationRuleGroup validationRuleGroup )
+ public String allowDeleteValidationRuleGroup( ValidationRuleGroup validationRuleGroup )
{
- return true;
+ return null;
}
public void deleteDataEntryForm( DataEntryForm form )
{
}
- public boolean allowDeleteDataEntryForm( DataEntryForm form )
+ public String allowDeleteDataEntryForm( DataEntryForm form )
{
- return true;
+ return null;
}
public void deleteOrganisationUnit( OrganisationUnit unit )
{
}
- public boolean allowDeleteOrganisationUnit( OrganisationUnit unit )
+ public String allowDeleteOrganisationUnit( OrganisationUnit unit )
{
- return true;
+ return null;
}
public void deleteOrganisationUnitGroup( OrganisationUnitGroup group )
{
}
- public boolean allowDeleteOrganisationUnitGroup( OrganisationUnitGroup group )
+ public String allowDeleteOrganisationUnitGroup( OrganisationUnitGroup group )
{
- return true;
+ return null;
}
public void deleteOrganisationUnitGroupSet( OrganisationUnitGroupSet groupSet )
{
}
- public boolean allowDeleteOrganisationUnitGroupSet( OrganisationUnitGroupSet groupSet )
+ public String allowDeleteOrganisationUnitGroupSet( OrganisationUnitGroupSet groupSet )
{
- return true;
+ return null;
}
public void deleteOrganisationUnitLevel( OrganisationUnitLevel level )
{
}
- public boolean allowDeleteOrganisationUnitLevel( OrganisationUnitLevel level )
+ public String allowDeleteOrganisationUnitLevel( OrganisationUnitLevel level )
{
- return true;
+ return null;
}
public void deleteReport( Report report )
{
}
- public boolean allowDeleteReport( Report report )
+ public String allowDeleteReport( Report report )
{
- return true;
+ return null;
}
public void deleteReportGroup( ReportGroup group )
{
}
- public boolean allowDeleteReportGroup( ReportGroup group )
+ public String allowDeleteReportGroup( ReportGroup group )
{
- return true;
+ return null;
}
public void deleteReportTable( ReportTable reportTable )
{
}
- public boolean allowDeleteReportTable( ReportTable reportTable )
+ public String allowDeleteReportTable( ReportTable reportTable )
{
- return true;
+ return null;
}
public void deleteReportTableGroup( ReportTableGroup group )
{
}
- public boolean allowDeleteReportTableGroup( ReportTableGroup group )
+ public String allowDeleteReportTableGroup( ReportTableGroup group )
{
- return true;
+ return null;
}
public void deleteUser( User user )
{
}
- public boolean allowDeleteUser( User user )
+ public String allowDeleteUser( User user )
{
- return true;
+ return null;
}
public void deleteUserCredentials( UserCredentials credentials )
{
}
- public boolean allowDeleteUserCredentials( UserCredentials credentials )
+ public String allowDeleteUserCredentials( UserCredentials credentials )
{
- return true;
+ return null;
}
public void deleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
{
}
- public boolean allowDeleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
+ public String allowDeleteUserAuthorityGroup( UserAuthorityGroup authorityGroup )
{
- return true;
+ return null;
}
public void deleteUserSetting( UserSetting userSetting )
{
}
- public boolean allowDeleteUserSetting( UserSetting userSetting )
+ public String allowDeleteUserSetting( UserSetting userSetting )
{
- return true;
+ return null;
}
public void deleteDataMartExport( DataMartExport dataMartExport )
{
}
- public boolean allowDeleteDataMartExport( DataMartExport dataMartExport )
+ public String allowDeleteDataMartExport( DataMartExport dataMartExport )
{
- return true;
+ return null;
}
public void deleteDocument( Document document )
{
}
- public boolean allowDeleteDocument( Document document )
+ public String allowDeleteDocument( Document document )
{
- return true;
+ return null;
}
public void deleteMapLegend( MapLegend mapLegend )
{
}
- public boolean allowDeleteMapLegend( MapLegend mapLegend )
+ public String allowDeleteMapLegend( MapLegend mapLegend )
{
- return true;
+ return null;
}
public void deleteMapLegendSet( MapLegendSet mapLegendSet )
{
}
- public boolean allowDeleteMapLegendSet( MapLegendSet mapLegendSet )
+ public String allowDeleteMapLegendSet( MapLegendSet mapLegendSet )
{
- return true;
+ return null;
}
public void deleteMapView( MapView mapView )
{
}
- public boolean allowDeleteMapView( MapView mapView )
- {
- return true;
- }
-
- public boolean allowDeleteLegend( Legend legend )
- {
- return true;
+ public String allowDeleteMapView( MapView mapView )
+ {
+ return null;
+ }
+
+ public void deleteLegend( Legend legend )
+ {
+ }
+
+ public String allowDeleteLegend( Legend legend )
+ {
+ return null;
}
public void deleteConcept( Concept concept )
{
}
- public boolean allowDeleteConcept( Concept concept )
- {
- return true;
- }
-
- public boolean allowDeletePatient( Patient patient )
- {
- return true;
+ public String allowDeleteConcept( Concept concept )
+ {
+ return null;
}
public void deletePatient( Patient patient )
{
}
- public boolean allowDeletePatientAttribute( PatientAttribute patientAttribute )
- {
- return true;
+ public String allowDeletePatient( Patient patient )
+ {
+ return null;
+ }
+
+ public String allowDeletePatientAttribute( PatientAttribute patientAttribute )
+ {
+ return null;
}
public void deletePatientAttribute( PatientAttribute patientAttribute )
{
-
}
- public boolean allowDeletePatientAttributeValue( PatientAttributeValue patientAttributeValue )
+ public String allowDeletePatientAttributeValue( PatientAttributeValue patientAttributeValue )
{
- return true;
+ return null;
}
public void deletePatientAttributeValue( PatientAttributeValue patientAttributeValue )
{
}
- public boolean allowDeletePatientAttributeGroup( PatientAttributeGroup patientAttributeGroup )
+ public String allowDeletePatientAttributeGroup( PatientAttributeGroup patientAttributeGroup )
{
- return true;
+ return null;
}
public void deletePatientAttributeGroup( PatientAttributeGroup patientAttributeGroup )
{
}
- public boolean allowDeletePatientIdentifier( PatientIdentifier patientIdentifier )
+ public String allowDeletePatientIdentifier( PatientIdentifier patientIdentifier )
{
- return true;
+ return null;
}
public void deletePatientIdentifier( PatientIdentifier patientIdentifier )
{
}
- public boolean allowDeletePatientIdentifierType( PatientIdentifierType patientIdentifierType )
+ public String allowDeletePatientIdentifierType( PatientIdentifierType patientIdentifierType )
{
- return true;
+ return null;
}
public void deletePatientIdentifierType( PatientIdentifierType patientIdentifierType )
{
}
- public boolean allowDeleteRelationship( Relationship relationship )
+ public String allowDeleteRelationship( Relationship relationship )
{
- return true;
+ return null;
}
public void deleteRelationship( Relationship relationship )
{
}
- public boolean allowDeleteRelationshipType( RelationshipType relationshipType )
+ public String allowDeleteRelationshipType( RelationshipType relationshipType )
{
- return true;
+ return null;
}
public void deleteRelationshipType( RelationshipType relationshipType )
{
}
- public boolean allowDeleteProgram( Program program )
+ public String allowDeleteProgram( Program program )
{
- return true;
+ return null;
}
public void deleteProgram( Program program )
{
}
- public boolean allowDeleteProgramInstance( ProgramInstance programInstance )
+ public String allowDeleteProgramInstance( ProgramInstance programInstance )
{
- return true;
+ return null;
}
public void deleteProgramInstance( ProgramInstance programInstance )
{
}
- public boolean allowDeleteProgramStage( ProgramStage programStage )
+ public String allowDeleteProgramStage( ProgramStage programStage )
{
- return true;
+ return null;
}
public void deleteProgramStage( ProgramStage programStage )
{
}
- public boolean allowDeleteProgramStageInstance( ProgramStageInstance programStageInstance )
+ public String allowDeleteProgramStageInstance( ProgramStageInstance programStageInstance )
{
- return true;
+ return null;
}
public void deleteProgramStageInstance( ProgramStageInstance programStageInstance )
{
}
- public boolean allowDeleteProgramStageDataElement( ProgramStageDataElement programStageDataElement )
+ public String allowDeleteProgramStageDataElement( ProgramStageDataElement programStageDataElement )
{
- return true;
+ return null;
}
public void deleteProgramStageDataElement( ProgramStageDataElement programStageDataElement )
{
}
- public boolean allowDeletePatientDataValue( PatientDataValue patientDataValue )
+ public String allowDeletePatientDataValue( PatientDataValue patientDataValue )
{
- return true;
+ return null;
}
public void deletePatientDataValue( PatientDataValue patientDataValue )
{
}
- public boolean allowDeleteValidationCriteria( ValidationCriteria validationCriteria )
+ public String allowDeleteValidationCriteria( ValidationCriteria validationCriteria )
{
- return true;
+ return null;
}
public void deleteValidationCriteria( ValidationCriteria validationCriteria )
{
}
- public boolean allowDeleteProgramAttributeValue( ProgramAttributeValue programAttributeValue )
+ public String allowDeleteProgramAttributeValue( ProgramAttributeValue programAttributeValue )
{
- return true;
+ return null;
}
public void deleteProgramAttributeValue( ProgramAttributeValue programAttributeValue )
{
}
- public boolean allowDeleteConstant( Constant constant )
+ public String allowDeleteConstant( Constant constant )
{
- return true;
+ return null;
}
public void deleteConstant( Constant constant )
{
}
- public boolean allowDeleteCaseAggregationCondition( CaseAggregationCondition caseAggregationCondition )
+ public String allowDeleteCaseAggregationCondition( CaseAggregationCondition caseAggregationCondition )
{
- return true;
+ return null;
}
public void deleteCaseAggregationCondition( CaseAggregationCondition caseAggregationCondition )
{
}
-
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemovePatientAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemovePatientAction.java 2011-09-14 06:36:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/RemovePatientAction.java 2011-09-29 07:41:04 +0000
@@ -90,7 +90,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/VerifyOrganisationUnitHasParentAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/VerifyOrganisationUnitHasParentAction.java 2011-09-28 02:14:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/patient/VerifyOrganisationUnitHasParentAction.java 2011-09-29 07:41:04 +0000
@@ -28,7 +28,6 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.caseentry.state.SelectedStateManager;
import com.opensymphony.xwork2.Action;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeAction.java 2011-09-08 10:38:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeAction.java 2011-09-29 07:41:04 +0000
@@ -90,7 +90,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeOptionAction.java 2011-09-08 10:38:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/RemoveAttributeOptionAction.java 2011-09-29 07:41:04 +0000
@@ -90,7 +90,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/constant/RemoveConstantAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/constant/RemoveConstantAction.java 2011-06-30 07:55:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/constant/RemoveConstantAction.java 2011-09-29 07:41:04 +0000
@@ -98,7 +98,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/RemoveDataElementCategoryAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/RemoveDataElementCategoryAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/RemoveDataElementCategoryAction.java 2011-09-29 07:41:04 +0000
@@ -97,7 +97,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/RemoveDataElementCategoryComboAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/RemoveDataElementCategoryComboAction.java 2010-05-29 16:09:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categorycombo/RemoveDataElementCategoryComboAction.java 2011-09-29 07:41:04 +0000
@@ -101,7 +101,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/concept/RemoveConceptAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/concept/RemoveConceptAction.java 2011-05-05 21:15:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/concept/RemoveConceptAction.java 2011-09-29 07:41:04 +0000
@@ -98,7 +98,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/RemoveDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/RemoveDataElementAction.java 2011-09-27 11:46:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/RemoveDataElementAction.java 2011-09-29 07:41:04 +0000
@@ -112,7 +112,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/RemoveDataElementGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/RemoveDataElementGroupAction.java 2011-05-05 21:15:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/RemoveDataElementGroupAction.java 2011-09-29 07:41:04 +0000
@@ -99,7 +99,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/RemoveIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/RemoveIndicatorAction.java 2011-05-05 21:15:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/RemoveIndicatorAction.java 2011-09-29 07:41:04 +0000
@@ -94,7 +94,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/RemoveIndicatorGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/RemoveIndicatorGroupAction.java 2011-05-05 21:15:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/RemoveIndicatorGroupAction.java 2011-09-29 07:41:04 +0000
@@ -100,7 +100,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/RemoveIndicatorTypeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/RemoveIndicatorTypeAction.java 2011-05-05 21:15:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/RemoveIndicatorTypeAction.java 2011-09-29 07:41:04 +0000
@@ -94,7 +94,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/RemoveOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/RemoveOrganisationUnitAction.java 2011-05-05 21:15:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/RemoveOrganisationUnitAction.java 2011-09-29 07:41:04 +0000
@@ -98,7 +98,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/RemovePatientAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/RemovePatientAttributeAction.java 2011-03-31 01:42:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/RemovePatientAttributeAction.java 2011-09-29 07:41:04 +0000
@@ -93,7 +93,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/RemovePatientIdentifierTypeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/RemovePatientIdentifierTypeAction.java 2011-03-31 01:42:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientidentifiertype/RemovePatientIdentifierTypeAction.java 2011-09-29 07:41:04 +0000
@@ -113,7 +113,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserGroupAction.java 2010-12-29 20:53:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserGroupAction.java 2011-09-29 07:41:04 +0000
@@ -91,7 +91,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/RemoveChartGroupAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/RemoveChartGroupAction.java 2011-07-21 09:09:42 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/RemoveChartGroupAction.java 2011-09-29 07:41:04 +0000
@@ -98,7 +98,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportgroup/action/RemoveReportGroupAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportgroup/action/RemoveReportGroupAction.java 2011-07-21 09:09:42 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reportgroup/action/RemoveReportGroupAction.java 2011-09-29 07:41:04 +0000
@@ -98,7 +98,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reporttablegroup/action/RemoveReportTableGroupAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reporttablegroup/action/RemoveReportTableGroupAction.java 2011-07-21 09:09:42 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/reporttablegroup/action/RemoveReportTableGroupAction.java 2011-09-29 07:41:04 +0000
@@ -98,7 +98,7 @@
{
if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
{
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
return ERROR;
}