← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 309: - Added PeriodType to DataElement. No database change. - Fixed bug related to edit of User.

 

------------------------------------------------------------
revno: 309
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Wed 2009-05-20 11:12:24 +0200
message:
  - Added PeriodType to DataElement. No database change. - Fixed bug related to edit of User.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2009-05-20 09:12:24 +0000
@@ -33,6 +33,8 @@
 
 import org.hisp.dhis.common.MetaObject;
 import org.hisp.dhis.datadictionary.ExtendedDataElement;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.period.PeriodType;
 
 /**
  * A DataElement is a definition (meta-information about) of the entities that
@@ -144,6 +146,11 @@
      */
     private String url;
     
+    /**
+     * The data sets which this data element is a member of.
+     */
+    private Set<DataSet> dataSets = new HashSet<DataSet>();
+    
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -192,6 +199,32 @@
     }
 
     // -------------------------------------------------------------------------
+    // Logic
+    // -------------------------------------------------------------------------
+
+    public PeriodType getPeriodType()
+    {
+        return dataSets != null && dataSets.size() > 0 ? dataSets.iterator().next().getPeriodType() : null;
+    }
+    
+    public boolean periodTypeIsValid()
+    {
+        PeriodType periodType = null;
+        
+        for ( DataSet dataSet : dataSets )
+        {
+            if ( periodType != null && !periodType.equals( dataSet.getPeriodType() ) )
+            {
+                return false;
+            }
+            
+            periodType = dataSet.getPeriodType();
+        }
+        
+        return true;
+    }
+    
+    // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------
 
@@ -355,4 +388,14 @@
     {
         this.url = url;
     }
+
+    public Set<DataSet> getDataSets()
+    {
+        return dataSets;
+    }
+
+    public void setDataSets( Set<DataSet> dataSets )
+    {
+        this.dataSets = dataSets;
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml	2009-05-20 09:12:24 +0000
@@ -58,5 +58,11 @@
     
     <property name="url"/>
     
+    <set name="dataSets" table="datasetmembers" inverse="true">
+      <key column="dataelementid"/>
+      <many-to-many class="org.hisp.dhis.dataset.DataSet" 
+          column="datasetid"/>
+    </set>
+    
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml	2009-05-05 15:24:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml	2009-05-20 09:12:24 +0000
@@ -46,6 +46,9 @@
     <property name="userStore">
       <ref bean="org.hisp.dhis.user.UserStore"/>
     </property>
+    <property name="organisationUnitGroupService">
+      <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService"/>
+    </property>
   </bean>
   
   <bean id="org.hisp.dhis.user.action.GetOrgunitUserListAction"



--
Trunk
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.