incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1188250 - in /incubator/isis/trunk/framework/viewer/json: json-applib/src/main/java/org/apache/isis/viewer/json/applib/capabilities/ json-applib/src/main/java/org/apache/isis/viewer/json/applib/domainobjects/ json-applib/src/main/java/org/...
Date Mon, 24 Oct 2011 17:32:16 GMT
Author: danhaywood
Date: Mon Oct 24 17:32:15 2011
New Revision: 1188250

URL: http://svn.apache.org/viewvc?rev=1188250&view=rev
Log:
ISIS-109: updated homepage resource in line with v0.48 of the RO spec

Modified:
    incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/capabilities/CapabilitiesRepresentation.java
    incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/domainobjects/ListRepresentation.java
    incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/homepage/HomePageRepresentation.java
    incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/user/UserRepresentation.java
    incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ReprRendererAbstract.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/capabilities/CapabilitiesReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ListReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectActionReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectCollectionReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectPropertyReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ScalarValueReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/home/HomePageReprRenderer.java
    incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserReprRenderer.java

Modified: incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/capabilities/CapabilitiesRepresentation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/capabilities/CapabilitiesRepresentation.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/capabilities/CapabilitiesRepresentation.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/capabilities/CapabilitiesRepresentation.java
Mon Oct 24 17:32:15 2011
@@ -32,7 +32,7 @@ public class CapabilitiesRepresentation 
     }
 
     public LinkRepresentation getSelf() {
-        return getLink("self");
+        return getLink("links[rel=self]");
     }
 
     public JsonRepresentation getCapabilities() {

Modified: incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/domainobjects/ListRepresentation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/domainobjects/ListRepresentation.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/domainobjects/ListRepresentation.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/domainobjects/ListRepresentation.java
Mon Oct 24 17:32:15 2011
@@ -33,7 +33,7 @@ public class ListRepresentation extends 
     }
 
     public LinkRepresentation getSelf() {
-        return getLink("self");
+        return getLink("links[rel=self]");
     }
 
     public JsonRepresentation getValues() {

Modified: incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/homepage/HomePageRepresentation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/homepage/HomePageRepresentation.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/homepage/HomePageRepresentation.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/homepage/HomePageRepresentation.java
Mon Oct 24 17:32:15 2011
@@ -32,16 +32,16 @@ public class HomePageRepresentation exte
     }
 
     public LinkRepresentation getSelf() {
-        return getLink("self");
+        return getLink("links[rel=self]");
     }
     public LinkRepresentation getUser() {
-        return getLink("user");
+        return getLink("links[rel=user]");
     }
     public LinkRepresentation getServices() {
-        return getLink("services");
+        return getLink("links[rel=services]");
     }
     public LinkRepresentation getCapabilities() {
-        return getLink("capabilities");
+        return getLink("links[rel=capabilities]");
     }
 
     public JsonRepresentation getLinks() {

Modified: incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/user/UserRepresentation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/user/UserRepresentation.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/user/UserRepresentation.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-applib/src/main/java/org/apache/isis/viewer/json/applib/user/UserRepresentation.java
Mon Oct 24 17:32:15 2011
@@ -33,7 +33,7 @@ public class UserRepresentation extends 
     }
     
     public LinkRepresentation getSelf() {
-        return getLink("self");
+        return getLink("links[rel=self]");
     }
 
     public String getUsername() {

Modified: incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-tck/src/test/java/org/apache/isis/viewer/json/tck/resources/service/invoke/DomainServiceResourceTest_invokeAction.java
Mon Oct 24 17:32:15 2011
@@ -24,6 +24,8 @@ import static org.hamcrest.CoreMatchers.
 import static org.junit.Assert.assertThat;
 
 import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.BigInteger;
 
 import javax.ws.rs.core.Response;
 
@@ -204,6 +206,18 @@ public class DomainServiceResourceTest_i
         
         final JsonRepresentation args = invokeLink.getArguments();
         assertThat(args.size(), is(0));
+        assertThat(args.mapHas("object"), is(true));
+        assertThat(args.mapHas("name"), is(true));
+        assertThat(args.mapHas("flag"), is(true));
+        assertThat(args.mapHas("Boolean"), is(true));
+        assertThat(args.mapHas("int"), is(true));
+        assertThat(args.mapHas("integer"), is(true));
+        assertThat(args.mapHas("long1"), is(true));
+        assertThat(args.mapHas("long2"), is(true));
+        assertThat(args.mapHas("double1"), is(true));
+        assertThat(args.mapHas("double2"), is(true));
+        assertThat(args.mapHas("bigInteger"), is(true));
+        assertThat(args.mapHas("bigDecimal"), is(true));
         
         // when
         args.mapPut("name", "New Name");

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ReprRendererAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ReprRendererAbstract.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ReprRendererAbstract.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/representations/ReprRendererAbstract.java
Mon Oct 24 17:32:15 2011
@@ -41,16 +41,10 @@ public abstract class ReprRendererAbstra
         this.resourceContext = resourceContext;
         this.linkFollower = asProvidedElseCreate(linkFollower);
         this.representationType = representationType;
-        this.representation = representation;
+        this.representation = representation;
+        withLinks();
     }
