← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12034: Fix bug - Don't load optionset-values in entry form.

 

------------------------------------------------------------
revno: 12034
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-09-11 16:50:12 +0700
message:
  Fix bug - Don't load optionset-values in entry form.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java
  dhis-2/dhis-web/dhis-web-caseentry/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-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetOptionsByDataElementAction.java	2013-09-11 09:50:12 +0000
@@ -32,8 +32,6 @@
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.struts2.ServletActionContext;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.option.OptionService;
 import org.hisp.dhis.option.OptionSet;
 import org.hisp.dhis.util.ContextUtils;
@@ -49,18 +47,11 @@
     implements Action
 {
     private static Integer MAX_OPTIONS_DISPLAYED = 30;
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
     
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
     private OptionService optionService;
 
     public void setOptionService( OptionService optionService )
@@ -104,23 +95,22 @@
     public String execute()
     {
         query = StringUtils.trimToNull( query );
-        
-        DataElement dataElement = dataElementService.getDataElement( id );
 
-        OptionSet optionSet = dataElement.getOptionSet();
+        OptionSet optionSet = optionService.getOptionSet( id );
 
         // ---------------------------------------------------------------------
         // If the query is null and the option set has not changed since last
         // request we can tell the client to use its cached response (304)
         // ---------------------------------------------------------------------
 
-        boolean isNotModified = ( query == null && ContextUtils.isNotModified( ServletActionContext.getRequest(), ServletActionContext.getResponse(), optionSet ) );
-        
+        boolean isNotModified = (query == null && ContextUtils.isNotModified( ServletActionContext.getRequest(),
+            ServletActionContext.getResponse(), optionSet ));
+
         if ( !isNotModified && optionSet != null )
         {
             options = optionService.getOptions( optionSet.getId(), query, MAX_OPTIONS_DISPLAYED );
         }
-        
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-09-10 18:29:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2013-09-11 09:50:12 +0000
@@ -149,7 +149,6 @@
 		id="org.hisp.dhis.caseentry.action.caseentry.GetOptionsByDataElementAction"
 		class="org.hisp.dhis.caseentry.action.caseentry.GetOptionsByDataElementAction"
 		scope="prototype">
-		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 		<property name="optionService" ref="org.hisp.dhis.option.OptionService" />
 	</bean>