You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by ja...@apache.org on 2012/04/01 15:44:17 UTC

svn commit: r1308115 - /ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RepositoryObjectSerializer.java

Author: jawi
Date: Sun Apr  1 13:44:17 2012
New Revision: 1308115

URL: http://svn.apache.org/viewvc?rev=1308115&view=rev
Log:
ACE-243: add the definition of a repository object to its JSON representation.

Modified:
    ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RepositoryObjectSerializer.java

Modified: ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RepositoryObjectSerializer.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RepositoryObjectSerializer.java?rev=1308115&r1=1308114&r2=1308115&view=diff
==============================================================================
--- ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RepositoryObjectSerializer.java (original)
+++ ace/trunk/ace-client-rest/src/main/java/org/apache/ace/client/rest/RepositoryObjectSerializer.java Sun Apr  1 13:44:17 2012
@@ -39,6 +39,8 @@ import com.google.gson.JsonSerializer;
 public class RepositoryObjectSerializer implements JsonSerializer<RepositoryObject> {
 
     /** used in all repository objects. */
+    private static final String DEFINITION = "definition";
+    /** used in all repository objects. */
     private static final String TAGS = "tags";
     /** used in all repository objects. */
     private static final String ATTRIBUTES = "attributes";
@@ -80,7 +82,10 @@ public class RepositoryObjectSerializer 
      */
     private JsonElement serializeStatefulTargetObject(StatefulTargetObject targetObject) {
         JsonObject result = new JsonObject();
-        // first add all attributes
+        // ACE-243: first all the definition...
+        result.addProperty(DEFINITION, targetObject.getDefinition());
+
+        // then add all attributes
         JsonObject attr = new JsonObject();
 
         if (targetObject.isRegistered()) {
@@ -151,7 +156,10 @@ public class RepositoryObjectSerializer 
      */
     private JsonElement serializeRepositoryObject(RepositoryObject repositoryObject) {
         JsonObject result = new JsonObject();
-        // first add all attributes
+        // ACE-243: first all the definition...
+        result.addProperty(DEFINITION, repositoryObject.getDefinition());
+        
+        // then add all attributes
         JsonObject attr = new JsonObject();
         
         Enumeration<String> keys = repositoryObject.getAttributeKeys();