-
-    private LinkFollower asProvidedElseCreate(LinkFollower linkFollower) {
-        if(linkFollower != null) {
-            return linkFollower;
-        }
-        return LinkFollower.create(resourceContext.getFollowLinks());
-    }
-
+
     public ResourceContext getResourceContext() {
         return resourceContext;
     }
@@ -58,6 +52,20 @@ public abstract class ReprRendererAbstra
     public LinkFollower getLinkFollower() {
         return linkFollower;
     }
+
+    private LinkFollower asProvidedElseCreate(LinkFollower linkFollower) {
+        if(linkFollower != null) {
+            return linkFollower;
+        }
+        return LinkFollower.create(resourceContext.getFollowLinks());
+    }
+
+    private R withLinks() {
+        JsonRepresentation links = JsonRepresentation.newArray();
+        representation.mapPut("links", links);
+        return cast(this);
+    }
+
 
     @Override
     public RepresentationType getRepresentationType() {
@@ -73,23 +81,15 @@ public abstract class ReprRendererAbstra
 
     public R withSelf(String href) {
         if(href != null) {
-            representation.mapPut("self", LinkBuilder.newBuilder(resourceContext, Rel.SELF,
representationType, href).build());
+            getLinks().arrayAdd(LinkBuilder.newBuilder(resourceContext, Rel.SELF, representationType,
href).build());
         }
         return cast(this);
     }
 
     
-    public R withLinks() {
-        return withLinks(JsonRepresentation.newArray());
-    }
-
-    public R withLinks(JsonRepresentation links) {
-        if(!links.isArray()) {
-            throw new IllegalArgumentException("links must be a list");
-        }
-        representation.mapPut("links", links);
-        return cast(this);
-    }
+    protected JsonRepresentation getLinks() {
+        return representation.getArray("links");
+    }
 
     public R withExtensions() {
         return withExtensions(JsonRepresentation.newMap());

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/capabilities/CapabilitiesReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/capabilities/CapabilitiesReprRenderer.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/capabilities/CapabilitiesReprRenderer.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/capabilities/CapabilitiesReprRenderer.java
Mon Oct 24 17:32:15 2011
@@ -55,6 +55,13 @@ public class CapabilitiesReprRenderer ex
             withSelf("capabilities/");
         }
 
+        putCapabilities();
+        putExtensions();
+        
+        return representation;
+    }
+
+    private void putCapabilities() {
         JsonRepresentation capabilities = JsonRepresentation.newMap();
 
         capabilities.mapPut("concurrencyChecking", "no");
@@ -68,10 +75,11 @@ public class CapabilitiesReprRenderer ex
         capabilities.mapPut("sorting", "no");
         capabilities.mapPut("domainModel", "rich");
 
-        representation.mapPut("capabilities", capabilities);
-        representation.mapPut("links", JsonRepresentation.newArray());
-        representation.mapPut("extensions", JsonRepresentation.newMap());
+        representation.mapPut("capabilities", capabilities);
+    }
+    
+    private void putExtensions() {
+        representation.mapPut("extensions", JsonRepresentation.newMap());
+    }
 
