← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17771: set PropertyType.IDENTIFIER on code field (override in Option, since they don't have unique codes)

 

------------------------------------------------------------
revno: 17771
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-12-22 11:28:42 +0100
message:
  set PropertyType.IDENTIFIER on code field (override in Option, since they don't have unique codes)
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/Option.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/common/BaseIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java	2014-12-19 15:36:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java	2014-12-22 10:28:42 +0000
@@ -205,6 +205,7 @@
     @JsonProperty
     @JacksonXmlProperty( isAttribute = true )
     @Description( "The unique code for this Object." )
+    @Property( PropertyType.IDENTIFIER )
     public String getCode()
     {
         return code;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/Option.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/Option.java	2014-12-01 08:36:34 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/Option.java	2014-12-22 10:28:42 +0000
@@ -28,10 +28,13 @@
 
 package org.hisp.dhis.option;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.DxfNamespaces;
-
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import org.hisp.dhis.schema.PropertyType;
+import org.hisp.dhis.schema.annotation.Property;
 
 /**
  * @author Chau Thu Tran
@@ -44,7 +47,7 @@
     {
         setAutoFields();
     }
-    
+
     public Option( String name, String code )
     {
         setAutoFields();
@@ -63,4 +66,13 @@
     {
         return false;
     }
+
+    @Override
+    @JsonProperty
+    @JacksonXmlProperty( isAttribute = true )
+    @Property( PropertyType.TEXT )
+    public String getCode()
+    {
+        return super.getCode();
+    }
 }