dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27951
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13938: PBF: AggregationEngine
------------------------------------------------------------
revno: 13938
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-02-05 10:49:02 +0000
message:
PBF: AggregationEngine
added:
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/AddAggregationQueryAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/AddAggregationQueryFormAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/AggregationQueryListAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/GetAggregationParameterAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/RunAggregationQueryAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultPBFAggregationService.java
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/addAggregationParam.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/addAggregationQuery.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/aggregationQueryList.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/aggregationEngine.js
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/runAggregationQueryForm.vm
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/runAggregationQueryResult.vm
modified:
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/Lookup.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadDataEntryFormAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityMaxDetailsAction.java
local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityScoreDetailsAction.java
local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/pbfDataEntry.js
local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.vm
--
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
=== added directory 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation'
=== added directory 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action'
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/AddAggregationQueryAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/AddAggregationQueryAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/AddAggregationQueryAction.java 2014-02-05 10:49:02 +0000
@@ -0,0 +1,256 @@
+package org.hisp.dhis.pbf.aggregation.action;
+
+import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
+import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.pbf.api.Lookup;
+import org.hisp.dhis.pbf.api.LookupService;
+
+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;
+ }
+
+ private LookupService lookupService;
+
+ public void setLookupService( LookupService lookupService )
+ {
+ this.lookupService = lookupService;
+ }
+
+ /* private CCEIAggregationService cceiAggregationService;
+
+ public void setCceiAggregationService( CCEIAggregationService cceiAggregationService )
+ {
+ this.cceiAggregationService = cceiAggregationService;
+ }
+*/
+ private DataElementCategoryService dataElementCategoryService;
+
+ public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+ {
+ this.dataElementCategoryService = dataElementCategoryService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/ Output
+ // -------------------------------------------------------------------------
+
+ private String name;
+
+ private String aggType;
+
+ private Integer dataElementId;
+
+
+ private Integer pbfDataSetId;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ public void setAggType( String aggType )
+ {
+ this.aggType = aggType;
+ }
+
+ public void setDataElementId( Integer dataElementId )
+ {
+ this.dataElementId = dataElementId;
+ }
+
+ public void setPbfDataSetId( Integer pbfDataSetId )
+ {
+ this.pbfDataSetId = pbfDataSetId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute()
+ throws Exception
+ {
+ DataElement dataElement = dataElementService.getDataElement( dataElementId );
+
+ /*
+ if( name == null && name.equalsIgnoreCase( "" ))
+ {
+ name = dataElement.getName();
+ }
+
+ */
+
+ /**
+ * TODO support for category option combo
+ */
+ if( aggType.equals( Lookup.PBF_AGG_TYPE_OVERALL_QUALITY_SCORE ) || aggType.equals( Lookup.PBF_AGG_TYPE_OVERALL_UNADJUSTED_PBF_AMOUNT ) )
+ {
+ String query = ""+pbfDataSetId;
+
+ CaseAggregationCondition condition = new CaseAggregationCondition( dataElement.getName(), aggType, query, dataElement, dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+
+ aggregationConditionService.addCaseAggregationCondition( condition );
+ }
+
+ /*if ( aggType.equals( Lookup.CCEI_AGG_TYPE_STORAGE_CAPACITY ) )
+ {
+ //CaseAggregationCondition condition = new CaseAggregationCondition( name, aggType, "NONE", dataElement, dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+
+ CaseAggregationCondition condition = new CaseAggregationCondition( dataElement.getName(), aggType, "NONE", dataElement, dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+
+ aggregationConditionService.addCaseAggregationCondition( condition );
+ }
+ else if ( aggType.equals( Lookup.CCEI_AGG_TYPE_REF_WORKING_STATUS_BY_MODEL ) )
+ {
+ HttpServletRequest request = ServletActionContext.getRequest();
+
+ Lookup lookup = lookupService.getLookupByName( Lookup.CCEI_WORKING_STATUS_OPTIONSET );
+
+ String[] workingStatusValues = request.getParameterValues( lookup.getName() );
+ String workingStatus = "";
+ for( String workingStatusValue : workingStatusValues )
+ {
+ workingStatus += "'" + workingStatusValue + "',";
+ }
+
+ lookup = lookupService.getLookupByName( Lookup.CCEI_MODEL_MODELTYPEATTRIBUTE );
+
+ String modelName = request.getParameter( lookup.getName() );
+ modelName = "'" + modelName + "'";
+ Integer modelTypeAttributeId = Integer.parseInt( lookup.getValue() );
+
+ workingStatus = workingStatus.substring( 0, workingStatus.length()-1 );
+
+ lookup = lookupService.getLookupByName( Lookup.CCEI_REF_EQUIPMENTTYPE_ID );
+
+ Integer equipmentTypeId = Integer.parseInt( lookup.getValue() );
+
+ String query = cceiAggregationService.getQueryForRefrigeratorWorkingStatus( equipmentTypeId, modelTypeAttributeId, modelName, workingStatus );
+
+ //CaseAggregationCondition condition = new CaseAggregationCondition( name, aggType, query, dataElement, dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+
+ CaseAggregationCondition condition = new CaseAggregationCondition( dataElement.getName(), aggType, query, dataElement, dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+
+ aggregationConditionService.addCaseAggregationCondition( condition );
+ }
+ else if ( aggType.equals( Lookup.CCEI_AGG_TYPE_REF_UTILIZATION ) )
+ {
+ HttpServletRequest request = ServletActionContext.getRequest();
+
+ Lookup lookup = lookupService.getLookupByName( Lookup.CCEI_UTILIZATION_OPTIONSET );
+ String utilization = request.getParameter( lookup.getName() );
+ utilization = "'" + utilization + "'";
+
+ lookup = lookupService.getLookupByName( Lookup.CCEI_MODEL_MODELTYPEATTRIBUTE );
+ String modelName = request.getParameter( lookup.getName() );
+ modelName = "'" + modelName + "'";
+ Integer modelTypeAttributeId = Integer.parseInt( lookup.getValue() );
+
+ lookup = lookupService.getLookupByName( Lookup.CCEI_REF_EQUIPMENTTYPE_ID );
+ Integer equipmentTypeId = Integer.parseInt( lookup.getValue() );
+
+ String query = cceiAggregationService.getQueryForRefrigeratorUtilization( equipmentTypeId, modelTypeAttributeId, modelName, utilization );
+
+ //CaseAggregationCondition condition = new CaseAggregationCondition( name, aggType, query, dataElement, dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+
+ CaseAggregationCondition condition = new CaseAggregationCondition( dataElement.getName(), aggType, query, dataElement, dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+
+ aggregationConditionService.addCaseAggregationCondition( condition );
+ }
+ else if ( aggType.equals( Lookup.CCEI_AGG_TYPE_REF_WORKING_STATUS_BY_TYPE ) )
+ {
+ HttpServletRequest request = ServletActionContext.getRequest();
+
+ Lookup lookup = lookupService.getLookupByName( Lookup.CCEI_WORKING_STATUS_OPTIONSET );
+
+ String[] workingStatusValues = request.getParameterValues( lookup.getName() );
+ String workingStatus = "";
+ for( String workingStatusValue : workingStatusValues )
+ {
+ workingStatus += "'" + workingStatusValue + "',";
+ }
+
+ lookup = lookupService.getLookupByName( Lookup.CCEI_EQUIPMENTTYPE_MODELTYPEATTRIBUTE );
+
+ String modelName = request.getParameter( lookup.getName() );
+ modelName = "'" + modelName + "'";
+ Integer modelTypeAttributeId = Integer.parseInt( lookup.getValue() );
+
+ workingStatus = workingStatus.substring( 0, workingStatus.length()-1 );
+
+ lookup = lookupService.getLookupByName( Lookup.CCEI_REF_EQUIPMENTTYPE_ID );
+
+ Integer equipmentTypeId = Integer.parseInt( lookup.getValue() );
+
+ String query = cceiAggregationService.getQueryForRefrigeratorWorkingStatus( equipmentTypeId, modelTypeAttributeId, modelName, workingStatus );
+
+ //CaseAggregationCondition condition = new CaseAggregationCondition( name, aggType, query, dataElement, dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+
+ CaseAggregationCondition condition = new CaseAggregationCondition( dataElement.getName(), aggType, query, dataElement, dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+
+ aggregationConditionService.addCaseAggregationCondition( condition );
+ }
+ else if( aggType.equals( Lookup.CCEI_AGG_TYPE_REF_TEMP_ALARMS ) )
+ {
+ HttpServletRequest request = ServletActionContext.getRequest();
+
+ String refTempAlarm = request.getParameter( Lookup.CCEI_AGG_TYPE_REF_TEMP_ALARMS );
+
+ Lookup lookup = lookupService.getLookupByName( Lookup.CCEI_REF_EQUIPMENTTYPE_ID );
+
+ Integer equipmentTypeId = Integer.parseInt( lookup.getValue() );
+
+ lookup = lookupService.getLookupByName( refTempAlarm );
+
+ if( lookup.getName().equals( Lookup.CCEI_NO_OF_REF_WITH_HIGHTEMP_ALARM) || lookup.getName().equals( Lookup.CCEI_NO_OF_REF_WITH_LOWTEMP_ALARM) )
+ {
+ String query = cceiAggregationService.getQueryForRefrigeratorCountByTemperatureAlarm( equipmentTypeId, Integer.parseInt(lookup.getValue() ) );
+
+ CaseAggregationCondition condition = new CaseAggregationCondition( dataElement.getName(), lookup.getName(), query, dataElement, dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+
+ aggregationConditionService.addCaseAggregationCondition( condition );
+ }
+ else if( lookup.getName().equals( Lookup.CCEI_FACILITY_WITH_HIGHTEMP_ALARM) || lookup.getName().equals( Lookup.CCEI_FACILITY_WITH_LOWTEMP_ALARM ) || lookup.getName().equals( Lookup.CCEI_FACILITY_WITH_TEMP_ALARM ) )
+ {
+ String query = cceiAggregationService.getQueryForRefrigeratorTemperatureAlarmByFacilty( equipmentTypeId, lookup.getValue() );
+
+ CaseAggregationCondition condition = new CaseAggregationCondition( dataElement.getName(), lookup.getName(), query, dataElement, dataElementCategoryService.getDefaultDataElementCategoryOptionCombo() );
+
+ aggregationConditionService.addCaseAggregationCondition( condition );
+ }
+ }
+*/
+ return SUCCESS;
+ }
+
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/AddAggregationQueryFormAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/AddAggregationQueryFormAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/AddAggregationQueryFormAction.java 2014-02-05 10:49:02 +0000
@@ -0,0 +1,85 @@
+package org.hisp.dhis.pbf.aggregation.action;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.hisp.dhis.attribute.AttributeValue;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.pbf.api.Lookup;
+import org.hisp.dhis.pbf.api.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.PBF_AGG_TYPE ) );
+
+ dataElementList = new ArrayList<DataElement>( dataElementService.getAllActiveDataElements() );
+
+/* Lookup lookup = lookupService.getLookupByName( "IS_PBF_AGGREGATED_DE_ATTRIBUTE_ID" );
+ Iterator<DataElement> iterator = dataElementList.iterator();
+ while( iterator.hasNext() )
+ {
+ DataElement dataElement = iterator.next();
+
+ Set<AttributeValue> dataElementAttributeValues = dataElement.getAttributeValues();
+ if( dataElementAttributeValues != null && dataElementAttributeValues.size() > 0 )
+ {
+ for( AttributeValue deAttributeValue : dataElementAttributeValues )
+ {
+ if( deAttributeValue.getAttribute().getId() == Integer.parseInt( lookup.getValue() ) && !deAttributeValue.getValue().equalsIgnoreCase( "true" ) )
+ {
+ iterator.remove();
+ }
+ }
+ }
+ }
+*/
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/AggregationQueryListAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/AggregationQueryListAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/AggregationQueryListAction.java 2014-02-05 10:49:02 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.pbf.aggregation.action;
+
+import java.util.Collection;
+
+import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
+import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
+
+import com.opensymphony.xwork2.Action;
+
+public class AggregationQueryListAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private CaseAggregationConditionService aggregationConditionService;
+
+ public void setAggregationConditionService( CaseAggregationConditionService aggregationConditionService )
+ {
+ this.aggregationConditionService = aggregationConditionService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/ Output
+ // -------------------------------------------------------------------------
+
+ private Collection<CaseAggregationCondition> aggregationConditions;
+
+ public Collection<CaseAggregationCondition> getAggregationConditions()
+ {
+ return aggregationConditions;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute()
+ throws Exception
+ {
+ aggregationConditions = aggregationConditionService.getAllCaseAggregationCondition();
+
+ return SUCCESS;
+ }
+
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/GetAggregationParameterAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/GetAggregationParameterAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/GetAggregationParameterAction.java 2014-02-05 10:49:02 +0000
@@ -0,0 +1,86 @@
+package org.hisp.dhis.pbf.aggregation.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.pbf.api.Lookup;
+import org.hisp.dhis.pbf.api.LookupService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetAggregationParameterAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+ private LookupService lookupService;
+
+ public void setLookupService( LookupService lookupService )
+ {
+ this.lookupService = lookupService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/ Output
+ // -------------------------------------------------------------------------
+ private String aggTypeId;
+
+ public void setAggTypeId( String aggTypeId )
+ {
+ this.aggTypeId = aggTypeId;
+ }
+
+ public String getAggTypeId()
+ {
+ return aggTypeId;
+ }
+
+ private List<DataSet> pbfTypeDataSets = new ArrayList<DataSet>();
+
+ public List<DataSet> getPbfTypeDataSets()
+ {
+ return pbfTypeDataSets;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute()
+ throws Exception
+ {
+ if ( aggTypeId.equals( Lookup.PBF_AGG_TYPE_OVERALL_QUALITY_SCORE ) )
+ {
+ List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_QUALITY_TYPE ) );
+
+ for( Lookup lookup : lookups )
+ {
+ DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( lookup.getValue() ) );
+
+ pbfTypeDataSets.add( dataSet );
+ }
+ }
+ else if ( aggTypeId.equals( Lookup.PBF_AGG_TYPE_OVERALL_UNADJUSTED_PBF_AMOUNT ) )
+ {
+ List<Lookup> lookups = new ArrayList<Lookup>( lookupService.getAllLookupsByType( Lookup.DS_PBF_TYPE ) );
+
+ for( Lookup lookup : lookups )
+ {
+ DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( lookup.getValue() ) );
+
+ pbfTypeDataSets.add( dataSet );
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/RunAggregationQueryAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/RunAggregationQueryAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/aggregation/action/RunAggregationQueryAction.java 2014-02-05 10:49:02 +0000
@@ -0,0 +1,261 @@
+package org.hisp.dhis.pbf.aggregation.action;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
+import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
+import org.hisp.dhis.constant.Constant;
+import org.hisp.dhis.constant.ConstantService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.pbf.api.Lookup;
+import org.hisp.dhis.pbf.impl.DefaultPBFAggregationService;
+import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.period.YearlyPeriodType;
+
+import com.opensymphony.xwork2.Action;
+
+public class RunAggregationQueryAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SelectionTreeManager selectionTreeManager;
+
+ public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
+ {
+ this.selectionTreeManager = selectionTreeManager;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+
+ private CaseAggregationConditionService aggregationConditionService;
+
+ public void setAggregationConditionService( CaseAggregationConditionService aggregationConditionService )
+ {
+ this.aggregationConditionService = aggregationConditionService;
+ }
+
+ private DefaultPBFAggregationService defaultPBFAggregationService;
+
+ public void setDefaultPBFAggregationService( DefaultPBFAggregationService defaultPBFAggregationService )
+ {
+ this.defaultPBFAggregationService = defaultPBFAggregationService;
+ }
+
+ /*private CCEIAggregationService cceiAggregationService;
+
+ public void setCceiAggregationService( CCEIAggregationService cceiAggregationService )
+ {
+ this.cceiAggregationService = cceiAggregationService;
+ }
+*/
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private ConstantService constantService;
+
+ public void setConstantService( ConstantService constantService )
+ {
+ this.constantService = constantService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+ private List<DataElement> dataElements = new ArrayList<DataElement>();
+
+ public List<DataElement> getDataElements()
+ {
+ return dataElements;
+ }
+
+ private String importStatus = "";
+
+ public String getImportStatus()
+ {
+ return importStatus;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ Map<String, Double> aggregationResultMap = new HashMap<String, Double>();
+
+ Set<OrganisationUnit> orgUnitList = new HashSet<OrganisationUnit>( selectionTreeManager.getReloadedSelectedOrganisationUnits() );
+
+ //Set<OrganisationUnitGroup> orgUnitGroups = new HashSet<OrganisationUnitGroup>( organisationUnitGroupService.getAllOrganisationUnitGroups() );
+
+ /*List<OrganisationUnitGroup> ouGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getOrganisationUnitGroupByName( EquipmentAttributeValue.HEALTHFACILITY ) );
+
+ OrganisationUnitGroup ouGroup = ouGroups.get( 0 );
+
+ if ( ouGroup != null )
+ {
+ orgUnitList.retainAll( ouGroup.getMembers() );
+ }*/
+
+ /*
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyyMM" );
+ String curMonth = simpleDateFormat.format( new Date() );
+ Period period = PeriodType.getPeriodFromIsoString( curMonth );
+ period = periodService.reloadPeriod( period );
+
+ List<Period> periods = new ArrayList<Period>();
+ periods.add( period );
+*/
+
+ Constant tariff_authority = constantService.getConstantByName( "TARIFF_SETTING_AUTHORITY" );
+ int tariff_setting_authority = 0;
+ if ( tariff_authority == null )
+ {
+ tariff_setting_authority = 3;
+ }
+ else
+ {
+ tariff_setting_authority = (int) tariff_authority.getValue();
+ }
+
+ Set<CaseAggregationCondition> conditions = new HashSet<CaseAggregationCondition>( aggregationConditionService.getAllCaseAggregationCondition() );
+ for ( CaseAggregationCondition condition : conditions )
+ {
+ DataElement dataElement = condition.getAggregationDataElement();
+
+ if ( condition.getOperator().equals( Lookup.PBF_AGG_TYPE_OVERALL_QUALITY_SCORE ) )
+ {
+ Integer dataSetId = Integer.parseInt( condition.getAggregationExpression() );
+
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+
+ Set<OrganisationUnit> orgUnits = new HashSet<OrganisationUnit>( dataSet.getSources() );
+
+ orgUnits.retainAll( orgUnitList );
+
+ List<Period> periods = new ArrayList<Period>();
+
+ periods.add( getCurrentPeriod( dataSet.getPeriodType(), new Date() ) );
+
+ aggregationResultMap.putAll( defaultPBFAggregationService.calculateOverallQualityScore( periods, dataElement, orgUnits, dataSetId, tariff_setting_authority ) );
+ }
+ else if( condition.getOperator().equals( Lookup.PBF_AGG_TYPE_OVERALL_UNADJUSTED_PBF_AMOUNT ) )
+ {
+ Integer dataSetId = Integer.parseInt( condition.getAggregationExpression() );
+
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+
+ Set<OrganisationUnit> orgUnits = new HashSet<OrganisationUnit>( dataSet.getSources() );
+
+ orgUnits.retainAll( orgUnitList );
+
+ List<Period> periods = new ArrayList<Period>();
+
+ periods.add( getCurrentPeriod( dataSet.getPeriodType(), new Date() ) );
+
+ aggregationResultMap.putAll( defaultPBFAggregationService.calculateOverallUnadjustedPBFAmount( periods, dataElement, orgUnits, dataSetId ) );
+ }
+
+ dataElements.add( dataElement );
+ }
+
+ for( String key : aggregationResultMap.keySet() )
+ {
+ System.out.println( key + " -- " + aggregationResultMap.get( key ) );
+ }
+
+ importStatus = defaultPBFAggregationService.importData( aggregationResultMap );
+
+ return SUCCESS;
+ }
+
+
+ public Period getCurrentPeriod( PeriodType periodType, Date currentDate )
+ {
+ Period period = new Period();
+
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime( currentDate );
+
+ int currentMonth = calendar.get( Calendar.MONTH );
+
+ if ( periodType.getName().equalsIgnoreCase( "quarterly" ) )
+ {
+ if ( currentMonth >= 0 && currentMonth <= 2 )
+ {
+ period = PeriodType.getPeriodFromIsoString( calendar.get( Calendar.YEAR ) + "Q1" );
+ }
+ else if ( currentMonth >= 3 && currentMonth <= 5 )
+ {
+ period = PeriodType.getPeriodFromIsoString( calendar.get( Calendar.YEAR ) + "Q2" );
+ }
+ else if ( currentMonth >= 6 && currentMonth <= 8 )
+ {
+ period = PeriodType.getPeriodFromIsoString( calendar.get( Calendar.YEAR ) + "Q3" );
+ }
+ else
+ {
+ period = PeriodType.getPeriodFromIsoString( calendar.get( Calendar.YEAR ) + "Q4" );
+ }
+ }
+ else if ( periodType.getName().equalsIgnoreCase( "yearly" ) )
+ {
+ period = PeriodType.getPeriodFromIsoString( calendar.get( Calendar.YEAR )+"" );
+ }
+ else if ( periodType.getName().equalsIgnoreCase( "monthly" ) )
+ {
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyyMM" );
+ period = PeriodType.getPeriodFromIsoString( simpleDateFormat.format( currentDate ) );
+ }
+
+ period = periodService.reloadPeriod( period );
+
+ return period;
+ }
+
+
+}
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/Lookup.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/Lookup.java 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/api/Lookup.java 2014-02-05 10:49:02 +0000
@@ -4,17 +4,21 @@
public class Lookup extends BaseNameableObject
{
- public static final String DS_PBF_TYPE = "DS_PBF_TYPE";
-
+ public static final String DS_PBF_TYPE = "DS_PBF_TYPE";
public static final String DS_QUALITY_TYPE = "DS_QUALITY_TYPE";
- public static final String OC_TARIFF = "OC_TARIFF";
-
- public static final String QV_TARIFF = "QV_TARIFF";
-
-
+ public static final String OC_TARIFF = "OC_TARIFF";
+ public static final String QV_TARIFF = "QV_TARIFF";
+ public static final String PBF_AGG_TYPE = "PBF_AGG_TYPE";
public static final String BANK = "BANK";
+ public static final String PBF_AGG_TYPE_OVERALL_QUALITY_SCORE = "OVERALL QUALITY SCORE";
+ public static final String PBF_AGG_TYPE_OVERALL_UNADJUSTED_PBF_AMOUNT = "OVERALL UNADJUSTED PBF AMOUNT";
+
+ public static final String ORGUNITID_BY_COMMA = "ORGUNITID_BY_COMMA";
+ public static final String PERIODID_BY_COMMA = "PERIODID_BY_COMMA";
+
+
private String type;
private String value;
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadDataEntryFormAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadDataEntryFormAction.java 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadDataEntryFormAction.java 2014-02-05 10:49:02 +0000
@@ -35,31 +35,31 @@
/**
* @author Mithilesh Kumar Thakur
*/
-public class LoadDataEntryFormAction implements Action
+public class LoadDataEntryFormAction
+ implements Action
{
- private final static String TARIFF_SETTING_AUTHORITY = "TARIFF_SETTING_AUTHORITY";
-
+ private final static String TARIFF_SETTING_AUTHORITY = "TARIFF_SETTING_AUTHORITY";
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
-
-
- private PBFDataValueService pbfDataValueService;
-
- public void setPbfDataValueService(PBFDataValueService pbfDataValueService)
- {
- this.pbfDataValueService = pbfDataValueService;
- }
-
- private OrganisationUnitService organisationUnitService;
-
+
+ private PBFDataValueService pbfDataValueService;
+
+ public void setPbfDataValueService( PBFDataValueService pbfDataValueService )
+ {
+ this.pbfDataValueService = pbfDataValueService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
{
this.organisationUnitService = organisationUnitService;
}
-
+
private DataSetService dataSetService;
-
+
public void setDataSetService( DataSetService dataSetService )
{
this.dataSetService = dataSetService;
@@ -73,26 +73,26 @@
}
private LookupService lookupService;
-
+
public void setLookupService( LookupService lookupService )
{
this.lookupService = lookupService;
}
-
+
private DataElementCategoryService dataElementCategoryService;
-
+
public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
{
this.dataElementCategoryService = dataElementCategoryService;
}
-
+
private TariffDataValueService tariffDataValueService;
-
+
public void setTariffDataValueService( TariffDataValueService tariffDataValueService )
{
this.tariffDataValueService = tariffDataValueService;
}
-
+
private CurrentUserService currentUserService;
public void setCurrentUserService( CurrentUserService currentUserService )
@@ -110,276 +110,259 @@
// -------------------------------------------------------------------------
// Comparator
// -------------------------------------------------------------------------
-/*
- private Comparator<DataElement> dataElementComparator;
-
- public void setDataElementComparator( Comparator<DataElement> dataElementComparator )
- {
- this.dataElementComparator = dataElementComparator;
- }
-*/
+ /*
+ * private Comparator<DataElement> dataElementComparator;
+ *
+ * public void setDataElementComparator( Comparator<DataElement>
+ * dataElementComparator ) { this.dataElementComparator =
+ * dataElementComparator; }
+ */
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
private Map<DataElement, PBFDataValue> pbfDataValueMap;
-
- public Map<DataElement, PBFDataValue> getPbfDataValueMap()
+
+ public Map<DataElement, PBFDataValue> getPbfDataValueMap()
{
- return pbfDataValueMap;
- }
-
- private String orgUnitId;
-
+ return pbfDataValueMap;
+ }
+
+ private String orgUnitId;
+
public void setOrgUnitId( String orgUnitId )
{
this.orgUnitId = orgUnitId;
}
-
+
private int dataSetId;
-
+
public void setDataSetId( int dataSetId )
{
this.dataSetId = dataSetId;
}
private String selectedPeriodId;
-
+
public void setSelectedPeriodId( String selectedPeriodId )
{
this.selectedPeriodId = selectedPeriodId;
}
private List<DataElement> dataElements = new ArrayList<DataElement>();
-
+
public List<DataElement> getDataElements()
{
return dataElements;
}
-
+
private OrganisationUnit organisationUnit;
public OrganisationUnit getOrganisationUnit()
{
return organisationUnit;
}
-
+
public Map<String, String> dataValueMap;
-
+
public Map<String, String> getDataValueMap()
{
return dataValueMap;
}
-
+
private DataSet dataSet;
-
+
public DataSet getDataSet()
{
return dataSet;
}
-
+
private Period period;
-
+
public Period getPeriod()
{
return period;
}
-
+
private List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>();
-
+
public List<DataElementCategoryOptionCombo> getOptionCombos()
{
return optionCombos;
}
-
+
private DataElementCategoryOptionCombo tariffOptCombo;
-
+
public DataElementCategoryOptionCombo getTariffOptCombo()
{
return tariffOptCombo;
}
-
+
private DataElementCategoryOptionCombo qValOptCombo;
-
- public DataElementCategoryOptionCombo getqValOptCombo()
+
+ public DataElementCategoryOptionCombo getqValOptCombo()
{
- return qValOptCombo;
- }
+ return qValOptCombo;
+ }
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
-
- public String execute()
- {
+
+ public String execute()
+ {
dataValueMap = new HashMap<String, String>();
-
-
- Lookup lookup = lookupService.getLookupByName( Lookup.OC_TARIFF );
-
- Lookup lookup2 = lookupService.getLookupByName( Lookup.QV_TARIFF );
-
- tariffOptCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer.parseInt( lookup.getValue() ) );
-
- qValOptCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer.parseInt( lookup.getValue() ) );
-
+
+ //Lookup lookup = lookupService.getLookupByName( Lookup.OC_TARIFF );
+
+ //Lookup lookup2 = lookupService.getLookupByName( Lookup.QV_TARIFF );
+
+ //tariffOptCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer.parseInt( lookup.getValue() ) );
+
+ //qValOptCombo = dataElementCategoryService.getDataElementCategoryOptionCombo( Integer.parseInt( lookup.getValue() ) );
+
organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
-
+
dataSet = dataSetService.getDataSet( dataSetId );
-
+
period = PeriodType.getPeriodFromIsoString( selectedPeriodId );
-
+
dataElements = new ArrayList<DataElement>( dataSet.getDataElements() );
-
- Collections.sort(dataElements);
-
+
+ Collections.sort( dataElements );
+
optionCombos = new ArrayList<DataElementCategoryOptionCombo>();
-
+
Map<Integer, Double> tariffDataValueMap = new HashMap<Integer, Double>();
-
+
// find parent
Constant tariff_authority = constantService.getConstantByName( TARIFF_SETTING_AUTHORITY );
int tariff_setting_authority = 0;
if ( tariff_authority == null )
{
tariff_setting_authority = 3;
-
+
}
else
{
tariff_setting_authority = (int) tariff_authority.getValue();
-
+
}
-
+
OrganisationUnit parentOrgunit = findParentOrgunitforTariff( organisationUnit, tariff_setting_authority );
-
- if( parentOrgunit != null )
+
+ if ( parentOrgunit != null )
{
- tariffDataValueMap.putAll( tariffDataValueService.getTariffDataValues( parentOrgunit, dataSet, period ) );
+ tariffDataValueMap.putAll( tariffDataValueService.getTariffDataValues( parentOrgunit, dataSet, period ) );
}
-
-
+
pbfDataValueMap = new HashMap<DataElement, PBFDataValue>();
- Set<PBFDataValue> pbfDataValues = new HashSet<PBFDataValue>( pbfDataValueService.getPBFDataValues(organisationUnit, dataSet, period) );
- for( PBFDataValue pbfDataValue : pbfDataValues )
+ Set<PBFDataValue> pbfDataValues = new HashSet<PBFDataValue>( pbfDataValueService.getPBFDataValues(
+ organisationUnit, dataSet, period ) );
+ for ( PBFDataValue pbfDataValue : pbfDataValues )
{
- DataElement de = pbfDataValue.getDataElement();
- if( pbfDataValue.getTariffAmount() == null )
- {
- Double tariffAmount = tariffDataValueMap.get( de.getId() );
- if( tariffAmount != null )
- {
- pbfDataValue.setStoredBy( currentUserService.getCurrentUsername() );
- pbfDataValue.setTariffAmount( tariffAmount );
- pbfDataValue.setTimestamp( new Date() );
- pbfDataValueService.updatePBFDataValue( pbfDataValue );
- }
- }
- pbfDataValueMap.put( de, pbfDataValue );
+ DataElement de = pbfDataValue.getDataElement();
+ if ( pbfDataValue.getTariffAmount() == null )
+ {
+ Double tariffAmount = tariffDataValueMap.get( de.getId() );
+ if ( tariffAmount != null )
+ {
+ pbfDataValue.setStoredBy( currentUserService.getCurrentUsername() );
+ pbfDataValue.setTariffAmount( tariffAmount );
+ pbfDataValue.setTimestamp( new Date() );
+ pbfDataValueService.updatePBFDataValue( pbfDataValue );
+ }
+ }
+ pbfDataValueMap.put( de, pbfDataValue );
}
-
+
Set<DataElement> tempDes = new HashSet<DataElement>();
tempDes.addAll( dataElements );
-
+
tempDes.removeAll( pbfDataValueMap.keySet() );
-
- for( DataElement de : tempDes )
+
+ for ( DataElement de : tempDes )
{
- Double tariffAmount = tariffDataValueMap.get( de.getId() );
- if( tariffAmount != null )
- {
- PBFDataValue pbfDataValue = new PBFDataValue();
-
- pbfDataValue.setDataSet( dataSet );
+ Double tariffAmount = tariffDataValueMap.get( de.getId() );
+ if ( tariffAmount != null )
+ {
+ PBFDataValue pbfDataValue = new PBFDataValue();
+
+ pbfDataValue.setDataSet( dataSet );
pbfDataValue.setDataElement( de );
pbfDataValue.setPeriod( period );
- pbfDataValue.setOrganisationUnit(organisationUnit);
+ pbfDataValue.setOrganisationUnit( organisationUnit );
pbfDataValue.setTariffAmount( tariffAmount );
pbfDataValue.setStoredBy( currentUserService.getCurrentUsername() );
pbfDataValue.setTimestamp( new Date() );
-
+
pbfDataValueService.addPBFDataValue( pbfDataValue );
pbfDataValueMap.put( de, pbfDataValue );
- }
- }
-
- /*
- for( DataElement dataElement : dataElements )
- {
- //DataElementCategoryOptionCombo decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo();
-
- DataElementCategoryCombo dataElementCategoryCombo = dataElement.getCategoryCombo();
-
- optionCombos = new ArrayList<DataElementCategoryOptionCombo>( dataElementCategoryCombo.getOptionCombos() );
-
- for( DataElementCategoryOptionCombo decombo : optionCombos )
- {
- DataValue dataValue = new DataValue();
-
- dataValue = dataValueService.getDataValue( dataElement, period, organisationUnit, decombo );
-
- String value = "";
-
- if ( dataValue != null )
- {
- value = dataValue.getValue();
- }
- else
- {
- if( decombo.getId() == tariffOptCombo.getId() )
- {
- Double tariffValue = tariffDataValueMap.get( dataElement.getId() );
-
- if( tariffValue != null )
- {
- value = tariffValue+"";
-
- dataValue = new DataValue( );
- dataValue.setDataElement(dataElement);
- dataValue.setPeriod(period);
- dataValue.setSource(organisationUnit);
- dataValue.setValue( value );
- dataValue.setStoredBy( currentUserService.getCurrentUsername() );
- dataValue.setTimestamp( new Date() );
- dataValue.setCategoryOptionCombo( decombo );
-
- dataValueService.addDataValue( dataValue );
- }
- }
- }
-
- String key = dataElement.getId()+ ":" + decombo.getId();
-
- dataValueMap.put( key, value );
}
-
- }
- */
-
- /*
- for( DataElementCategoryOptionCombo decombo : optionCombos )
- {
- System.out.println(" decombo ---" + decombo.getId() +" -- " + decombo.getName() );
- }
- */
-
-
+ }
+
+ /*
+ * for( DataElement dataElement : dataElements ) {
+ * //DataElementCategoryOptionCombo decoc =
+ * dataElementCategoryService.getDefaultDataElementCategoryOptionCombo
+ * ();
+ *
+ * DataElementCategoryCombo dataElementCategoryCombo =
+ * dataElement.getCategoryCombo();
+ *
+ * optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
+ * dataElementCategoryCombo.getOptionCombos() );
+ *
+ * for( DataElementCategoryOptionCombo decombo : optionCombos ) {
+ * DataValue dataValue = new DataValue();
+ *
+ * dataValue = dataValueService.getDataValue( dataElement, period,
+ * organisationUnit, decombo );
+ *
+ * String value = "";
+ *
+ * if ( dataValue != null ) { value = dataValue.getValue(); } else { if(
+ * decombo.getId() == tariffOptCombo.getId() ) { Double tariffValue =
+ * tariffDataValueMap.get( dataElement.getId() );
+ *
+ * if( tariffValue != null ) { value = tariffValue+"";
+ *
+ * dataValue = new DataValue( ); dataValue.setDataElement(dataElement);
+ * dataValue.setPeriod(period); dataValue.setSource(organisationUnit);
+ * dataValue.setValue( value ); dataValue.setStoredBy(
+ * currentUserService.getCurrentUsername() ); dataValue.setTimestamp(
+ * new Date() ); dataValue.setCategoryOptionCombo( decombo );
+ *
+ * dataValueService.addDataValue( dataValue ); } } }
+ *
+ * String key = dataElement.getId()+ ":" + decombo.getId();
+ *
+ * dataValueMap.put( key, value ); }
+ *
+ * }
+ */
+
+ /*
+ * for( DataElementCategoryOptionCombo decombo : optionCombos ) {
+ * System.out.println(" decombo ---" + decombo.getId() +" -- " +
+ * decombo.getName() ); }
+ */
+
return SUCCESS;
}
-
- public OrganisationUnit findParentOrgunitforTariff( OrganisationUnit organisationUnit, Integer tariffOULevel )
- {
- Integer ouLevel = organisationUnitService.getLevelOfOrganisationUnit( organisationUnit.getId() );
- if( tariffOULevel == ouLevel )
- {
- return organisationUnit;
- }
- else
- {
- return findParentOrgunitforTariff( organisationUnit.getParent(), tariffOULevel );
- }
- }
+
+ public OrganisationUnit findParentOrgunitforTariff( OrganisationUnit organisationUnit, Integer tariffOULevel )
+ {
+ Integer ouLevel = organisationUnitService.getLevelOfOrganisationUnit( organisationUnit.getId() );
+ if ( tariffOULevel == ouLevel )
+ {
+ return organisationUnit;
+ }
+ else
+ {
+ return findParentOrgunitforTariff( organisationUnit.getParent(), tariffOULevel );
+ }
+ }
}
-
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultPBFAggregationService.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultPBFAggregationService.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/impl/DefaultPBFAggregationService.java 2014-02-05 10:49:02 +0000
@@ -0,0 +1,286 @@
+package org.hisp.dhis.pbf.impl;
+
+import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
+import static org.hisp.dhis.system.util.TextUtils.getCommaDelimitedString;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.hisp.dhis.constant.ConstantService;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.pbf.api.Lookup;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.user.CurrentUserService;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.support.rowset.SqlRowSet;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class DefaultPBFAggregationService
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+ private ConstantService constantService;
+
+ public void setConstantService( ConstantService constantService )
+ {
+ this.constantService = constantService;
+ }
+
+ private CurrentUserService currentUserService;
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
+ private DataElementCategoryService dataElementCategoryService;
+
+ public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
+ {
+ this.dataElementCategoryService = dataElementCategoryService;
+ }
+
+ private JdbcTemplate jdbcTemplate;
+
+ public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+ {
+ this.jdbcTemplate = jdbcTemplate;
+ }
+
+ // -------------------------------------------------------------------------
+ //
+ // -------------------------------------------------------------------------
+
+ public Map<String, Double> calculateOverallQualityScore( List<Period> periods, DataElement dataElement, Set<OrganisationUnit> orgUnits, Integer dataSetId, int settingLevel )
+ {
+ Map<String, Double> aggregationResultMap = new HashMap<String, Double>();
+
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+
+ try
+ {
+ Map<String, Double> maxScoreResultMap = new HashMap<String, Double>();
+ for( Period period : periods )
+ {
+ String query = "SELECT os.organisationunitid, qmv.organisationunitid, qmv.startdate, qmv.enddate, SUM( qmv.value ) FROM qualitymaxvalue qmv "+
+ " INNER JOIN _orgunitstructure os on qmv.organisationunitid = os.idlevel"+settingLevel+" "+
+ " INNER JOIN datasetmembers dsm on dsm.dataelementid = qmv.dataelementid " +
+ " WHERE " +
+ " qmv.startdate <='"+ simpleDateFormat.format( period.getStartDate() ) +"' AND "+
+ " qmv.enddate >='"+ simpleDateFormat.format( period.getEndDate() ) +"' AND " +
+ " dsm.datasetid = " + dataSetId +" " +
+ " GROUP BY os.organisationunitid, qmv.organisationunitid, qmv.startdate, qmv.enddate";
+
+ System.out.println( query );
+
+ SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
+ while ( rs.next() )
+ {
+ Integer orgUnitId = rs.getInt( 1 );
+ //Integer deId = rs.getInt( 3 );
+ Double value = rs.getDouble( 5 );
+ maxScoreResultMap.put( orgUnitId+":"+period.getId(), value );
+ }
+ }
+
+ Collection<Integer> orgUnitIds = new ArrayList<Integer>( getIdentifiers( OrganisationUnit.class, orgUnits ) );
+ String orgUnitIdsByComma = getCommaDelimitedString( orgUnitIds );
+
+ Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers( Period.class, periods ) );
+ String periodsByComma = getCommaDelimitedString( periodIds );
+
+ String query = "SELECT dv.sourceid, dv.periodid, SUM( CAST ( value AS NUMERIC ) ) FROM datavalue dv "+
+ " INNER JOIN datasetmembers dsm on dsm.dataelementid = dv.dataelementid " +
+ " WHERE " +
+ " dv.periodid IN (" + periodsByComma + ") AND "+
+ " dv.sourceid IN ("+ orgUnitIdsByComma +") AND " +
+ " dsm.datasetid = " + dataSetId +" " +
+ " GROUP BY dv.sourceid, dv.periodid";
+
+ System.out.println( query );
+
+ SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
+ while ( rs.next() )
+ {
+ Integer orgUnitId = rs.getInt( 1 );
+ Integer periodId = rs.getInt( 2 );
+ Double value = rs.getDouble( 3 );
+
+ try
+ {
+ Double maxScore = maxScoreResultMap.get( orgUnitId+":"+periodId );
+ if( maxScore != null && maxScore != 0.0 )
+ {
+ Double overAllQualityScore = ( value / maxScore ) * 100.0;
+
+ aggregationResultMap.put( orgUnitId+":"+dataElement.getId()+":"+periodId, overAllQualityScore );
+ }
+ }
+ catch( Exception e )
+ {
+
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ System.out.println("Exception :"+ e.getMessage() );
+ }
+
+ return aggregationResultMap;
+ }
+
+ public Map<String, Double> calculateOverallUnadjustedPBFAmount( List<Period> periods, DataElement dataElement, Set<OrganisationUnit> orgUnits, Integer dataSetId )
+ {
+ Map<String, Double> aggregationResultMap = new HashMap<String, Double>();
+
+ try
+ {
+ String query = "SELECT organisationunitid, periodid, SUM( ( qtyvalidated * tariffamount ) ) FROM pbfdatavalue " +
+ " WHERE " +
+ " periodid IN ( "+ Lookup.PERIODID_BY_COMMA +" ) AND "+
+ " datasetid = "+ dataSetId + " AND " +
+ " organisationunitid IN (" + Lookup.ORGUNITID_BY_COMMA + ") " +
+ " GROUP BY organisationunitid, periodid ";
+
+ Collection<Integer> orgUnitIds = new ArrayList<Integer>( getIdentifiers( OrganisationUnit.class, orgUnits ) );
+ String orgUnitIdsByComma = getCommaDelimitedString( orgUnitIds );
+ query = query.replace( Lookup.ORGUNITID_BY_COMMA, orgUnitIdsByComma );
+
+ Collection<Integer> periodIds = new ArrayList<Integer>( getIdentifiers( Period.class, periods ) );
+ String periodsByComma = getCommaDelimitedString( periodIds );
+ query = query.replace( Lookup.PERIODID_BY_COMMA, periodsByComma );
+
+ //System.out.println( query );
+
+ SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
+ while ( rs.next() )
+ {
+ Integer orgUnitId = rs.getInt( 1 );
+ Integer periodId = rs.getInt( 2 );
+ Double countValue = rs.getDouble( 3 );
+ aggregationResultMap.put( orgUnitId+":"+dataElement.getId()+":"+periodId, countValue );
+ }
+ }
+ catch( Exception e )
+ {
+ System.out.println("Exception :"+ e.getMessage() );
+ }
+
+ return aggregationResultMap;
+ }
+
+
+ public String importData( Map<String, Double> aggregationResultMap )
+ {
+ String importStatus = "";
+
+ Integer updateCount = 0;
+ Integer insertCount = 0;
+
+ String storedBy = currentUserService.getCurrentUsername();
+ if ( storedBy == null )
+ {
+ storedBy = "[unknown]";
+ }
+
+ long t;
+ Date d = new Date();
+ t = d.getTime();
+ java.sql.Date lastUpdatedDate = new java.sql.Date( t );
+
+ String query = "";
+ int insertFlag = 1;
+ String insertQuery = "INSERT INTO datavalue ( dataelementid, periodid, sourceid, categoryoptioncomboid, value, storedby, lastupdated, attributeoptioncomboid ) VALUES ";
+
+ try
+ {
+ int count = 1;
+ for ( String cellKey : aggregationResultMap.keySet() )
+ {
+ // Orgunit
+ String[] oneRow = cellKey.split( ":" );
+ Integer orgUnitId = Integer.parseInt( oneRow[0] );
+ Integer deId = Integer.parseInt( oneRow[1] );
+ //Integer periodId = period.getId();
+ Integer periodId = Integer.parseInt( oneRow[2] );
+
+ Integer deCOCId = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo().getId();
+ String value = aggregationResultMap.get( cellKey ) + "";
+
+ query = "SELECT value FROM datavalue WHERE dataelementid = " + deId + " AND categoryoptioncomboid = " + deCOCId + " AND periodid = " + periodId + " AND sourceid = " + orgUnitId;
+ SqlRowSet sqlResultSet1 = jdbcTemplate.queryForRowSet( query );
+ if ( sqlResultSet1 != null && sqlResultSet1.next() )
+ {
+ String updateQuery = "UPDATE datavalue SET value = '" + value + "', storedby = '" + storedBy + "',lastupdated='" + lastUpdatedDate + "' WHERE dataelementid = " + deId + " AND periodid = "
+ + periodId + " AND sourceid = " + orgUnitId + " AND categoryoptioncomboid = " + deCOCId;
+
+ jdbcTemplate.update( updateQuery );
+ updateCount++;
+ }
+ else
+ {
+ if ( value != null && !value.trim().equals( "" ) )
+ {
+ insertQuery += "( " + deId + ", " + periodId + ", " + orgUnitId + ", " + deCOCId + ", '" + value + "', '" + storedBy + "', '" + lastUpdatedDate + "'," + deCOCId + "), ";
+ insertFlag = 2;
+ insertCount++;
+ }
+ }
+
+ if ( count == 1000 )
+ {
+ count = 1;
+
+ if ( insertFlag != 1 )
+ {
+ insertQuery = insertQuery.substring( 0, insertQuery.length() - 2 );
+ jdbcTemplate.update( insertQuery );
+ }
+
+ insertFlag = 1;
+
+ insertQuery = "INSERT INTO datavalue ( dataelementid, periodid, sourceid, categoryoptioncomboid, value, storedby, lastupdated, attributeoptioncomboid ) VALUES ";
+ }
+
+ count++;
+ }
+
+ if ( insertFlag != 1 )
+ {
+ insertQuery = insertQuery.substring( 0, insertQuery.length() - 2 );
+ jdbcTemplate.update( insertQuery );
+ }
+
+ importStatus = "Successfully populated aggregated data for the period : "; //+ period.getStartDateString();
+ importStatus += "<br/> Total new records : " + insertCount;
+ importStatus += "<br/> Total updated records : " + updateCount;
+
+ }
+ catch ( Exception e )
+ {
+ importStatus = "Exception occured while import, please check log for more details" + e.getMessage();
+ }
+
+ return importStatus;
+ }
+
+}
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityMaxDetailsAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityMaxDetailsAction.java 2014-01-22 11:29:04 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityMaxDetailsAction.java 2014-02-05 10:49:02 +0000
@@ -37,20 +37,21 @@
implements Action
{
- private final static String QUALITY_MAX_DATAELEMENT = "QUALITY_MAX_DATAELEMENT";
+ private final static String QUALITY_MAX_DATAELEMENT = "QUALITY_MAX_DATAELEMENT";
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
private QualityMaxValueService qualityMaxValueService;
-
- public void setQualityMaxValueService(
- QualityMaxValueService qualityMaxValueService) {
- this.qualityMaxValueService = qualityMaxValueService;
- }
+
+ public void setQualityMaxValueService( QualityMaxValueService qualityMaxValueService )
+ {
+ this.qualityMaxValueService = qualityMaxValueService;
+ }
private DataSetService dataSetService;
-
+
public void setDataSetService( DataSetService dataSetService )
{
this.dataSetService = dataSetService;
@@ -62,103 +63,112 @@
{
this.organisationUnitService = organisationUnitService;
}
-
+
private LookupService lookupService;
-
+
public void setLookupService( LookupService lookupService )
{
this.lookupService = lookupService;
}
-
+
private ConstantService constantService;
public void setConstantService( ConstantService constantService )
{
this.constantService = constantService;
}
-
+
// -------------------------------------------------------------------------
// Input / Output
// -------------------------------------------------------------------------
-
+
private String orgUnitId;
-
- public void setOrgUnitId(String orgUnitId) {
- this.orgUnitId = orgUnitId;
- }
-
- private String dataSetId;
-
- public void setDataSetId(String dataSetId) {
- this.dataSetId = dataSetId;
- }
-
+
+ public void setOrgUnitId( String orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ private String dataSetId;
+
+ public void setDataSetId( String dataSetId )
+ {
+ this.dataSetId = dataSetId;
+ }
+
private String startDate;
-
- public void setStartDate(String startDate) {
- this.startDate = startDate;
- }
-
+
+ public void setStartDate( String startDate )
+ {
+ this.startDate = startDate;
+ }
+
private String endDate;
-
- public void setEndDate(String endDate) {
- this.endDate = endDate;
- }
-
- List<DataElement> dataElements = new ArrayList<DataElement>();
-
- public List<DataElement> getDataElements() {
- return dataElements;
- }
-
- private SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );;
-
- public SimpleDateFormat getSimpleDateFormat() {
- return simpleDateFormat;
- }
-
- private Map<Integer,QualityMaxValue> qualityMaxValueMap = new HashMap<Integer,QualityMaxValue>();
-
- public Map<Integer, QualityMaxValue> getQualityMaxValueMap() {
- return qualityMaxValueMap;
- }
-
+
+ public void setEndDate( String endDate )
+ {
+ this.endDate = endDate;
+ }
+
+ List<DataElement> dataElements = new ArrayList<DataElement>();
+
+ public List<DataElement> getDataElements()
+ {
+ return dataElements;
+ }
+
+ private SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );;
+
+ public SimpleDateFormat getSimpleDateFormat()
+ {
+ return simpleDateFormat;
+ }
+
+ private Map<Integer, QualityMaxValue> qualityMaxValueMap = new HashMap<Integer, QualityMaxValue>();
+
+ public Map<Integer, QualityMaxValue> getQualityMaxValueMap()
+ {
+ return qualityMaxValueMap;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
- public String execute() throws Exception
+ public String execute()
+ throws Exception
{
- SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
-
+ SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+
Date sDate = dateFormat.parse( startDate );
Date eDate = dateFormat.parse( endDate );
- Constant qualityMaxDataElement = constantService.getConstantByName( QUALITY_MAX_DATAELEMENT );
+ Constant qualityMaxDataElement = constantService.getConstantByName( QUALITY_MAX_DATAELEMENT );
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
- DataSet dataSet = dataSetService.getDataSet(Integer.parseInt(dataSetId));
-
- List<DataElement> dataElementList = new ArrayList<DataElement>(dataSet.getDataElements());
- for( DataElement de : dataElementList )
+ DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( dataSetId ) );
+
+ List<DataElement> dataElementList = new ArrayList<DataElement>( dataSet.getDataElements() );
+ for ( DataElement de : dataElementList )
{
Set<AttributeValue> attrValueSet = new HashSet<AttributeValue>( de.getAttributeValues() );
for ( AttributeValue attValue : attrValueSet )
{
- if(attValue.getAttribute().getId() == qualityMaxDataElement.getValue())
- {
- dataElements.add(de);
- }
+ if ( attValue.getAttribute().getId() == qualityMaxDataElement.getValue() )
+ {
+ dataElements.add( de );
+ }
}
}
- for(DataElement dataElement : dataElements)
+ for ( DataElement dataElement : dataElements )
{
- QualityMaxValue qualityMaxValue = qualityMaxValueService.getQualityMaxValue(organisationUnit, dataElement, dataSet, sDate, eDate );
- if(qualityMaxValue != null)
- {
- qualityMaxValueMap.put(dataElement.getId(), qualityMaxValue);
- System.out.println("In Quality Data Value");
- }
+ QualityMaxValue qualityMaxValue = qualityMaxValueService.getQualityMaxValue( organisationUnit, dataElement,
+ dataSet, sDate, eDate );
+ if ( qualityMaxValue != null )
+ {
+ qualityMaxValueMap.put( dataElement.getId(), qualityMaxValue );
+ System.out.println( "In Quality Data Value" );
+ }
}
- Collections.sort(dataElements);
+ Collections.sort( dataElements );
return SUCCESS;
}
}
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityScoreDetailsAction.java'
--- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityScoreDetailsAction.java 2014-01-23 12:25:55 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/quality/dataentry/LoadQualityScoreDetailsAction.java 2014-02-05 10:49:02 +0000
@@ -43,21 +43,23 @@
public class LoadQualityScoreDetailsAction
implements Action
{
- private final static String TARIFF_SETTING_AUTHORITY = "TARIFF_SETTING_AUTHORITY";
- private final static String QUALITY_MAX_DATAELEMENT = "QUALITY_MAX_DATAELEMENT";
+ private final static String TARIFF_SETTING_AUTHORITY = "TARIFF_SETTING_AUTHORITY";
+
+ private final static String QUALITY_MAX_DATAELEMENT = "QUALITY_MAX_DATAELEMENT";
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
private QualityMaxValueService qualityMaxValueService;
-
- public void setQualityMaxValueService(
- QualityMaxValueService qualityMaxValueService) {
- this.qualityMaxValueService = qualityMaxValueService;
- }
+
+ public void setQualityMaxValueService( QualityMaxValueService qualityMaxValueService )
+ {
+ this.qualityMaxValueService = qualityMaxValueService;
+ }
private DataSetService dataSetService;
-
+
public void setDataSetService( DataSetService dataSetService )
{
this.dataSetService = dataSetService;
@@ -69,159 +71,169 @@
{
this.organisationUnitService = organisationUnitService;
}
-
+
private LookupService lookupService;
-
+
public void setLookupService( LookupService lookupService )
{
this.lookupService = lookupService;
}
-
+
private ConstantService constantService;
public void setConstantService( ConstantService constantService )
{
this.constantService = constantService;
}
-
+
private DataValueService dataValueService;
-
- public void setDataValueService(DataValueService dataValueService)
+
+ public void setDataValueService( DataValueService dataValueService )
{
- this.dataValueService = dataValueService;
- }
-
+ this.dataValueService = dataValueService;
+ }
+
private DataElementCategoryService categoryService;
public void setCategoryService( DataElementCategoryService categoryService )
{
this.categoryService = categoryService;
}
-
+
// -------------------------------------------------------------------------
// Input / Output
// -------------------------------------------------------------------------
-
- private String orgUnitId;
-
- public void setOrgUnitId(String orgUnitId) {
- this.orgUnitId = orgUnitId;
- }
-
- private String dataSetId;
-
- public void setDataSetId(String dataSetId) {
- this.dataSetId = dataSetId;
- }
-
- private String selectedPeriodId;
-
+
+ private String orgUnitId;
+
+ public void setOrgUnitId( String orgUnitId )
+ {
+ this.orgUnitId = orgUnitId;
+ }
+
+ private String dataSetId;
+
+ public void setDataSetId( String dataSetId )
+ {
+ this.dataSetId = dataSetId;
+ }
+
+ private String selectedPeriodId;
+
public void setSelectedPeriodId( String selectedPeriodId )
{
this.selectedPeriodId = selectedPeriodId;
}
-
- List<DataElement> dataElements = new ArrayList<DataElement>();
-
- public List<DataElement> getDataElements() {
- return dataElements;
- }
-
- private SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );;
-
- public SimpleDateFormat getSimpleDateFormat() {
- return simpleDateFormat;
- }
-
- private Map<Integer,QualityMaxValue> qualityMaxValueMap = new HashMap<Integer,QualityMaxValue>();
-
- public Map<Integer, QualityMaxValue> getQualityMaxValueMap() {
- return qualityMaxValueMap;
- }
-
- private Map<Integer,DataValue> dataValueMap = new HashMap<Integer, DataValue>();
-
- public Map<Integer, DataValue> getDataValueMap() {
- return dataValueMap;
- }
-
+
+ List<DataElement> dataElements = new ArrayList<DataElement>();
+
+ public List<DataElement> getDataElements()
+ {
+ return dataElements;
+ }
+
+ private SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd" );;
+
+ public SimpleDateFormat getSimpleDateFormat()
+ {
+ return simpleDateFormat;
+ }
+
+ private Map<Integer, QualityMaxValue> qualityMaxValueMap = new HashMap<Integer, QualityMaxValue>();
+
+ public Map<Integer, QualityMaxValue> getQualityMaxValueMap()
+ {
+ return qualityMaxValueMap;
+ }
+
+ private Map<Integer, DataValue> dataValueMap = new HashMap<Integer, DataValue>();
+
+ public Map<Integer, DataValue> getDataValueMap()
+ {
+ return dataValueMap;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
- public String execute() throws Exception
+ public String execute()
+ throws Exception
{
- SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
-
- Period period = PeriodType.getPeriodFromIsoString( selectedPeriodId );
- Constant tariff_authority = constantService.getConstantByName( TARIFF_SETTING_AUTHORITY );
- int tariff_setting_authority = 0;
- if ( tariff_authority == null )
- {
- tariff_setting_authority = 1;
-
- }
- else
- {
- tariff_setting_authority = (int) tariff_authority.getValue();
-
- }
- Constant qualityMaxDataElement = constantService.getConstantByName( QUALITY_MAX_DATAELEMENT );
+ SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd" );
+
+ Period period = PeriodType.getPeriodFromIsoString( selectedPeriodId );
+ Constant tariff_authority = constantService.getConstantByName( TARIFF_SETTING_AUTHORITY );
+ int tariff_setting_authority = 0;
+ if ( tariff_authority == null )
+ {
+ tariff_setting_authority = 1;
+
+ }
+ else
+ {
+ tariff_setting_authority = (int) tariff_authority.getValue();
+
+ }
+ Constant qualityMaxDataElement = constantService.getConstantByName( QUALITY_MAX_DATAELEMENT );
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
- DataSet dataSet = dataSetService.getDataSet(Integer.parseInt(dataSetId));
-
+ DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( dataSetId ) );
+
DataElementCategoryOptionCombo optionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
-
- List<DataElement> dataElementList = new ArrayList<DataElement>(dataSet.getDataElements());
- for( DataElement de : dataElementList )
+
+ List<DataElement> dataElementList = new ArrayList<DataElement>( dataSet.getDataElements() );
+ for ( DataElement de : dataElementList )
{
- Set<AttributeValue> attrValueSet = new HashSet<AttributeValue>( de.getAttributeValues() );
+ Set<AttributeValue> attrValueSet = new HashSet<AttributeValue>( de.getAttributeValues() );
for ( AttributeValue attValue : attrValueSet )
{
- if(attValue.getAttribute().getId() == qualityMaxDataElement.getValue())
- {
- dataElements.add(de);
- }
+ if ( attValue.getAttribute().getId() == qualityMaxDataElement.getValue() )
+ {
+ dataElements.add( de );
+ }
}
}
- for(DataElement dataElement : dataElements)
+ for ( DataElement dataElement : dataElements )
{
- List<QualityMaxValue> qualityMaxValues = new ArrayList<QualityMaxValue>();
- OrganisationUnit parentOrgunit = findParentOrgunitforTariff( organisationUnit, tariff_setting_authority );
- if( parentOrgunit != null )
- {
- qualityMaxValues = new ArrayList<QualityMaxValue>(qualityMaxValueService.getQuanlityMaxValues(parentOrgunit, dataElement)) ;
- }
- DataValue dataValue = dataValueService.getDataValue(dataElement, period, organisationUnit, optionCombo);
- for (QualityMaxValue qualityMaxValue : qualityMaxValues)
- {
-
- if(qualityMaxValue.getStartDate().getTime() <= period.getStartDate().getTime() && period.getEndDate().getTime() <= qualityMaxValue.getEndDate().getTime() )
- {
- qualityMaxValueMap.put(dataElement.getId(), qualityMaxValue);
- if(dataValue != null)
- {
- dataValueMap.put(dataElement.getId(), dataValue );
- }
-
- System.out.println("In Quality Data Value");
- break;
- }
- }
+ List<QualityMaxValue> qualityMaxValues = new ArrayList<QualityMaxValue>();
+ OrganisationUnit parentOrgunit = findParentOrgunitforTariff( organisationUnit, tariff_setting_authority );
+ if ( parentOrgunit != null )
+ {
+ qualityMaxValues = new ArrayList<QualityMaxValue>( qualityMaxValueService.getQuanlityMaxValues(
+ parentOrgunit, dataElement ) );
+ }
+ DataValue dataValue = dataValueService.getDataValue( dataElement, period, organisationUnit, optionCombo );
+ for ( QualityMaxValue qualityMaxValue : qualityMaxValues )
+ {
+
+ if ( qualityMaxValue.getStartDate().getTime() <= period.getStartDate().getTime()
+ && period.getEndDate().getTime() <= qualityMaxValue.getEndDate().getTime() )
+ {
+ qualityMaxValueMap.put( dataElement.getId(), qualityMaxValue );
+ if ( dataValue != null )
+ {
+ dataValueMap.put( dataElement.getId(), dataValue );
+ }
+
+ System.out.println( "In Quality Data Value" );
+ break;
+ }
+ }
}
- Collections.sort(dataElements);
+ Collections.sort( dataElements );
return SUCCESS;
}
- public OrganisationUnit findParentOrgunitforTariff( OrganisationUnit organisationUnit, Integer tariffOULevel )
- {
- Integer ouLevel = organisationUnitService.getLevelOfOrganisationUnit( organisationUnit.getId() );
- if( tariffOULevel == ouLevel )
- {
- return organisationUnit;
- }
- else
- {
- return findParentOrgunitforTariff( organisationUnit.getParent(), tariffOULevel );
- }
- }
+
+ public OrganisationUnit findParentOrgunitforTariff( OrganisationUnit organisationUnit, Integer tariffOULevel )
+ {
+ Integer ouLevel = organisationUnitService.getLevelOfOrganisationUnit( organisationUnit.getId() );
+ if ( tariffOULevel == ouLevel )
+ {
+ return organisationUnit;
+ }
+ else
+ {
+ return findParentOrgunitforTariff( organisationUnit.getParent(), tariffOULevel );
+ }
+ }
}
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml 2014-01-23 12:25:55 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml 2014-02-05 10:49:02 +0000
@@ -235,7 +235,7 @@
<property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />
<property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
- <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+ <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
</bean>
<!-- Save Quality Data -->
@@ -247,5 +247,58 @@
<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
+
+ <!-- Aggregation Engine -->
+ <bean id="org.hisp.dhis.pbf.aggregation.action.AggregationQueryListAction"
+ class="org.hisp.dhis.pbf.aggregation.action.AggregationQueryListAction"
+ scope="prototype">
+ <property name="aggregationConditionService" ref="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.pbf.aggregation.action.AddAggregationQueryFormAction"
+ class="org.hisp.dhis.pbf.aggregation.action.AddAggregationQueryFormAction"
+ scope="prototype">
+ <property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.pbf.aggregation.action.AddAggregationQueryAction"
+ class="org.hisp.dhis.pbf.aggregation.action.AddAggregationQueryAction"
+ scope="prototype">
+ <property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />
+ <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="aggregationConditionService" ref="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
+ <property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.pbf.aggregation.action.GetAggregationParameterAction"
+ class="org.hisp.dhis.pbf.aggregation.action.GetAggregationParameterAction"
+ scope="prototype">
+ <property name="lookupService" ref="org.hisp.dhis.pbf.api.LookupService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.pbf.aggregation.action.RunAggregationQueryAction"
+ class="org.hisp.dhis.pbf.aggregation.action.RunAggregationQueryAction"
+ scope="prototype">
+ <property name="aggregationConditionService" ref="org.hisp.dhis.caseaggregation.CaseAggregationConditionService" />
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
+ <property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="defaultPBFAggregationService" ref="org.hisp.dhis.pbf.impl.DefaultPBFAggregationService" />
+ <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.pbf.impl.DefaultPBFAggregationService"
+ class="org.hisp.dhis.pbf.impl.DefaultPBFAggregationService"
+ scope="prototype">
+ <property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+ <property name="dataElementCategoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
+ <property name="jdbcTemplate" ref="jdbcTemplate" />
+ </bean>
</beans>
\ No newline at end of file
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml 2014-01-23 12:25:55 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml 2014-02-05 10:49:02 +0000
@@ -171,6 +171,43 @@
/dhis-web-maintenance-pbf/status.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
+
+ <!-- Aggregation Engine -->
+ <action name="aggregationQueryList" class="org.hisp.dhis.pbf.aggregation.action.AggregationQueryListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-pbf/aggregationQueryList.vm</param>
+ <param name="menu">/dhis-web-maintenance-pbf/menu.vm</param>
+ <param name="javascripts">javascript/aggregationEngine.js</param>
+ </action>
+
+ <action name="addAggregationQueryForm" class="org.hisp.dhis.pbf.aggregation.action.AddAggregationQueryFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-pbf/addAggregationQuery.vm</param>
+ <param name="menu">/dhis-web-maintenance-pbf/menu.vm</param>
+ <param name="javascripts">javascript/aggregationEngine.js</param>
+ </action>
+
+ <action name="loadAggregationParam" class="org.hisp.dhis.pbf.aggregation.action.GetAggregationParameterAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-maintenance-pbf/addAggregationParam.vm</param>
+ </action>
+
+ <action name="addAggregationQuery" class="org.hisp.dhis.pbf.aggregation.action.AddAggregationQueryAction">
+ <result name="success" type="redirect">aggregationQueryList.action</result>
+ </action>
+
+ <action name="runAggregationQueryForm" class="org.hisp.dhis.pbf.action.NoAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-pbf/runAggregationQueryForm.vm</param>
+ <param name="menu">/dhis-web-maintenance-pbf/menu.vm</param>
+ </action>
+
+ <action name="runAggregationQuery" class="org.hisp.dhis.pbf.aggregation.action.RunAggregationQueryAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-pbf/runAggregationQueryResult.vm</param>
+ <param name="menu">/dhis-web-maintenance-pbf/menu.vm</param>
+ </action>
+
</package>
</struts>
\ No newline at end of file
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/addAggregationParam.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/addAggregationParam.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/addAggregationParam.vm 2014-02-05 10:49:02 +0000
@@ -0,0 +1,33 @@
+
+
+#if( $aggTypeId == "OVERALL UNADJUSTED PBF AMOUNT" )
+
+ <table style="width:100%" cellpadding="5" cellspacing="5">
+ <tr>
+ <td style="width:40%">PBFType - Tariff</td>
+ <td style="width:60%">
+ <select id="pbfTypeDataSetId" name="pbfDataSetId" style="width:100%" multiple>
+ #foreach( $pbfTypeDataSet in $pbfTypeDataSets )
+ <option value="$pbfTypeDataSet.id">$pbfTypeDataSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ </table>
+
+#elseif( $aggTypeId == "OVERALL QUALITY SCORE" )
+
+ <table style="width:100%" cellpadding="5" cellspacing="5">
+ <tr>
+ <td style="width:40%">PBFType - Quality</td>
+ <td style="width:60%">
+ <select id="pbfTypeDataSetId" name="pbfDataSetId" style="width:100%" multiple>
+ #foreach( $pbfTypeDataSet in $pbfTypeDataSets )
+ <option value="$pbfTypeDataSet.id">$pbfTypeDataSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ </table>
+
+#end
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/addAggregationQuery.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/addAggregationQuery.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/addAggregationQuery.vm 2014-02-05 10:49:02 +0000
@@ -0,0 +1,64 @@
+<script >
+function getParameters()
+{
+ if($("#aggType").val() != '-1')
+ {
+ $("#loadParameters").load("loadAggregationParam.action",
+ {
+ aggTypeId : $('#aggType').val()
+ }
+ , function( ){
+ });
+ }
+}
+</script>
+<form id="addAggregationForm" action="addAggregationQuery.action" method="post" >
+
+<table style="width:50%" cellpadding="5" cellspacing="5">
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString( "aggregation_query_builder_detail" )</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr style="display:none">
+ <td style="width:40%"><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td style="width:60%"><input type="text" id="name" name="name" class="{validate:{required:true,minlength:2}}" style='width:100%; margin-bottom:-5px;'></td>
+ </tr>
+ <tr>
+ <td style="width:40%"><label for="dataElement">$i18n.getString( "dataelement" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td style="width:60%">
+ <select style='width:130%; margin-bottom:-5px;' id="dataElementId" name="dataElementId" >
+ #foreach( $dataElement in $dataElementList )
+ <option value="$dataElement.id">$dataElement.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td style="width:40%"><label for="operator">$i18n.getString( "type" )</label></td>
+ <td style="width:60%">
+ <select style='width:130%; margin-bottom:-5px;' id="aggType" name="aggType" onchange="getParameters()">
+ <option value="-1" >Please Select</option>
+ #foreach( $lookup in $lookups )
+ <option value="$lookup.name">$lookup.value</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <div id="loadParameters" style="width:100%"></div>
+ </td>
+ </tr>
+
+ </tbody>
+</table>
+
+<p>
+ <input type="submit" value="$i18n.getString( 'add' )" />
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='aggregationQueryList.action'" />
+</p>
+
+</form>
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/aggregationQueryList.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/aggregationQueryList.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/aggregationQueryList.vm 2014-02-05 10:49:02 +0000
@@ -0,0 +1,67 @@
+
+<script>
+$(function() {
+ dhis2.contextmenu.makeContextMenu({
+ menuId: 'contextMenu',
+ menuItemActiveClass: 'contextMenuItemActive'
+ });
+});
+</script>
+
+<h3>$i18n.getString( 'ccei_aggregation_query_builder_management' ) #openHelp( "patient_aggregation_query_builder" )</h3>
+
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="showUpdateCaseAggregationForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li><a data-target-fn="translateWithContext"><i class="fa fa-globe"></i> $i18n.getString( "translation_translate" )</a></li>
+ <li><a data-target-fn="removeCaseAggregation"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ <li><a data-target-fn="showCaseAggregationDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
+ </ul>
+</div>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+ <table width="100%">
+ <tr>
+ <td style="text-align:right">
+ <input type="button" value="$i18n.getString( 'add_new' )" onclick="showAddAggregationForm();" >
+ </td>
+ </tr>
+ </table>
+ <table class="listTable">
+ <col>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #foreach( $aggregationCondition in $aggregationConditions )
+ <tr id="tr${aggregationCondition.id}" data-id="$!aggregationCondition.id" data-uid="$!aggregationCondition.uid" data-type="CaseAggregationCondition"
+ data-name="$encoder.htmlEncode( $!aggregationCondition.displayName )"
+ data-can-manage="$security.canManage( $aggregationCondition )"
+ data-can-update="$security.canUpdate( $aggregationCondition )"
+ data-can-delete="$security.canDelete( $aggregationCondition )">
+ <td>$encoder.htmlEncode( $!aggregationCondition.displayName )</td>
+ </tr>
+ #end
+ </tbody>
+ </table>
+ </td>
+
+ <td id="detailsData">
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
+ <a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"></a>
+ </div>
+ <p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+ <p><label class="bold">$i18n.getString( "operator" ):</label><br><span id="operatorField"></span></p>
+ <p><label class="bold">$i18n.getString( "aggregation_data_element" ):</label><br><span id="aggregationDataElementField"></span></p>
+ <p><label class="bold">$i18n.getString( "option_combo" ):</label><br><span id="optionComboField"></span></p>
+ <p><label class="bold">$i18n.getString( "data_element_for_sum_avg_min_max" ):</label><br><span id="deSumField"></span></p>
+ <p><label class="bold">$i18n.getString( "aggregation_expression" ):</label><br><span id="aggregationExpressionField"></span></p>
+ </div>
+ </td>
+ </tr>
+</table>
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/aggregationEngine.js'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/aggregationEngine.js 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/aggregationEngine.js 2014-02-05 10:49:02 +0000
@@ -0,0 +1,7 @@
+
+
+function showAddAggregationForm()
+{
+ window.location.href = 'addAggregationQueryForm.action';
+}
+
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/pbfDataEntry.js'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/pbfDataEntry.js 2014-01-18 12:25:59 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/pbfDataEntry.js 2014-02-05 10:49:02 +0000
@@ -195,7 +195,7 @@
{
var code = json.c;
- alert(code)
+ //alert(code)
if ( code == '0' || code == 0) // Value successfully saved on server
{
markValue( fieldId, COLOR_GREEN );
=== modified file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.vm 2014-01-22 11:29:04 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/menu.vm 2014-02-05 10:49:02 +0000
@@ -11,3 +11,9 @@
<li><a href="bankDetailsManagement.action">$i18n.getString( "bank_details_management" )</a></li>
</ul>
+
+<h2>$i18n.getString( "aggregation_builder" )</h2>
+<ul>
+ <li><a href="aggregationQueryList.action">$i18n.getString( "aggregation_query_list" )</a></li>
+ <li><a href="runAggregationQueryForm.action">$i18n.getString( "manual_aggregation" )</a></li>
+</ul>
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/runAggregationQueryForm.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/runAggregationQueryForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/runAggregationQueryForm.vm 2014-02-05 10:49:02 +0000
@@ -0,0 +1,18 @@
+<h3>$i18n.getString( "manual_aggregation" )</h3>
+
+<form id="runAggregationQueryForm" action="runAggregationQuery.action" method="post">
+
+ <table id="selectionTable">
+ <tr>
+ <td>
+ #organisationUnitSelectionTree( false, true, false )
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="submit" id="submitButton" value="$i18n.getString( 'aggregate_values' )" style="width:10em"/>
+ </td>
+ </tr>
+ </table>
+
+</form>
=== added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/runAggregationQueryResult.vm'
--- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/runAggregationQueryResult.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/runAggregationQueryResult.vm 2014-02-05 10:49:02 +0000
@@ -0,0 +1,2 @@
+
+$importStatus
\ No newline at end of file