-        return representation;
-    }
 }
\ No newline at end of file

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java
Mon Oct 24 17:32:15 2011
@@ -50,6 +50,7 @@ public abstract class AbstractObjectMemb
         usingLinkToBuilder(new DomainObjectLinkTo());
 
         // done eagerly so can use as criteria for x-ro-follow-links
+        
         putId();
         putMemberType();
 
@@ -65,7 +66,8 @@ public abstract class AbstractObjectMemb
     }
 
     public R withSelf() {
-        representation.mapPut("self", linkToBuilder.linkToMember(Rel.SELF, memberType, objectMember).build());
+        final JsonRepresentation links = getLinks();
+        links.mapPut("self", linkToBuilder.linkToMember(Rel.SELF, memberType, objectMember).build());
         return cast(this);
     }
 

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectReprRenderer.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectReprRenderer.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainObjectReprRenderer.java
Mon Oct 24 17:32:15 2011
@@ -103,10 +103,9 @@ public class DomainObjectReprRenderer ex
         withMembers(objectAdapter);
 
         // links
-        final JsonRepresentation links = JsonRepresentation.newArray();
+        final JsonRepresentation links = getLinks();
         links.arrayAdd(
                 DomainTypeReprRenderer.newLinkToBuilder(getResourceContext(), Rel.DESCRIBEDBY,
objectAdapter.getSpecification()).build());
-        withLinks(links);
         
         // extensions
         withExtensions();

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ListReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ListReprRenderer.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ListReprRenderer.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ListReprRenderer.java
Mon Oct 24 17:32:15 2011
@@ -64,7 +64,6 @@ public class ListReprRenderer extends Re
 
     public JsonRepresentation render() {
         withObjectAdapters();
-        withLinks();
         withExtensions();
 
         return representation;

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectActionReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectActionReprRenderer.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectActionReprRenderer.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectActionReprRenderer.java
Mon Oct 24 17:32:15 2011
@@ -65,10 +65,9 @@ public class ObjectActionReprRenderer ex
         putExtensionsIsisProprietary(extensions);
         withExtensions(extensions );
         
-        JsonRepresentation links = JsonRepresentation.newArray();
+        JsonRepresentation links = getLinks();
         addLinksFormalDomainModel(links, resourceContext);
         addLinksIsisProprietary(links, resourceContext);
-        withLinks(links);
 
         return representation;
     }

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectCollectionReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectCollectionReprRenderer.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectCollectionReprRenderer.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectCollectionReprRenderer.java
Mon Oct 24 17:32:15 2011
@@ -65,10 +65,9 @@ public class ObjectCollectionReprRendere
         putExtensionsIsisProprietary(extensions);
         withExtensions(extensions );
         
-        JsonRepresentation links = JsonRepresentation.newArray();
+        JsonRepresentation links = getLinks();
         addLinksFormalDomainModel(links, resourceContext);
         addLinksIsisProprietary(links, resourceContext);
-        withLinks(links);
 
         return representation;
     }

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectPropertyReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectPropertyReprRenderer.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectPropertyReprRenderer.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectPropertyReprRenderer.java
Mon Oct 24 17:32:15 2011
@@ -66,10 +66,9 @@ public class ObjectPropertyReprRenderer 
         putExtensionsIsisProprietary(extensions);
         withExtensions(extensions );
         
-        JsonRepresentation links = JsonRepresentation.newArray();
+        JsonRepresentation links = getLinks();
         addLinksFormalDomainModel(links, resourceContext);
         addLinksIsisProprietary(links, resourceContext);
-        withLinks(links);
 
         return representation;
     }

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ScalarValueReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ScalarValueReprRenderer.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ScalarValueReprRenderer.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ScalarValueReprRenderer.java
Mon Oct 24 17:32:15 2011
@@ -65,10 +65,9 @@ public class ScalarValueReprRenderer ext
         putExtensionsIsisProprietary(extensions);
         withExtensions(extensions );
         
