← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7113: local vn - Fixed bug of loading entry form based on department.

 

------------------------------------------------------------
revno: 7113
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-05-31 13:06:01 +0700
message:
  local vn - Fixed bug of loading entry form based on department.
modified:
  local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLocalDataSetStore.java
  local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDepartmentsAction.java
  local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java
  local/vn/dhis-web-dataentry-hospital/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 'local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLocalDataSetStore.java'
--- local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLocalDataSetStore.java	2012-05-10 16:18:43 +0000
+++ local/vn/dhis-service-vn/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLocalDataSetStore.java	2012-05-31 06:06:01 +0000
@@ -80,12 +80,14 @@
         // Iterate through all matching data element fields
         // ---------------------------------------------------------------------
         DataElementCategoryOptionCombo optionCombo = null;
-        
+        String dataElementCode = null;
+        String inputHTML = null;
+
         while ( inputMatcher.find() )
         {
-            String dataElementCode = inputMatcher.group( 1 );
+            dataElementCode = inputMatcher.group( 1 );
 
-            String inputHTML = inputMatcher.group();
+            inputHTML = inputMatcher.group();
             inputHTML = inputHTML.replace( ">", "" );
 
             Matcher identifierMatcher = ProgramDataEntryService.IDENTIFIER_PATTERN_FIELD.matcher( dataElementCode );
@@ -93,11 +95,13 @@
             if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
             {
                 int optionComboId = Integer.parseInt( identifierMatcher.group( 2 ) );
+
                 optionCombo = categoryService.getDataElementCategoryOptionCombo( optionComboId );
+
                 return optionCombo;
             }
         }
-        
+
         return null;
     }
 }

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDepartmentsAction.java'
--- local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDepartmentsAction.java	2012-05-11 08:28:02 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDepartmentsAction.java	2012-05-31 06:06:01 +0000
@@ -29,7 +29,6 @@
 
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Map;
 
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -37,8 +36,8 @@
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.dataset.LocalDataSetService;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.reportsheet.CategoryOptionAssociation;
-import org.hisp.dhis.reportsheet.CategoryOptionAssociationService;
+import org.hisp.dhis.reportsheet.OptionComboAssociation;
+import org.hisp.dhis.reportsheet.OptionComboAssociationService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -61,9 +60,9 @@
         this.selectionManager = selectionManager;
     }
 
-    private CategoryOptionAssociationService associationService;
+    private OptionComboAssociationService associationService;
 
-    public void setAssociationService( CategoryOptionAssociationService associationService )
+    public void setAssociationService( OptionComboAssociationService associationService )
     {
         this.associationService = associationService;
     }
@@ -93,9 +92,9 @@
         this.dataSetId = dataSetId;
     }
 
-    private Collection<CategoryOptionAssociation> associations;
+    private Collection<OptionComboAssociation> associations;
 
-    public Collection<CategoryOptionAssociation> getAssociations()
+    public Collection<OptionComboAssociation> getAssociations()
     {
         return associations;
     }
@@ -115,18 +114,13 @@
     public String execute()
         throws Exception
     {
-        associations = associationService
-            .getCategoryOptionAssociations( selectionManager.getSelectedOrganisationUnit() );
-        
-        Collection<DataElementCategoryOptionCombo> departmentInOrgunit = new HashSet<DataElementCategoryOptionCombo>();
-        
-        for( CategoryOptionAssociation association : associations )
-        {
-            departmentInOrgunit.addAll( association.getCategoryOption().getCategoryOptionCombos() );
-        }
+        Collection<DataElementCategoryOptionCombo> departmentInOrgunit = associationService
+            .getOptionCombos( selectionManager.getSelectedOrganisationUnit() );
+
         DataSet dataSet = dataSetService.getDataSet( dataSetId );
 
         String description = dataSet.getDescription();
+
         if ( description != null && !description.trim().isEmpty() )
         {
             Collection<DataSet> dataSets = localDataSetService.getDataSetsByDescription( description );
@@ -136,9 +130,10 @@
             {
                 if ( relativedataSet.getDataEntryForm() != null )
                 {
-                    DataElementCategoryOptionCombo optionCombo = localDataSetService.getDepartmentByDataSet( relativedataSet );
+                    DataElementCategoryOptionCombo optionCombo = localDataSetService
+                        .getDepartmentByDataSet( relativedataSet );
 
-                    if( departmentInOrgunit.contains( optionCombo ) )
+                    if ( departmentInOrgunit.contains( optionCombo ) )
                     {
                         mapDataSets.put( relativedataSet.getId(), optionCombo.getName() );
                     }

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java'
--- local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java	2012-05-10 16:18:43 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java	2012-05-31 06:06:01 +0000
@@ -34,8 +34,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.hisp.dhis.attribute.Attribute;
-import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategory;
@@ -50,7 +48,6 @@
 import org.hisp.dhis.dataentryform.DataEntryFormService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.dataset.LocalDataSetService;
 import org.hisp.dhis.dataset.Section;
 import org.hisp.dhis.dataset.comparator.SectionOrderComparator;
 import org.hisp.dhis.i18n.I18n;

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml	2012-05-15 06:05:09 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml	2012-05-31 06:06:01 +0000
@@ -149,7 +149,7 @@
   
   <bean id="org.hisp.dhis.de.action.LoadDepartmentsAction" class="org.hisp.dhis.de.action.LoadDepartmentsAction" scope="prototype">
 	 <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-	 <property name="associationService" ref="org.hisp.dhis.reportsheet.CategoryOptionAssociationService" />
+	 <property name="associationService" ref="org.hisp.dhis.reportsheet.OptionComboAssociationService" />
 	 <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
 	 <property name="localDataSetService" ref="org.hisp.dhis.dataset.LocalDataSetService" />
   </bean>