isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1234460 [21/30] - in /incubator/isis/trunk/framework/viewer: bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/ bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/components/ bdd/common/src/main/java/org/apache/isis/viewer...
Date Sun, 22 Jan 2012 08:05:57 GMT
Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceResourceServerside.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/DomainServiceResourceServerside.java?rev=1234460&r1=1234459&r2=1234460&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceResourceServerside.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/DomainServiceResourceServerside.java Sun Jan 22 08:05:17 2012
@@ -18,7 +18,6 @@ package org.apache.isis.viewer.json.view
 
 import java.io.InputStream;
 import java.util.List;
-import java.util.Map;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
@@ -27,7 +26,6 @@ import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
@@ -42,65 +40,56 @@ import org.apache.isis.viewer.json.viewe
 import org.apache.isis.viewer.json.viewer.resources.domainobjects.DomainResourceHelper.MemberMode;
 
 @Path("/services")
-public class DomainServiceResourceServerside extends ResourceAbstract implements
-        DomainServiceResource {
+public class DomainServiceResourceServerside extends ResourceAbstract implements DomainServiceResource {
 
     @Override
     @GET
     @Path("/")
     @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_LIST, RestfulMediaType.APPLICATION_JSON_ERROR })
     public Response services() {
-        RepresentationType representationType = RepresentationType.LIST;
+        final RepresentationType representationType = RepresentationType.LIST;
         init(representationType);
 
         final List<ObjectAdapter> serviceAdapters = getResourceContext().getPersistenceSession().getServices();
 
         final RendererFactory factory = RendererFactoryRegistry.instance.find(representationType);
-        
+
         final ListReprRenderer renderer = (ListReprRenderer) factory.newRenderer(getResourceContext(), null, JsonRepresentation.newMap());
-        renderer.usingLinkToBuilder(new DomainServiceLinkTo())
-                .withSelf("services")
-                .with(serviceAdapters);
-        
+        renderer.usingLinkToBuilder(new DomainServiceLinkTo()).withSelf("services").with(serviceAdapters);
+
         return responseOfOk(renderer, Caching.ONE_DAY).build();
     }
 
-    ////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////
     // domain service
-    ////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////
 
+    @Override
     @GET
     @Path("/{serviceId}")
     @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_DOMAIN_OBJECT, RestfulMediaType.APPLICATION_JSON_ERROR })
-    public Response service(
-            @PathParam("serviceId") String serviceId) {
+    public Response service(@PathParam("serviceId") final String serviceId) {
         init(RepresentationType.DOMAIN_OBJECT);
-        
+
         final ObjectAdapter serviceAdapter = getServiceAdapter(serviceId);
-        
-        final RendererFactory rendererFactory = 
-                rendererFactoryRegistry.find(RepresentationType.DOMAIN_OBJECT);
-        
-        final DomainObjectReprRenderer renderer = 
-                (DomainObjectReprRenderer) rendererFactory.newRenderer(getResourceContext(), null, JsonRepresentation.newMap());
-        renderer.usingLinkToBuilder(new DomainServiceLinkTo())
-                    .with(serviceAdapter)
-                    .includesSelf();
+
+        final RendererFactory rendererFactory = rendererFactoryRegistry.find(RepresentationType.DOMAIN_OBJECT);
+
+        final DomainObjectReprRenderer renderer = (DomainObjectReprRenderer) rendererFactory.newRenderer(getResourceContext(), null, JsonRepresentation.newMap());
+        renderer.usingLinkToBuilder(new DomainServiceLinkTo()).with(serviceAdapter).includesSelf();
 
         return responseOfOk(renderer, Caching.ONE_DAY).build();
     }
 
-
-    ////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////
     // domain service property
-    ////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////
 
+    @Override
     @GET
     @Path("/{serviceId}/properties/{propertyId}")
     @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_PROPERTY, RestfulMediaType.APPLICATION_JSON_ERROR })
-    public Response propertyDetails(
-            @PathParam("serviceId") final String serviceId,
-            @PathParam("propertyId") final String propertyId) {
+    public Response propertyDetails(@PathParam("serviceId") final String serviceId, @PathParam("propertyId") final String propertyId) {
         init(RepresentationType.OBJECT_PROPERTY);
 
         final ObjectAdapter serviceAdapter = getServiceAdapter(serviceId);
@@ -109,18 +98,15 @@ public class DomainServiceResourceServer
         return helper.propertyDetails(serviceAdapter, propertyId, MemberMode.NOT_MUTATING, Caching.ONE_DAY);
     }
 
-
-
-    ////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////
     // domain service action
-    ////////////////////////////////////////////////////////////
-    
+    // //////////////////////////////////////////////////////////
+
+    @Override
     @GET
     @Path("/{serviceId}/actions/{actionId}")
     @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_OBJECT_ACTION, RestfulMediaType.APPLICATION_JSON_ERROR })