-        JsonRepresentation links = JsonRepresentation.newArray();
+        JsonRepresentation links = getLinks();
         addLinksFormalDomainModel(links, resourceContext);
         addLinksIsisProprietary(links, resourceContext);
-        withLinks(links);
 
         return representation;
     }

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/home/HomePageReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/home/HomePageReprRenderer.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/home/HomePageReprRenderer.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/home/HomePageReprRenderer.java
Mon Oct 24 17:32:15 2011
@@ -64,26 +64,20 @@ public class HomePageReprRenderer extend
         
         // self
         if(includesSelf) {
-            putLinkToSelf(representation);
+            addLinkToSelf(representation);
         }
 
-        // user
-        putLinkToUser(representation);
+        addLinkToUser();
+        addLinkToServices();
+        addLinkToCapabilities();
 
-        // services
-        putLinkToServices(representation);
-        
-        // capabilities
-        putLinkToCapabilities(representation);
-
-        // links and extensions
-        representation.mapPut("links", JsonRepresentation.newArray());
+        // inks and extensions
         representation.mapPut("extensions", JsonRepresentation.newMap());
 
         return representation;
     }
 
-    private void putLinkToSelf(JsonRepresentation representation) {
+    private void addLinkToSelf(JsonRepresentation representation) {
         final LinkBuilder linkBuilder = LinkBuilder.newBuilder(resourceContext, Rel.SELF,
getRepresentationType(), "");
 
         final LinkFollower linkFollower = getLinkFollower().follow("self");
@@ -95,10 +89,10 @@ public class HomePageReprRenderer extend
             
             linkBuilder.withValue(renderer.render());
         }
-        representation.mapPut("self", linkBuilder.build());
+        getLinks().arrayAdd(linkBuilder.build());
     }
 
-    private void putLinkToCapabilities(final JsonRepresentation representation) {
+    private void addLinkToCapabilities() {
         final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getResourceContext(), Rel.CAPABILITIES,
RepresentationType.CAPABILITIES, "capabilities");
         
         final LinkFollower linkFollower = getLinkFollower().follow("capabilities");
@@ -110,10 +104,10 @@ public class HomePageReprRenderer extend
             linkBuilder.withValue(renderer.render());
         }
         
-        representation.mapPut("capabilities", linkBuilder.build());
+        getLinks().arrayAdd(linkBuilder.build());
     }
 
-    private void putLinkToServices(JsonRepresentation representation) {
+    private void addLinkToServices() {
 
         final LinkBuilder linkBuilder = 
                 LinkBuilder.newBuilder(getResourceContext(), Rel.SERVICES, RepresentationType.LIST,
"services");
@@ -133,10 +127,10 @@ public class HomePageReprRenderer extend
             linkBuilder.withValue(renderer.render());
         }
         
-        representation.mapPut("services", linkBuilder.build());
+        getLinks().arrayAdd(linkBuilder.build());
     }
 
-    private void putLinkToUser(JsonRepresentation representation) {
+    private void addLinkToUser() {
         final LinkBuilder userLinkBuilder = 
                 LinkBuilder.newBuilder(getResourceContext(), Rel.USER, RepresentationType.USER,
"user");
         
@@ -150,7 +144,7 @@ public class HomePageReprRenderer extend
             userLinkBuilder.withValue(renderer.render());
         }
         
-        representation.mapPut("user", userLinkBuilder.build());
+        getLinks().arrayAdd(userLinkBuilder.build());
     }
 
 }
\ No newline at end of file

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserReprRenderer.java?rev=1188250&r1=1188249&r2=1188250&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserReprRenderer.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserReprRenderer.java
Mon Oct 24 17:32:15 2011
@@ -58,7 +58,6 @@ public class UserReprRenderer extends Re
         if(includesSelf) {
             withSelf("user");
         }
-        withLinks();
         withExtensions();
         return representation;
     }



Mime
View raw message