dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16715
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6424: Made datavalueset props shorter
------------------------------------------------------------
revno: 6424
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-03-28 20:46:31 +0200
message:
Made datavalueset props shorter
modified:
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSet.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.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-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSet.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSet.java 2012-03-28 18:27:56 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSet.java 2012-03-28 18:46:31 +0000
@@ -48,11 +48,11 @@
*/
public static final IdentificationStrategy DEFAULT_STRATEGY = IdentificationStrategy.UID;
- private String dataSetIdentifier;
-
- private String organisationUnitIdentifier;
-
- private String periodIsoDate;
+ private String dataSet;
+
+ private String orgUnit;
+
+ private String period;
private String completeDate;
@@ -72,40 +72,40 @@
this.idScheme = idScheme;
}
- @JsonProperty( value="dataSet" )
- @JacksonXmlProperty( localName="dataSet", isAttribute=true, namespace = Dxf2Namespace.NAMESPACE )
- public String getDataSetIdentifier()
- {
- return dataSetIdentifier;
- }
-
- public void setDataSetIdentifier( String dataSetId )
- {
- this.dataSetIdentifier = dataSetId;
- }
-
- @JsonProperty( value="orgUnit" )
- @JacksonXmlProperty( localName="orgUnit", isAttribute=true, namespace = Dxf2Namespace.NAMESPACE )
- public String getOrganisationUnitIdentifier()
- {
- return organisationUnitIdentifier;
- }
-
- public void setOrganisationUnitIdentifier( String organisationUnitId )
- {
- this.organisationUnitIdentifier = organisationUnitId;
- }
-
- @JsonProperty( value="period" )
- @JacksonXmlProperty( localName="period", isAttribute=true, namespace = Dxf2Namespace.NAMESPACE )
- public String getPeriodIsoDate()
- {
- return periodIsoDate;
- }
-
- public void setPeriodIsoDate( String periodIsoDate )
- {
- this.periodIsoDate = periodIsoDate;
+ @JsonProperty() //TODO make required
+ @JacksonXmlProperty( isAttribute=true, namespace = Dxf2Namespace.NAMESPACE )
+ public String getDataSet()
+ {
+ return dataSet;
+ }
+
+ public void setDataSet( String dataSet )
+ {
+ this.dataSet = dataSet;
+ }
+
+ @JsonProperty()
+ @JacksonXmlProperty( isAttribute=true, namespace = Dxf2Namespace.NAMESPACE )
+ public String getOrgUnit()
+ {
+ return orgUnit;
+ }
+
+ public void setOrgUnit( String orgUnit )
+ {
+ this.orgUnit = orgUnit;
+ }
+
+ @JsonProperty()
+ @JacksonXmlProperty( isAttribute=true, namespace = Dxf2Namespace.NAMESPACE )
+ public String getPeriod()
+ {
+ return period;
+ }
+
+ public void setPeriod( String period )
+ {
+ this.period = period;
}
@JsonProperty
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2012-03-28 16:04:53 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2012-03-28 18:46:31 +0000
@@ -136,7 +136,7 @@
DataSet dataSet = getDataSet( dataValueSet );
- OrganisationUnit unit = getOrgUnit( dataValueSet.getOrganisationUnitIdentifier() );
+ OrganisationUnit unit = getOrgUnit( dataValueSet.getOrgUnit() );
if ( !dataSet.getSources().contains( unit ) )
{
@@ -144,7 +144,7 @@
+ " does not report data set with ID " + dataSet.getUid() );
}
- Period period = getPeriod( dataValueSet.getPeriodIsoDate(), dataSet.getPeriodType() );
+ Period period = getPeriod( dataValueSet.getPeriod(), dataSet.getPeriodType() );
handleComplete( dataValueSet, dataSet, unit, period );
@@ -159,7 +159,7 @@
private void log( DataValueSet dataValueSet, OrganisationUnit unit, DataSet dataSet )
{
String message = "Saved data value set for " + dataSet.getName() + ", " + unit.getName() + ", "
- + dataValueSet.getPeriodIsoDate() + " - data values received: ";
+ + dataValueSet.getPeriod() + " - data values received: ";
for ( org.hisp.dhis.dxf2.datavalue.DataValue value : dataValueSet.getDataValues() )
{
@@ -173,7 +173,7 @@
{
DataSet dataSet = null;
- String uid = dataValueSet.getDataSetIdentifier();
+ String uid = dataValueSet.getDataSet();
if ( uid != null )
{
@@ -194,6 +194,8 @@
private DataSet resolveDataSet( DataValueSet dataValueSet )
{
+ //TODO make data set required
+
if ( dataValueSet.getDataValues() == null )
{
throw new IllegalArgumentException( "Data value set does not specify a data set and does not contain data values" );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java 2012-03-28 16:04:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataValueSetController.java 2012-03-28 18:46:31 +0000
@@ -78,8 +78,8 @@
dataValueSetService.saveDataValueSet( dataValueSet );
- log.debug( "Saved data value set for data set: " + dataValueSet.getDataSetIdentifier() +
- ", org unit: " + dataValueSet.getOrganisationUnitIdentifier() + ", period: " + dataValueSet.getPeriodIsoDate() );
+ log.debug( "Saved data value set for data set: " + dataValueSet.getDataSet() +
+ ", org unit: " + dataValueSet.getOrgUnit() + ", period: " + dataValueSet.getPeriod() );
ContextUtils.okResponse( response, "Saved data value set succesfully" );
}
@@ -90,31 +90,4 @@
{
response.sendError( HttpServletResponse.SC_CONFLICT, ex.getMessage() );
}
-
- /*
- @RequestMapping( value = "/test", method = RequestMethod.GET )
- public String getDataValueSetTest( Model model ) throws Exception
- {
- DataValueSets dataValueSets = new DataValueSets();
-
- DataValue v1 = new DataValue();
- v1.setDataElement( "de" );
- v1.setValue( "va" );
-
- DataValue v2 = new DataValue();
- v2.setDataElement( "de" );
- v2.setValue( "va" );
-
- DataValueSet d = new DataValueSet();
- d.setDataSetIdentifier( "ds" );
- d.setOrganisationUnitIdentifier( "ou" );
- d.setPeriodIsoDate( "pe" );
- d.getDataValues().add( v1 );
- d.getDataValues().add( v2 );
- dataValueSets.getDataValueSets().add( d );
-
- model.addAttribute( "model", dataValueSets );
-
- return "dataValueSets";
- }*/
}