← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13435: CCEI: work in progress aggregation query builder

 

------------------------------------------------------------
revno: 13435
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-12-26 10:29:48 +0000
message:
  CCEI: work in progress aggregation query builder
added:
  local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/aggregation/action/AddAggregationQueryAction.java
  local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/aggregation/action/AddAggregationQueryFormAction.java
  local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/addAggregationQuery.vm
modified:
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/lookup/Lookup.java
  local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml
  local/in/dhis-web-maintenance-ccem/src/main/resources/struts.xml
  local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/aggregationEngine.js


--
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/in/dhis-in-api/src/main/java/org/hisp/dhis/lookup/Lookup.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/lookup/Lookup.java	2013-12-24 12:32:37 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/lookup/Lookup.java	2013-12-26 10:29:48 +0000
@@ -8,6 +8,8 @@
     
     public static final String BANK = "BANK";
     
+    public static final String CCEI_AGG_TYPE = "CCEI_AGG_TYPE";
+    
     private String type;
     
     private String value;

=== added file 'local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/aggregation/action/AddAggregationQueryAction.java'
--- local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/aggregation/action/AddAggregationQueryAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/aggregation/action/AddAggregationQueryAction.java	2013-12-26 10:29:48 +0000
@@ -0,0 +1,43 @@
+package org.hisp.dhis.ccem.aggregation.action;
+
+import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
+import org.hisp.dhis.dataelement.DataElementService;
+
+import com.opensymphony.xwork2.Action;
+
+public class AddAggregationQueryAction implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private CaseAggregationConditionService aggregationConditionService;
+
+    public void setAggregationConditionService( CaseAggregationConditionService aggregationConditionService )
+    {
+        this.aggregationConditionService = aggregationConditionService;
+    }
+    
+    private DataElementService dataElementService;
+    
+    public void setDataElementService(DataElementService dataElementService) 
+    {
+		this.dataElementService = dataElementService;
+	}
+    
+    // -------------------------------------------------------------------------
+    // Input/ Output
+    // -------------------------------------------------------------------------
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+	public String execute()
+        throws Exception
+    {
+    	//aggregationConditionService.addCaseAggregationCondition(arg0);
+        
+        return SUCCESS;
+    }
+
+}

=== added file 'local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/aggregation/action/AddAggregationQueryFormAction.java'
--- local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/aggregation/action/AddAggregationQueryFormAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/java/org/hisp/dhis/ccem/aggregation/action/AddAggregationQueryFormAction.java	2013-12-26 10:29:48 +0000
@@ -0,0 +1,61 @@
+package org.hisp.dhis.ccem.aggregation.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.lookup.Lookup;
+import org.hisp.dhis.lookup.LookupService;
+
+import com.opensymphony.xwork2.Action;
+
+public class AddAggregationQueryFormAction implements Action 
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+	private LookupService lookupService;
+
+	public void setLookupService(LookupService lookupService) 
+	{
+		this.lookupService = lookupService;
+	}
+	
+    private DataElementService dataElementService;
+    
+    public void setDataElementService(DataElementService dataElementService) 
+    {
+		this.dataElementService = dataElementService;
+	}
+
+    // -------------------------------------------------------------------------
+    // Input/ Output
+    // -------------------------------------------------------------------------
+	List<Lookup> lookups;
+	
+    public List<Lookup> getLookups() 
+    {
+		return lookups;
+	}
+	
+    List<DataElement> dataElementList;
+    
+	public List<DataElement> getDataElementList() 
+	{
+		return dataElementList;
+	}
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+	public String execute()
+        throws Exception
+    {
+		lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.CCEI_AGG_TYPE ) );
+
+		dataElementList = new ArrayList<DataElement>( dataElementService.getAllActiveDataElements() );
+		
+    	return SUCCESS;
+    }
+}

=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml	2013-12-24 12:32:37 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/resources/META-INF/dhis/beans.xml	2013-12-26 10:29:48 +0000
@@ -740,5 +740,11 @@
         scope="prototype">
         <property name="aggregationConditionService" ref="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
     </bean>   
+     <bean id="org.hisp.dhis.ccem.aggregation.action.AddAggregationQueryFormAction"
+        class="org.hisp.dhis.ccem.aggregation.action.AddAggregationQueryFormAction"
+        scope="prototype">
+        <property name="lookupService" ref="org.hisp.dhis.lookup.LookupService" />
+        <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+    </bean>   
 	
 </beans>
\ No newline at end of file

=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-ccem/src/main/resources/struts.xml	2013-12-24 12:32:37 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/resources/struts.xml	2013-12-26 10:29:48 +0000
@@ -675,10 +675,9 @@
 
     <action name="addAggregationQueryForm" class="org.hisp.dhis.ccem.aggregation.action.AddAggregationQueryFormAction">
         <result name="success" type="velocity">/main.vm</result>
-        <param name="page">/dhis-web-maintenance-ccem/addAggregationQueryForm.vm</param>
+        <param name="page">/dhis-web-maintenance-ccem/addAggregationQuery.vm</param>
         <param name="menu">/dhis-web-maintenance-ccem/menu.vm</param>
         <param name="javascripts">javascript/aggregationEngine.js</param>
-        <interceptor-ref name="fileUploadStack"/>
     </action>
 	
 </package>

=== added file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/addAggregationQuery.vm'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/addAggregationQuery.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/addAggregationQuery.vm	2013-12-26 10:29:48 +0000
@@ -0,0 +1,47 @@
+<form id="addAggregationForm" action="addAggregationQuery.action" method="post" >
+
+<table> 
+	<thead>
+      <tr>
+        <th colspan="2">$i18n.getString( "aggregation_query_builder_detail" )</th>
+      </tr>
+    </thead>
+	
+    <tbody>
+    	<tr>
+        	<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+        	<td><input type="text" id="name" name="name" class="{validate:{required:true,minlength:2}}"></td>
+    	</tr>    
+    	<tr>
+			<td><label for="dataElement">$i18n.getString( "dataelement" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+			<td>			
+				<select style='width:20px; margin-bottom:-5px;height:20px;' id="dataElementId" name="dataElementId" >
+					#foreach( $dataElement in $dataElementList )
+						<option value="$dataElement.id">$dataElement.name</option>
+					#end
+				</select>
+			</td>
+		</tr>
+		<tr>
+			<td><label for="operator">$i18n.getString( "type" )</label></td>
+			<td>			
+				<select style='width:20px; margin-bottom:-5px;height:20px;' id="aggType" name="aggType" >
+					#foreach( $lookup in $lookups )
+						<option value="$lookup.id">$lookup.value</option>
+					#end
+				</select>
+			</td>
+		</tr>
+	
+		
+    </tbody>
+</table>
+
+
+<p>	
+	<input type="submit" value="$i18n.getString( 'add' )" />
+	<input type="button" value="$i18n.getString( 'test_condition' )" onclick='testCaseAggregationCondition();'/>
+	<input type="button" value="$i18n.getString( 'cancel' )" onClick="cancelOnClick();" />
+</p>
+
+</form>

=== modified file 'local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/aggregationEngine.js'
--- local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/aggregationEngine.js	2013-12-24 12:32:37 +0000
+++ local/in/dhis-web-maintenance-ccem/src/main/webapp/dhis-web-maintenance-ccem/javascript/aggregationEngine.js	2013-12-26 10:29:48 +0000
@@ -2,6 +2,6 @@
 
 function showAddAggregationForm() 
 {
-	window.location.href = 'showAddAggregationForm.action';
+	window.location.href = 'addAggregationQueryForm.action';
 }