dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12336
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3772: Removed unnecessary cascading from OrganisationUnit-parent and DataSet-Section associations
------------------------------------------------------------
revno: 3772
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-05-28 13:57:54 +0200
message:
Removed unnecessary cascading from OrganisationUnit-parent and DataSet-Section associations
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DataSetDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml
dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/RemoveSectionAction.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/dataset/DataSetDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DataSetDeletionHandler.java 2011-04-22 21:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DataSetDeletionHandler.java 2011-05-28 11:57:54 +0000
@@ -70,6 +70,18 @@
}
}
}
+
+ @Override
+ public void deleteSection( Section section )
+ {
+ for ( DataSet dataSet : dataSetService.getAllDataSets() )
+ {
+ if ( dataSet.getSections().remove( section ) )
+ {
+ dataSetService.updateDataSet( dataSet );
+ }
+ }
+ }
@Override
public void deleteOrganisationUnit( OrganisationUnit unit )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2011-05-11 07:32:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2011-05-28 11:57:54 +0000
@@ -48,7 +48,7 @@
<many-to-many column="sourceid" class="org.hisp.dhis.organisationunit.OrganisationUnit" foreign-key="fk_dataset_organisationunit"/>
</set>
- <set name="sections" order-by="sortorder" inverse="true" cascade="all">
+ <set name="sections" order-by="sortorder" inverse="true">
<cache usage="read-write" />
<key column="datasetid" />
<one-to-many class="org.hisp.dhis.dataset.Section" />
@@ -58,8 +58,7 @@
<property name="sortOrder" />
- <many-to-one name="dataEntryForm" class="org.hisp.dhis.dataentryform.DataEntryForm" foreign-key="fk_dataset_dataentryform"
- cascade="all" />
+ <many-to-one name="dataEntryForm" class="org.hisp.dhis.dataentryform.DataEntryForm" foreign-key="fk_dataset_dataentryform" cascade="all" />
<property name="mobile" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml 2011-05-11 07:32:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml 2011-05-28 11:57:54 +0000
@@ -19,7 +19,7 @@
<column name="name" not-null="true" unique="true" length="230" />
</property>
- <set name="children" inverse="true" cascade="save-update,delete-orphan">
+ <set name="children" inverse="true">
<cache usage="read-write" />
<key column="parentid" />
<one-to-many class="org.hisp.dhis.organisationunit.OrganisationUnit" />
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml 2011-04-30 09:28:32 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml 2011-05-28 11:57:54 +0000
@@ -4,7 +4,7 @@
<diskStore path="java.io.tmpdir"/>
<defaultCache
- maxElementsInMemory="500000"
+ maxElementsInMemory="400000"
eternal="false"
timeToIdleSeconds="360"
timeToLiveSeconds="720"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java 2011-01-25 21:25:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java 2011-05-28 11:57:54 +0000
@@ -111,8 +111,7 @@
for ( String id : selectedList )
{
- DataElement d = dataElementService.getDataElement( Integer.parseInt( id ) );
- selectedDataElements.add( d );
+ selectedDataElements.add( dataElementService.getDataElement( Integer.parseInt( id ) ) );
}
section.setDataElements( selectedDataElements );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/RemoveSectionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/RemoveSectionAction.java 2010-12-22 04:05:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/RemoveSectionAction.java 2011-05-28 11:57:54 +0000
@@ -76,8 +76,9 @@
Section section = sectionService.getSection( id );
DataSet dataSet = section.getDataSet();
-
- if(dataSet.getMobile() != null && dataSet.getMobile()){
+
+ if ( dataSet.getMobile() != null && dataSet.getMobile() ) //TODO hack
+ {
dataSet.setVersion( dataSet.getVersion() + 1 );
dataSetService.updateDataSet( dataSet );
}