← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9222: FRED-API: minor validate message update

 

------------------------------------------------------------
revno: 9222
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-12-08 13:29:54 +0300
message:
  FRED-API: minor validate message update
modified:
  dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/validation/constraint/IdObjectExistsValidator.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/validation/constraint/IdObjectExistsValidator.java'
--- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/validation/constraint/IdObjectExistsValidator.java	2012-12-08 08:31:02 +0000
+++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/validation/constraint/IdObjectExistsValidator.java	2012-12-08 10:29:54 +0000
@@ -58,6 +58,15 @@
     {
         IdentifiableObject identifiableObject = identifiableObjectManager.get( identifiableObjectClass, value );
 
-        return identifiableObject != null;
+        boolean isValid = identifiableObject != null;
+
+        if ( !isValid )
+        {
+            context.disableDefaultConstraintViolation();
+            context.buildConstraintViolationWithTemplate( String.format( "No object found with ID %s.", value ) )
+                .addConstraintViolation();
+        }
+
+        return isValid;
     }
 }