incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1188379 [2/2] - in /incubator/isis/trunk/framework/viewer/json: json-applib/src/main/java/org/apache/isis/viewer/json/applib/ json-applib/src/main/java/org/apache/isis/viewer/json/applib/capabilities/ json-applib/src/main/java/org/apache/i...
Date Mon, 24 Oct 2011 21:05:18 GMT
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=1188379&r1=1188378&r2=1188379&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 21:05:17 2011
@@ -61,9 +61,8 @@ public class ObjectActionReprRenderer ex
         
         putDisabledReasonIfDisabled();
         
-        JsonRepresentation extensions = JsonRepresentation.newMap();
+        JsonRepresentation extensions = getExtensions();
         putExtensionsIsisProprietary(extensions);
-        withExtensions(extensions );
         
         JsonRepresentation links = getLinks();
         addLinksFormalDomainModel(links, resourceContext);
@@ -103,12 +102,12 @@ public class ObjectActionReprRenderer ex
         
         final String mutator = semantics.getInvokeKey();
         final MutatorSpec mutatorSpec = mutators.get(mutator);
-        appendInvokeLink(mutatorSpec);
+        addInvokeLinkIfMutator(mutatorSpec);
         
         return cast(this);
     }
 
-    private void appendInvokeLink(MutatorSpec mutatorSpec) {
+    private void addInvokeLinkIfMutator(MutatorSpec mutatorSpec) {
         if(!hasMemberFacet(mutatorSpec.mutatorFacetType)) {
             return;
         } 
@@ -118,7 +117,7 @@ public class ObjectActionReprRenderer ex
                 .withHttpMethod(mutatorSpec.httpMethod)
                 .withArguments(arguments)
                 .build();
-        representation.mapPut("invoke", detailsLink);
+        getLinks().arrayAdd(detailsLink);
     }
     
 	private ObjectAdapter contributingServiceAdapter() {

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAdapterLinkTo.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/ObjectAdapterLinkTo.java?rev=1188379&r1=1188378&r2=1188379&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAdapterLinkTo.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAdapterLinkTo.java
Mon Oct 24 21:05:17 2011
@@ -29,6 +29,8 @@ public interface ObjectAdapterLinkTo {
     ObjectAdapterLinkTo usingResourceContext(ResourceContext resourceContext);
     
     ObjectAdapterLinkTo with(ObjectAdapter objectAdapter);
+
+    ObjectAdapterLinkTo with(Rel rel);
 
     LinkBuilder builder();
 

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=1188379&r1=1188378&r2=1188379&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 21:05:17 2011
@@ -61,9 +61,8 @@ public class ObjectCollectionReprRendere
         
         putDisabledReasonIfDisabled();
         
-        JsonRepresentation extensions = JsonRepresentation.newMap();
+        JsonRepresentation extensions = getExtensions();
         putExtensionsIsisProprietary(extensions);
-        withExtensions(extensions );
         
         JsonRepresentation links = getLinks();
         addLinksFormalDomainModel(links, resourceContext);

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=1188379&r1=1188378&r2=1188379&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 21:05:17 2011
@@ -62,9 +62,8 @@ public class ObjectPropertyReprRenderer 
 
         putDisabledReasonIfDisabled();
 
-        JsonRepresentation extensions = JsonRepresentation.newMap();
+        JsonRepresentation extensions = getExtensions();
         putExtensionsIsisProprietary(extensions);
-        withExtensions(extensions );
         
         JsonRepresentation links = getLinks();
         addLinksFormalDomainModel(links, resourceContext);

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=1188379&r1=1188378&r2=1188379&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 21:05:17 2011
@@ -61,9 +61,8 @@ public class ScalarValueReprRenderer ext
     @Override
     public JsonRepresentation render() {
  
-        JsonRepresentation extensions = JsonRepresentation.newMap();
+        JsonRepresentation extensions = getExtensions();
         putExtensionsIsisProprietary(extensions);
-        withExtensions(extensions );
         
         JsonRepresentation links = getLinks();
         addLinksFormalDomainModel(links, resourceContext);

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/AbstractTypeFeatureReprBuilder.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/domaintypes/AbstractTypeFeatureReprBuilder.java?rev=1188379&r1=1188378&r2=1188379&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/AbstractTypeFeatureReprBuilder.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/AbstractTypeFeatureReprBuilder.java
Mon Oct 24 21:05:17 2011
@@ -59,19 +59,43 @@ public abstract class AbstractTypeFeatur
         objectSpecification = specAndFeature.getObjectSpecification();
         objectFeature = specAndFeature.getObjectFeature();
         memberType = MemberType.determineFrom(objectFeature);
+        
+        // done eagerly so can use as criteria for x-ro-follow-links
+        putIdIfMember();
+        putMemberTypeIfMember();
+
         return cast(this);
     }
-    
+
+    protected void putIdIfMember() {
+        if(memberType == null) {
+            return;
+        } 
+        ObjectMember objectMember = (ObjectMember) objectFeature;
+        representation.mapPut(memberType.getJsProp(), objectMember.getId());
+    }
+
+    protected void putMemberTypeIfMember() {
+        if(memberType == null) {
+            return;
+        } 
+        representation.mapPut("memberType", memberType.getName());
+    }
+
     
     protected void includeSelfIfRequired() {
         if(!includesSelf) {
             return;
         } 
         
-        representation.mapPut("self", 
-            LinkBuilder.newBuilder(getResourceContext(), Rel.SELF, getRepresentationType(),
"domainTypes/%s/%s/%s", 
-                    getObjectSpecification().getFullIdentifier(), getMemberType().getUrlPart(),
((ObjectMember)getObjectFeature()).getId()).build());
+        final ObjectMember objectMember = (ObjectMember)getObjectFeature();
+        final LinkBuilder linkBuilder = LinkBuilder.newBuilder(
+                getResourceContext(), Rel.SELF, getRepresentationType(), 
+                "domainTypes/%s/%s/%s", 
+                getObjectSpecification().getFullIdentifier(), 
+                getMemberType().getUrlPart(), 
+                objectMember.getId());
+        getLinks().arrayAdd(linkBuilder.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/domaintypes/DomainTypeResourceServerside.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/domaintypes/DomainTypeResourceServerside.java?rev=1188379&r1=1188378&r2=1188379&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/DomainTypeResourceServerside.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/DomainTypeResourceServerside.java
Mon Oct 24 21:05:17 2011
@@ -49,7 +49,6 @@ import org.apache.isis.viewer.json.viewe
 @Path("/domainTypes")
 public class DomainTypeResourceServerside extends ResourceAbstract implements DomainTypeResource
{
 
-
     @GET
     @Path("/")
     @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_DOMAIN_TYPES
})

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=1188379&r1=1188378&r2=1188379&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 21:05:17 2011
@@ -80,7 +80,7 @@ public class HomePageReprRenderer extend
     private void addLinkToSelf(JsonRepresentation representation) {
         final LinkBuilder linkBuilder = LinkBuilder.newBuilder(resourceContext, Rel.SELF,
getRepresentationType(), "");
 
-        final LinkFollower linkFollower = getLinkFollower().follow("self");
+        final LinkFollower linkFollower = getLinkFollower().follow("links[rel=self]");
         if(linkFollower.isFollowing()) {
 
             final RendererFactory factory = RendererFactoryRegistry.instance.find(RepresentationType.HOME_PAGE);
@@ -95,7 +95,7 @@ public class HomePageReprRenderer extend
     private void addLinkToCapabilities() {
         final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getResourceContext(), Rel.CAPABILITIES,
RepresentationType.CAPABILITIES, "capabilities");
         
-        final LinkFollower linkFollower = getLinkFollower().follow("capabilities");
+        final LinkFollower linkFollower = getLinkFollower().follow("links[rel=capabilities]");
         if(linkFollower.isFollowing()) {
 
             final RendererFactory factory = RendererFactoryRegistry.instance.find(RepresentationType.CAPABILITIES);
@@ -112,7 +112,7 @@ public class HomePageReprRenderer extend
         final LinkBuilder linkBuilder = 
                 LinkBuilder.newBuilder(getResourceContext(), Rel.SERVICES, RepresentationType.LIST,
"services");
         
-        final LinkFollower linkFollower = getLinkFollower().follow("services");
+        final LinkFollower linkFollower = getLinkFollower().follow("links[rel=services]");
         if(linkFollower.isFollowing()) {
             
             final List<ObjectAdapter> serviceAdapters = getResourceContext().getPersistenceSession().getServices();
@@ -134,7 +134,7 @@ public class HomePageReprRenderer extend
         final LinkBuilder userLinkBuilder = 
                 LinkBuilder.newBuilder(getResourceContext(), Rel.USER, RepresentationType.USER,
"user");
         
-        final LinkFollower linkFollower = getLinkFollower().follow("user");
+        final LinkFollower linkFollower = getLinkFollower().follow("links[rel=user]");
         if(linkFollower.isFollowing()) {
             final RendererFactory factory = RendererFactoryRegistry.instance.find(RepresentationType.USER);
             final UserReprRenderer renderer = 

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=1188379&r1=1188378&r2=1188379&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 21:05:17 2011
@@ -45,7 +45,7 @@ public class UserReprRenderer extends Re
 
     @Override
     public UserReprRenderer with(AuthenticationSession authenticationSession) {
-        representation.mapPut("username", authenticationSession.getUserName());
+        representation.mapPut("userName", authenticationSession.getUserName());
         JsonRepresentation roles = JsonRepresentation.newArray();
         for (String role : authenticationSession.getRoles()) {
             roles.arrayAdd(role);
@@ -58,7 +58,7 @@ public class UserReprRenderer extends Re
         if(includesSelf) {
             withSelf("user");
         }
-        withExtensions();
+        getExtensions();
         return representation;
     }
 



Mime
View raw message