-    public Response actionPrompt(
-            @PathParam("serviceId") final String serviceId, 
-            @PathParam("actionId") final String actionId) {
+    public Response actionPrompt(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId) {
         init(RepresentationType.OBJECT_ACTION);
 
         final ObjectAdapter serviceAdapter = getServiceAdapter(serviceId);
@@ -129,35 +115,32 @@ public class DomainServiceResourceServer
         return helper.actionPrompt(actionId);
     }
 
-    
-    ////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////
     // domain service action invoke
-    ////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////
 
+    @Override
     @GET
     @Path("/{serviceId}/actions/{actionId}/invoke")
     @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
-    public Response invokeActionQueryOnly(
-            @PathParam("serviceId") final String serviceId, 
-            @PathParam("actionId") final String actionId) {
+    public Response invokeActionQueryOnly(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId) {
         init(RepresentationType.ACTION_RESULT);
-        
+
         final JsonRepresentation arguments = getResourceContext().getQueryStringAsJsonRepr();
-        
+
         final ObjectAdapter serviceAdapter = getServiceAdapter(serviceId);
         final DomainResourceHelper helper = new DomainResourceHelper(getResourceContext(), serviceAdapter).using(new DomainServiceLinkTo());
 
         return helper.invokeActionQueryOnly(actionId, arguments);
     }
 
+    @Override
     @PUT
     @Path("/{serviceId}/actions/{actionId}/invoke")
-    @Consumes({ MediaType.WILDCARD })   // to save the client having to specify a Content-Type: application/json
+    @Consumes({ MediaType.WILDCARD })
+    // to save the client having to specify a Content-Type: application/json
     @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
-    public Response invokeActionIdempotent(
-            @PathParam("serviceId") final String serviceId, 
-            @PathParam("actionId") final String actionId,
-            final InputStream arguments) {
+    public Response invokeActionIdempotent(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId, final InputStream arguments) {
         init(RepresentationType.ACTION_RESULT);
 
         final ObjectAdapter serviceAdapter = getServiceAdapter(serviceId);
@@ -166,14 +149,13 @@ public class DomainServiceResourceServer
         return helper.invokeActionIdempotent(actionId, arguments);
     }
 
+    @Override
     @POST
     @Path("/{serviceId}/actions/{actionId}/invoke")
-    @Consumes({ MediaType.WILDCARD })   // to save the client having to specify a Content-Type: application/json
+    @Consumes({ MediaType.WILDCARD })
+    // to save the client having to specify a Content-Type: application/json
     @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_ACTION_RESULT, RestfulMediaType.APPLICATION_JSON_ERROR })
-    public Response invokeAction(
-            @PathParam("serviceId") final String serviceId, 
-            @PathParam("actionId") final String actionId,
-            final InputStream arguments) {
+    public Response invokeAction(@PathParam("serviceId") final String serviceId, @PathParam("actionId") final String actionId, final InputStream arguments) {
         init(RepresentationType.ACTION_RESULT);
 
         final ObjectAdapter serviceAdapter = getServiceAdapter(serviceId);

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/JsonValueEncoder.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/JsonValueEncoder.java?rev=1234460&r1=1234459&r2=1234460&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/JsonValueEncoder.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/JsonValueEncoder.java Sun Jan 22 08:05:17 2012
@@ -16,8 +16,8 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.json.viewer.resources.domainobjects;
-
+package org.apache.isis.viewer.json.viewer.resources.domainobjects;
+
 import java.math.BigDecimal;
 import java.math.BigInteger;
 
@@ -25,205 +25,200 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.viewer.json.applib.JsonRepresentation;
-
-/**
- * Similar to Isis' value encoding, but with additional support for JSON primitives. 
- */
-public final class JsonValueEncoder {
-
-    static class ExpectedStringRepresentingValueException extends IllegalArgumentException {
-        private static final long serialVersionUID = 1L;
-    }
-
-    public ObjectAdapter asAdapter(final ObjectSpecification objectSpec, final JsonRepresentation representation) {
-        if(objectSpec == null) {
-            throw new IllegalArgumentException("objectSpec cannot be null");
-        }
-        final EncodableFacet encodableFacet = objectSpec.getFacet(EncodableFacet.class);
-        if(encodableFacet == null) {
-            throw new IllegalArgumentException("objectSpec expected to have EncodableFacet");
-        }
-        if(representation == null) {
-            throw new IllegalArgumentException("representation cannot be null");
-        }
-        if(!representation.isValue()) {
-            throw new IllegalArgumentException("representation must be of a value");
-        }
-
-        // special case handling for JSON built-ins
-        if(isBoolean(objectSpec)) {
-            if(!representation.isBoolean()) {
-                throwIncompatibleException(objectSpec, representation);
-            } 
-            String argStr = ""+representation.asBoolean();
-            return encodableFacet.fromEncodedString(argStr);
-        }
-        
-        if(isInteger(objectSpec)) {
-            if(representation.isInt()) {
-                String argStr = ""+representation.asInt();
+
+/**
+ * Similar to Isis' value encoding, but with additional support for JSON
+ * primitives.
+ */
+public final class JsonValueEncoder {
+
+    static class ExpectedStringRepresentingValueException extends IllegalArgumentException {
+        private static final long serialVersionUID = 1L;
+    }
+
+    public ObjectAdapter asAdapter(final ObjectSpecification objectSpec, final JsonRepresentation representation) {
+        if (objectSpec == null) {
+            throw new IllegalArgumentException("objectSpec cannot be null");
+        }
+        final EncodableFacet encodableFacet = objectSpec.getFacet(EncodableFacet.class);
+        if (encodableFacet == null) {
+            throw new IllegalArgumentException("objectSpec expected to have EncodableFacet");
+        }
+        if (representation == null) {
+            throw new IllegalArgumentException("representation cannot be null");
+        }
+        if (!representation.isValue()) {
+            throw new IllegalArgumentException("representation must be of a value");
+        }
+
+        // special case handling for JSON built-ins
+        if (isBoolean(objectSpec)) {
+            if (!representation.isBoolean()) {
+                throwIncompatibleException(objectSpec, representation);
+            }
+            final String argStr = "" + representation.asBoolean();
+            return encodableFacet.fromEncodedString(argStr);
+        }
+
+        if (isInteger(objectSpec)) {
+            if (representation.isInt()) {
+                final String argStr = "" + representation.asInt();
                 return encodableFacet.fromEncodedString(argStr);
-            } 
+            }
             // best effort
-            if(representation.isString()) {
-                String argStr = representation.asString();
+            if (representation.isString()) {
+                final String argStr = representation.asString();
                 return encodableFacet.fromEncodedString(argStr);
             }
             // give up
-            throwIncompatibleException(objectSpec, representation);
-        }
-        
-        if(isLong(objectSpec)) {
-            if(!representation.isLong()) {
-                throwIncompatibleException(objectSpec, representation);
-            } 
-            String argStr = ""+representation.asLong();
-            return encodableFacet.fromEncodedString(argStr);
-        }
-        
-        if(isBigInteger(objectSpec)) {
-            if(representation.isBigInteger()) {
-                String argStr = ""+representation.asBigInteger();
+            throwIncompatibleException(objectSpec, representation);
+        }
+
+        if (isLong(objectSpec)) {
+            if (!representation.isLong()) {
+                throwIncompatibleException(objectSpec, representation);
+            }
+            final String argStr = "" + representation.asLong();
+            return encodableFacet.fromEncodedString(argStr);
+        }
+
+        if (isBigInteger(objectSpec)) {
+            if (representation.isBigInteger()) {
+                final String argStr = "" + representation.asBigInteger();
                 return encodableFacet.fromEncodedString(argStr);
             }
             // best effort
-            if(representation.isLong()) {
-                String argStr = ""+representation.asLong();
+            if (representation.isLong()) {
+                final String argStr = "" + representation.asLong();
                 return encodableFacet.fromEncodedString(argStr);
-            } 
-            if(representation.isInt()) {
-                String argStr = ""+representation.asInt();
-                return encodableFacet.fromEncodedString(argStr);
-            } 
-            if(representation.isString()) {
-                String argStr = representation.asString();
+            }
+            if (representation.isInt()) {
+                final String argStr = "" + representation.asInt();
+                return encodableFacet.fromEncodedString(argStr);
+            }
+            if (representation.isString()) {
+                final String argStr = representation.asString();
                 return encodableFacet.fromEncodedString(argStr);
             }
             // give up
-            throwIncompatibleException(objectSpec, representation);
-        }
-        
-        if(isBigDecimal(objectSpec)) {
-            if(representation.isBigDecimal()) { 
-                String argStr = ""+representation.asBigDecimal();
+            throwIncompatibleException(objectSpec, representation);
+        }
+
+        if (isBigDecimal(objectSpec)) {
+            if (representation.isBigDecimal()) {
+                final String argStr = "" + representation.asBigDecimal();
                 return encodableFacet.fromEncodedString(argStr);
-            } 
+            }
             // best effort
-            if(representation.isBigInteger()) { 
-                String argStr = ""+representation.asBigInteger();
+            if (representation.isBigInteger()) {
+                final String argStr = "" + representation.asBigInteger();
                 return encodableFacet.fromEncodedString(argStr);
-            } 
-            if(representation.isDouble()) {
-                String argStr = ""+representation.asDouble();
+            }
+            if (representation.isDouble()) {
+                final String argStr = "" + representation.asDouble();
                 return encodableFacet.fromEncodedString(argStr);
             }
-            if(representation.isLong()) {
-                String argStr = ""+representation.asLong();
+            if (representation.isLong()) {
+                final String argStr = "" + representation.asLong();
                 return encodableFacet.fromEncodedString(argStr);
-            } 
-            if(representation.isInt()) {
-                String argStr = ""+representation.asInt();
+            }
+            if (representation.isInt()) {
+                final String argStr = "" + representation.asInt();
                 return encodableFacet.fromEncodedString(argStr);
-            } 
-            if(representation.isString()) {
-                String argStr = representation.asString();
+            }
+            if (representation.isString()) {
+                final String argStr = representation.asString();
                 return encodableFacet.fromEncodedString(argStr);
             }
             // give up
-            throwIncompatibleException(objectSpec, representation);
-        }
-        
-        if(isDouble(objectSpec)) {
-            if(representation.isDouble()) {
-                String argStr = ""+representation.asDouble();
+            throwIncompatibleException(objectSpec, representation);
+        }
+
+        if (isDouble(objectSpec)) {
+            if (representation.isDouble()) {
+                final String argStr = "" + representation.asDouble();
                 return encodableFacet.fromEncodedString(argStr);
-            } 
+            }
             // best effort
-            if(representation.isLong()) {
-                String argStr = ""+representation.asLong();
+            if (representation.isLong()) {
+                final String argStr = "" + representation.asLong();
                 return encodableFacet.fromEncodedString(argStr);
-            } 
-            if(representation.isInt()) {
-                String argStr = ""+representation.asInt();
-                return encodableFacet.fromEncodedString(argStr);
-            } 
-            if(representation.isString()) {
-                String argStr = representation.asString();
+            }
+            if (representation.isInt()) {
+                final String argStr = "" + representation.asInt();
+                return encodableFacet.fromEncodedString(argStr);
+            }
+            if (representation.isString()) {
+                final String argStr = representation.asString();
                 return encodableFacet.fromEncodedString(argStr);
             }
             // give up
-            throwIncompatibleException(objectSpec, representation);
-        }
-        
-        if(!representation.isString()) {
-            throw new ExpectedStringRepresentingValueException();
-        }
-        String argStr = representation.asString();
-        return encodableFacet.fromEncodedString(argStr);
-    }
-
-    public Object asObject(ObjectAdapter objectAdapter) {
-        if(objectAdapter == null) {
-            throw new IllegalArgumentException("objectAdapter cannot be null");
-        }
-        final ObjectSpecification objectSpec = objectAdapter.getSpecification();
-
-        // special case handling for JSON built-ins (at least so far as json.org defines them).
-        if(     isBoolean(objectSpec) || 
-                isInteger(objectSpec) || 
-                isLong(objectSpec) || 
-                isBigInteger(objectSpec) || 
-                isDouble(objectSpec) || 
-                isBigDecimal(objectSpec) ) {
-            // simply return
-            return objectAdapter.getObject();
-        }
-        
-        final EncodableFacet encodableFacet = objectSpec.getFacet(EncodableFacet.class);
-        if(encodableFacet == null) {
-            throw new IllegalArgumentException("objectSpec expected to have EncodableFacet");
-        }
-        return encodableFacet.toEncodedString(objectAdapter);
-    }
-
-    
-    private boolean isBoolean(final ObjectSpecification objectSpec) {
-        return hasCorrespondingClass(objectSpec, boolean.class, Boolean.class);
-    }
-
-    private boolean isInteger(final ObjectSpecification objectSpec) {
-        return hasCorrespondingClass(objectSpec, int.class, Integer.class);
-    }
-
-    private boolean isLong(final ObjectSpecification objectSpec) {
-        return hasCorrespondingClass(objectSpec, long.class, Long.class);
-    }
-
-    private boolean isBigInteger(final ObjectSpecification objectSpec) {
-        return hasCorrespondingClass(objectSpec, BigInteger.class);
-    }
-
-    private boolean isDouble(final ObjectSpecification objectSpec) {
-        return hasCorrespondingClass(objectSpec, double.class, Double.class);
-    }
-    
-    private boolean isBigDecimal(final ObjectSpecification objectSpec) {
-        return hasCorrespondingClass(objectSpec, BigDecimal.class);
-    }
-
-
-    private boolean hasCorrespondingClass(ObjectSpecification objectSpec, Class<?>... candidates) {
-        final Class<?> specClass = objectSpec.getCorrespondingClass();
-        for(final Class<?> candidate: candidates) {
-            if(specClass == candidate) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private void throwIncompatibleException(final ObjectSpecification objectSpec, final JsonRepresentation representation) {
-        throw new IllegalArgumentException(String.format("representation '%s' incompatible with objectSpec '%s'", representation.toString(), objectSpec.getCorrespondingClass().getName()));
-    }
-
-}
+            throwIncompatibleException(objectSpec, representation);
+        }
+
+        if (!representation.isString()) {
+            throw new ExpectedStringRepresentingValueException();
+        }
+        final String argStr = representation.asString();
+        return encodableFacet.fromEncodedString(argStr);
+    }
+
+    public Object asObject(final ObjectAdapter objectAdapter) {
+        if (objectAdapter == null) {
+            throw new IllegalArgumentException("objectAdapter cannot be null");
+        }
+        final ObjectSpecification objectSpec = objectAdapter.getSpecification();
+
+        // special case handling for JSON built-ins (at least so far as json.org
+        // defines them).
+        if (isBoolean(objectSpec) || isInteger(objectSpec) || isLong(objectSpec) || isBigInteger(objectSpec) || isDouble(objectSpec) || isBigDecimal(objectSpec)) {
+            // simply return
+            return objectAdapter.getObject();
+        }
+
+        final EncodableFacet encodableFacet = objectSpec.getFacet(EncodableFacet.class);
+        if (encodableFacet == null) {
+            throw new IllegalArgumentException("objectSpec expected to have EncodableFacet");
+        }
+        return encodableFacet.toEncodedString(objectAdapter);
+    }
+
+    private boolean isBoolean(final ObjectSpecification objectSpec) {
+        return hasCorrespondingClass(objectSpec, boolean.class, Boolean.class);
+    }
+
+    private boolean isInteger(final ObjectSpecification objectSpec) {
+        return hasCorrespondingClass(objectSpec, int.class, Integer.class);
+    }
+
+    private boolean isLong(final ObjectSpecification objectSpec) {
+        return hasCorrespondingClass(objectSpec, long.class, Long.class);
+    }
+
+    private boolean isBigInteger(final ObjectSpecification objectSpec) {
+        return hasCorrespondingClass(objectSpec, BigInteger.class);
+    }
+
+    private boolean isDouble(final ObjectSpecification objectSpec) {
+        return hasCorrespondingClass(objectSpec, double.class, Double.class);
+    }
+
+    private boolean isBigDecimal(final ObjectSpecification objectSpec) {
+        return hasCorrespondingClass(objectSpec, BigDecimal.class);
+    }
+
+    private boolean hasCorrespondingClass(final ObjectSpecification objectSpec, final Class<?>... candidates) {
+        final Class<?> specClass = objectSpec.getCorrespondingClass();
+        for (final Class<?> candidate : candidates) {
+            if (specClass == candidate) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private void throwIncompatibleException(final ObjectSpecification objectSpec, final JsonRepresentation representation) {
+        throw new IllegalArgumentException(String.format("representation '%s' incompatible with objectSpec '%s'", representation.toString(), objectSpec.getCorrespondingClass().getName()));
+    }
+
+}

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=1234460&r1=1234459&r2=1234460&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 Sun Jan 22 08:05:17 2012
@@ -39,7 +39,7 @@ public class ListReprRenderer extends Re
         }
 
         @Override
-        public ReprRenderer<?, ?> newRenderer(ResourceContext resourceContext, LinkFollower linkFollower, JsonRepresentation representation) {
+        public ReprRenderer<?, ?> newRenderer(final ResourceContext resourceContext, final LinkFollower linkFollower, final JsonRepresentation representation) {
             return new ListReprRenderer(resourceContext, linkFollower, getRepresentationType(), representation);
         }
     }
@@ -49,65 +49,64 @@ public class ListReprRenderer extends Re
     private ObjectSpecification elementType;
     private ObjectSpecification returnType;
 
-    private ListReprRenderer(ResourceContext resourceContext, LinkFollower linkFollower, RepresentationType representationType, JsonRepresentation representation) {
+    private ListReprRenderer(final ResourceContext resourceContext, final LinkFollower linkFollower, final RepresentationType representationType, final JsonRepresentation representation) {
         super(resourceContext, linkFollower, representationType, representation);
         usingLinkToBuilder(new DomainObjectLinkTo());
     }
-    
-    public ListReprRenderer usingLinkToBuilder(ObjectAdapterLinkTo objectAdapterLinkToBuilder) {
+
+    public ListReprRenderer usingLinkToBuilder(final ObjectAdapterLinkTo objectAdapterLinkToBuilder) {
         this.linkTo = objectAdapterLinkToBuilder.usingResourceContext(resourceContext);
         return this;
     }
 
     @Override
-    public ListReprRenderer with(Collection<ObjectAdapter> objectAdapters) {
+    public ListReprRenderer with(final Collection<ObjectAdapter> objectAdapters) {
         this.objectAdapters = objectAdapters;
         return this;
     }
 
-    public ListReprRenderer withReturnType(ObjectSpecification returnType) {
+    public ListReprRenderer withReturnType(final ObjectSpecification returnType) {
         this.returnType = returnType;
         return this;
     }
 
-    public ListReprRenderer withElementType(ObjectSpecification elementType) {
+    public ListReprRenderer withElementType(final ObjectSpecification elementType) {
         this.elementType = elementType;
         return this;
     }
 
+    @Override
     public JsonRepresentation render() {
         addValue();
-        
+
         addLink(Rel.RETURN_TYPE, returnType);
         addLink(Rel.ELEMENT_TYPE, elementType);
-        
+
         getExtensions();
 
         return representation;
     }
 
     private void addValue() {
-        if(objectAdapters == null) {
+        if (objectAdapters == null) {
             return;
         }
-        
-        JsonRepresentation values = JsonRepresentation.newArray();
+
+        final JsonRepresentation values = JsonRepresentation.newArray();
         final LinkFollower linkFollower = getLinkFollower().follow("value");
 
-        for(ObjectAdapter adapter: objectAdapters) {
-            JsonRepresentation linkToObject = linkTo.with(adapter).builder().build();
+        for (final ObjectAdapter adapter : objectAdapters) {
+            final JsonRepresentation linkToObject = linkTo.with(adapter).builder().build();
             values.arrayAdd(linkToObject);
 
-            if(linkFollower.matches(linkToObject)) {
+            if (linkFollower.matches(linkToObject)) {
                 final RendererFactory factory = RendererFactoryRegistry.instance.find(RepresentationType.DOMAIN_OBJECT);
-                final DomainObjectReprRenderer renderer = 
-                        (DomainObjectReprRenderer) factory.newRenderer(getResourceContext(), linkFollower, JsonRepresentation.newMap());
-                JsonRepresentation domainObject = renderer.with(adapter).render();
+                final DomainObjectReprRenderer renderer = (DomainObjectReprRenderer) factory.newRenderer(getResourceContext(), linkFollower, JsonRepresentation.newMap());
+                final JsonRepresentation domainObject = renderer.with(adapter).render();
                 linkToObject.mapPut("value", domainObject);
             }
         }
         representation.mapPut("value", values);
     }
 
-
 }
\ 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/MemberType.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/MemberType.java?rev=1234460&r1=1234459&r2=1234460&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/MemberType.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/MemberType.java Sun Jan 22 08:05:17 2012
@@ -42,39 +42,33 @@ import com.google.common.collect.Immutab
 
 public enum MemberType {
 
-    PROPERTY("properties/", "id", RepresentationType.OBJECT_PROPERTY, ImmutableMap.of(
-        "modify", MutatorSpec.of(Rel.MODIFY, PropertyValidateFacet.class, PropertySetterFacet.class, HttpMethod.PUT, BodyArgs.ONE),
-        "clear", MutatorSpec.of(Rel.CLEAR, PropertyValidateFacet.class, PropertyClearFacet.class, HttpMethod.DELETE, BodyArgs.NONE)
-        )) {
+    PROPERTY("properties/", "id", RepresentationType.OBJECT_PROPERTY, ImmutableMap.of("modify", MutatorSpec.of(Rel.MODIFY, PropertyValidateFacet.class, PropertySetterFacet.class, HttpMethod.PUT, BodyArgs.ONE), "clear",
+            MutatorSpec.of(Rel.CLEAR, PropertyValidateFacet.class, PropertyClearFacet.class, HttpMethod.DELETE, BodyArgs.NONE))) {
         @Override
-        public ObjectSpecification specFor(ObjectMember objectMember) {
+        public ObjectSpecification specFor(final ObjectMember objectMember) {
             return objectMember.getSpecification();
         }
     },
     /**
-     * {@link #getMutators()} are keyed by {@link CollectionSemantics#getAddToKey()}
+     * {@link #getMutators()} are keyed by
+     * {@link CollectionSemantics#getAddToKey()}
      */
-    COLLECTION("collections/", "id", RepresentationType.OBJECT_COLLECTION, ImmutableMap.of(
-        "addToSet", MutatorSpec.of(Rel.ADD_TO, CollectionValidateAddToFacet.class, CollectionAddToFacet.class, HttpMethod.PUT, BodyArgs.ONE),
-        "addToList", MutatorSpec.of(Rel.ADD_TO, CollectionValidateAddToFacet.class, CollectionAddToFacet.class, HttpMethod.POST, BodyArgs.ONE),
-        "removeFrom", MutatorSpec.of(Rel.REMOVE_FROM, CollectionValidateRemoveFromFacet.class, CollectionRemoveFromFacet.class, HttpMethod.DELETE, BodyArgs.ONE)
-        )) {
+    COLLECTION("collections/", "id", RepresentationType.OBJECT_COLLECTION, ImmutableMap.of("addToSet", MutatorSpec.of(Rel.ADD_TO, CollectionValidateAddToFacet.class, CollectionAddToFacet.class, HttpMethod.PUT, BodyArgs.ONE), "addToList",
+            MutatorSpec.of(Rel.ADD_TO, CollectionValidateAddToFacet.class, CollectionAddToFacet.class, HttpMethod.POST, BodyArgs.ONE), "removeFrom", MutatorSpec.of(Rel.REMOVE_FROM, CollectionValidateRemoveFromFacet.class, CollectionRemoveFromFacet.class, HttpMethod.DELETE, BodyArgs.ONE))) {
         @Override
-        public ObjectSpecification specFor(ObjectMember objectMember) {
+        public ObjectSpecification specFor(final ObjectMember objectMember) {
             return objectMember.getSpecification();
         }
     },
     /**
-     * {@link #getMutators()} are keyed by {@link ActionSemantics#getInvokeKey()}
+     * {@link #getMutators()} are keyed by
+     * {@link ActionSemantics#getInvokeKey()}
      */
-    ACTION("actions/", "id", RepresentationType.ACTION_RESULT, ImmutableMap.of(
-        "invokeQueryOnly", MutatorSpec.of(Rel.INVOKE, ActionValidationFacet.class, ActionInvocationFacet.class, HttpMethod.GET, BodyArgs.MANY, "invoke"),
-        "invokeIdempotent", MutatorSpec.of(Rel.INVOKE, ActionValidationFacet.class, ActionInvocationFacet.class, HttpMethod.PUT, BodyArgs.MANY, "invoke"),
-        "invoke", MutatorSpec.of(Rel.INVOKE, ActionValidationFacet.class, ActionInvocationFacet.class, HttpMethod.POST, BodyArgs.MANY, "invoke")
-    )) {
+    ACTION("actions/", "id", RepresentationType.ACTION_RESULT, ImmutableMap.of("invokeQueryOnly", MutatorSpec.of(Rel.INVOKE, ActionValidationFacet.class, ActionInvocationFacet.class, HttpMethod.GET, BodyArgs.MANY, "invoke"), "invokeIdempotent",
+            MutatorSpec.of(Rel.INVOKE, ActionValidationFacet.class, ActionInvocationFacet.class, HttpMethod.PUT, BodyArgs.MANY, "invoke"), "invoke", MutatorSpec.of(Rel.INVOKE, ActionValidationFacet.class, ActionInvocationFacet.class, HttpMethod.POST, BodyArgs.MANY, "invoke"))) {
         @Override
-        public ObjectSpecification specFor(ObjectMember objectMember) {
-            ObjectAction objectAction = (ObjectAction) objectMember;
+        public ObjectSpecification specFor(final ObjectMember objectMember) {
+            final ObjectAction objectAction = (ObjectAction) objectMember;
             return objectAction.getReturnType();
         }
     };
@@ -86,7 +80,7 @@ public enum MemberType {
 
     private final Map<String, MutatorSpec> mutators;
 
-    private MemberType(String urlPart, String jsProp, RepresentationType representationType, Map<String, MutatorSpec> mutators) {
+    private MemberType(final String urlPart, final String jsProp, final RepresentationType representationType, final Map<String, MutatorSpec> mutators) {
         this.urlPart = urlPart;
         this.jsProp = jsProp;
         this.representationType = representationType;
@@ -101,11 +95,11 @@ public enum MemberType {
     public String getUrlPart() {
         return urlPart;
     }
-    
+
     public Map<String, MutatorSpec> getMutators() {
         return mutators;
     }
-    
+
     public abstract ObjectSpecification specFor(ObjectMember objectMember);
 
     public boolean isProperty() {
@@ -121,32 +115,27 @@ public enum MemberType {
     }
 
     public static MemberType lookup(final String memberTypeName) {
-        for (MemberType memberType : values()) {
-            if(memberType.getName().equals(memberTypeName)) {
+        for (final MemberType memberType : values()) {
+            if (memberType.getName().equals(memberTypeName)) {
                 return memberType;
             }
         }
-    	return null;
+        return null;
     }
 
-	public static MemberType of(ObjectMember objectMember) {
-		return objectMember.isAction()?
-				ACTION:
-					objectMember.isOneToOneAssociation()?
-						PROPERTY:
-						COLLECTION;
-	}
+    public static MemberType of(final ObjectMember objectMember) {
+        return objectMember.isAction() ? ACTION : objectMember.isOneToOneAssociation() ? PROPERTY : COLLECTION;
+    }
 
     public RepresentationType getRepresentationType() {
         return representationType;
     }
 
-
     public String getName() {
         return name;
     }
 
-    public static MemberType determineFrom(ObjectFeature objectFeature) {
+    public static MemberType determineFrom(final ObjectFeature objectFeature) {
         if (objectFeature instanceof ObjectAction) {
             return MemberType.ACTION;
         }
@@ -159,6 +148,4 @@ public enum MemberType {
         return null;
     }
 
-
-
 }

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/MutatorSpec.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/MutatorSpec.java?rev=1234460&r1=1234459&r2=1234460&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/MutatorSpec.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/MutatorSpec.java Sun Jan 22 08:05:17 2012
@@ -22,11 +22,11 @@ import org.apache.isis.viewer.json.appli
 
 public class MutatorSpec {
 
-    public static MutatorSpec of(Rel rel, Class<? extends Facet> validationFacetType, Class<? extends Facet> mutatorFacetType, HttpMethod httpMethod, BodyArgs argSpec) {
+    public static MutatorSpec of(final Rel rel, final Class<? extends Facet> validationFacetType, final Class<? extends Facet> mutatorFacetType, final HttpMethod httpMethod, final BodyArgs argSpec) {
         return of(rel, validationFacetType, mutatorFacetType, httpMethod, argSpec, null);
     }
 
-    public static MutatorSpec of(Rel rel, Class<? extends Facet> validationFacetType, Class<? extends Facet> mutatorFacetType, HttpMethod httpMethod, BodyArgs argSpec, String suffix) {
+    public static MutatorSpec of(final Rel rel, final Class<? extends Facet> validationFacetType, final Class<? extends Facet> mutatorFacetType, final HttpMethod httpMethod, final BodyArgs argSpec, final String suffix) {
         return new MutatorSpec(rel, validationFacetType, mutatorFacetType, httpMethod, argSpec, suffix);
     }
 
@@ -37,7 +37,7 @@ public class MutatorSpec {
     public final String suffix;
     public final BodyArgs arguments;
 
-    private MutatorSpec(Rel rel, Class<? extends Facet> validationFacetType, Class<? extends Facet> mutatorFacetType, HttpMethod httpMethod, BodyArgs bodyArgs, String suffix) {
+    private MutatorSpec(final Rel rel, final Class<? extends Facet> validationFacetType, final Class<? extends Facet> mutatorFacetType, final HttpMethod httpMethod, final BodyArgs bodyArgs, final String suffix) {
         this.rel = rel;
         this.validationFacetType = validationFacetType;
         this.mutatorFacetType = mutatorFacetType;

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=1234460&r1=1234459&r2=1234460&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 Sun Jan 22 08:05:17 2012
@@ -46,99 +46,96 @@ public class ObjectActionReprRenderer ex
         }
 
         @Override
-        public ReprRenderer<?,?> newRenderer(ResourceContext resourceContext, LinkFollower linkFollower, JsonRepresentation representation) {
+        public ReprRenderer<?, ?> newRenderer(final ResourceContext resourceContext, final LinkFollower linkFollower, final JsonRepresentation representation) {
             return new ObjectActionReprRenderer(resourceContext, linkFollower, getRepresentationType(), representation);
         }
     }
 
-    private ObjectActionReprRenderer(ResourceContext resourceContext, LinkFollower linkFollower, RepresentationType representationType, JsonRepresentation representation) {
+    private ObjectActionReprRenderer(final ResourceContext resourceContext, final LinkFollower linkFollower, final RepresentationType representationType, final JsonRepresentation representation) {
         super(resourceContext, linkFollower, representationType, representation);
     }
 
+    @Override
     public JsonRepresentation render() {
         // id and memberType are rendered eagerly
-        
+
         renderMemberContent();
         putDisabledReasonIfDisabled();
-        
-        if(mode.isStandalone() || mode.isMutated()) {
+
+        if (mode.isStandalone() || mode.isMutated()) {
             addParameterDetails();
         }
 
         return representation;
     }
 
-
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
     // details link
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
 
     /**
      * Mandatory hook method to support x-ro-follow-links
      */
     @Override
-    protected void followDetailsLink(JsonRepresentation detailsLink) {
-        RendererFactory factory = RendererFactoryRegistry.instance.find(RepresentationType.OBJECT_ACTION);
-        final ObjectActionReprRenderer renderer = 
-                (ObjectActionReprRenderer) factory.newRenderer(getResourceContext(), getLinkFollower(), JsonRepresentation.newMap());
-        renderer.with(new ObjectAndAction(objectAdapter, objectMember))
-                .usingLinkTo(linkTo)
-                .asFollowed();
+    protected void followDetailsLink(final JsonRepresentation detailsLink) {
+        final RendererFactory factory = RendererFactoryRegistry.instance.find(RepresentationType.OBJECT_ACTION);
+        final ObjectActionReprRenderer renderer = (ObjectActionReprRenderer) factory.newRenderer(getResourceContext(), getLinkFollower(), JsonRepresentation.newMap());
+        renderer.with(new ObjectAndAction(objectAdapter, objectMember)).usingLinkTo(linkTo).asFollowed();
         detailsLink.mapPut("value", renderer.render());
     }
 
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
     // mutators
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
 
     @Override
     protected void addMutatorsIfEnabled() {
-        if(usability().isVetoed()) {
+        if (usability().isVetoed()) {
             return;
         }
-        Map<String, MutatorSpec> mutators = memberType.getMutators();
+        final Map<String, MutatorSpec> mutators = memberType.getMutators();
         final ActionSemantics semantics = ActionSemantics.determine(this.resourceContext, objectMember);
-        
+
         final String mutator = semantics.getInvokeKey();
         final MutatorSpec mutatorSpec = mutators.get(mutator);
-        
+
         addLinkFor(mutatorSpec);
     }
 
+    @Override
     protected ObjectAdapterLinkTo linkToForMutatorInvoke() {
-        if(!objectMember.isContributed()) {
+        if (!objectMember.isContributed()) {
             return super.linkToForMutatorInvoke();
         }
         final DomainServiceLinkTo linkTo = new DomainServiceLinkTo();
         return linkTo.usingResourceContext(getResourceContext()).with(contributingServiceAdapter());
     }
-    
-	private ObjectAdapter contributingServiceAdapter() {
-    	ObjectSpecification serviceType = objectMember.getOnType();
-    	List<ObjectAdapter> serviceAdapters = getPersistenceSession().getServices();
-    	for (ObjectAdapter serviceAdapter : serviceAdapters) {
-			if(serviceAdapter.getSpecification() == serviceType) {
-				return serviceAdapter;
-			}
-		}
-    	// fail fast
-    	throw new IllegalStateException("Unable to locate contributing service");
-	}
-
-	
-    @Override
-    protected JsonRepresentation mutatorArgs(MutatorSpec mutatorSpec) {
-        JsonRepresentation argMap = JsonRepresentation.newMap();
-        List<ObjectActionParameter> parameters = objectMember.getParameters();
-        for(int i=0; i<objectMember.getParameterCount(); i++) {
-            argMap.mapPut(parameters.get(i).getId(), argValueFor(i)); 
+
+    private ObjectAdapter contributingServiceAdapter() {
+        final ObjectSpecification serviceType = objectMember.getOnType();
+        final List<ObjectAdapter> serviceAdapters = getPersistenceSession().getServices();
+        for (final ObjectAdapter serviceAdapter : serviceAdapters) {
+            if (serviceAdapter.getSpecification() == serviceType) {
+                return serviceAdapter;
+            }
+        }
+        // fail fast
+        throw new IllegalStateException("Unable to locate contributing service");
+    }
+
+    @Override
+    protected JsonRepresentation mutatorArgs(final MutatorSpec mutatorSpec) {
+        final JsonRepresentation argMap = JsonRepresentation.newMap();
+        final List<ObjectActionParameter> parameters = objectMember.getParameters();
+        for (int i = 0; i < objectMember.getParameterCount(); i++) {
+            argMap.mapPut(parameters.get(i).getId(), argValueFor(i));
         }
         return argMap;
     }
 
-    private Object argValueFor(int i) {
-        if(objectMember.isContributed()) {
-            ObjectActionParameter actionParameter = objectMember.getParameters().get(i);
+    private Object argValueFor(final int i) {
+        if (objectMember.isContributed()) {
+            final ObjectActionParameter actionParameter = objectMember.getParameters().get(i);
             if (actionParameter.getSpecification().isOfType(objectAdapter.getSpecification())) {
                 return DomainObjectReprRenderer.newLinkToBuilder(resourceContext, Rel.OBJECT, objectAdapter).build();
             }
@@ -147,82 +144,83 @@ public class ObjectActionReprRenderer ex
         return NullNode.getInstance();
     }
 
-
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
     // parameter details
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
 
     private ObjectActionReprRenderer addParameterDetails() {
-    	List<Object> parameters = Lists.newArrayList();
-		for (int i=0; i< objectMember.getParameterCount(); i++) {
-			ObjectActionParameter param = objectMember.getParameters().get(i);
-			parameters.add(paramDetails(param));
-		}
-		representation.mapPut("parameters", parameters);
-		return this;
-	}
-
-	private Object paramDetails(ObjectActionParameter param) {
-		final JsonRepresentation paramRep = JsonRepresentation.newMap();
-		paramRep.mapPut("num", param.getNumber());
-		paramRep.mapPut("id", param.getId());
-		paramRep.mapPut("name", param.getName());
-		paramRep.mapPut("description", param.getDescription());
-		Object paramChoices = choicesFor(param);
-		if(paramChoices != null) {
-			paramRep.mapPut("choices", paramChoices);
-		}
-		Object paramDefault = defaultFor(param);
-		if(paramDefault != null) {
-			paramRep.mapPut("default", paramDefault);
-		}
-		return paramRep;
-	}
-
-	private Object choicesFor(ObjectActionParameter param) {
-		ObjectAdapter[] choiceAdapters = param.getChoices(objectAdapter);
-		if(choiceAdapters == null || choiceAdapters.length == 0) {
-			return null;
-		}
-        List<Object> list = Lists.newArrayList();
+        final List<Object> parameters = Lists.newArrayList();
+        for (int i = 0; i < objectMember.getParameterCount(); i++) {
+            final ObjectActionParameter param = objectMember.getParameters().get(i);
+            parameters.add(paramDetails(param));
+        }
+        representation.mapPut("parameters", parameters);
+        return this;
+    }
+
+    private Object paramDetails(final ObjectActionParameter param) {
+        final JsonRepresentation paramRep = JsonRepresentation.newMap();
+        paramRep.mapPut("num", param.getNumber());
+        paramRep.mapPut("id", param.getId());
+        paramRep.mapPut("name", param.getName());
+        paramRep.mapPut("description", param.getDescription());
+        final Object paramChoices = choicesFor(param);
+        if (paramChoices != null) {
+            paramRep.mapPut("choices", paramChoices);
+        }
+        final Object paramDefault = defaultFor(param);
+        if (paramDefault != null) {
+            paramRep.mapPut("default", paramDefault);
+        }
+        return paramRep;
+    }
+
+    private Object choicesFor(final ObjectActionParameter param) {
+        final ObjectAdapter[] choiceAdapters = param.getChoices(objectAdapter);
+        if (choiceAdapters == null || choiceAdapters.length == 0) {
+            return null;
+        }
+        final List<Object> list = Lists.newArrayList();
         for (final ObjectAdapter choiceAdapter : choiceAdapters) {
-        	ObjectSpecification objectSpec = param.getSpecification();
-        	list.add(DomainObjectReprRenderer.valueOrRef(resourceContext, choiceAdapter, objectSpec));
+            final ObjectSpecification objectSpec = param.getSpecification();
+            list.add(DomainObjectReprRenderer.valueOrRef(resourceContext, choiceAdapter, objectSpec));
         }
         return list;
-	}
+    }
 
-	private Object defaultFor(ObjectActionParameter param) {
-		ObjectAdapter defaultAdapter = param.getDefault(objectAdapter);
-		if(defaultAdapter == null) {
-			return null;
-		}
-    	ObjectSpecification objectSpec = param.getSpecification();
-    	return DomainObjectReprRenderer.valueOrRef(resourceContext, defaultAdapter, objectSpec);
-	}
-
-	
-	/////////////////////////////////////////////////////
-	// extensions and links
-    /////////////////////////////////////////////////////
-	
-     protected void addLinksToFormalDomainModel() {
-         getLinks().arrayAdd(ActionDescriptionReprRenderer.newLinkToBuilder(resourceContext, Rel.DESCRIBEDBY, objectAdapter.getSpecification(), objectMember).build());
-     }
-     
-     protected void addLinksIsisProprietary() {
-        if(objectMember.isContributed()) {
-            ObjectAdapter serviceAdapter = contributingServiceAdapter();
-            JsonRepresentation contributedByLink = DomainObjectReprRenderer.newLinkToBuilder(resourceContext, Rel.CONTRIBUTED_BY, serviceAdapter).build();
+    private Object defaultFor(final ObjectActionParameter param) {
+        final ObjectAdapter defaultAdapter = param.getDefault(objectAdapter);
+        if (defaultAdapter == null) {
+            return null;
+        }
+        final ObjectSpecification objectSpec = param.getSpecification();
+        return DomainObjectReprRenderer.valueOrRef(resourceContext, defaultAdapter, objectSpec);
+    }
+
+    // ///////////////////////////////////////////////////
+    // extensions and links
+    // ///////////////////////////////////////////////////
+
+    @Override
+    protected void addLinksToFormalDomainModel() {
+        getLinks().arrayAdd(ActionDescriptionReprRenderer.newLinkToBuilder(resourceContext, Rel.DESCRIBEDBY, objectAdapter.getSpecification(), objectMember).build());
+    }
+
+    @Override
+    protected void addLinksIsisProprietary() {
+        if (objectMember.isContributed()) {
+            final ObjectAdapter serviceAdapter = contributingServiceAdapter();
+            final JsonRepresentation contributedByLink = DomainObjectReprRenderer.newLinkToBuilder(resourceContext, Rel.CONTRIBUTED_BY, serviceAdapter).build();
             getLinks().arrayAdd(contributedByLink);
         }
     }
 
-     protected void putExtensionsIsisProprietary() {
-         getExtensions().mapPut("actionType", objectMember.getType().name().toLowerCase());
-         
-         final ActionSemantics semantics = ActionSemantics.determine(resourceContext, objectMember);
-         getExtensions().mapPut("actionSemantics", semantics.getName());
-     }
+    @Override
+    protected void putExtensionsIsisProprietary() {
+        getExtensions().mapPut("actionType", objectMember.getType().name().toLowerCase());
+
+        final ActionSemantics semantics = ActionSemantics.determine(resourceContext, objectMember);
+        getExtensions().mapPut("actionSemantics", semantics.getName());
+    }
 
 }
\ 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/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=1234460&r1=1234459&r2=1234460&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 Sun Jan 22 08:05:17 2012
@@ -16,26 +16,27 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.json.viewer.resources.domainobjects;
-
+package org.apache.isis.viewer.json.viewer.resources.domainobjects;
+
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
 import org.apache.isis.viewer.json.applib.RepresentationType;
 import org.apache.isis.viewer.json.applib.links.Rel;
 import org.apache.isis.viewer.json.viewer.ResourceContext;
 import org.apache.isis.viewer.json.viewer.representations.LinkBuilder;
-
-public interface ObjectAdapterLinkTo {
-
-    ObjectAdapterLinkTo usingResourceContext(ResourceContext resourceContext);
-    
-    ObjectAdapterLinkTo with(ObjectAdapter objectAdapter);
 
-    LinkBuilder builder();
+public interface ObjectAdapterLinkTo {
+
+    ObjectAdapterLinkTo usingResourceContext(ResourceContext resourceContext);
+
+    ObjectAdapterLinkTo with(ObjectAdapter objectAdapter);
+
+    LinkBuilder builder();
+
     LinkBuilder builder(Rel rel);
-
+
     LinkBuilder memberBuilder(Rel rel, MemberType memberType, ObjectMember objectMember, String... parts);
+
     LinkBuilder memberBuilder(Rel rel, MemberType memberType, ObjectMember objectMember, RepresentationType representationType, String... parts);
 
-
-}
+}

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAndAction.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/ObjectAndAction.java?rev=1234460&r1=1234459&r2=1234460&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAndAction.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAndAction.java Sun Jan 22 08:05:17 2012
@@ -16,15 +16,15 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.json.viewer.resources.domainobjects;
-
+package org.apache.isis.viewer.json.viewer.resources.domainobjects;
+
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-
-public class ObjectAndAction extends ObjectAndMember<ObjectAction>{
-    
-    public ObjectAndAction(ObjectAdapter objectAdapter, ObjectAction action) {
-        super(objectAdapter, action);
-    }
-
+
+public class ObjectAndAction extends ObjectAndMember<ObjectAction> {
+
+    public ObjectAndAction(final ObjectAdapter objectAdapter, final ObjectAction action) {
+        super(objectAdapter, action);
+    }
+
 }
\ 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/ObjectAndActionInvocation.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/ObjectAndActionInvocation.java?rev=1234460&r1=1234459&r2=1234460&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAndActionInvocation.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAndActionInvocation.java Sun Jan 22 08:05:17 2012
@@ -16,37 +16,40 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.json.viewer.resources.domainobjects;
-
+package org.apache.isis.viewer.json.viewer.resources.domainobjects;
+
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.viewer.json.applib.JsonRepresentation;
-
-public class ObjectAndActionInvocation {
-    
+
+public class ObjectAndActionInvocation {
+
     private final ObjectAdapter objectAdapter;
     private final ObjectAction action;
     private final JsonRepresentation arguments;
     private final ObjectAdapter returnedAdapter;
-    
-    public ObjectAndActionInvocation(ObjectAdapter objectAdapter, ObjectAction action, JsonRepresentation arguments, ObjectAdapter returnedAdapter) {
+
+    public ObjectAndActionInvocation(final ObjectAdapter objectAdapter, final ObjectAction action, final JsonRepresentation arguments, final ObjectAdapter returnedAdapter) {
         this.objectAdapter = objectAdapter;
         this.action = action;
         this.arguments = arguments;
-        this.returnedAdapter = returnedAdapter;
+        this.returnedAdapter = returnedAdapter;
     }
 
     public ObjectAdapter getObjectAdapter() {
         return objectAdapter;
     }
+
     public ObjectAction getAction() {
         return action;
     }
+
     public JsonRepresentation getArguments() {
         return arguments;
     }
+
     public ObjectAdapter getReturnedAdapter() {
         return returnedAdapter;
     }
-
+
 }
\ 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/ObjectAndCollection.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/ObjectAndCollection.java?rev=1234460&r1=1234459&r2=1234460&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAndCollection.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAndCollection.java Sun Jan 22 08:05:17 2012
@@ -16,15 +16,15 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.json.viewer.resources.domainobjects;
-
+package org.apache.isis.viewer.json.viewer.resources.domainobjects;
+
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-
-public class ObjectAndCollection extends ObjectAndMember<OneToManyAssociation>{
-    
-    public ObjectAndCollection(ObjectAdapter objectAdapter, OneToManyAssociation collection) {
-        super(objectAdapter, collection);
-    }
-
+
+public class ObjectAndCollection extends ObjectAndMember<OneToManyAssociation> {
+
+    public ObjectAndCollection(final ObjectAdapter objectAdapter, final OneToManyAssociation collection) {
+        super(objectAdapter, collection);
+    }
+
 }
\ 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/ObjectAndMember.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/ObjectAndMember.java?rev=1234460&r1=1234459&r2=1234460&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAndMember.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAndMember.java Sun Jan 22 08:05:17 2012
@@ -16,24 +16,26 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.json.viewer.resources.domainobjects;
-
+package org.apache.isis.viewer.json.viewer.resources.domainobjects;
+
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
-
-public abstract class ObjectAndMember<T extends ObjectMember> {
-    
-    private ObjectAdapter objectAdapter;
-    private T objectMember;
-    
-    public ObjectAndMember(ObjectAdapter objectAdapter, T objectMember) {
-        this.objectAdapter = objectAdapter;
-        this.objectMember = objectMember;
-    }
-    public ObjectAdapter getObjectAdapter() {
-        return objectAdapter;
-    }
-    public T getMember() {
-        return objectMember;
-    }
+
+public abstract class ObjectAndMember<T extends ObjectMember> {
+
+    private final ObjectAdapter objectAdapter;
+    private final T objectMember;
+
+    public ObjectAndMember(final ObjectAdapter objectAdapter, final T objectMember) {
+        this.objectAdapter = objectAdapter;
+        this.objectMember = objectMember;
+    }
+
+    public ObjectAdapter getObjectAdapter() {
+        return objectAdapter;
+    }
+
+    public T getMember() {
+        return objectMember;
+    }
 }
\ 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/ObjectAndProperty.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/ObjectAndProperty.java?rev=1234460&r1=1234459&r2=1234460&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAndProperty.java (original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ObjectAndProperty.java Sun Jan 22 08:05:17 2012
@@ -16,15 +16,15 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.json.viewer.resources.domainobjects;
-
+package org.apache.isis.viewer.json.viewer.resources.domainobjects;
+
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-
-public class ObjectAndProperty extends ObjectAndMember<OneToOneAssociation>{
-    
-    public ObjectAndProperty(ObjectAdapter objectAdapter, OneToOneAssociation property) {
-        super(objectAdapter, property);
-    }
-
+
+public class ObjectAndProperty extends ObjectAndMember<OneToOneAssociation> {
+
+    public ObjectAndProperty(final ObjectAdapter objectAdapter, final OneToOneAssociation property) {
+        super(objectAdapter, property);
+    }
+
 }
\ 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/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=1234460&r1=1234459&r2=1234460&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 Sun Jan 22 08:05:17 2012
@@ -46,103 +46,97 @@ public class ObjectCollectionReprRendere
         }
 
         @Override
-        public ReprRenderer<?,?> newRenderer(ResourceContext resourceContext, LinkFollower linkFollower, JsonRepresentation representation) {
+        public ReprRenderer<?, ?> newRenderer(final ResourceContext resourceContext, final LinkFollower linkFollower, final JsonRepresentation representation) {
             return new ObjectCollectionReprRenderer(resourceContext, linkFollower, getRepresentationType(), representation);
         }
     }
 
-    private ObjectCollectionReprRenderer(ResourceContext resourceContext, LinkFollower linkFollower, RepresentationType representationType, JsonRepresentation representation) {
+    private ObjectCollectionReprRenderer(final ResourceContext resourceContext, final LinkFollower linkFollower, final RepresentationType representationType, final JsonRepresentation representation) {
         super(resourceContext, linkFollower, representationType, representation);
     }
-    
+
+    @Override
     public JsonRepresentation render() {
         // id and memberType are rendered eagerly
 
         renderMemberContent();
-        if(mode.isStandalone() || mode.isMutated() || !objectAdapter.isPersistent()) {
+        if (mode.isStandalone() || mode.isMutated() || !objectAdapter.isPersistent()) {
             addValue();
         }
         putDisabledReasonIfDisabled();
 
-        if(mode.isStandalone() || mode.isMutated()) {
+        if (mode.isStandalone() || mode.isMutated()) {
             addExtensionsIsisProprietaryChangedObjects();
         }
 
         return representation;
     }
 
-    
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
     // value
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
 
     private void addValue() {
-        ObjectAdapter valueAdapter = objectMember.get(objectAdapter);
-        if(valueAdapter == null) {
+        final ObjectAdapter valueAdapter = objectMember.get(objectAdapter);
+        if (valueAdapter == null) {
             return;
         }
 
         final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(valueAdapter);
-        List<JsonRepresentation> list = Lists.newArrayList();
+        final List<JsonRepresentation> list = Lists.newArrayList();
         for (final ObjectAdapter elementAdapter : facet.iterable(valueAdapter)) {
 
-            LinkBuilder newBuilder = DomainObjectReprRenderer.newLinkToBuilder(resourceContext, Rel.OBJECT, elementAdapter);
+            final LinkBuilder newBuilder = DomainObjectReprRenderer.newLinkToBuilder(resourceContext, Rel.OBJECT, elementAdapter);
 
             list.add(newBuilder.build());
         }
-        
+
         representation.mapPut("value", list);
     }
 
-
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
     // details link
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
 
     /**
      * Mandatory hook method to support x-ro-follow-links
      */
     @Override
-    protected void followDetailsLink(JsonRepresentation detailsLink) {
-        RendererFactory factory = RendererFactoryRegistry.instance.find(RepresentationType.OBJECT_COLLECTION);
-        final ObjectCollectionReprRenderer renderer = 
-                (ObjectCollectionReprRenderer) factory.newRenderer(getResourceContext(), getLinkFollower(), JsonRepresentation.newMap());
+    protected void followDetailsLink(final JsonRepresentation detailsLink) {
+        final RendererFactory factory = RendererFactoryRegistry.instance.find(RepresentationType.OBJECT_COLLECTION);
+        final ObjectCollectionReprRenderer renderer = (ObjectCollectionReprRenderer) factory.newRenderer(getResourceContext(), getLinkFollower(), JsonRepresentation.newMap());
         renderer.with(new ObjectAndCollection(objectAdapter, objectMember)).asFollowed();
         detailsLink.mapPut("value", renderer.render());
     }
 
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
     // mutators
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
 
     @Override
     protected void addMutatorsIfEnabled() {
-        if(usability().isVetoed()) {
+        if (usability().isVetoed()) {
             return;
         }
-        
+
         final CollectionSemantics semantics = CollectionSemantics.determine(this.resourceContext, objectMember);
         addMutatorLink(semantics.getAddToKey());
         addMutatorLink(semantics.getRemoveFromKey());
-        
+
         return;
     }
 
-    private void addMutatorLink(String key) {
-        Map<String, MutatorSpec> mutators = memberType.getMutators();
+    private void addMutatorLink(final String key) {
+        final Map<String, MutatorSpec> mutators = memberType.getMutators();
         final MutatorSpec mutatorSpec = mutators.get(key);
         addLinkFor(mutatorSpec);
     }
 
-
-
-
-
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
     // extensions and links
-    /////////////////////////////////////////////////////
-    
-    
+    // ///////////////////////////////////////////////////
+
+    @Override
     protected void addLinksToFormalDomainModel() {
         final LinkBuilder linkBuilder = CollectionDescriptionReprRenderer.newLinkToBuilder(resourceContext, Rel.DESCRIBEDBY, objectAdapter.getSpecification(), objectMember);
         getLinks().arrayAdd(linkBuilder.build());
@@ -153,10 +147,10 @@ public class ObjectCollectionReprRendere
         // none
     }
 
+    @Override
     protected void putExtensionsIsisProprietary() {
         final CollectionSemantics semantics = CollectionSemantics.determine(resourceContext, objectMember);
         getExtensions().mapPut("collectionSemantics", semantics.name().toLowerCase());
     }
 
-
 }
\ 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/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=1234460&r1=1234459&r2=1234460&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 Sun Jan 22 08:05:17 2012
@@ -38,7 +38,6 @@ import com.google.common.collect.Lists;
 
 public class ObjectPropertyReprRenderer extends AbstractObjectMemberReprRenderer<ObjectPropertyReprRenderer, OneToOneAssociation> {
 
-    
     public static class Factory extends ReprRendererFactoryAbstract {
 
         public Factory() {
@@ -46,122 +45,112 @@ public class ObjectPropertyReprRenderer 
         }
 
         @Override
-        public ReprRenderer<?,?> newRenderer(ResourceContext resourceContext, LinkFollower linkFollower, JsonRepresentation representation) {
+        public ReprRenderer<?, ?> newRenderer(final ResourceContext resourceContext, final LinkFollower linkFollower, final JsonRepresentation representation) {
             return new ObjectPropertyReprRenderer(resourceContext, linkFollower, getRepresentationType(), representation);
         }
     }
-    
 
-    private ObjectPropertyReprRenderer(ResourceContext resourceContext, LinkFollower linkFollower, RepresentationType representationType, JsonRepresentation representation) {
+    private ObjectPropertyReprRenderer(final ResourceContext resourceContext, final LinkFollower linkFollower, final RepresentationType representationType, final JsonRepresentation representation) {
         super(resourceContext, linkFollower, representationType, representation);
     }
 
+    @Override
     public JsonRepresentation render() {
         // id and memberType are rendered eagerly
-        
+
         renderMemberContent();
         addValue();
-        
+
         putDisabledReasonIfDisabled();
 
-        if(mode.isStandalone() || mode.isMutated()) {
+        if (mode.isStandalone() || mode.isMutated()) {
             addChoices();
             addExtensionsIsisProprietaryChangedObjects();
         }
-        
-        
+
         return representation;
     }
 
-
-    
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
     // value
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
 
     private void addValue() {
         representation.mapPut("value", valueRep());
     }
 
     private Object valueRep() {
-        ObjectAdapter valueAdapter = objectMember.get(objectAdapter);
-        if(valueAdapter == null) {
+        final ObjectAdapter valueAdapter = objectMember.get(objectAdapter);
+        if (valueAdapter == null) {
             return NullNode.getInstance();
         }
         return DomainObjectReprRenderer.valueOrRef(resourceContext, valueAdapter, objectMember.getSpecification());
     }
 
-
-
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
     // details link
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
 
     /**
      * Mandatory hook method to support x-ro-follow-links
      */
     @Override
-    protected void followDetailsLink(JsonRepresentation detailsLink) {
-        RendererFactory factory = RendererFactoryRegistry.instance.find(RepresentationType.OBJECT_PROPERTY);
-        final ObjectPropertyReprRenderer renderer = 
-                (ObjectPropertyReprRenderer) factory.newRenderer(getResourceContext(), getLinkFollower(), JsonRepresentation.newMap());
+    protected void followDetailsLink(final JsonRepresentation detailsLink) {
+        final RendererFactory factory = RendererFactoryRegistry.instance.find(RepresentationType.OBJECT_PROPERTY);
+        final ObjectPropertyReprRenderer renderer = (ObjectPropertyReprRenderer) factory.newRenderer(getResourceContext(), getLinkFollower(), JsonRepresentation.newMap());
         renderer.with(new ObjectAndProperty(objectAdapter, objectMember)).asFollowed();
         detailsLink.mapPut("value", renderer.render());
     }
 
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
     // mutators
-    /////////////////////////////////////////////////////
-
+    // ///////////////////////////////////////////////////
 
     @Override
     protected void addMutatorsIfEnabled() {
-        if(usability().isVetoed()) {
+        if (usability().isVetoed()) {
             return;
         }
-        Map<String, MutatorSpec> mutators = memberType.getMutators();
-        for(String mutator: mutators.keySet()) {
-            MutatorSpec mutatorSpec = mutators.get(mutator);
+        final Map<String, MutatorSpec> mutators = memberType.getMutators();
+        for (final String mutator : mutators.keySet()) {
+            final MutatorSpec mutatorSpec = mutators.get(mutator);
             addLinkFor(mutatorSpec);
         }
         return;
     }
 
-
-	
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
     // choices
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
 
-	private ObjectPropertyReprRenderer addChoices() {
-		Object propertyChoices = propertyChoices();
-		if(propertyChoices != null) {
-			representation.mapPut("choices", propertyChoices);
-		}
-		return this;
-	}
-
-	private Object propertyChoices() {
-		ObjectAdapter[] choiceAdapters = objectMember.getChoices(objectAdapter);
-		if(choiceAdapters == null || choiceAdapters.length == 0) {
-			return null;
-		}
-        List<Object> list = Lists.newArrayList();
+    private ObjectPropertyReprRenderer addChoices() {
+        final Object propertyChoices = propertyChoices();
+        if (propertyChoices != null) {
+            representation.mapPut("choices", propertyChoices);
+        }
+        return this;
+    }
+
+    private Object propertyChoices() {
+        final ObjectAdapter[] choiceAdapters = objectMember.getChoices(objectAdapter);
+        if (choiceAdapters == null || choiceAdapters.length == 0) {
+            return null;
+        }
+        final List<Object> list = Lists.newArrayList();
         for (final ObjectAdapter choiceAdapter : choiceAdapters) {
-        	ObjectSpecification objectSpec = objectMember.getSpecification();
-        	list.add(DomainObjectReprRenderer.valueOrRef(resourceContext, choiceAdapter, objectSpec));
+            final ObjectSpecification objectSpec = objectMember.getSpecification();
+            list.add(DomainObjectReprRenderer.valueOrRef(resourceContext, choiceAdapter, objectSpec));
         }
         return list;
-	}
+    }
 
-	
-    /////////////////////////////////////////////////////
+    // ///////////////////////////////////////////////////
     // extensions and links
-    /////////////////////////////////////////////////////
-    
+    // ///////////////////////////////////////////////////
+
+    @Override
     protected void addLinksToFormalDomainModel() {
-        getLinks().arrayAdd(
-                PropertyDescriptionReprRenderer.newLinkToBuilder(getResourceContext(), Rel.DESCRIBEDBY, objectAdapter.getSpecification(), objectMember).build());
+        getLinks().arrayAdd(PropertyDescriptionReprRenderer.newLinkToBuilder(getResourceContext(), Rel.DESCRIBEDBY, objectAdapter.getSpecification(), objectMember).build());
     }
 
     @Override
@@ -174,5 +163,4 @@ public class ObjectPropertyReprRenderer 
         // none
     }
 
-
 }
\ 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/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=1234460&r1=1234459&r2=1234460&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 Sun Jan 22 08:05:17 2012
@@ -34,44 +34,45 @@ public class ScalarValueReprRenderer ext
 
     private final JsonValueEncoder jsonValueEncoder = new JsonValueEncoder();
     private ObjectSpecification returnType;
-    
+
     public static class Factory extends ReprRendererFactoryAbstract {
         public Factory() {
             super(RepresentationType.SCALAR_VALUE);
         }
 
         @Override
-        public ReprRenderer<?, ?> newRenderer(ResourceContext resourceContext, LinkFollower linkFollower, JsonRepresentation representation) {
+        public ReprRenderer<?, ?> newRenderer(final ResourceContext resourceContext, final LinkFollower linkFollower, final JsonRepresentation representation) {
             return new ScalarValueReprRenderer(resourceContext, linkFollower, getRepresentationType(), representation);
         }
     }
 
-    private ScalarValueReprRenderer(final ResourceContext resourceContext, LinkFollower linkFollower, RepresentationType representationType, JsonRepresentation representation) {
+    private ScalarValueReprRenderer(final ResourceContext resourceContext, final LinkFollower linkFollower, final RepresentationType representationType, final JsonRepresentation representation) {
         super(resourceContext, linkFollower, representationType, representation);
     }
 
+    @Override
     public ScalarValueReprRenderer with(final ObjectAdapter objectAdapter) {
         final EncodableFacet facet = objectAdapter.getSpecification().getFacet(EncodableFacet.class);
-        if(facet == null) {
+        if (facet == null) {
             throw JsonApplicationException.create(HttpStatusCode.INTERNAL_SERVER_ERROR, "Not an (encodable) value", objectAdapter.titleString());
         }
         final Object value = jsonValueEncoder.asObject(objectAdapter);
-        
+
         representation.mapPut("value", value);
         return this;
     }
 
     @Override
     public JsonRepresentation render() {
- 
+
         addLinkToReturnType();
-        
+
         getExtensions();
 
         return representation;
     }
 
-    public ScalarValueReprRenderer withReturnType(ObjectSpecification returnType) {
+    public ScalarValueReprRenderer withReturnType(final ObjectSpecification returnType) {
         this.returnType = returnType;
         return this;
     }
@@ -80,6 +81,4 @@ public class ScalarValueReprRenderer ext
         addLink(Rel.RETURN_TYPE, returnType);
     }
 
-
-    
 }
\ No newline at end of file



Mime
View raw message