dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34333
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17621: minor fix, use property to fetch id getter in LinkService
------------------------------------------------------------
revno: 17621
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-11-30 16:24:43 +0700
message:
minor fix, use property to fetch id getter in LinkService
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/service/DefaultLinkService.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/src/main/java/org/hisp/dhis/webapi/service/DefaultLinkService.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/service/DefaultLinkService.java 2014-07-30 09:46:29 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/service/DefaultLinkService.java 2014-11-30 09:24:43 +0000
@@ -199,19 +199,20 @@
Schema schema = schemaService.getDynamicSchema( klass );
- if ( !schema.haveApiEndpoint() )
+ if ( !schema.haveApiEndpoint() || schema.getProperty( "id" ) == null || schema.getProperty( "id" ).getGetterMethod() == null )
{
return;
}
+ Property id = schema.getProperty( "id" );
+
try
{
- Method getUid = object.getClass().getMethod( "getUid" );
- Object value = getUid.invoke( object );
+ Object value = id.getGetterMethod().invoke( object );
if ( !String.class.isInstance( value ) )
{
- log.warn( "getUid on object of type " + object.getClass().getName() + " does not return a String." );
+ log.warn( "id on object of type " + object.getClass().getName() + " does not return a String." );
return;
}