=== modified file 'dhis-2/dhis-services/dhis-service-administration/pom.xml' --- dhis-2/dhis-services/dhis-service-administration/pom.xml 2010-04-12 16:35:57 +0000 +++ dhis-2/dhis-services/dhis-service-administration/pom.xml 2010-04-13 11:04:48 +0000 @@ -33,14 +33,6 @@ org.hisp.dhis dhis-options - - org.hisp.dhis - dhis-service-patient - - - org.hisp.dhis - dhis-service-reporting - === modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataprune/DefaultDataPruneService.java' --- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataprune/DefaultDataPruneService.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataprune/DefaultDataPruneService.java 2010-04-13 11:04:48 +0000 @@ -32,26 +32,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.hisp.dhis.chart.Chart; -import org.hisp.dhis.chart.ChartService; -import org.hisp.dhis.dataset.CompleteDataSetRegistration; import org.hisp.dhis.dataset.CompleteDataSetRegistrationService; import org.hisp.dhis.datavalue.DataValueService; -import org.hisp.dhis.hierarchy.HierarchyViolationException; import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.organisationunit.OrganisationUnitGroup; -import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; import org.hisp.dhis.organisationunit.OrganisationUnitService; -import org.hisp.dhis.patient.PatientIdentifier; -import org.hisp.dhis.patient.PatientIdentifierService; -import org.hisp.dhis.reportexcel.ReportExcel; -import org.hisp.dhis.reportexcel.ReportExcelService; -import org.hisp.dhis.reportexcel.excelitem.ExcelItemGroup; -import org.hisp.dhis.reportexcel.excelitem.ExcelItemService; -import org.hisp.dhis.reporttable.ReportTable; -import org.hisp.dhis.reporttable.ReportTableService; -import org.hisp.dhis.user.User; -import org.hisp.dhis.user.UserStore; import org.springframework.transaction.annotation.Transactional; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; @@ -77,27 +61,6 @@ this.organisationUnitService = organisationUnitService; } - private ReportTableService reportTableService; - - public void setReportTableService( ReportTableService reportTableService ) - { - this.reportTableService = reportTableService; - } - - private ReportExcelService reportExcelService; - - public void setReportExcelService( ReportExcelService reportExcelService ) - { - this.reportExcelService = reportExcelService; - } - - private ExcelItemService excelItemService; - - public void setExcelItemService( ExcelItemService excelItemService ) - { - this.excelItemService = excelItemService; - } - private CompleteDataSetRegistrationService completeDataSetRegistrationService; public void setCompleteDataSetRegistrationService( CompleteDataSetRegistrationService completeDataSetRegistrationService ) @@ -112,34 +75,6 @@ this.dataValueService = dataValueService; } - private OrganisationUnitGroupService organisationUnitGroupService; - - public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService ) - { - this.organisationUnitGroupService = organisationUnitGroupService; - } - - private UserStore userStore; - - public void setUserStore( UserStore userStore ) - { - this.userStore = userStore; - } - - private PatientIdentifierService patientIdentifierService; - - public void setPatientIdentifierService( PatientIdentifierService patientIdentifierService ) - { - this.patientIdentifierService = patientIdentifierService; - } - - private ChartService chartService; - - public void setChartService( ChartService chartService ) - { - this.chartService = chartService; - } - // ------------------------------------------------------------------------- // DataPruneService implementation // ------------------------------------------------------------------------- @@ -188,118 +123,6 @@ deleteABranch( (OrganisationUnit)eachChild ); } } - try - { - removeOrganisationUnitAndBelonging( organisationUnit ); - } - catch ( HierarchyViolationException e ) - { - System.err.println(e.getMessage()); - } - } - - private void removeOrganisationUnitAndBelonging( OrganisationUnit organisationUnit ) - throws HierarchyViolationException - { - removeOganisationUnitFromReportTable( organisationUnit ); - removeOrganisationUnitFromReportExcel( organisationUnit ); - removeOrganisationUnitFromExcelItemGroup( organisationUnit ); - removeCompleteDataSetRegistrationByOganisationUnit( organisationUnit ); - removeOrganisationUnitFromOrganisationUnitGroup( organisationUnit ); - removeOrganisationUnitFromUser( organisationUnit ); - removePatientIdentifierByOrganisationUnit( organisationUnit ); - removeOrganisationUnitFromChart( organisationUnit ); - dataValueService.deleteDataValuesBySource( organisationUnit ); - organisationUnitService.deleteOrganisationUnit( organisationUnit ); - } - - private void removeCompleteDataSetRegistrationByOganisationUnit( OrganisationUnit organisationUnit ) - { - for ( CompleteDataSetRegistration each : completeDataSetRegistrationService.getAllCompleteDataSetRegistrations()) - { - if(each.getSource().getId() == organisationUnit.getId()) - { - completeDataSetRegistrationService.deleteCompleteDataSetRegistration( each ); - } - } - - } - - private void removeOganisationUnitFromReportTable( OrganisationUnit organisationUnit ) - { - for ( ReportTable each : reportTableService.getAllReportTables() ) - { - if(each.getUnits().contains( organisationUnit )) { - each.getAllUnits().remove( organisationUnit ); - reportTableService.saveReportTable( each ); - } - } - - } - - private void removeOrganisationUnitFromReportExcel( OrganisationUnit organisationUnit ) - { - for(ReportExcel each : reportExcelService.getALLReportExcel()) - { - if(each.getOrganisationAssocitions().contains( organisationUnit )) - { - each.getOrganisationAssocitions().remove( organisationUnit ); - reportExcelService.updateReportExcel( each ); - } - } - } - - private void removeOrganisationUnitFromExcelItemGroup( OrganisationUnit organisationUnit ) - { - for(ExcelItemGroup each : excelItemService.getAllExcelItemGroup()) - { - if(each.getOrganisationAssocitions().contains( organisationUnit )) - { - each.getOrganisationAssocitions().remove( organisationUnit ); - excelItemService.updateExcelItemGroup( each ); - } - } - } - - private void removeOrganisationUnitFromOrganisationUnitGroup( OrganisationUnit organisationUnit ) - { - for(OrganisationUnitGroup each : organisationUnitGroupService.getAllOrganisationUnitGroups()) - { - if(each.getMembers().contains( organisationUnit )) - { - each.getMembers().remove( organisationUnit ); - organisationUnitGroupService.updateOrganisationUnitGroup( each ); - } - } - } - - private void removeOrganisationUnitFromUser( OrganisationUnit organisationUnit ) - { - for(User each : userStore.getAllUsers()) - { - if(each.getOrganisationUnits().contains( organisationUnit )) - { - each.getOrganisationUnits().remove( organisationUnit ); - userStore.updateUser( each ); - } - } - } - - private void removePatientIdentifierByOrganisationUnit( OrganisationUnit organisationUnit ) { - for(PatientIdentifier each : patientIdentifierService.getPatientIdentifiersByOrgUnit( organisationUnit )) - { - patientIdentifierService.deletePatientIdentifier( each ); - } - } - - private void removeOrganisationUnitFromChart( OrganisationUnit organisationUnit ) { - for(Chart each : chartService.getAllCharts()) - { - if(each.getOrganisationUnits().contains( organisationUnit )) - { - each.getOrganisationUnits().remove( organisationUnit ); - chartService.saveChart( each ); - } - } + //removeOrganisationUnitAndBelonging( organisationUnit ); } } === modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml 2010-04-12 16:35:57 +0000 +++ dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml 2010-04-13 11:04:48 +0000 @@ -126,24 +126,10 @@ class="org.hisp.dhis.dataprune.DefaultDataPruneService"> - - - - - - -