isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1176973 [2/2] - in /incubator/isis/trunk/framework/viewer/json: json-applib/src/main/java/org/apache/isis/viewer/json/applib/ json-tck/src/test/java/org/apache/isis/viewer/json/tck/ json-viewer/src/main/java/org/apache/isis/viewer/json/vie...
Date Wed, 28 Sep 2011 17:32:02 GMT
Copied: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ScalarReprBuilder.java
(from r1173268, incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ScalarRepBuilder.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/ScalarReprBuilder.java?p2=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ScalarReprBuilder.java&p1=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ScalarRepBuilder.java&r1=1173268&r2=1176973&rev=1176973&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ScalarRepBuilder.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domainobjects/ScalarReprBuilder.java
Wed Sep 28 17:32:00 2011
@@ -22,23 +22,23 @@ import org.apache.isis.viewer.json.appli
 import org.apache.isis.viewer.json.applib.RestfulResponse.HttpStatusCode;
 import org.apache.isis.viewer.json.viewer.JsonApplicationException;
 import org.apache.isis.viewer.json.viewer.ResourceContext;
-import org.apache.isis.viewer.json.viewer.representations.AbstractRepresentationBuilder;
+import org.apache.isis.viewer.json.viewer.representations.AbstractReprBuilder;
 
-public class ScalarRepBuilder extends AbstractRepresentationBuilder<ScalarRepBuilder>
{
+public class ScalarReprBuilder extends AbstractReprBuilder<ScalarReprBuilder> {
 
-    public static ScalarRepBuilder newBuilder(final ResourceContext resourceContext) {
-        return new ScalarRepBuilder(resourceContext, JsonRepresentation.newMap());
+    public static ScalarReprBuilder newBuilder(final ResourceContext resourceContext) {
+        return new ScalarReprBuilder(resourceContext, JsonRepresentation.newMap());
     }
 
-    public static ScalarRepBuilder newBuilder(ResourceContext resourceContext, JsonRepresentation
representation) {
-        return new ScalarRepBuilder(resourceContext, representation);
+    public static ScalarReprBuilder newBuilder(ResourceContext resourceContext, JsonRepresentation
representation) {
+        return new ScalarReprBuilder(resourceContext, representation);
     }
 
-    private ScalarRepBuilder(final ResourceContext resourceContext, JsonRepresentation representation)
{
+    private ScalarReprBuilder(final ResourceContext resourceContext, JsonRepresentation representation)
{
         super(resourceContext, representation);
     }
 
-    public ScalarRepBuilder withAdapter(final ObjectAdapter objectAdapter) {
+    public ScalarReprBuilder withAdapter(final ObjectAdapter objectAdapter) {
         final EncodableFacet facet = objectAdapter.getSpecification().getFacet(EncodableFacet.class);
         if(facet == null) {
             throw JsonApplicationException.create(HttpStatusCode.INTERNAL_SERVER_ERROR, "Not
an (encodable) value", objectAdapter.titleString());

Copied: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/AbstractTypeMemberReprBuilder.java
(from r1170062, incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/AbstractTypeMemberRepBuilder.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/AbstractTypeMemberReprBuilder.java?p2=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/AbstractTypeMemberReprBuilder.java&p1=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/AbstractTypeMemberRepBuilder.java&r1=1170062&r2=1176973&rev=1176973&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/AbstractTypeMemberRepBuilder.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/AbstractTypeMemberReprBuilder.java
Wed Sep 28 17:32:00 2011
@@ -19,16 +19,16 @@ package org.apache.isis.viewer.json.view
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
 import org.apache.isis.viewer.json.viewer.ResourceContext;
-import org.apache.isis.viewer.json.viewer.representations.AbstractRepresentationBuilder;
+import org.apache.isis.viewer.json.viewer.representations.AbstractReprBuilder;
 import org.apache.isis.viewer.json.viewer.resources.domainobjects.MemberType;
 
-public abstract class AbstractTypeMemberRepBuilder<R extends AbstractRepresentationBuilder<R>,
T extends ObjectMember> extends AbstractRepresentationBuilder<R> {
+public abstract class AbstractTypeMemberReprBuilder<R extends AbstractReprBuilder<R>,
T extends ObjectMember> extends AbstractReprBuilder<R> {
 
     protected final ObjectSpecification objectSpecification;
     protected final MemberType memberType;
     protected final T objectMember;
 
-    public AbstractTypeMemberRepBuilder(ResourceContext resourceContext, ObjectSpecification
objectSpecification, MemberType memberType, T objectMember) {
+    public AbstractTypeMemberReprBuilder(ResourceContext resourceContext, ObjectSpecification
objectSpecification, MemberType memberType, T objectMember) {
         super(resourceContext);
         this.objectSpecification = objectSpecification;
         this.memberType = memberType;

Copied: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/DomainTypeReprBuilder.java
(from r1170062, incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/DomainTypeRepBuilder.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/DomainTypeReprBuilder.java?p2=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/DomainTypeReprBuilder.java&p1=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/DomainTypeRepBuilder.java&r1=1170062&r2=1176973&rev=1176973&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/DomainTypeRepBuilder.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/DomainTypeReprBuilder.java
Wed Sep 28 17:32:00 2011
@@ -19,22 +19,22 @@ package org.apache.isis.viewer.json.view
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.viewer.json.applib.JsonRepresentation;
 import org.apache.isis.viewer.json.viewer.ResourceContext;
-import org.apache.isis.viewer.json.viewer.representations.LinkToBuilder;
-import org.apache.isis.viewer.json.viewer.representations.AbstractRepresentationBuilder;
+import org.apache.isis.viewer.json.viewer.representations.LinkReprBuilder;
+import org.apache.isis.viewer.json.viewer.representations.AbstractReprBuilder;
 
-public class DomainTypeRepBuilder extends AbstractRepresentationBuilder<DomainTypeRepBuilder>
{
+public class DomainTypeReprBuilder extends AbstractReprBuilder<DomainTypeReprBuilder>
{
 
-    public static DomainTypeRepBuilder newBuilder(ResourceContext representationContext)
{
-        return new DomainTypeRepBuilder(representationContext);
+    public static DomainTypeReprBuilder newBuilder(ResourceContext representationContext)
{
+        return new DomainTypeReprBuilder(representationContext);
     }
 
-    public static LinkToBuilder newLinkToBuilder(ResourceContext resourceContext, String
rel, ObjectSpecification objectSpec) {
+    public static LinkReprBuilder newLinkToBuilder(ResourceContext resourceContext, String
rel, ObjectSpecification objectSpec) {
         String typeFullName = objectSpec.getFullIdentifier();
         String url = "domainTypes/" + typeFullName;
-        return LinkToBuilder.newBuilder(resourceContext, rel, url);
+        return LinkReprBuilder.newBuilder(resourceContext, rel, url);
     }
 
-    public DomainTypeRepBuilder(ResourceContext resourceContext) {
+    public DomainTypeReprBuilder(ResourceContext resourceContext) {
         super(resourceContext);
     }
 

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=1176973&r1=1176972&r2=1176973&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
Wed Sep 28 17:32:00 2011
@@ -32,7 +32,7 @@ import org.apache.isis.viewer.json.appli
 import org.apache.isis.viewer.json.applib.RepresentationType;
 import org.apache.isis.viewer.json.applib.RestfulMediaType;
 import org.apache.isis.viewer.json.applib.domaintypes.DomainTypeResource;
-import org.apache.isis.viewer.json.viewer.representations.LinkToBuilder;
+import org.apache.isis.viewer.json.viewer.representations.LinkReprBuilder;
 import org.apache.isis.viewer.json.viewer.resources.ResourceAbstract;
 
 /**
@@ -50,12 +50,12 @@ public class DomainTypeResourceServersid
         init();
 
         JsonRepresentation representation = JsonRepresentation.newMap();
-        representation.mapPut("self", LinkToBuilder.newBuilder(getResourceContext(), "self",
"domainTypes").build());
+        representation.mapPut("self", LinkReprBuilder.newBuilder(getResourceContext(), "self",
"domainTypes").build());
         
         JsonRepresentation specList = JsonRepresentation.newArray();
         final Collection<ObjectSpecification> allSpecifications = getSpecificationLoader().allSpecifications();
         for (ObjectSpecification objectSpec : allSpecifications) {
-            final LinkToBuilder linkBuilder = LinkToBuilder.newBuilder(getResourceContext(),
"domainType", "domainTypes/%s", objectSpec.getFullIdentifier());
+            final LinkReprBuilder linkBuilder = LinkReprBuilder.newBuilder(getResourceContext(),
"domainType", "domainTypes/%s", objectSpec.getFullIdentifier());
             specList.arrayAdd(linkBuilder.build());
         }
         
@@ -72,7 +72,7 @@ public class DomainTypeResourceServersid
         init();
 
         JsonRepresentation representation = JsonRepresentation.newMap();
-        representation.mapPut("self", LinkToBuilder.newBuilder(getResourceContext(), "self",
"domainTypes/%s", domainType).build());
+        representation.mapPut("self", LinkReprBuilder.newBuilder(getResourceContext(), "self",
"domainTypes/%s", domainType).build());
         
         return responseOfOk(RepresentationType.DOMAIN_TYPE, Caching.ONE_DAY, representation).build();
     }
@@ -86,7 +86,7 @@ public class DomainTypeResourceServersid
         init();
 
         JsonRepresentation representation = JsonRepresentation.newMap();
-        representation.mapPut("self", LinkToBuilder.newBuilder(getResourceContext(), "self",
"domainTypes/%s/properties/%s", domainType, propertyId).build());
+        representation.mapPut("self", LinkReprBuilder.newBuilder(getResourceContext(), "self",
"domainTypes/%s/properties/%s", domainType, propertyId).build());
         
         return responseOfOk(RepresentationType.TYPE_PROPERTY, Caching.ONE_DAY, representation).build();
     }
@@ -100,7 +100,7 @@ public class DomainTypeResourceServersid
         init();
 
         JsonRepresentation representation = JsonRepresentation.newMap();
-        representation.mapPut("self", LinkToBuilder.newBuilder(getResourceContext(), "self",
"domainType/%s/collections/%s", domainType, collectionId).build());
+        representation.mapPut("self", LinkReprBuilder.newBuilder(getResourceContext(), "self",
"domainType/%s/collections/%s", domainType, collectionId).build());
         
         return responseOfOk(RepresentationType.TYPE_COLLECTION, Caching.ONE_DAY, representation).build();
     }
@@ -114,7 +114,7 @@ public class DomainTypeResourceServersid
         init();
 
         JsonRepresentation representation = JsonRepresentation.newMap();
-        representation.mapPut("self", LinkToBuilder.newBuilder(getResourceContext(), "self",
"domainTypes/%s/actions/%s", domainType, actionId).build());
+        representation.mapPut("self", LinkReprBuilder.newBuilder(getResourceContext(), "self",
"domainTypes/%s/actions/%s", domainType, actionId).build());
         
         return responseOfOk(RepresentationType.TYPE_ACTION, Caching.ONE_DAY, representation).build();
     }
@@ -129,7 +129,7 @@ public class DomainTypeResourceServersid
         init();
 
         JsonRepresentation representation = JsonRepresentation.newMap();
-        representation.mapPut("self", LinkToBuilder.newBuilder(getResourceContext(), "self",
"domainTypes/%s/actions/%s/params/%s", domainType, actionId, paramName).build());
+        representation.mapPut("self", LinkReprBuilder.newBuilder(getResourceContext(), "self",
"domainTypes/%s/actions/%s/params/%s", domainType, actionId, paramName).build());
         
         return responseOfOk(RepresentationType.TYPE_COLLECTION, Caching.ONE_DAY, representation).build();
     }

Copied: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypeActionReprBuilder.java
(from r1170062, incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypeActionRepBuilder.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/TypeActionReprBuilder.java?p2=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypeActionReprBuilder.java&p1=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypeActionRepBuilder.java&r1=1170062&r2=1176973&rev=1176973&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypeActionRepBuilder.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypeActionReprBuilder.java
Wed Sep 28 17:32:00 2011
@@ -20,23 +20,23 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.viewer.json.applib.JsonRepresentation;
 import org.apache.isis.viewer.json.viewer.ResourceContext;
-import org.apache.isis.viewer.json.viewer.representations.LinkToBuilder;
+import org.apache.isis.viewer.json.viewer.representations.LinkReprBuilder;
 import org.apache.isis.viewer.json.viewer.resources.domainobjects.MemberType;
 
-public class TypeActionRepBuilder extends AbstractTypeMemberRepBuilder<TypeActionRepBuilder,
ObjectAction> {
+public class TypeActionReprBuilder extends AbstractTypeMemberReprBuilder<TypeActionReprBuilder,
ObjectAction> {
 
-    public static TypeActionRepBuilder newBuilder(ResourceContext representationContext,
ObjectSpecification objectSpecification, ObjectAction objectAction) {
-        return new TypeActionRepBuilder(representationContext, objectSpecification, objectAction);
+    public static TypeActionReprBuilder newBuilder(ResourceContext representationContext,
ObjectSpecification objectSpecification, ObjectAction objectAction) {
+        return new TypeActionReprBuilder(representationContext, objectSpecification, objectAction);
     }
 
-    public static LinkToBuilder newLinkToBuilder(ResourceContext resourceContext, String
rel, ObjectSpecification objectSpecification, ObjectAction objectAction) {
+    public static LinkReprBuilder newLinkToBuilder(ResourceContext resourceContext, String
rel, ObjectSpecification objectSpecification, ObjectAction objectAction) {
         String typeFullName = objectSpecification.getFullIdentifier();
         String actionId = objectAction.getId();
         String url = "domainTypes/" + typeFullName + "/actions/" + actionId;
-        return LinkToBuilder.newBuilder(resourceContext, rel, url);
+        return LinkReprBuilder.newBuilder(resourceContext, rel, url);
     }
 
-    public TypeActionRepBuilder(ResourceContext resourceContext, ObjectSpecification objectSpecification,
ObjectAction objectAction) {
+    public TypeActionReprBuilder(ResourceContext resourceContext, ObjectSpecification objectSpecification,
ObjectAction objectAction) {
         super(resourceContext, objectSpecification, MemberType.OBJECT_ACTION, objectAction);
     }
 

Copied: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypeCollectionReprBuilder.java
(from r1173585, incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypeCollectionRepBuilder.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/TypeCollectionReprBuilder.java?p2=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypeCollectionReprBuilder.java&p1=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypeCollectionRepBuilder.java&r1=1173585&r2=1176973&rev=1176973&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypeCollectionRepBuilder.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypeCollectionReprBuilder.java
Wed Sep 28 17:32:00 2011
@@ -20,23 +20,23 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 import org.apache.isis.viewer.json.applib.JsonRepresentation;
 import org.apache.isis.viewer.json.viewer.ResourceContext;
-import org.apache.isis.viewer.json.viewer.representations.LinkToBuilder;
+import org.apache.isis.viewer.json.viewer.representations.LinkReprBuilder;
 import org.apache.isis.viewer.json.viewer.resources.domainobjects.MemberType;
 
-public class TypeCollectionRepBuilder extends AbstractTypeMemberRepBuilder<TypeCollectionRepBuilder,
OneToManyAssociation> {
+public class TypeCollectionReprBuilder extends AbstractTypeMemberReprBuilder<TypeCollectionReprBuilder,
OneToManyAssociation> {
 
-    public static TypeCollectionRepBuilder newBuilder(ResourceContext representationContext,
ObjectSpecification objectSpecification, OneToManyAssociation collection) {
-        return new TypeCollectionRepBuilder(representationContext, objectSpecification, collection);
+    public static TypeCollectionReprBuilder newBuilder(ResourceContext representationContext,
ObjectSpecification objectSpecification, OneToManyAssociation collection) {
+        return new TypeCollectionReprBuilder(representationContext, objectSpecification,
collection);
     }
 
-    public static LinkToBuilder newLinkToBuilder(ResourceContext resourceContext, String
rel, ObjectSpecification objectSpecification, OneToManyAssociation collection) {
+    public static LinkReprBuilder newLinkToBuilder(ResourceContext resourceContext, String
rel, ObjectSpecification objectSpecification, OneToManyAssociation collection) {
         String typeFullName = objectSpecification.getFullIdentifier();
         String collectionId = collection.getId();
         String url = "domainTypes/" + typeFullName + "/collections/" + collectionId;
-        return LinkToBuilder.newBuilder(resourceContext, rel, url);
+        return LinkReprBuilder.newBuilder(resourceContext, rel, url);
     }
 
-    public TypeCollectionRepBuilder(ResourceContext resourceContext, ObjectSpecification
objectSpecification, OneToManyAssociation collection) {
+    public TypeCollectionReprBuilder(ResourceContext resourceContext, ObjectSpecification
objectSpecification, OneToManyAssociation collection) {
         super(resourceContext, objectSpecification, MemberType.OBJECT_COLLECTION, collection);
     }
 

Copied: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypePropertyReprBuilder.java
(from r1173585, incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypePropertyRepBuilder.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/TypePropertyReprBuilder.java?p2=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypePropertyReprBuilder.java&p1=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypePropertyRepBuilder.java&r1=1173585&r2=1176973&rev=1176973&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypePropertyRepBuilder.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/domaintypes/TypePropertyReprBuilder.java
Wed Sep 28 17:32:00 2011
@@ -20,23 +20,23 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
 import org.apache.isis.viewer.json.applib.JsonRepresentation;
 import org.apache.isis.viewer.json.viewer.ResourceContext;
-import org.apache.isis.viewer.json.viewer.representations.LinkToBuilder;
+import org.apache.isis.viewer.json.viewer.representations.LinkReprBuilder;
 import org.apache.isis.viewer.json.viewer.resources.domainobjects.MemberType;
 
-public class TypePropertyRepBuilder extends AbstractTypeMemberRepBuilder<TypePropertyRepBuilder,
OneToOneAssociation> {
+public class TypePropertyReprBuilder extends AbstractTypeMemberReprBuilder<TypePropertyReprBuilder,
OneToOneAssociation> {
 
-    public static TypePropertyRepBuilder newBuilder(ResourceContext representationContext,
ObjectSpecification objectSpecification, OneToOneAssociation property) {
-        return new TypePropertyRepBuilder(representationContext, objectSpecification, property);
+    public static TypePropertyReprBuilder newBuilder(ResourceContext representationContext,
ObjectSpecification objectSpecification, OneToOneAssociation property) {
+        return new TypePropertyReprBuilder(representationContext, objectSpecification, property);
     }
 
-    public static LinkToBuilder newLinkToBuilder(ResourceContext resourceContext, String
rel, ObjectSpecification objectSpecification, OneToOneAssociation property) {
+    public static LinkReprBuilder newLinkToBuilder(ResourceContext resourceContext, String
rel, ObjectSpecification objectSpecification, OneToOneAssociation property) {
         String typeFullName = objectSpecification.getFullIdentifier();
         String propertyId = property.getId();
         String url = "domainTypes/" + typeFullName + "/properties/" + propertyId;
-        return LinkToBuilder.newBuilder(resourceContext, rel, url);
+        return LinkReprBuilder.newBuilder(resourceContext, rel, url);
     }
 
-    public TypePropertyRepBuilder(ResourceContext resourceContext, ObjectSpecification objectSpecification,
OneToOneAssociation property) {
+    public TypePropertyReprBuilder(ResourceContext resourceContext, ObjectSpecification objectSpecification,
OneToOneAssociation property) {
         super(resourceContext, objectSpecification, MemberType.OBJECT_COLLECTION, property);
     }
 

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/home/HomePageResourceServerside.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/HomePageResourceServerside.java?rev=1176973&r1=1176972&r2=1176973&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/home/HomePageResourceServerside.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/home/HomePageResourceServerside.java
Wed Sep 28 17:32:00 2011
@@ -18,20 +18,24 @@
  */
 package org.apache.isis.viewer.json.viewer.resources.home;
 
+import java.util.List;
+
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
-import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.apache.isis.viewer.json.applib.JsonRepresentation;
 import org.apache.isis.viewer.json.applib.RepresentationType;
 import org.apache.isis.viewer.json.applib.RestfulMediaType;
-import org.apache.isis.viewer.json.applib.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.json.applib.RestfulRequest.QueryParameter;
 import org.apache.isis.viewer.json.applib.homepage.HomePageResource;
-import org.apache.isis.viewer.json.viewer.JsonApplicationException;
-import org.apache.isis.viewer.json.viewer.representations.LinkToBuilder;
+import org.apache.isis.viewer.json.viewer.representations.LinkReprBuilder;
+import org.apache.isis.viewer.json.viewer.representations.ReprBuilder;
 import org.apache.isis.viewer.json.viewer.resources.ResourceAbstract;
+import org.apache.isis.viewer.json.viewer.resources.domainobjects.DomainServiceResourceHelper;
+import org.apache.isis.viewer.json.viewer.resources.user.UserReprBuilder;
+import org.apache.isis.viewer.json.viewer.resources.user.UserResourceHelper;
 
 /**
  * Implementation note: it seems to be necessary to annotate the implementation with {@link
Path} rather than the
@@ -45,27 +49,54 @@ public class HomePageResourceServerside 
     public Response resources() {
         init();
         
-        fakeRuntimeExceptionIfXFail();
-        
         JsonRepresentation representation = JsonRepresentation.newMap();
         
-        representation.mapPut("self", LinkToBuilder.newBuilder(getResourceContext(), "self",
"").build());
-        representation.mapPut("user", LinkToBuilder.newBuilder(getResourceContext(), "user",
"user").build());
-        representation.mapPut("services", LinkToBuilder.newBuilder(getResourceContext(),
"services", "services").build());
-        representation.mapPut("capabilities", LinkToBuilder.newBuilder(getResourceContext(),
"capabilities", "capabilities").build());
+        // self
+        representation.mapPut("self", LinkReprBuilder.newBuilder(getResourceContext(), "self",
"").build());
 
+        // user
+        putLinkToUser(representation);
+
+        // services
+        putLinkToServices(representation);
+        
+        // capabilities
+        representation.mapPut("capabilities", LinkReprBuilder.newBuilder(getResourceContext(),
"capabilities", "capabilities").build());
+
+        //
         representation.mapPut("links", JsonRepresentation.newArray());
         representation.mapPut("extensions", JsonRepresentation.newMap());
 
         return responseOfOk(RepresentationType.HOME_PAGE, Caching.ONE_DAY, representation).build();
     }
 
-    private void fakeRuntimeExceptionIfXFail() {
-        HttpHeaders httpHeaders = getResourceContext().getHttpHeaders();
-        if(httpHeaders.getRequestHeader("X-Fail") != null) {
-            throw JsonApplicationException.create(HttpStatusCode.METHOD_FAILURE);
+    private void putLinkToServices(JsonRepresentation representation) {
+
+        final LinkReprBuilder servicesLinkBuilder = LinkReprBuilder.newBuilder(getResourceContext(),
"services", "services");
+        
+        final List<String> followLinks = getResourceContext().getArg(QueryParameter.FOLLOW_LINKS);
+        if(followLinks.contains("services")) {
+            final ReprBuilder reprBuilder = 
+                    new DomainServiceResourceHelper(getResourceContext()).services();
+            servicesLinkBuilder.withValue(reprBuilder.build());
+        }
+        
+        representation.mapPut("services", servicesLinkBuilder.build());
+    }
+
+    private void putLinkToUser(JsonRepresentation representation) {
+        final LinkReprBuilder userLinkBuilder = LinkReprBuilder.newBuilder(getResourceContext(),
"user", "user");
+        
+        final List<String> followLinks = getResourceContext().getArg(QueryParameter.FOLLOW_LINKS);
+        if(followLinks.contains("user")) {
+            final ReprBuilder reprBuilder = 
+                    new UserResourceHelper(getResourceContext()).user();
+            userLinkBuilder.withValue(reprBuilder.build());
         }
+        
+        representation.mapPut("user", userLinkBuilder.build());
     }
 
 
+
 }
\ No newline at end of file

Copied: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserReprBuilder.java
(from r1170062, incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserRepBuilder.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/UserReprBuilder.java?p2=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserReprBuilder.java&p1=incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserRepBuilder.java&r1=1170062&r2=1176973&rev=1176973&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserRepBuilder.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserReprBuilder.java
Wed Sep 28 17:32:00 2011
@@ -19,20 +19,20 @@ package org.apache.isis.viewer.json.view
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.viewer.json.applib.JsonRepresentation;
 import org.apache.isis.viewer.json.viewer.ResourceContext;
-import org.apache.isis.viewer.json.viewer.representations.AbstractRepresentationBuilder;
+import org.apache.isis.viewer.json.viewer.representations.AbstractReprBuilder;
 
-public class UserRepBuilder extends AbstractRepresentationBuilder<UserRepBuilder> {
+public class UserReprBuilder extends AbstractReprBuilder<UserReprBuilder> {
 
-    public static UserRepBuilder newBuilder(ResourceContext resourceContext) {
-        return new UserRepBuilder(resourceContext);
+    public static UserReprBuilder newBuilder(ResourceContext resourceContext) {
+        return new UserReprBuilder(resourceContext);
     }
 
-    private UserRepBuilder(ResourceContext resourceContext) {
+    private UserReprBuilder(ResourceContext resourceContext) {
         super(resourceContext);
         withSelf("user");
     }
 
-    public UserRepBuilder withAuthenticationSession(AuthenticationSession authenticationSession)
{
+    public UserReprBuilder withAuthenticationSession(AuthenticationSession authenticationSession)
{
         representation.mapPut("username", authenticationSession.getUserName());
         JsonRepresentation roles = JsonRepresentation.newArray();
         for (String role : authenticationSession.getRoles()) {

Added: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserResourceHelper.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/UserResourceHelper.java?rev=1176973&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserResourceHelper.java
(added)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserResourceHelper.java
Wed Sep 28 17:32:00 2011
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.viewer.json.viewer.resources.user;
+
+import org.apache.isis.viewer.json.viewer.ResourceContext;
+import org.apache.isis.viewer.json.viewer.resources.AbstractResourceHelper;
+
+public class UserResourceHelper extends AbstractResourceHelper {
+
+    public UserResourceHelper(ResourceContext resourceContext) {
+        this(resourceContext, null);
+    }
+
+    public UserResourceHelper(ResourceContext resourceContext, String selfRef) {
+        super(resourceContext, selfRef);
+    }
+
+    public UserReprBuilder user() {
+        return UserReprBuilder.newBuilder(getResourceContext())
+                    .withAuthenticationSession(getResourceContext().getAuthenticationSession())
+                    .withSelf(getSelfRef());
+    }
+
+}

Modified: incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserResourceServerside.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/UserResourceServerside.java?rev=1176973&r1=1176972&r2=1176973&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserResourceServerside.java
(original)
+++ incubator/isis/trunk/framework/viewer/json/json-viewer/src/main/java/org/apache/isis/viewer/json/viewer/resources/user/UserResourceServerside.java
Wed Sep 28 17:32:00 2011
@@ -25,7 +25,7 @@ import javax.ws.rs.core.Response;
 import org.apache.isis.viewer.json.applib.RepresentationType;
 import org.apache.isis.viewer.json.applib.RestfulMediaType;
 import org.apache.isis.viewer.json.applib.user.UserResource;
-import org.apache.isis.viewer.json.viewer.ResourceContext;
+import org.apache.isis.viewer.json.viewer.representations.ReprBuilder;
 import org.apache.isis.viewer.json.viewer.resources.ResourceAbstract;
 
 public class UserResourceServerside extends ResourceAbstract implements UserResource {
@@ -34,11 +34,12 @@ public class UserResourceServerside exte
     @Produces({ MediaType.APPLICATION_JSON, RestfulMediaType.APPLICATION_JSON_USER })
     public Response user() {
         init();
-        
-        ResourceContext resourceContext = getResourceContext();
-        UserRepBuilder builder = UserRepBuilder.newBuilder(resourceContext).withAuthenticationSession(getAuthenticationSession());
 
-        return responseOfOk(RepresentationType.USER, Caching.ONE_HOUR, builder).build();
+        final ReprBuilder reprBuilder = 
+                new UserResourceHelper(getResourceContext()).user();
+
+        return responseOfOk(RepresentationType.USER, Caching.ONE_HOUR, reprBuilder.build()).build();
     }
 
+
 }



Mime
View raw message