dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20800
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9671: minor fix
------------------------------------------------------------
revno: 9671
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-01-31 11:21:11 +0700
message:
minor fix
modified:
dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.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-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java 2013-01-31 04:12:32 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java 2013-01-31 04:21:11 +0000
@@ -469,14 +469,14 @@
if ( constraintViolations.isEmpty() )
{
- OrganisationUnit organisationUnit = conversionService.convert( facility, OrganisationUnit.class );
- OrganisationUnit old_organisationUnit = organisationUnitService.getOrganisationUnit( facility.getId() );
+ OrganisationUnit organisationUnitUpdate = conversionService.convert( facility, OrganisationUnit.class );
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( facility.getId() );
if ( request.getHeader( "ETag" ) != null )
{
- Facility old_facility = conversionService.convert( old_organisationUnit, Facility.class );
+ Facility old_facility = conversionService.convert( organisationUnit, Facility.class );
List<OrganisationUnitLevel> organisationUnitLevels = organisationUnitService.getOrganisationUnitLevels();
- addHierarchyPropertyToFacility( organisationUnitLevels, organisationUnit, old_facility );
+ addHierarchyPropertyToFacility( organisationUnitLevels, organisationUnitUpdate, old_facility );
ObjectMapper objectMapper = new ObjectMapperFactoryBean().getObject();
String body = objectMapper.writeValueAsString( old_facility );
@@ -489,46 +489,46 @@
}
}
- if ( old_organisationUnit == null )
+ if ( organisationUnit == null )
{
return new ResponseEntity<String>( MessageResponseUtils.jsonMessage( "No object with that identifier exists." ),
headers, HttpStatus.NOT_FOUND );
}
- else if ( !old_organisationUnit.getName().equals( organisationUnit.getName() ) )
+ else if ( !organisationUnit.getName().equals( organisationUnitUpdate.getName() ) )
{
- OrganisationUnit ouByName = organisationUnitService.getOrganisationUnitByName( organisationUnit.getName() );
+ OrganisationUnit ouByName = organisationUnitService.getOrganisationUnitByName( organisationUnitUpdate.getName() );
- if ( ouByName != null && !old_organisationUnit.getUid().equals( ouByName.getUid() ) )
+ if ( ouByName != null && !organisationUnit.getUid().equals( ouByName.getUid() ) )
{
return new ResponseEntity<String>( MessageResponseUtils.jsonMessage( "Another object with the same name already exists." ),
headers, HttpStatus.CONFLICT );
}
}
- else if ( organisationUnit.getCode() != null )
+ else if ( organisationUnitUpdate.getCode() != null )
{
- OrganisationUnit ouByCode = organisationUnitService.getOrganisationUnitByCode( organisationUnit.getCode() );
+ OrganisationUnit ouByCode = organisationUnitService.getOrganisationUnitByCode( organisationUnitUpdate.getCode() );
- if ( ouByCode != null && !old_organisationUnit.getUid().equals( ouByCode.getUid() ) )
+ if ( ouByCode != null && !organisationUnit.getUid().equals( ouByCode.getUid() ) )
{
return new ResponseEntity<String>( MessageResponseUtils.jsonMessage( "Another object with the same code already exists." ),
headers, HttpStatus.CONFLICT );
}
}
- old_organisationUnit.setName( organisationUnit.getName() );
- old_organisationUnit.setShortName( organisationUnit.getShortName() );
- old_organisationUnit.setCode( organisationUnit.getCode() );
- old_organisationUnit.setFeatureType( organisationUnit.getFeatureType() );
- old_organisationUnit.setCoordinates( organisationUnit.getCoordinates() );
- old_organisationUnit.setParent( organisationUnit.getParent() );
- old_organisationUnit.setActive( organisationUnit.isActive() );
-
- old_organisationUnit.removeAllDataSets();
- organisationUnitService.updateOrganisationUnit( old_organisationUnit );
-
- for ( DataSet dataSet : organisationUnit.getDataSets() )
+ organisationUnit.setName( organisationUnitUpdate.getName() );
+ organisationUnit.setShortName( organisationUnitUpdate.getShortName() );
+ organisationUnit.setCode( organisationUnitUpdate.getCode() );
+ organisationUnit.setFeatureType( organisationUnitUpdate.getFeatureType() );
+ organisationUnit.setCoordinates( organisationUnitUpdate.getCoordinates() );
+ organisationUnit.setParent( organisationUnitUpdate.getParent() );
+ organisationUnit.setActive( organisationUnitUpdate.isActive() );
+
+ organisationUnit.removeAllDataSets();
+ organisationUnitService.updateOrganisationUnit( organisationUnit );
+
+ for ( DataSet dataSet : organisationUnitUpdate.getDataSets() )
{
- dataSet.addOrganisationUnit( old_organisationUnit );
+ dataSet.addOrganisationUnit( organisationUnit );
dataSetService.updateDataSet( dataSet );
}