dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15780
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5813: Moved removal of translations from services to TranslationDeletionHandler
------------------------------------------------------------
revno: 5813
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-01-27 12:40:18 +0100
message:
Moved removal of translations from services to TranslationDeletionHandler
added:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/TranslationDeletionHandler.java
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultSectionService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2012-01-22 08:05:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2012-01-27 11:40:18 +0000
@@ -107,10 +107,8 @@
}
public void deleteDataElement( DataElement dataElement )
- throws HierarchyViolationException
+ throws HierarchyViolationException //TODO remove
{
- i18nService.removeObject( dataElement );
-
dataElementStore.delete( dataElement );
}
@@ -361,8 +359,6 @@
public void deleteDataElementGroup( DataElementGroup dataElementGroup )
{
- i18nService.removeObject( dataElementGroup );
-
dataElementGroupStore.delete( dataElementGroup );
}
@@ -457,8 +453,6 @@
public void deleteDataElementGroupSet( DataElementGroupSet groupSet )
{
- i18nService.removeObject( groupSet );
-
dataElementGroupSetStore.delete( groupSet );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2012-01-19 11:43:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2012-01-27 11:40:18 +0000
@@ -106,8 +106,6 @@
public void deleteDataSet( DataSet dataSet )
{
- i18nService.removeObject( dataSet );
-
dataSetStore.delete( dataSet );
log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(),
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultSectionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultSectionService.java 2012-01-19 11:43:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultSectionService.java 2012-01-27 11:40:18 +0000
@@ -76,8 +76,6 @@
public void deleteSection( Section section )
{
- i18nService.removeObject( section );
-
sectionStore.delete( section );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java 2012-01-19 11:43:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java 2012-01-27 11:40:18 +0000
@@ -102,8 +102,6 @@
public void deleteIndicator( Indicator indicator )
{
- i18nService.removeObject( indicator );
-
indicatorStore.delete( indicator );
}
@@ -211,8 +209,6 @@
public void deleteIndicatorType( IndicatorType indicatorType )
{
- i18nService.removeObject( indicatorType );
-
indicatorTypeStore.delete( indicatorType );
}
@@ -285,8 +281,6 @@
public void deleteIndicatorGroup( IndicatorGroup indicatorGroup )
{
- i18nService.removeObject( indicatorGroup );
-
indicatorGroupStore.delete( indicatorGroup );
}
@@ -378,8 +372,6 @@
public void deleteIndicatorGroupSet( IndicatorGroupSet groupSet )
{
- i18nService.removeObject( groupSet );
-
indicatorGroupSetStore.delete( groupSet );
}
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/TranslationDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/TranslationDeletionHandler.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/translation/TranslationDeletionHandler.java 2012-01-27 11:40:18 +0000
@@ -0,0 +1,142 @@
+package org.hisp.dhis.translation;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.Section;
+import org.hisp.dhis.i18n.I18nService;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorGroupSet;
+import org.hisp.dhis.indicator.IndicatorType;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
+import org.hisp.dhis.system.deletion.DeletionHandler;
+import org.hisp.dhis.validation.ValidationRule;
+import org.hisp.dhis.validation.ValidationRuleGroup;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class TranslationDeletionHandler
+ extends DeletionHandler
+{
+ private I18nService i18nService;
+
+ public void setI18nService( I18nService service )
+ {
+ i18nService = service;
+ }
+
+ @Override
+ protected String getClassName()
+ {
+ return Translation.class.getSimpleName();
+ }
+
+ @Override
+ public void deleteDataElement( DataElement dataElement )
+ {
+ i18nService.removeObject( dataElement );
+ }
+
+ @Override
+ public void deleteDataElementGroup( DataElementGroup dataElementGroup )
+ {
+ i18nService.removeObject( dataElementGroup );
+ }
+
+ @Override
+ public void deleteDataElementGroupSet( DataElementGroupSet dataElementGroupSet )
+ {
+ i18nService.removeObject( dataElementGroupSet );
+ }
+
+ @Override
+ public void deleteDataSet( DataSet dataSet )
+ {
+ i18nService.removeObject( dataSet );
+ }
+
+ @Override
+ public void deleteSection( Section section )
+ {
+ i18nService.removeObject( section );
+ }
+
+ @Override
+ public void deleteIndicator( Indicator indicator )
+ {
+ i18nService.removeObject( indicator );
+ }
+
+ @Override
+ public void deleteIndicatorGroup( IndicatorGroup indicatorGroup )
+ {
+ i18nService.removeObject( indicatorGroup );
+ }
+
+ @Override
+ public void deleteIndicatorType( IndicatorType indicatorType )
+ {
+ i18nService.removeObject( indicatorType );
+ }
+
+ @Override
+ public void deleteIndicatorGroupSet( IndicatorGroupSet indicatorGroupSet )
+ {
+ i18nService.removeObject( indicatorGroupSet );
+ }
+
+ @Override
+ public void deleteValidationRule( ValidationRule validationRule )
+ {
+ i18nService.removeObject( validationRule );
+ }
+
+ @Override
+ public void deleteValidationRuleGroup( ValidationRuleGroup validationRuleGroup )
+ {
+ i18nService.removeObject( validationRuleGroup );
+ }
+
+ @Override
+ public void deleteOrganisationUnitGroup( OrganisationUnitGroup group )
+ {
+ i18nService.removeObject( group );
+ }
+
+ @Override
+ public void deleteOrganisationUnitGroupSet( OrganisationUnitGroupSet groupSet )
+ {
+ i18nService.removeObject( groupSet );
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2012-01-22 12:16:48 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2012-01-27 11:40:18 +0000
@@ -813,6 +813,10 @@
<property name="messageService" ref="org.hisp.dhis.message.MessageService"/>
</bean>
+ <bean id="org.hisp.dhis.translation.TranslationDeletionHandler" class="org.hisp.dhis.translation.TranslationDeletionHandler">
+ <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService"/>
+ </bean>
+
<!-- DeletionManager -->
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
@@ -850,6 +854,7 @@
<ref local="org.hisp.dhis.dataelement.DataElementGroupSetDeletionHandler" />
<ref local="org.hisp.dhis.configuration.ConfigurationDeletionHandler" />
<ref local="org.hisp.dhis.message.MessageConversationDeletionHandler" />
+ <ref local="org.hisp.dhis.translation.TranslationDeletionHandler" />
</list>
</list>
</property>
=== 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 2012-01-03 06:08:25 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2012-01-27 11:40:18 +0000
@@ -402,6 +402,15 @@
return null;
}
+ public String allowDeleteUserGroup ( UserGroup userGroup )
+ {
+ return null;
+ }
+
+ public void deleteUserGroup( UserGroup userGroup )
+ {
+ }
+
public void deleteUserSetting( UserSetting userSetting )
{
}
@@ -644,13 +653,4 @@
public void deleteCaseAggregationCondition( CaseAggregationCondition caseAggregationCondition )
{
}
-
- public String allowDeleteUserGroup ( UserGroup userGroup )
- {
- return null;
- }
-
- public void deleteUserGroup( UserGroup userGroup )
- {
- }
}