← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6025: Removed DataSet.lockExceptions association, not required

 

------------------------------------------------------------
revno: 6025
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-02-17 14:25:29 +0100
message:
  Removed DataSet.lockExceptions association, not required
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.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/hibernate/HibernateLockExceptionStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml
  dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockException.vm


--
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/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2012-02-16 15:31:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2012-02-17 13:25:29 +0000
@@ -126,11 +126,6 @@
      */
     private int expiryDays;
 
-    /**
-     * Locking exceptions
-     */
-    private Set<LockException> lockExceptions = new HashSet<LockException>();
-
     // -------------------------------------------------------------------------
     // Contructors
     // -------------------------------------------------------------------------
@@ -448,17 +443,4 @@
     {
         this.expiryDays = expiryDays;
     }
-
-    @XmlElementWrapper( name = "lockExceptions" )
-    @XmlElement( name = "lockException" )
-    @JsonProperty
-    public Set<LockException> getLockExceptions()
-    {
-        return lockExceptions;
-    }
-
-    public void setLockExceptions( Set<LockException> lockExceptions )
-    {
-        this.lockExceptions = lockExceptions;
-    }
 }

=== 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-02-16 18:13:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2012-02-17 13:25:29 +0000
@@ -27,7 +27,19 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.apache.commons.lang.Validate;
+import static org.hisp.dhis.i18n.I18nUtils.getCountByName;
+import static org.hisp.dhis.i18n.I18nUtils.getObjectsBetween;
+import static org.hisp.dhis.i18n.I18nUtils.getObjectsBetweenByName;
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.dataelement.DataElement;
@@ -43,10 +55,6 @@
 import org.joda.time.DateTime;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.*;
-
-import static org.hisp.dhis.i18n.I18nUtils.*;
-
 /**
  * @author Lars Helge Overland
  * @version $Id: DefaultDataSetService.java 6255 2008-11-10 16:01:24Z larshelg $
@@ -335,32 +343,18 @@
     @Override
     public int addLockException( LockException lockException )
     {
-        Validate.notNull( lockException );
-
-        DataSet dataSet = lockException.getDataSet();
-
-        dataSet.getLockExceptions().add( lockException );
-
         return lockExceptionStore.save( lockException );
     }
 
     @Override
     public void updateLockException( LockException lockException )
     {
-        Validate.notNull( lockException );
-
         lockExceptionStore.update( lockException );
     }
 
     @Override
     public void deleteLockException( LockException lockException )
     {
-        Validate.notNull( lockException );
-
-        DataSet dataSet = lockException.getDataSet();
-
-        dataSet.getLockExceptions().remove( lockException );
-
         lockExceptionStore.delete( lockException );
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java	2012-02-17 13:13:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java	2012-02-17 13:25:29 +0000
@@ -95,7 +95,7 @@
     @Override
     public Collection<LockException> getCombinations()
     {
-        final String sql = "SELECT DISTINCT datasetid, periodid FROM LockException";
+        final String sql = "select distinct datasetid, periodid from LockException";
 
         final Collection<LockException> lockExceptions = new ArrayList<LockException>();
 
@@ -124,7 +124,7 @@
     @Override
     public void deleteCombination( DataSet dataSet, Period period )
     {
-        final String hql = "DELETE FROM LockException WHERE dataSet=:dataSet AND period=:period";
+        final String hql = "delete from LockException where dataSet=:dataSet and period=:period";
         
         Query query = getQuery( hql );
         query.setParameter( "dataSet", dataSet );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2012-02-17 12:10:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2012-02-17 13:25:29 +0000
@@ -100,6 +100,7 @@
         executeSql( "DROP TABLE datasetlockedperiods" );
         executeSql( "DROP TABLE datasetlocksource" );
         executeSql( "DROP TABLE datasetlock" );
+        executeSql( "DROP TABLE datasetlockexceptions" );
         executeSql( "ALTER TABLE dataelementcategoryoption drop column categoryid" );
         executeSql( "ALTER TABLE reporttable DROP column dimension_type" );
         executeSql( "ALTER TABLE reporttable DROP column dimensiontype" );

=== 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	2012-02-16 15:31:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2012-02-17 13:25:29 +0000
@@ -63,11 +63,5 @@
 
     <property name="expiryDays" />
 
-    <set name="lockExceptions" table="datasetlockexceptions">
-      <cache usage="read-write" />
-      <key column="datasetid" />
-      <many-to-many class="org.hisp.dhis.dataset.LockException" column="lockexceptionid" unique="true" />
-    </set>
-
   </class>
 </hibernate-mapping>

=== 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	2012-02-12 19:37:55 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml	2012-02-17 13:25:29 +0000
@@ -116,8 +116,6 @@
 
   <cache name="org.hisp.dhis.dataset.DataSet.sections" maxElementsInMemory="3000" />
 
-  <cache name="org.hisp.dhis.dataset.DataSet.lockExceptions" maxElementsInMemory="1000" />
-
   <cache name="org.hisp.dhis.dataelement.DataElement.groups" maxElementsInMemory="3000" />
 
   <cache name="org.hisp.dhis.dataelement.DataElement.dataSets" maxElementsInMemory="3000" />

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockException.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockException.vm	2012-02-14 07:51:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockException.vm	2012-02-17 13:25:29 +0000
@@ -38,7 +38,7 @@
 			</table>
 			<table class="listTable" id="listTable">
 				<col/>
-				<col width="96px"/>			
+				<col width="80px"/>			
                 <thead>				
 				<tr>
 					<th>$i18n.getString( "name" )</th>