← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4582: extended attributeService with functionality for getting attributes belonging to DE/I/OU

 

------------------------------------------------------------
revno: 4582
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-09-14 11:22:51 +0200
message:
  extended attributeService with functionality for getting attributes belonging to DE/I/OU
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml


--
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/attribute/AttributeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java	2011-09-07 13:42:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java	2011-09-14 09:22:51 +0000
@@ -52,6 +52,12 @@
 
     public Set<Attribute> getAllAttributes();
 
+    public Set<Attribute> getDataElementAttributes();
+
+    public Set<Attribute> getIndicatorAttributes();
+
+    public Set<Attribute> getOrganisationUnitAttributes();
+
     public int getAttributeCount();
 
     public int getAttributeCountByName( String name );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java	2011-09-07 13:42:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java	2011-09-14 09:22:51 +0000
@@ -108,7 +108,7 @@
     {
         return attributeStore.getByName( name );
     }
-    
+
     @Override
     public Set<Attribute> getAllAttributes()
     {
@@ -116,6 +116,24 @@
     }
 
     @Override
+    public Set<Attribute> getDataElementAttributes()
+    {
+        return attributeStore.getDataElementAttributes();
+    }
+
+    @Override
+    public Set<Attribute> getIndicatorAttributes()
+    {
+        return attributeStore.getIndicatorAttributes();
+    }
+
+    @Override
+    public Set<Attribute> getOrganisationUnitAttributes()
+    {
+        return attributeStore.getOrganisationUnitAttributes();
+    }
+
+    @Override
     public int getAttributeCount()
     {
         return attributeStore.getCount();

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java	2011-04-26 17:29:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java	2011-09-14 09:22:51 +0000
@@ -31,7 +31,11 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.attribute.AttributeValue;
+import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementGroup;
@@ -52,7 +56,7 @@
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
-    
+
     private DataElementService dataElementService;
 
     public void setDataElementService( DataElementService dataElementService )
@@ -73,55 +77,73 @@
     {
         this.organisationUnitService = organisationUnitService;
     }
-    
+
+    private AttributeService attributeService;
+
+    public void setAttributeService( AttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
     // -------------------------------------------------------------------------
     // Input/output
     // -------------------------------------------------------------------------
-            
+
     private Collection<DataElementGroup> dataElementGroups;
-    
+
     public Collection<DataElementGroup> getDataElementGroups()
     {
         return dataElementGroups;
     }
-    
+
     private List<DataElementCategoryCombo> dataElementCategoryCombos;
-    
+
     public List<DataElementCategoryCombo> getDataElementCategoryCombos()
     {
         return dataElementCategoryCombos;
     }
 
     private DataElementCategoryCombo defaultCategoryCombo;
-    
+
     public DataElementCategoryCombo getDefaultCategoryCombo()
     {
-    	return defaultCategoryCombo;
+        return defaultCategoryCombo;
     }
-    
+
     private List<OrganisationUnitLevel> organisationUnitLevels;
 
     public List<OrganisationUnitLevel> getOrganisationUnitLevels()
     {
         return organisationUnitLevels;
     }
-    
+
+    private List<Attribute> attributes;
+
+    public List<Attribute> getAttributes()
+    {
+        return attributes;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
-    
+
     public String execute()
-    {    	
-    	defaultCategoryCombo = dataElementCategoryService.getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
-    	
+    {
+        defaultCategoryCombo = dataElementCategoryService
+            .getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
+
         dataElementGroups = dataElementService.getAllDataElementGroups();
-                
-        dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>( dataElementCategoryService.getAllDataElementCategoryCombos() );
-        
+
+        dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>(
+            dataElementCategoryService.getAllDataElementCategoryCombos() );
+
         Collections.sort( dataElementCategoryCombos, new DataElementCategoryComboNameComparator() );
-        
+
         organisationUnitLevels = organisationUnitService.getOrganisationUnitLevels();
-        
+
+        attributes = new ArrayList<Attribute>( attributeService.getDataElementAttributes() );
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml	2011-09-12 06:19:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml	2011-09-14 09:22:51 +0000
@@ -3,7 +3,7 @@
   xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd";>
 
-	<!-- Data Element -->
+  <!-- Data Element -->
 
   <bean id="org.hisp.dhis.dd.action.dataelement.GetDataElementListAction" class="org.hisp.dhis.dd.action.dataelement.GetDataElementListAction"
     scope="prototype">
@@ -57,6 +57,7 @@
     <property name="organisationUnitService">
       <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService" />
     </property>
+    <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
   </bean>
 
   <bean id="org.hisp.dhis.dd.action.dataelement.GetDataElementAction" class="org.hisp.dhis.dd.action.dataelement.GetDataElementAction"
@@ -119,7 +120,7 @@
     </property>
   </bean>
 
-	<!-- Data Element Group -->
+  <!-- Data Element Group -->
 
   <bean id="org.hisp.dhis.dd.action.dataelementgroup.ShowDataElementGroupEditorAction" class="org.hisp.dhis.dd.action.dataelementgroup.ShowDataElementGroupEditorAction"
     scope="prototype">
@@ -191,7 +192,7 @@
     </property>
   </bean>
 
-	<!-- Data Element Group Set -->
+  <!-- Data Element Group Set -->
 
   <bean id="org.hisp.dhis.dd.action.dataelementgroupset.AddDataElementGroupSetAction" class="org.hisp.dhis.dd.action.dataelementgroupset.AddDataElementGroupSetAction"
     scope="prototype">
@@ -243,7 +244,7 @@
   </bean>
 
 
-	<!-- Indicator Group -->
+  <!-- Indicator Group -->
 
   <bean id="org.hisp.dhis.dd.action.indicatorgroup.ShowIndicatorGroupEditorAction" class="org.hisp.dhis.dd.action.indicatorgroup.ShowIndicatorGroupEditorAction"
     scope="prototype">
@@ -315,7 +316,7 @@
     </property>
   </bean>
 
-	<!-- Indicator Group Set -->
+  <!-- Indicator Group Set -->
 
   <bean id="org.hisp.dhis.dd.action.indicatorgroupset.AddIndicatorGroupSetAction" class="org.hisp.dhis.dd.action.indicatorgroupset.AddIndicatorGroupSetAction"
     scope="prototype">
@@ -366,7 +367,7 @@
     </property>
   </bean>
 
-	<!-- Indicator Type -->
+  <!-- Indicator Type -->
 
   <bean id="org.hisp.dhis.dd.action.indicatortype.GetIndicatorTypeListAction" class="org.hisp.dhis.dd.action.indicatortype.GetIndicatorTypeListAction"
     scope="prototype">
@@ -410,7 +411,7 @@
     </property>
   </bean>
 
-	<!-- Indicator -->
+  <!-- Indicator -->
 
   <bean id="org.hisp.dhis.dd.action.indicator.GetIndicatorListAction" class="org.hisp.dhis.dd.action.indicator.GetIndicatorListAction"
     scope="prototype">
@@ -481,7 +482,7 @@
     </property>
   </bean>
 
-	<!-- DataDictionary -->
+  <!-- DataDictionary -->
 
   <bean id="org.hisp.dhis.dd.action.datadictionary.AddDataDictionaryAction" class="org.hisp.dhis.dd.action.datadictionary.AddDataDictionaryAction"
     scope="prototype">
@@ -551,7 +552,7 @@
     </property>
   </bean>
 
-	<!-- Category -->
+  <!-- Category -->
 
   <bean id="org.hisp.dhis.dd.action.category.AddDataElementCategoryAction" class="org.hisp.dhis.dd.action.category.AddDataElementCategoryAction"
     scope="prototype">
@@ -617,7 +618,7 @@
     </property>
   </bean>
 
-	<!-- CategoryCombo -->
+  <!-- CategoryCombo -->
 
   <bean id="org.hisp.dhis.dd.action.categorycombo.GetDataElementCategoryListAction" class="org.hisp.dhis.dd.action.categorycombo.GetDataElementCategoryListAction"
     scope="prototype">
@@ -668,24 +669,24 @@
     </property>
   </bean>
 
-	<!-- PDF -->
+  <!-- PDF -->
 
   <bean id="org.hisp.dhis.dd.action.pdf.ExportToPdfAction" class="org.hisp.dhis.dd.action.pdf.ExportToPdfAction"
     scope="prototype">
     <property name="serviceProvider">
       <ref bean="exportServiceProvider" />
     </property>
-    <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService"/>
-    <property name="dataDictionaryService" ref="org.hisp.dhis.datadictionary.DataDictionaryService"/>
-    <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService"/>
+    <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+    <property name="dataDictionaryService" ref="org.hisp.dhis.datadictionary.DataDictionaryService" />
+    <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
   </bean>
 
-	<!-- Other -->
+  <!-- Other -->
 
   <bean id="org.hisp.dhis.dd.action.NoAction" class="org.hisp.dhis.dd.action.NoAction" />
 
 
-	<!-- Validate CategoryOption -->
+  <!-- Validate CategoryOption -->
 
   <bean id="org.hisp.dhis.dd.action.category.ValidateDataElementCategoryOptionAction" class="org.hisp.dhis.dd.action.category.ValidateDataElementCategoryOptionAction"
     scope="prototype">
@@ -694,7 +695,7 @@
     </property>
   </bean>
 
-	<!-- Concept Name -->
+  <!-- Concept Name -->
 
   <bean id="org.hisp.dhis.dd.action.concept.AddConceptAction" class="org.hisp.dhis.dd.action.concept.AddConceptAction"
     scope="prototype">