dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11619
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3360: Fixed bug, sorting of category option combos in dataset section report
------------------------------------------------------------
revno: 3360
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-04-12 14:15:54 +0200
message:
Fixed bug, sorting of category option combos in dataset section report
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SectionFormAction.java
--
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-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2011-02-16 17:16:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2011-04-12 12:15:54 +0000
@@ -28,6 +28,7 @@
*/
import java.util.Collection;
+import java.util.List;
import org.hisp.dhis.hierarchy.HierarchyViolationException;
@@ -294,7 +295,7 @@
* @param categoryCombo the DataElementCategoryCombo.
*
*/
- Collection<DataElementCategoryOptionCombo> sortOptionCombos( DataElementCategoryCombo categoryCombo );
+ List<DataElementCategoryOptionCombo> sortOptionCombos( DataElementCategoryCombo categoryCombo );
/**
* Generates and persists a default DataElementCategory,
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2011-04-08 15:39:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2011-04-12 12:15:54 +0000
@@ -538,7 +538,7 @@
updateDataElementCategoryCombo( categoryCombo );
}
- public Collection<DataElementCategoryOptionCombo> sortOptionCombos( DataElementCategoryCombo categoryCombo )
+ public List<DataElementCategoryOptionCombo> sortOptionCombos( DataElementCategoryCombo categoryCombo )
{
List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
categoryCombo.getOptionCombos() );
@@ -547,14 +547,14 @@
Map<Integer, Collection<DataElementCategoryOption>> orderedOptions = prepareOptionsForCombination( categoryCombo );
- Collection<DataElementCategoryOptionCombo> orderdCategoryOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
+ List<DataElementCategoryOptionCombo> orderdCategoryOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
for ( int i = 0; i < totalColumns; i++ )
{
- Collection<DataElementCategoryOption> options = new ArrayList<DataElementCategoryOption>( categoryCombo
+ List<DataElementCategoryOption> options = new ArrayList<DataElementCategoryOption>( categoryCombo
.getCategories().size() );
- Collection<DataElementCategory> copyOforderedCategories = categoryCombo.getCategories();
+ List<DataElementCategory> copyOforderedCategories = categoryCombo.getCategories();
Iterator<DataElementCategory> categoryIterator = copyOforderedCategories.iterator();
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java 2011-04-04 09:23:22 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/activityplan/DefaultActivityPlanService.java 2011-04-12 12:15:54 +0000
@@ -40,6 +40,7 @@
import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patientdatavalue.PatientDataValue;
import org.hisp.dhis.patientdatavalue.PatientDataValueService;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramInstance;
import org.hisp.dhis.program.ProgramInstanceService;
@@ -102,11 +103,7 @@
public Collection<Activity> getCurrentActivitiesByProvider( OrganisationUnit organisationUnit )
{
- Date today = new Date();
- today.setHours( 0 );
- today.setMinutes( 0 );
- today.setSeconds( 0 );
- long time = today.getTime();
+ long time = PeriodType.createCalendarInstance().getTime().getTime();
List<Activity> items = new ArrayList<Activity>();
@@ -129,6 +126,8 @@
if(!programStageInstance.isCompleted()){
expiredDate.setTime( DateUtils.getDateAfterAddition( programStageInstance.getDueDate(), programStageInstance.getProgramInstance().getProgram().getMaxDaysAllowedInputData() ) );
+ //TODO compare with date.before
+
if ( programStageInstance.getDueDate().getTime() <= time && expiredDate.getTimeInMillis() > time )
{
Activity activity = new Activity();
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2011-04-07 08:21:36 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2011-04-12 12:15:54 +0000
@@ -100,7 +100,6 @@
return getCriteria( Restrictions.eq( "birthDate", birthDate ) ).list();
}
- @SuppressWarnings( "unchecked" )
public Collection<Patient> getByNames( String name )
{
String sql = statementBuilder.getPatientsByFullName( name );
@@ -133,7 +132,6 @@
return patients;
}
- @SuppressWarnings( "unchecked" )
public Collection<Patient> getByNames( String name, int min, int max )
{
String sql = statementBuilder.getPatientsByFullName( name, min, max );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java 2011-04-01 11:19:55 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java 2011-04-12 12:15:54 +0000
@@ -50,6 +50,7 @@
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.comparator.DataElementCategoryOptionComboNameComparator;
import org.hisp.dhis.dataelement.comparator.DataElementNameComparator;
import org.hisp.dhis.dataset.DataSet;
@@ -106,6 +107,13 @@
{
this.aggregatedDataValueService = aggregatedDataValueService;
}
+
+ private DataElementCategoryService categoryService;
+
+ public void setCategoryService( DataElementCategoryService categoryService )
+ {
+ this.categoryService = categoryService;
+ }
private SystemSettingManager systemSettingManager;
@@ -245,7 +253,9 @@
grid.addHeader( new GridHeader( i18n.getString( "dataelement" ), false, true ) ); // Data element header
- for ( DataElementCategoryOptionCombo optionCombo : categoryCombo.getOptionCombos() ) // Value headers
+ List<DataElementCategoryOptionCombo> optionCombos = categoryService.sortOptionCombos( categoryCombo );
+
+ for ( DataElementCategoryOptionCombo optionCombo : optionCombos ) // Value headers
{
grid.addHeader( new GridHeader( optionCombo.isDefault() ? DEFAULT_HEADER : optionCombo.getName(), false, false ) );
}
@@ -276,7 +286,7 @@
grid.addRow();
grid.addValue( dataElement.getName() ); // Data element name
- for ( DataElementCategoryOptionCombo optionCombo : categoryCombo.getOptionCombos() ) // Values
+ for ( DataElementCategoryOptionCombo optionCombo : optionCombos ) // Values
{
Double value = null;
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-04-08 15:39:44 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-04-12 12:15:54 +0000
@@ -194,6 +194,8 @@
ref="org.hisp.dhis.options.SystemSettingManager"/>
<property name="aggregatedDataValueService"
ref="org.hisp.dhis.aggregation.AggregatedDataValueService"/>
+ <property name="categoryService"
+ ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
<property name="aggregationService"
ref="org.hisp.dhis.aggregation.AggregationService"/>
</bean>
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SectionFormAction.java 2011-04-03 10:25:42 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SectionFormAction.java 2011-04-12 12:15:54 +0000
@@ -214,9 +214,9 @@
return orderdCategoryOptionCombos;
}
- private Collection<DataElementCategoryOptionCombo> allOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
+ private List<DataElementCategoryOptionCombo> allOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
- public Collection<DataElementCategoryOptionCombo> getAllOptionCombos()
+ public List<DataElementCategoryOptionCombo> getAllOptionCombos()
{
return allOptionCombos;
}
@@ -343,7 +343,7 @@
for ( DataElementCategoryCombo categoryCombo : orderedCategoryCombos )
{
- Collection<DataElementCategoryOptionCombo> optionCombos = categoryService.sortOptionCombos( categoryCombo );
+ List<DataElementCategoryOptionCombo> optionCombos = categoryService.sortOptionCombos( categoryCombo );
allOptionCombos.addAll( optionCombos );