dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #01200
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 350: Period type name now used instead of internal period type id.
------------------------------------------------------------
revno: 350
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-06-02 14:13:35 +0200
message:
Period type name now used instead of internal period type id.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java
dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java
dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java
gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetPeriodsByPeriodTypeAction.java
gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2009-05-29 12:05:15 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2009-06-02 12:13:35 +0000
@@ -304,12 +304,12 @@
int addMapView( MapView mapView );
- int addMapView( String name, int indicatorGroupId, int indicatorId, int periodTypeId, int periodId,
+ int addMapView( String name, int indicatorGroupId, int indicatorId, String periodTypeName, int periodId,
String mapLayerPath, int method, int classes, String colorLow, String colorHigh );
void updateMapView( MapView mapView );
- void addOrUpdateMapView( String name, int indicatorGroupId, int indicatorId, int periodTypeId, int periodId,
+ void addOrUpdateMapView( String name, int indicatorGroupId, int indicatorId, String periodTypeName, int periodId,
String mapLayerPath, int method, int classes, String colorLow, String colorHigh );
void deleteMapView( MapView view );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java 2009-05-22 22:53:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java 2009-06-02 12:13:35 +0000
@@ -253,4 +253,12 @@
* @return the PeriodType with the given name, or null if no match.
*/
PeriodType getPeriodTypeByName( String name );
+
+ /**
+ * Returns a PeriodType represented by the given Class.
+ *
+ * @param periodType the Class type of the PeriodType.
+ * @return a PeriodType instance.
+ */
+ PeriodType getPeriodTypeByClass( Class<? extends PeriodType> periodType );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java 2009-05-23 11:56:04 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java 2009-06-02 12:13:35 +0000
@@ -313,7 +313,12 @@
{
return PeriodType.getPeriodTypeByName( name );
}
-
+
+ public PeriodType getPeriodTypeByClass( Class<? extends PeriodType> periodType )
+ {
+ return periodStore.getPeriodType( periodType );
+ }
+
public Period getPeriodFromDates( Date startDate, Date endDate, PeriodType periodType )
{
return periodStore.getPeriodFromDates( startDate, endDate, periodType );
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2009-05-29 12:05:15 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2009-06-02 12:13:35 +0000
@@ -396,7 +396,7 @@
return mappingStore.addMapView( mapView );
}
- public int addMapView( String name, int indicatorGroupId, int indicatorId, int periodTypeId, int periodId,
+ public int addMapView( String name, int indicatorGroupId, int indicatorId, String periodTypeName, int periodId,
String mapLayerPath, int method, int classes, String colorLow, String colorHigh )
{
MapView mapView = new MapView();
@@ -405,7 +405,7 @@
Indicator indicator = indicatorService.getIndicator( indicatorId );
- PeriodType periodType = periodService.getPeriodType( periodTypeId );
+ PeriodType periodType = periodService.getPeriodTypeByClass( PeriodType.getPeriodTypeByName( periodTypeName ).getClass() );
Period period = periodService.getPeriod( periodId );
@@ -429,14 +429,14 @@
mappingStore.updateMapView( mapView );
}
- public void addOrUpdateMapView( String name, int indicatorGroupId, int indicatorId, int periodTypeId, int periodId,
+ public void addOrUpdateMapView( String name, int indicatorGroupId, int indicatorId, String periodTypeName, int periodId,
String mapLayerPath, int method, int classes, String colorLow, String colorHigh )
{
IndicatorGroup indicatorGroup = indicatorService.getIndicatorGroup( indicatorGroupId );
Indicator indicator = indicatorService.getIndicator( indicatorId );
- PeriodType periodType = periodService.getPeriodType( periodTypeId );
+ PeriodType periodType = periodService.getPeriodTypeByClass( PeriodType.getPeriodTypeByName( periodTypeName ).getClass() );
Period period = periodService.getPeriod( periodId );
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java 2009-05-29 12:05:15 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java 2009-06-02 12:13:35 +0000
@@ -59,7 +59,7 @@
{
this.sessionManager = sessionManager;
}
-
+
// -------------------------------------------------------------------------
// Map
// -------------------------------------------------------------------------
@@ -289,7 +289,7 @@
public void updateMapView( MapView view )
{
Session session = sessionManager.getCurrentSession();
-
+
session.update( view );
}
=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml 2009-05-27 10:26:48 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/META-INF/dhis/beans.xml 2009-06-02 12:13:35 +0000
@@ -15,7 +15,7 @@
<property name="indicatorService"
ref="org.hisp.dhis.indicator.IndicatorService"/>
<property name="periodService"
- ref="org.hisp.dhis.period.PeriodService"/>
+ ref="org.hisp.dhis.period.PeriodService"/>
</bean>
<!-- Store definitions -->
=== modified file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java 2009-05-27 10:26:48 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapViewAction.java 2009-06-02 12:13:35 +0000
@@ -74,9 +74,9 @@
this.indicatorId = indicatorId;
}
- private int periodTypeId;
+ private String periodTypeId;
- public void setPeriodTypeId( int periodTypeId )
+ public void setPeriodTypeId( String periodTypeId )
{
this.periodTypeId = periodTypeId;
}
=== modified file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetPeriodsByPeriodTypeAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetPeriodsByPeriodTypeAction.java 2009-04-23 21:12:33 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetPeriodsByPeriodTypeAction.java 2009-06-02 12:13:35 +0000
@@ -68,11 +68,11 @@
// Input
// -------------------------------------------------------------------------
- private Integer periodTypeId;
+ private String name;
- public void setPeriodTypeId( Integer periodTypeId )
+ public void setName( String name )
{
- this.periodTypeId = periodTypeId;
+ this.name = name;
}
// -------------------------------------------------------------------------
@@ -93,7 +93,7 @@
public String execute()
throws Exception
{
- PeriodType periodType = periodService.getPeriodType( periodTypeId );
+ PeriodType periodType = PeriodType.getPeriodTypeByName( name );
if ( periodType != null )
{
@@ -105,8 +105,10 @@
}
Collections.sort( object, new PeriodComparator() );
+
+ System.out.println(object);
}
-
+
return SUCCESS;
}
}
=== modified file 'gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js'
--- gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js 2009-05-29 15:39:03 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js 2009-06-02 12:13:35 +0000
@@ -219,10 +219,10 @@
if (MAPVIEWACTIVE) {
Ext.getCmp('indicator_cb').setValue(MAPVIEW.indicatorId);
- var periodTypeId = getPeriodTypeIdByName(MAPVIEW.periodTypeId);
- Ext.getCmp('periodtype_cb').setValue(periodTypeId);
+ var name = MAPVIEW.periodTypeId;
+ Ext.getCmp('periodtype_cb').setValue(name);
- periodStore.baseParams = { periodTypeId: periodTypeId, format: 'json' };
+ periodStore.baseParams = { name: name, format: 'json' };
periodStore.reload();
}
},
@@ -233,9 +233,8 @@
periodTypeStore = new Ext.data.JsonStore({
url: path + 'getAllPeriodTypes' + type,
- baseParams: { format: 'json' },
root: 'periodTypes',
- fields: ['id', 'name'],
+ fields: ['name'],
autoLoad: true
});
@@ -441,7 +440,7 @@
fieldLabel: 'Period type',
typeAhead: true,
editable: false,
- valueField: 'id',
+ valueField: 'name',
displayField: 'name',
mode: 'remote',
forceSelection: true,
@@ -458,8 +457,8 @@
Ext.getCmp('mapview_cb').reset();
}
- var ptid = Ext.getCmp('periodtype_cb').getValue();
- Ext.getCmp('period_cb').getStore().baseParams = { periodTypeId: ptid, format: 'json' };
+ var pt = Ext.getCmp('periodtype_cb').getValue();
+ Ext.getCmp('period_cb').getStore().baseParams = { name: pt, format: 'json' };
Ext.getCmp('period_cb').getStore().reload();
},
scope: this
--
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.