← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14444: add nameableObject property to schema

 

------------------------------------------------------------
revno: 14444
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-03-26 17:25:17 +0100
message:
  add nameableObject property to schema
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Property.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultPropertyIntrospectorService.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-api/src/main/java/org/hisp/dhis/schema/Property.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Property.java	2014-03-26 11:12:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Property.java	2014-03-26 16:25:17 +0000
@@ -61,6 +61,8 @@
 
     private boolean identifiableObject;
 
+    private boolean nameableObject;
+
     public Property( Method method )
     {
         this.method = method;
@@ -184,6 +186,18 @@
         this.identifiableObject = identifiableObject;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public boolean isNameableObject()
+    {
+        return nameableObject;
+    }
+
+    public void setNameableObject( boolean nameableObject )
+    {
+        this.nameableObject = nameableObject;
+    }
+
     @Override
     public String toString()
     {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultPropertyIntrospectorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultPropertyIntrospectorService.java	2014-03-26 15:18:22 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultPropertyIntrospectorService.java	2014-03-26 16:25:17 +0000
@@ -34,6 +34,7 @@
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.NameableObject;
 import org.hisp.dhis.common.annotation.Description;
 import org.hisp.dhis.system.util.ReflectionUtils;
 import org.springframework.util.StringUtils;
@@ -147,6 +148,11 @@
                 if ( IdentifiableObject.class.isAssignableFrom( returnType ) )
                 {
                     property.setIdentifiableObject( true );
+
+                    if ( NameableObject.class.isAssignableFrom( returnType ) )
+                    {
+                        property.setNameableObject( true );
+                    }
                 }
                 else if ( Collection.class.isAssignableFrom( returnType ) )
                 {
@@ -162,6 +168,11 @@
                         if ( IdentifiableObject.class.isAssignableFrom( klass ) )
                         {
                             property.setIdentifiableObject( true );
+
+                            if ( NameableObject.class.isAssignableFrom( klass ) )
+                            {
+                                property.setNameableObject( true );
+                            }
                         }
                     }
                 }