dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19972
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8945: Use formname of dataelement in tabular report; remove unused methods.
------------------------------------------------------------
revno: 8945
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-11-08 09:58:24 +0700
message:
Use formname of dataelement in tabular report; remove unused methods.
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2012-10-23 15:14:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2012-11-08 02:58:24 +0000
@@ -28,10 +28,7 @@
package org.hisp.dhis.caseentry.action.report;
import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_DATA_ELEMENT;
-import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_FIXED_ATTRIBUTE;
-import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_IDENTIFIER_TYPE;
import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_NUMBER_DATA_ELEMENT;
-import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_PATIENT_ATTRIBUTE;
import static org.hisp.dhis.patientreport.PatientTabularReport.VALUE_TYPE_OPTION_SET;
import java.util.ArrayList;
@@ -52,11 +49,6 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.paging.ActionPagingSupport;
-import org.hisp.dhis.patient.PatientAttribute;
-import org.hisp.dhis.patient.PatientAttributeOption;
-import org.hisp.dhis.patient.PatientAttributeService;
-import org.hisp.dhis.patient.PatientIdentifierType;
-import org.hisp.dhis.patient.PatientIdentifierTypeService;
import org.hisp.dhis.patientreport.TabularReportColumn;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageInstance;
@@ -104,20 +96,6 @@
this.programStageInstanceService = programStageInstanceService;
}
- private PatientAttributeService patientAttributeService;
-
- public void setPatientAttributeService( PatientAttributeService patientAttributeService )
- {
- this.patientAttributeService = patientAttributeService;
- }
-
- private PatientIdentifierTypeService patientIdentifierTypeService;
-
- public void setPatientIdentifierTypeService( PatientIdentifierTypeService patientIdentifierTypeService )
- {
- this.patientIdentifierTypeService = patientIdentifierTypeService;
- }
-
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -217,21 +195,7 @@
{
this.format = format;
}
-
- private List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();
-
- public List<PatientIdentifierType> getIdentifierTypes()
- {
- return identifierTypes;
- }
-
- private List<PatientAttribute> patientAttributes = new ArrayList<PatientAttribute>();
-
- public List<PatientAttribute> getPatientAttributes()
- {
- return patientAttributes;
- }
-
+
private List<DataElement> dataElements = new ArrayList<DataElement>();
public List<DataElement> getDataElements()
@@ -341,9 +305,6 @@
// ---------------------------------------------------------------------
ProgramStage programStage = programStageService.getProgramStage( programStageId );
-
- // TODO check sql traffic
-
Date startValue = format.parseDate( startDate );
Date endValue = format.parseDate( endDate );
List<TabularReportColumn> columns = getTableColumns();
@@ -361,8 +322,7 @@
total = getNumberOfPages( totalRecords );
this.paging = createPaging( totalRecords );
- // total = paging.getTotal(); //TODO
-
+
grid = programStageInstanceService.getTabularReport( programStage, columns, organisationUnits, level,
startValue, endValue, !orderByOrgunitAsc, getStartPos(), paging.getPageSize() );
}
@@ -401,7 +361,7 @@
startPos = (startPos > total) ? total : startPos;
return startPos;
}
-
+
private List<TabularReportColumn> getTableColumns()
{
List<TabularReportColumn> columns = new ArrayList<TabularReportColumn>();
@@ -422,29 +382,7 @@
column.setHidden( Boolean.parseBoolean( values[2] ) );
column.setQuery( values.length == 4 ? TextUtils.lower( values[3] ) : null );
- if ( PREFIX_FIXED_ATTRIBUTE.equals( prefix ) )
- {
- column.setName( values[1] );
- }
- else if ( PREFIX_IDENTIFIER_TYPE.equals( prefix ) )
- {
- PatientIdentifierType identifierType = patientIdentifierTypeService
- .getPatientIdentifierType( column.getIdentifierAsInt() );
-
- column.setName( identifierType.getName() );
- }
- else if ( PREFIX_PATIENT_ATTRIBUTE.equals( prefix ) )
- {
- int objectId = Integer.parseInt( values[1] );
- PatientAttribute attribute = patientAttributeService.getPatientAttribute( objectId );
- patientAttributes.add( attribute );
-
- valueTypes.add( attribute.getValueType() );
- mapSuggestedValues.put( index, getSuggestedAttributeValues( attribute ) );
-
- column.setName( attribute.getName() );
- }
- else if ( PREFIX_DATA_ELEMENT.equals( prefix ) )
+ if ( PREFIX_DATA_ELEMENT.equals( prefix ) )
{
int objectId = Integer.parseInt( values[1] );
DataElement dataElement = dataElementService.getDataElement( objectId );
@@ -459,7 +397,7 @@
valueTypes.add( valueType );
mapSuggestedValues.put( index, getSuggestedDataElementValues( dataElement ) );
- column.setName( dataElement.getName() );
+ column.setName( dataElement.getFormNameFallback() );
}
columns.add( column );
@@ -471,27 +409,6 @@
return columns;
}
- private List<String> getSuggestedAttributeValues( PatientAttribute patientAttribute )
- {
- List<String> values = new ArrayList<String>();
- String valueType = patientAttribute.getValueType();
-
- if ( valueType.equals( PatientAttribute.TYPE_BOOL ) )
- {
- values.add( i18n.getString( "yes" ) );
- values.add( i18n.getString( "no" ) );
- }
- else if ( valueType.equals( PatientAttribute.TYPE_COMBO ) )
- {
- for ( PatientAttributeOption attributeOption : patientAttribute.getAttributeOptions() )
- {
- values.add( attributeOption.getName() );
- }
- }
-
- return values;
- }
-
private List<String> getSuggestedDataElementValues( DataElement dataElement )
{
List<String> values = new ArrayList<String>();
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-11-07 15:43:51 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-11-08 02:58:24 +0000
@@ -843,10 +843,6 @@
<property name="organisationUnitService"
ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="patientAttributeService"
- ref="org.hisp.dhis.patient.PatientAttributeService" />
- <property name="patientIdentifierTypeService"
- ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
</bean>
<bean