You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2011/05/03 09:44:50 UTC

svn commit: r1098948 [5/16] - in /incubator/isis/trunk/viewer: restful/applib/src/main/java/org/apache/isis/viewer/restful/applib/ restful/applib/src/main/java/org/apache/isis/viewer/restful/applib/providers/ restful/applib/src/main/java/org/apache/isi...

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationAccess.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationAccess.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationAccess.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationAccess.java Tue May  3 07:44:41 2011
@@ -16,68 +16,65 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.resources.objects.properties;
-
-import java.text.MessageFormat;
-
-import nu.xom.Element;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
-import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectAssociation;
-import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
-
-
-public final class TableColumnOneToOneAssociationAccess extends TableColumnNakedObjectAssociation<OneToOneAssociation> {
-
-    public TableColumnOneToOneAssociationAccess(
-            final AuthenticationSession session,
-            final ObjectAdapter nakedObject,
-            final ResourceContext resourceContext) {
-        super("Access", session, nakedObject, resourceContext);
-    }
-
-    @Override
-    public Element doTd(final OneToOneAssociation property) {
-        if (!property.isVisible(getSession(), getNakedObject()).isAllowed()) {
-            return xhtmlRenderer.p(null, HtmlClass.PROPERTY);
-        }
-
-        final ObjectAdapter propertyValue = property.get(getNakedObject());
-        if (propertyValue == null) {
-            return xhtmlRenderer.p(null, HtmlClass.PROPERTY);
-        }
-
-        ParseableFacet parseable = property.getFacet(ParseableFacet.class);
-        if (parseable == null) {
-            final ObjectSpecification propertySpec = property.getSpecification();
-            parseable = propertySpec.getFacet(ParseableFacet.class);
-        }
-        if (parseable != null) {
-            return doTdForParseable(propertyValue);
-        } else {
-            return doTdForNonParseable(propertyValue);
-        }
-    }
-
-    private Element doTdForParseable(final ObjectAdapter propertyValue) {
-        final String titleString = propertyValue.titleString();
-        return xhtmlRenderer.p(titleString, HtmlClass.PROPERTY);
-    }
-
-    private Element doTdForNonParseable(final ObjectAdapter propertyValue) {
-        final String titleString = propertyValue.titleString();
-        final Oid oid = propertyValue.getOid();
-        if (oid == null) {
-            return xhtmlRenderer.p(null, HtmlClass.PROPERTY);
-        }
-        final String uri = MessageFormat.format("{0}/object/{1}", getContextPath(), getOidStr(propertyValue));
-        return new Element(xhtmlRenderer.aHref(uri, titleString, "propertyValue", "property", HtmlClass.PROPERTY));
-    }
-
-}
+package org.apache.isis.viewer.restful.viewer.resources.objects.properties;
+
+import java.text.MessageFormat;
+
+import nu.xom.Element;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
+import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectAssociation;
+import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
+
+public final class TableColumnOneToOneAssociationAccess extends TableColumnNakedObjectAssociation<OneToOneAssociation> {
+
+    public TableColumnOneToOneAssociationAccess(final AuthenticationSession session, final ObjectAdapter nakedObject,
+        final ResourceContext resourceContext) {
+        super("Access", session, nakedObject, resourceContext);
+    }
+
+    @Override
+    public Element doTd(final OneToOneAssociation property) {
+        if (!property.isVisible(getSession(), getNakedObject()).isAllowed()) {
+            return xhtmlRenderer.p(null, HtmlClass.PROPERTY);
+        }
+
+        final ObjectAdapter propertyValue = property.get(getNakedObject());
+        if (propertyValue == null) {
+            return xhtmlRenderer.p(null, HtmlClass.PROPERTY);
+        }
+
+        ParseableFacet parseable = property.getFacet(ParseableFacet.class);
+        if (parseable == null) {
+            final ObjectSpecification propertySpec = property.getSpecification();
+            parseable = propertySpec.getFacet(ParseableFacet.class);
+        }
+        if (parseable != null) {
+            return doTdForParseable(propertyValue);
+        } else {
+            return doTdForNonParseable(propertyValue);
+        }
+    }
+
+    private Element doTdForParseable(final ObjectAdapter propertyValue) {
+        final String titleString = propertyValue.titleString();
+        return xhtmlRenderer.p(titleString, HtmlClass.PROPERTY);
+    }
+
+    private Element doTdForNonParseable(final ObjectAdapter propertyValue) {
+        final String titleString = propertyValue.titleString();
+        final Oid oid = propertyValue.getOid();
+        if (oid == null) {
+            return xhtmlRenderer.p(null, HtmlClass.PROPERTY);
+        }
+        final String uri = MessageFormat.format("{0}/object/{1}", getContextPath(), getOidStr(propertyValue));
+        return new Element(xhtmlRenderer.aHref(uri, titleString, "propertyValue", "property", HtmlClass.PROPERTY));
+    }
+
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationClear.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationClear.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationClear.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationClear.java Tue May  3 07:44:41 2011
@@ -16,56 +16,53 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.resources.objects.properties;
-
-import java.text.MessageFormat;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
-import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectAssociationModifyAbstract;
-import org.apache.isis.viewer.restful.viewer.util.StringUtil;
-import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
-
-
-public final class TableColumnOneToOneAssociationClear extends
-        TableColumnNakedObjectAssociationModifyAbstract<OneToOneAssociation> {
-
-    public TableColumnOneToOneAssociationClear(
-            final AuthenticationSession session,
-            final ObjectAdapter nakedObject,
-            final ResourceContext resourceContext) {
-        super("Clear", session, nakedObject, resourceContext, false);
-    }
-
-    @Override
-    protected String getFormNamePrefix() {
-        return "property-";
-    }
-
-    @Override
-    protected String getHtmlClassAttribute() {
-        return HtmlClass.PROPERTY;
-    }
-
-    @Override
-    protected String getFormButtonLabel() {
-        return "Clear";
-    }
-
-    /**
-     * Calls the <tt>putProperty()</tt> Javascript function that lives in <tt>nof-rest-support.js</tt>
-     * 
-     * @param url
-     * @param associationId
-     * @param inputFieldName
-     *            - the name of the field in the form to read the value.
-     * @return
-     */
-    @Override
-    protected String invokeJavascript(final String url, final String associationId, final String inputFieldName) {
-        return MessageFormat.format("clearProperty({0},{1});", StringUtil.quote(url), StringUtil.quote(associationId));
-    }
-
-}
+package org.apache.isis.viewer.restful.viewer.resources.objects.properties;
+
+import java.text.MessageFormat;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
+import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectAssociationModifyAbstract;
+import org.apache.isis.viewer.restful.viewer.util.StringUtil;
+import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
+
+public final class TableColumnOneToOneAssociationClear extends
+    TableColumnNakedObjectAssociationModifyAbstract<OneToOneAssociation> {
+
+    public TableColumnOneToOneAssociationClear(final AuthenticationSession session, final ObjectAdapter nakedObject,
+        final ResourceContext resourceContext) {
+        super("Clear", session, nakedObject, resourceContext, false);
+    }
+
+    @Override
+    protected String getFormNamePrefix() {
+        return "property-";
+    }
+
+    @Override
+    protected String getHtmlClassAttribute() {
+        return HtmlClass.PROPERTY;
+    }
+
+    @Override
+    protected String getFormButtonLabel() {
+        return "Clear";
+    }
+
+    /**
+     * Calls the <tt>putProperty()</tt> Javascript function that lives in <tt>nof-rest-support.js</tt>
+     * 
+     * @param url
+     * @param associationId
+     * @param inputFieldName
+     *            - the name of the field in the form to read the value.
+     * @return
+     */
+    @Override
+    protected String invokeJavascript(final String url, final String associationId, final String inputFieldName) {
+        return MessageFormat.format("clearProperty({0},{1});", StringUtil.quote(url), StringUtil.quote(associationId));
+    }
+
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationInvalidReason.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationInvalidReason.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationInvalidReason.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationInvalidReason.java Tue May  3 07:44:41 2011
@@ -16,29 +16,25 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.resources.objects.properties;
-
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectMemberInvalidReason;
-import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
-
-
-public final class TableColumnOneToOneAssociationInvalidReason extends
-        TableColumnNakedObjectMemberInvalidReason<OneToOneAssociation> {
-
-    public TableColumnOneToOneAssociationInvalidReason(
-            final AuthenticationSession session,
-            final ObjectAdapter nakedObject,
-            final ResourceContext resourceContext) {
-        super(session, nakedObject, resourceContext);
-    }
-
-    @Override
-    protected String getDomId(final OneToOneAssociation member) {
-        return "property-invalid-" + member.getId();
-    }
-
-}
+package org.apache.isis.viewer.restful.viewer.resources.objects.properties;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectMemberInvalidReason;
+import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
+
+public final class TableColumnOneToOneAssociationInvalidReason extends
+    TableColumnNakedObjectMemberInvalidReason<OneToOneAssociation> {
+
+    public TableColumnOneToOneAssociationInvalidReason(final AuthenticationSession session,
+        final ObjectAdapter nakedObject, final ResourceContext resourceContext) {
+        super(session, nakedObject, resourceContext);
+    }
+
+    @Override
+    protected String getDomId(final OneToOneAssociation member) {
+        return "property-invalid-" + member.getId();
+    }
+
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationModify.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationModify.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationModify.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationModify.java Tue May  3 07:44:41 2011
@@ -16,57 +16,54 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.resources.objects.properties;
-
-import java.text.MessageFormat;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
-import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectAssociationModifyAbstract;
-import org.apache.isis.viewer.restful.viewer.util.StringUtil;
-import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
-
-
-public final class TableColumnOneToOneAssociationModify extends
-        TableColumnNakedObjectAssociationModifyAbstract<OneToOneAssociation> {
-
-    public TableColumnOneToOneAssociationModify(
-            final AuthenticationSession session,
-            final ObjectAdapter nakedObject,
-            final ResourceContext resourceContext) {
-        super("Modify", session, nakedObject, resourceContext);
-    }
-
-    @Override
-    protected String getFormNamePrefix() {
-        return "property-";
-    }
-
-    @Override
-    protected String getHtmlClassAttribute() {
-        return HtmlClass.PROPERTY;
-    }
-
-    @Override
-    protected String getFormButtonLabel() {
-        return "Set";
-    }
-
-    /**
-     * Calls the <tt>putProperty()</tt> Javascript function that lives in <tt>nof-rest-support.js</tt>
-     * 
-     * @param url
-     * @param associationId
-     * @param inputFieldName
-     *            - the name of the field in the form to read the value.
-     * @return
-     */
-    @Override
-    protected String invokeJavascript(final String url, final String associationId, final String inputFieldName) {
-        return MessageFormat.format("modifyProperty({0},{1},{2}.value);", StringUtil.quote(url), StringUtil.quote(associationId),
-                inputFieldName);
-    }
-
-}
+package org.apache.isis.viewer.restful.viewer.resources.objects.properties;
+
+import java.text.MessageFormat;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
+import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectAssociationModifyAbstract;
+import org.apache.isis.viewer.restful.viewer.util.StringUtil;
+import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
+
+public final class TableColumnOneToOneAssociationModify extends
+    TableColumnNakedObjectAssociationModifyAbstract<OneToOneAssociation> {
+
+    public TableColumnOneToOneAssociationModify(final AuthenticationSession session, final ObjectAdapter nakedObject,
+        final ResourceContext resourceContext) {
+        super("Modify", session, nakedObject, resourceContext);
+    }
+
+    @Override
+    protected String getFormNamePrefix() {
+        return "property-";
+    }
+
+    @Override
+    protected String getHtmlClassAttribute() {
+        return HtmlClass.PROPERTY;
+    }
+
+    @Override
+    protected String getFormButtonLabel() {
+        return "Set";
+    }
+
+    /**
+     * Calls the <tt>putProperty()</tt> Javascript function that lives in <tt>nof-rest-support.js</tt>
+     * 
+     * @param url
+     * @param associationId
+     * @param inputFieldName
+     *            - the name of the field in the form to read the value.
+     * @return
+     */
+    @Override
+    protected String invokeJavascript(final String url, final String associationId, final String inputFieldName) {
+        return MessageFormat.format("modifyProperty({0},{1},{2}.value);", StringUtil.quote(url),
+            StringUtil.quote(associationId), inputFieldName);
+    }
+
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationName.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationName.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationName.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationName.java Tue May  3 07:44:41 2011
@@ -16,39 +16,36 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.resources.objects.properties;
-
-import java.text.MessageFormat;
-
-import nu.xom.Element;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
-import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectMemberName;
-import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
-
-
-public class TableColumnOneToOneAssociationName extends TableColumnNakedObjectMemberName<OneToOneAssociation> {
-
-    public TableColumnOneToOneAssociationName(
-            final ObjectSpecification noSpec,
-            final AuthenticationSession session,
-            final ObjectAdapter nakedObject,
-            final ResourceContext resourceContext) {
-        super(noSpec, session, nakedObject, resourceContext);
-    }
-
-    @Override
-    public Element doTd(final OneToOneAssociation oneToOneAssociation) {
-        final String memberName = oneToOneAssociation.getIdentifier().getMemberName();
-        final String memberType = "property";
-        final String uri = MessageFormat.format("{0}/specs/{1}/{2}/{3}", getContextPath(), getNoSpec().getFullIdentifier(), memberType,
-                memberName);
-        return new Element(xhtmlRenderer.aHref(uri, oneToOneAssociation.getName(), "propertySpec", memberType, HtmlClass.PROPERTY));
-    }
-
-
-}
+package org.apache.isis.viewer.restful.viewer.resources.objects.properties;
+
+import java.text.MessageFormat;
+
+import nu.xom.Element;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
+import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectMemberName;
+import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
+
+public class TableColumnOneToOneAssociationName extends TableColumnNakedObjectMemberName<OneToOneAssociation> {
+
+    public TableColumnOneToOneAssociationName(final ObjectSpecification noSpec, final AuthenticationSession session,
+        final ObjectAdapter nakedObject, final ResourceContext resourceContext) {
+        super(noSpec, session, nakedObject, resourceContext);
+    }
+
+    @Override
+    public Element doTd(final OneToOneAssociation oneToOneAssociation) {
+        final String memberName = oneToOneAssociation.getIdentifier().getMemberName();
+        final String memberType = "property";
+        final String uri =
+            MessageFormat.format("{0}/specs/{1}/{2}/{3}", getContextPath(), getNoSpec().getFullIdentifier(),
+                memberType, memberName);
+        return new Element(xhtmlRenderer.aHref(uri, oneToOneAssociation.getName(), "propertySpec", memberType,
+            HtmlClass.PROPERTY));
+    }
+
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationParseable.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationParseable.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationParseable.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationParseable.java Tue May  3 07:44:41 2011
@@ -16,31 +16,29 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.resources.objects.properties;
-
-import nu.xom.Element;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
-import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectAssociation;
-import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
-
-
-public final class TableColumnOneToOneAssociationParseable extends TableColumnNakedObjectAssociation<OneToOneAssociation> {
-
-    public TableColumnOneToOneAssociationParseable(
-            final AuthenticationSession session,
-            final ObjectAdapter nakedObject,
-            final ResourceContext resourceContext) {
-        super("Parseable", session, nakedObject, resourceContext);
-    }
-
-    @Override
-    public Element doTd(final OneToOneAssociation property) {
-        final boolean parseable = property.getFacet(ParseableFacet.class) != null;
-        return xhtmlRenderer.p(parseable, HtmlClass.VISIBLE);
-    }
-}
+package org.apache.isis.viewer.restful.viewer.resources.objects.properties;
+
+import nu.xom.Element;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
+import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectAssociation;
+import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
+
+public final class TableColumnOneToOneAssociationParseable extends
+    TableColumnNakedObjectAssociation<OneToOneAssociation> {
+
+    public TableColumnOneToOneAssociationParseable(final AuthenticationSession session,
+        final ObjectAdapter nakedObject, final ResourceContext resourceContext) {
+        super("Parseable", session, nakedObject, resourceContext);
+    }
+
+    @Override
+    public Element doTd(final OneToOneAssociation property) {
+        final boolean parseable = property.getFacet(ParseableFacet.class) != null;
+        return xhtmlRenderer.p(parseable, HtmlClass.VISIBLE);
+    }
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/services/ServicesResourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/services/ServicesResourceImpl.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/services/ServicesResourceImpl.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/services/ServicesResourceImpl.java Tue May  3 07:44:41 2011
@@ -16,49 +16,51 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.resources.services;
-
-import java.text.MessageFormat;
-import java.util.List;
-
-import javax.ws.rs.Path;
-
-import nu.xom.Element;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.restful.applib.resources.ServicesResource;
-import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
-import org.apache.isis.viewer.restful.viewer.html.XhtmlTemplate;
-import org.apache.isis.viewer.restful.viewer.resources.ResourceAbstract;
-
-
-/**
- * Implementation note: it seems to be necessary to annotate the implementation with {@link Path} rather than
- * the interface (at least under RestEasy 1.0.2 and 1.1-RC2).
- */
-@Path("/services")
-public class ServicesResourceImpl extends ResourceAbstract implements ServicesResource {
-
-    public String services() {
-        init();
-        final XhtmlTemplate xhtml = new XhtmlTemplate("Services", getServletRequest());
-        
-        xhtml.appendToBody(asDivNofSession());
-        xhtml.appendToBody(resourcesDiv());
-
-        final Element div = xhtmlRenderer.div_p("Services", HtmlClass.SECTION);
-
-        final Element ul = xhtmlRenderer.ul(HtmlClass.SERVICES);
-        final List<ObjectAdapter> serviceAdapters = getPersistenceSession().getServices();
-        for (final ObjectAdapter serviceAdapter : serviceAdapters) {
-            final String uri = MessageFormat.format("{0}/object/{1}", getServletRequest().getContextPath(), getOidStr(serviceAdapter));
-            ul.appendChild(xhtmlRenderer.li_a(uri, serviceAdapter.titleString(), "object", "services", HtmlClass.SERVICE));
-        }
-        div.appendChild(ul);
-
-        xhtml.appendToBody(div);
-        
-		return xhtml.toXML();
-    }
-
-}
+package org.apache.isis.viewer.restful.viewer.resources.services;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import javax.ws.rs.Path;
+
+import nu.xom.Element;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.restful.applib.resources.ServicesResource;
+import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
+import org.apache.isis.viewer.restful.viewer.html.XhtmlTemplate;
+import org.apache.isis.viewer.restful.viewer.resources.ResourceAbstract;
+
+/**
+ * Implementation note: it seems to be necessary to annotate the implementation with {@link Path} rather than the
+ * interface (at least under RestEasy 1.0.2 and 1.1-RC2).
+ */
+@Path("/services")
+public class ServicesResourceImpl extends ResourceAbstract implements ServicesResource {
+
+    @Override
+    public String services() {
+        init();
+        final XhtmlTemplate xhtml = new XhtmlTemplate("Services", getServletRequest());
+
+        xhtml.appendToBody(asDivNofSession());
+        xhtml.appendToBody(resourcesDiv());
+
+        final Element div = xhtmlRenderer.div_p("Services", HtmlClass.SECTION);
+
+        final Element ul = xhtmlRenderer.ul(HtmlClass.SERVICES);
+        final List<ObjectAdapter> serviceAdapters = getPersistenceSession().getServices();
+        for (final ObjectAdapter serviceAdapter : serviceAdapters) {
+            final String uri =
+                MessageFormat.format("{0}/object/{1}", getServletRequest().getContextPath(), getOidStr(serviceAdapter));
+            ul.appendChild(xhtmlRenderer.li_a(uri, serviceAdapter.titleString(), "object", "services",
+                HtmlClass.SERVICE));
+        }
+        div.appendChild(ul);
+
+        xhtml.appendToBody(div);
+
+        return xhtml.toXML();
+    }
+
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/specs/SpecsResourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/specs/SpecsResourceImpl.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/specs/SpecsResourceImpl.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/specs/SpecsResourceImpl.java Tue May  3 07:44:41 2011
@@ -16,437 +16,421 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.resources.specs;
-
-import java.beans.IntrospectionException;
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.ws.rs.Path;
-import javax.ws.rs.WebApplicationException;
-
-import nu.xom.Element;
-
-import com.google.common.collect.Lists;
-
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.restful.applib.resources.SpecsResource;
-import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
-import org.apache.isis.viewer.restful.viewer.html.XhtmlTemplate;
-import org.apache.isis.viewer.restful.viewer.resources.ResourceAbstract;
-import org.apache.isis.viewer.restful.viewer.util.ActionUtils;
-
-
-/**
- * Implementation note: it seems to be necessary to annotate the implementation with {@link Path} rather than
- * the interface (at least under RestEasy 1.0.2 and 1.1-RC2).
- */
-@Path("/specs")
-public class SpecsResourceImpl extends ResourceAbstract implements SpecsResource {
-
-    @Override
-    public String specs() {
-        init();
-
-        final XhtmlTemplate xhtml = new XhtmlTemplate("Specifications", getServletRequest());
-        
-        xhtml.appendToBody(asDivNofSession());
-        xhtml.appendToBody(resourcesDiv());
-
-        final Element div = xhtmlRenderer.div_p("Specifications", HtmlClass.SECTION);
-
-        final Element ul = xhtmlRenderer.ul(HtmlClass.SPECIFICATIONS);
-        final ArrayList<ObjectSpecification> allSpecs = Lists.newArrayList(getSpecificationLoader().allSpecifications());
-        Collections.sort(allSpecs, ObjectSpecification.COMPARATOR_FULLY_QUALIFIED_CLASS_NAME);
-        final List<ObjectSpecification> sorted = allSpecs;
-        for (final ObjectSpecification spec : sorted) {
-            final String specFullName = spec.getFullIdentifier();
-            final String uri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
-            ul.appendChild(xhtmlRenderer.li_a(uri, specFullName, "spec", "specs", HtmlClass.SPECIFICATION));
-        }
-        div.appendChild(ul);
-
-        xhtml.appendToBody(div);
-        
-		return xhtml.toXML();
-    }
-
-
-    private SpecificationLoader getSpecificationLoader() {
-        return IsisContext.getSpecificationLoader();
-    }
-
-    // /////////////////////////////////////////////////////////////////////
-    // spec
-    // /////////////////////////////////////////////////////////////////////
-
-    @Override
-    public String spec(final String specFullName) {
-        init();
-        final XhtmlTemplate xhtml = new XhtmlTemplate(specFullName, getServletRequest());
-        xhtml.appendToBody(asDivNofSession());
-
-        final ObjectSpecification noSpec = getSpecification(specFullName);
-
-        xhtml.appendToBody(asDivTableFacets(noSpec, noSpec.getFullIdentifier()));
-
-        final Element propertiesDivEl = asDivProperties(noSpec);
-        xhtml.appendToBody(propertiesDivEl);
-
-        final Element collectionsDivEl = asDivCollections(noSpec);
-        xhtml.appendToBody(collectionsDivEl);
-
-        for (final ActionType type : ACTION_TYPES) {
-            final Element actionsDivEl = asDivActions(noSpec, type);
-            xhtml.appendToBody(actionsDivEl);
-        }
-
-        return xhtml.toXML();
-    }
-
-    private Element asDivProperties(final ObjectSpecification noSpec) {
-        final Element div = xhtmlRenderer.div_p("Properties", HtmlClass.PROPERTIES);
-
-        final List<OneToOneAssociation> properties = noSpec.getProperties();
-        final Element ul = xhtmlRenderer.ul(HtmlClass.PROPERTIES);
-        div.appendChild(ul);
-        for (final ObjectAssociation property : properties) {
-            final String propertyId = property.getIdentifier().getMemberName();
-            final String path = MessageFormat.format("{0}/specs/{1}/property/{2}", getServletRequest().getContextPath(), noSpec
-                    .getFullIdentifier(), propertyId);
-            final Element li = xhtmlRenderer.li_a(path, propertyId, "property", "spec", HtmlClass.PROPERTY);
-            ul.appendChild(li);
-        }
-        return div;
-    }
-
-    private Element asDivCollections(final ObjectSpecification noSpec) {
-        final Element div = xhtmlRenderer.div_p("Collections", HtmlClass.COLLECTIONS);
-
-        final List<OneToManyAssociation> collections = noSpec.getCollections();
-        final Element ul = xhtmlRenderer.ul(HtmlClass.COLLECTIONS);
-        div.appendChild(ul);
-        for (final ObjectAssociation collection : collections) {
-            final String collectionId = collection.getIdentifier().getMemberName();
-            final String path = MessageFormat.format("{0}/specs/{1}/collection/{2}", getServletRequest().getContextPath(), noSpec
-                    .getFullIdentifier(), collectionId);
-            final Element li = xhtmlRenderer.li_a(path, collectionId, "collection", "spec", HtmlClass.COLLECTION);
-            ul.appendChild(li);
-        }
-        return div;
-    }
-
-    private Element asDivActions(final ObjectSpecification noSpec, final ActionType type) {
-        final Element div = xhtmlRenderer.div_p(type.name() + " actions", HtmlClass.ACTIONS);
-
-        final List<ObjectAction> actions = ActionUtils.flattened(noSpec.getObjectActions(type));
-        final Element ul = xhtmlRenderer.ul(HtmlClass.ACTIONS);
-        div.appendChild(ul);
-        for (final ObjectAction action : actions) {
-            final Identifier actionIdentifier = action.getIdentifier();
-            final String actionId = actionIdentifier.toNameParmsIdentityString();
-            final String noSpecFullName = noSpec.getFullIdentifier();
-            final String uri = MessageFormat.format("{0}/specs/{1}/action/{2}", getServletRequest().getContextPath(), noSpecFullName, actionId);
-            final Element li = xhtmlRenderer.li_a(uri, actionId, "action", "spec", HtmlClass.ACTION);
-            ul.appendChild(li);
-        }
-        return div;
-    }
-
-    // /////////////////////////////////////////////////////////////////////
-    // specFacet
-    // /////////////////////////////////////////////////////////////////////
-
-    @Override
-    public String specFacet(
-            final String specFullName,
-            final String facetTypeName) {
-        init();
-
-        final String specAndFacet = specFullName + "/facet/" + facetTypeName;
-        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndFacet, getServletRequest());
-        xhtml.appendToBody(asDivNofSession());
-
-
-        final ObjectSpecification noSpec = getSpecification(specFullName);
-
-        final String uri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
-        xhtml.appendToBody(xhtmlRenderer.aHref(uri, "owning spec", "spec", "facet", HtmlClass.SPECIFICATION));
-
-        try {
-            xhtml.appendToBody(divFacetElements(facetTypeName, noSpec));
-        } catch (final IllegalArgumentException e) {
-            throw new WebApplicationException(responseOfNotFound(e));
-        } catch (final ClassNotFoundException e) {
-            throw new WebApplicationException(responseOfInternalServerError(e));
-        } catch (final IntrospectionException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        } catch (final IllegalAccessException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        } catch (final InvocationTargetException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        }
-
-        return xhtml.toXML();
-    }
-
-    // /////////////////////////////////////////////////////////////////////
-    // specProperty
-    // /////////////////////////////////////////////////////////////////////
-
-    @Override
-    public String specProperty(
-            final String specFullName,
-            final String propertyName) {
-        init();
-
-        final String specAndProperty = specFullName + "/property/" + propertyName;
-        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndProperty, getServletRequest());
-        xhtml.appendToBody(asDivNofSession());
-
-
-        // owners
-        final Element div = xhtmlRenderer.div_p("Owners", null);
-        xhtml.appendToBody(div);
-        final Element ul = xhtmlRenderer.ul(HtmlClass.SPECIFICATION);
-
-        final String uri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
-        ul.appendChild(xhtmlRenderer.aHref(uri, "owning spec", "spec", "property", HtmlClass.SPECIFICATION));
-
-        div.appendChild(ul);
-
-        
-        final ObjectSpecification noSpec = getSpecification(specFullName);
-        final ObjectAssociation property = noSpec.getAssociation(propertyName);
-
-        xhtml.appendToBody(asDivTableFacets(property, propertyName));
-
-        return xhtml.toXML();
-    }
-
-    // /////////////////////////////////////////////////////////////////////
-    // specCollection
-    // /////////////////////////////////////////////////////////////////////
-
-    @Override
-    public String specCollection(
-            final String specFullName,
-            final String collectionName) {
-        init();
-
-        final String specAndCollection = specFullName + "/collection/" + collectionName;
-        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndCollection, getServletRequest());
-        xhtml.appendToBody(asDivNofSession());
-
-
-        // owners
-        final Element div = xhtmlRenderer.div_p("Owners", null);
-        xhtml.appendToBody(div);
-        final Element ul = xhtmlRenderer.ul(HtmlClass.SPECIFICATION);
-
-        final String uri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
-        ul.appendChild(xhtmlRenderer.aHref(uri, "owning spec", "spec", "collection", HtmlClass.SPECIFICATION));
-
-        div.appendChild(ul);
-
-        
-        final ObjectSpecification noSpec = getSpecification(specFullName);
-        final ObjectAssociation collection = noSpec.getAssociation(collectionName);
-
-        xhtml.appendToBody(asDivTableFacets(collection, collectionName));
-
-        return xhtml.toXML();
-    }
-
-    // /////////////////////////////////////////////////////////////////////
-    // specAction
-    // /////////////////////////////////////////////////////////////////////
-
-    @Override
-    public String specAction(
-    		final String specFullName, 
-    		final String actionId) {
-        init();
-
-        final String specAndAction = specFullName + "/action/" + actionId;
-        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndAction, getServletRequest());
-        xhtml.appendToBody(asDivNofSession());
-
-
-        // owners
-        final Element div = xhtmlRenderer.div_p("Owners", null);
-        xhtml.appendToBody(div);
-        final Element ul = xhtmlRenderer.ul(HtmlClass.SPECIFICATION);
-
-        final String specUri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
-        ul.appendChild(xhtmlRenderer.li_a(specUri, specFullName, "owning spec", "spec", HtmlClass.SPECIFICATION));
-
-        div.appendChild(ul);
-
-        
-        final ObjectSpecification noSpec = getSpecification(specFullName);
-        final ObjectAction action = noSpec.getObjectAction(null, actionId);
-
-        xhtml.appendToBody(asDivTableFacets(action, actionId));
-
-        return xhtml.toXML();
-    }
-
-    // /////////////////////////////////////////////////////////////////////
-    // specPropertyFacet
-    // /////////////////////////////////////////////////////////////////////
-
-    @Override
-    public String specPropertyFacet(
-            final String specFullName,
-            final String propertyName,
-            final String facetTypeName) {
-        init();
-
-        final String specAndPropertyAndFacet = specFullName + "/property/" + propertyName + "/facet/" + facetTypeName;
-        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndPropertyAndFacet, getServletRequest());
-        xhtml.appendToBody(asDivNofSession());
-
-
-        final ObjectSpecification noSpec = getSpecification(specFullName);
-        final ObjectAssociation property = noSpec.getAssociation(propertyName);
-
-        // owners
-        final Element div = xhtmlRenderer.div_p("Owners", null);
-        xhtml.appendToBody(div);
-        final Element ul = xhtmlRenderer.ul(HtmlClass.PROPERTIES);
-
-        final String specUri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
-        ul.appendChild(xhtmlRenderer.li_a(specUri, specFullName, "owning spec", "spec", "facet"));
-
-        final String propertyUri = MessageFormat.format("{0}/specs/{1}/property/{2}", getServletRequest().getContextPath(),
-                specFullName, propertyName);
-        ul.appendChild(xhtmlRenderer.li_a(propertyUri, propertyName, "owning property", "property", "facet"));
-
-        div.appendChild(ul);
-
-        try {
-            xhtml.appendToBody(divFacetElements(facetTypeName, property));
-        } catch (final IllegalArgumentException e) {
-        	throw new WebApplicationException(responseOfNotFound(e));
-        } catch (final ClassNotFoundException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        } catch (final IntrospectionException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        } catch (final IllegalAccessException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        } catch (final InvocationTargetException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        }
-
-        return xhtml.toXML();
-    }
-
-    // /////////////////////////////////////////////////////////////////////
-    // specCollectionFacet
-    // /////////////////////////////////////////////////////////////////////
-
-    @Override
-    public String specCollectionFacet(
-            final String specFullName,
-            final String collectionId,
-            final String facetTypeName) {
-        init();
-
-        final String specAndPropertyAndFacet = specFullName + "/collection/" + collectionId + "/facet/" + facetTypeName;
-        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndPropertyAndFacet, getServletRequest());
-        xhtml.appendToBody(asDivNofSession());
-
-
-        final ObjectSpecification noSpec = getSpecification(specFullName);
-        final ObjectAssociation collection = noSpec.getAssociation(collectionId);
-
-        // owners
-        final Element div = xhtmlRenderer.div_p("Owners", null);
-        xhtml.appendToBody(div);
-        final Element ul = xhtmlRenderer.ul(HtmlClass.PROPERTIES);
-
-        final String specUri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
-        ul.appendChild(xhtmlRenderer.li_a(specUri, specFullName, "owning spec", "spec", "facet"));
-
-        final String collectionUri = MessageFormat.format("{0}/specs/{1}/collection/{2}", getServletRequest().getContextPath(),
-                specFullName, collectionId);
-        ul.appendChild(xhtmlRenderer.li_a(collectionUri, collectionId, "owning collection", "collection", "facet"));
-        div.appendChild(ul);
-
-        try {
-            xhtml.appendToBody(divFacetElements(facetTypeName, collection));
-        } catch (final IllegalArgumentException e) {
-        	throw new WebApplicationException(responseOfNotFound(e));
-        } catch (final ClassNotFoundException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        } catch (final IntrospectionException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        } catch (final IllegalAccessException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        } catch (final InvocationTargetException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        }
-
-        return xhtml.toXML();
-    }
-
-    // /////////////////////////////////////////////////////////////////////
-    // specActionFacet
-    // /////////////////////////////////////////////////////////////////////
-
-    @Override
-    public String specActionFacet(
-            final String specFullName,
-            final String actionId,
-            final String facetTypeName) {
-        init();
-
-        final String specAndPropertyAndFacet = specFullName + "/action/" + actionId + "/facet/" + facetTypeName;
-        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndPropertyAndFacet, getServletRequest());
-        xhtml.appendToBody(asDivNofSession());
-
-
-        final ObjectSpecification noSpec = getSpecification(specFullName);
-        final ObjectAction action = noSpec.getObjectAction(null, actionId);
-
-        // owners
-        final Element div = xhtmlRenderer.div_p("Owners", null);
-        xhtml.appendToBody(div);
-        final Element ul = xhtmlRenderer.ul(HtmlClass.PROPERTIES);
-        final String specUri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
-        ul.appendChild(xhtmlRenderer.li_a(specUri, specFullName, "owning spec", "spec", "facet"));
-        final String actionUri = MessageFormat.format("{0}/specs/{1}/action/{2}", getServletRequest().getContextPath(), specFullName,
-                actionId);
-        ul.appendChild(xhtmlRenderer.li_a(actionUri, actionId, "owning action", "collection", "facet"));
-        div.appendChild(ul);
-
-        try {
-            xhtml.appendToBody(divFacetElements(facetTypeName, action));
-        } catch (final IllegalArgumentException e) {
-        	throw new WebApplicationException(responseOfNotFound(e));
-        } catch (final ClassNotFoundException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        } catch (final IntrospectionException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        } catch (final IllegalAccessException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        } catch (final InvocationTargetException e) {
-        	throw new WebApplicationException(responseOfInternalServerError(e));
-        }
-
-        return xhtml.toXML();
-    }
-
-}
+package org.apache.isis.viewer.restful.viewer.resources.specs;
+
+import java.beans.IntrospectionException;
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.ws.rs.Path;
+import javax.ws.rs.WebApplicationException;
+
+import nu.xom.Element;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.core.metamodel.spec.ActionType;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.restful.applib.resources.SpecsResource;
+import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
+import org.apache.isis.viewer.restful.viewer.html.XhtmlTemplate;
+import org.apache.isis.viewer.restful.viewer.resources.ResourceAbstract;
+import org.apache.isis.viewer.restful.viewer.util.ActionUtils;
+
+import com.google.common.collect.Lists;
+
+/**
+ * Implementation note: it seems to be necessary to annotate the implementation with {@link Path} rather than the
+ * interface (at least under RestEasy 1.0.2 and 1.1-RC2).
+ */
+@Path("/specs")
+public class SpecsResourceImpl extends ResourceAbstract implements SpecsResource {
+
+    @Override
+    public String specs() {
+        init();
+
+        final XhtmlTemplate xhtml = new XhtmlTemplate("Specifications", getServletRequest());
+
+        xhtml.appendToBody(asDivNofSession());
+        xhtml.appendToBody(resourcesDiv());
+
+        final Element div = xhtmlRenderer.div_p("Specifications", HtmlClass.SECTION);
+
+        final Element ul = xhtmlRenderer.ul(HtmlClass.SPECIFICATIONS);
+        final ArrayList<ObjectSpecification> allSpecs =
+            Lists.newArrayList(getSpecificationLoader().allSpecifications());
+        Collections.sort(allSpecs, ObjectSpecification.COMPARATOR_FULLY_QUALIFIED_CLASS_NAME);
+        final List<ObjectSpecification> sorted = allSpecs;
+        for (final ObjectSpecification spec : sorted) {
+            final String specFullName = spec.getFullIdentifier();
+            final String uri =
+                MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
+            ul.appendChild(xhtmlRenderer.li_a(uri, specFullName, "spec", "specs", HtmlClass.SPECIFICATION));
+        }
+        div.appendChild(ul);
+
+        xhtml.appendToBody(div);
+
+        return xhtml.toXML();
+    }
+
+    private SpecificationLoader getSpecificationLoader() {
+        return IsisContext.getSpecificationLoader();
+    }
+
+    // /////////////////////////////////////////////////////////////////////
+    // spec
+    // /////////////////////////////////////////////////////////////////////
+
+    @Override
+    public String spec(final String specFullName) {
+        init();
+        final XhtmlTemplate xhtml = new XhtmlTemplate(specFullName, getServletRequest());
+        xhtml.appendToBody(asDivNofSession());
+
+        final ObjectSpecification noSpec = getSpecification(specFullName);
+
+        xhtml.appendToBody(asDivTableFacets(noSpec, noSpec.getFullIdentifier()));
+
+        final Element propertiesDivEl = asDivProperties(noSpec);
+        xhtml.appendToBody(propertiesDivEl);
+
+        final Element collectionsDivEl = asDivCollections(noSpec);
+        xhtml.appendToBody(collectionsDivEl);
+
+        for (final ActionType type : ACTION_TYPES) {
+            final Element actionsDivEl = asDivActions(noSpec, type);
+            xhtml.appendToBody(actionsDivEl);
+        }
+
+        return xhtml.toXML();
+    }
+
+    private Element asDivProperties(final ObjectSpecification noSpec) {
+        final Element div = xhtmlRenderer.div_p("Properties", HtmlClass.PROPERTIES);
+
+        final List<OneToOneAssociation> properties = noSpec.getProperties();
+        final Element ul = xhtmlRenderer.ul(HtmlClass.PROPERTIES);
+        div.appendChild(ul);
+        for (final ObjectAssociation property : properties) {
+            final String propertyId = property.getIdentifier().getMemberName();
+            final String path =
+                MessageFormat.format("{0}/specs/{1}/property/{2}", getServletRequest().getContextPath(),
+                    noSpec.getFullIdentifier(), propertyId);
+            final Element li = xhtmlRenderer.li_a(path, propertyId, "property", "spec", HtmlClass.PROPERTY);
+            ul.appendChild(li);
+        }
+        return div;
+    }
+
+    private Element asDivCollections(final ObjectSpecification noSpec) {
+        final Element div = xhtmlRenderer.div_p("Collections", HtmlClass.COLLECTIONS);
+
+        final List<OneToManyAssociation> collections = noSpec.getCollections();
+        final Element ul = xhtmlRenderer.ul(HtmlClass.COLLECTIONS);
+        div.appendChild(ul);
+        for (final ObjectAssociation collection : collections) {
+            final String collectionId = collection.getIdentifier().getMemberName();
+            final String path =
+                MessageFormat.format("{0}/specs/{1}/collection/{2}", getServletRequest().getContextPath(),
+                    noSpec.getFullIdentifier(), collectionId);
+            final Element li = xhtmlRenderer.li_a(path, collectionId, "collection", "spec", HtmlClass.COLLECTION);
+            ul.appendChild(li);
+        }
+        return div;
+    }
+
+    private Element asDivActions(final ObjectSpecification noSpec, final ActionType type) {
+        final Element div = xhtmlRenderer.div_p(type.name() + " actions", HtmlClass.ACTIONS);
+
+        final List<ObjectAction> actions = ActionUtils.flattened(noSpec.getObjectActions(type));
+        final Element ul = xhtmlRenderer.ul(HtmlClass.ACTIONS);
+        div.appendChild(ul);
+        for (final ObjectAction action : actions) {
+            final Identifier actionIdentifier = action.getIdentifier();
+            final String actionId = actionIdentifier.toNameParmsIdentityString();
+            final String noSpecFullName = noSpec.getFullIdentifier();
+            final String uri =
+                MessageFormat.format("{0}/specs/{1}/action/{2}", getServletRequest().getContextPath(), noSpecFullName,
+                    actionId);
+            final Element li = xhtmlRenderer.li_a(uri, actionId, "action", "spec", HtmlClass.ACTION);
+            ul.appendChild(li);
+        }
+        return div;
+    }
+
+    // /////////////////////////////////////////////////////////////////////
+    // specFacet
+    // /////////////////////////////////////////////////////////////////////
+
+    @Override
+    public String specFacet(final String specFullName, final String facetTypeName) {
+        init();
+
+        final String specAndFacet = specFullName + "/facet/" + facetTypeName;
+        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndFacet, getServletRequest());
+        xhtml.appendToBody(asDivNofSession());
+
+        final ObjectSpecification noSpec = getSpecification(specFullName);
+
+        final String uri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
+        xhtml.appendToBody(xhtmlRenderer.aHref(uri, "owning spec", "spec", "facet", HtmlClass.SPECIFICATION));
+
+        try {
+            xhtml.appendToBody(divFacetElements(facetTypeName, noSpec));
+        } catch (final IllegalArgumentException e) {
+            throw new WebApplicationException(responseOfNotFound(e));
+        } catch (final ClassNotFoundException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        } catch (final IntrospectionException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        } catch (final IllegalAccessException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        } catch (final InvocationTargetException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        }
+
+        return xhtml.toXML();
+    }
+
+    // /////////////////////////////////////////////////////////////////////
+    // specProperty
+    // /////////////////////////////////////////////////////////////////////
+
+    @Override
+    public String specProperty(final String specFullName, final String propertyName) {
+        init();
+
+        final String specAndProperty = specFullName + "/property/" + propertyName;
+        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndProperty, getServletRequest());
+        xhtml.appendToBody(asDivNofSession());
+
+        // owners
+        final Element div = xhtmlRenderer.div_p("Owners", null);
+        xhtml.appendToBody(div);
+        final Element ul = xhtmlRenderer.ul(HtmlClass.SPECIFICATION);
+
+        final String uri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
+        ul.appendChild(xhtmlRenderer.aHref(uri, "owning spec", "spec", "property", HtmlClass.SPECIFICATION));
+
+        div.appendChild(ul);
+
+        final ObjectSpecification noSpec = getSpecification(specFullName);
+        final ObjectAssociation property = noSpec.getAssociation(propertyName);
+
+        xhtml.appendToBody(asDivTableFacets(property, propertyName));
+
+        return xhtml.toXML();
+    }
+
+    // /////////////////////////////////////////////////////////////////////
+    // specCollection
+    // /////////////////////////////////////////////////////////////////////
+
+    @Override
+    public String specCollection(final String specFullName, final String collectionName) {
+        init();
+
+        final String specAndCollection = specFullName + "/collection/" + collectionName;
+        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndCollection, getServletRequest());
+        xhtml.appendToBody(asDivNofSession());
+
+        // owners
+        final Element div = xhtmlRenderer.div_p("Owners", null);
+        xhtml.appendToBody(div);
+        final Element ul = xhtmlRenderer.ul(HtmlClass.SPECIFICATION);
+
+        final String uri = MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
+        ul.appendChild(xhtmlRenderer.aHref(uri, "owning spec", "spec", "collection", HtmlClass.SPECIFICATION));
+
+        div.appendChild(ul);
+
+        final ObjectSpecification noSpec = getSpecification(specFullName);
+        final ObjectAssociation collection = noSpec.getAssociation(collectionName);
+
+        xhtml.appendToBody(asDivTableFacets(collection, collectionName));
+
+        return xhtml.toXML();
+    }
+
+    // /////////////////////////////////////////////////////////////////////
+    // specAction
+    // /////////////////////////////////////////////////////////////////////
+
+    @Override
+    public String specAction(final String specFullName, final String actionId) {
+        init();
+
+        final String specAndAction = specFullName + "/action/" + actionId;
+        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndAction, getServletRequest());
+        xhtml.appendToBody(asDivNofSession());
+
+        // owners
+        final Element div = xhtmlRenderer.div_p("Owners", null);
+        xhtml.appendToBody(div);
+        final Element ul = xhtmlRenderer.ul(HtmlClass.SPECIFICATION);
+
+        final String specUri =
+            MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
+        ul.appendChild(xhtmlRenderer.li_a(specUri, specFullName, "owning spec", "spec", HtmlClass.SPECIFICATION));
+
+        div.appendChild(ul);
+
+        final ObjectSpecification noSpec = getSpecification(specFullName);
+        final ObjectAction action = noSpec.getObjectAction(null, actionId);
+
+        xhtml.appendToBody(asDivTableFacets(action, actionId));
+
+        return xhtml.toXML();
+    }
+
+    // /////////////////////////////////////////////////////////////////////
+    // specPropertyFacet
+    // /////////////////////////////////////////////////////////////////////
+
+    @Override
+    public String specPropertyFacet(final String specFullName, final String propertyName, final String facetTypeName) {
+        init();
+
+        final String specAndPropertyAndFacet = specFullName + "/property/" + propertyName + "/facet/" + facetTypeName;
+        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndPropertyAndFacet, getServletRequest());
+        xhtml.appendToBody(asDivNofSession());
+
+        final ObjectSpecification noSpec = getSpecification(specFullName);
+        final ObjectAssociation property = noSpec.getAssociation(propertyName);
+
+        // owners
+        final Element div = xhtmlRenderer.div_p("Owners", null);
+        xhtml.appendToBody(div);
+        final Element ul = xhtmlRenderer.ul(HtmlClass.PROPERTIES);
+
+        final String specUri =
+            MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
+        ul.appendChild(xhtmlRenderer.li_a(specUri, specFullName, "owning spec", "spec", "facet"));
+
+        final String propertyUri =
+            MessageFormat.format("{0}/specs/{1}/property/{2}", getServletRequest().getContextPath(), specFullName,
+                propertyName);
+        ul.appendChild(xhtmlRenderer.li_a(propertyUri, propertyName, "owning property", "property", "facet"));
+
+        div.appendChild(ul);
+
+        try {
+            xhtml.appendToBody(divFacetElements(facetTypeName, property));
+        } catch (final IllegalArgumentException e) {
+            throw new WebApplicationException(responseOfNotFound(e));
+        } catch (final ClassNotFoundException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        } catch (final IntrospectionException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        } catch (final IllegalAccessException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        } catch (final InvocationTargetException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        }
+
+        return xhtml.toXML();
+    }
+
+    // /////////////////////////////////////////////////////////////////////
+    // specCollectionFacet
+    // /////////////////////////////////////////////////////////////////////
+
+    @Override
+    public String specCollectionFacet(final String specFullName, final String collectionId, final String facetTypeName) {
+        init();
+
+        final String specAndPropertyAndFacet = specFullName + "/collection/" + collectionId + "/facet/" + facetTypeName;
+        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndPropertyAndFacet, getServletRequest());
+        xhtml.appendToBody(asDivNofSession());
+
+        final ObjectSpecification noSpec = getSpecification(specFullName);
+        final ObjectAssociation collection = noSpec.getAssociation(collectionId);
+
+        // owners
+        final Element div = xhtmlRenderer.div_p("Owners", null);
+        xhtml.appendToBody(div);
+        final Element ul = xhtmlRenderer.ul(HtmlClass.PROPERTIES);
+
+        final String specUri =
+            MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
+        ul.appendChild(xhtmlRenderer.li_a(specUri, specFullName, "owning spec", "spec", "facet"));
+
+        final String collectionUri =
+            MessageFormat.format("{0}/specs/{1}/collection/{2}", getServletRequest().getContextPath(), specFullName,
+                collectionId);
+        ul.appendChild(xhtmlRenderer.li_a(collectionUri, collectionId, "owning collection", "collection", "facet"));
+        div.appendChild(ul);
+
+        try {
+            xhtml.appendToBody(divFacetElements(facetTypeName, collection));
+        } catch (final IllegalArgumentException e) {
+            throw new WebApplicationException(responseOfNotFound(e));
+        } catch (final ClassNotFoundException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        } catch (final IntrospectionException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        } catch (final IllegalAccessException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        } catch (final InvocationTargetException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        }
+
+        return xhtml.toXML();
+    }
+
+    // /////////////////////////////////////////////////////////////////////
+    // specActionFacet
+    // /////////////////////////////////////////////////////////////////////
+
+    @Override
+    public String specActionFacet(final String specFullName, final String actionId, final String facetTypeName) {
+        init();
+
+        final String specAndPropertyAndFacet = specFullName + "/action/" + actionId + "/facet/" + facetTypeName;
+        final XhtmlTemplate xhtml = new XhtmlTemplate(specAndPropertyAndFacet, getServletRequest());
+        xhtml.appendToBody(asDivNofSession());
+
+        final ObjectSpecification noSpec = getSpecification(specFullName);
+        final ObjectAction action = noSpec.getObjectAction(null, actionId);
+
+        // owners
+        final Element div = xhtmlRenderer.div_p("Owners", null);
+        xhtml.appendToBody(div);
+        final Element ul = xhtmlRenderer.ul(HtmlClass.PROPERTIES);
+        final String specUri =
+            MessageFormat.format("{0}/specs/{1}", getServletRequest().getContextPath(), specFullName);
+        ul.appendChild(xhtmlRenderer.li_a(specUri, specFullName, "owning spec", "spec", "facet"));
+        final String actionUri =
+            MessageFormat.format("{0}/specs/{1}/action/{2}", getServletRequest().getContextPath(), specFullName,
+                actionId);
+        ul.appendChild(xhtmlRenderer.li_a(actionUri, actionId, "owning action", "collection", "facet"));
+        div.appendChild(ul);
+
+        try {
+            xhtml.appendToBody(divFacetElements(facetTypeName, action));
+        } catch (final IllegalArgumentException e) {
+            throw new WebApplicationException(responseOfNotFound(e));
+        } catch (final ClassNotFoundException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        } catch (final IntrospectionException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        } catch (final IllegalAccessException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        } catch (final InvocationTargetException e) {
+            throw new WebApplicationException(responseOfInternalServerError(e));
+        }
+
+        return xhtml.toXML();
+    }
+
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/user/UserResourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/user/UserResourceImpl.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/user/UserResourceImpl.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/user/UserResourceImpl.java Tue May  3 07:44:41 2011
@@ -16,45 +16,45 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.resources.user;
-
-import java.util.List;
-
-import javax.ws.rs.Path;
-
-import nu.xom.Element;
-
-import org.apache.isis.viewer.restful.applib.resources.UserResource;
-import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
-import org.apache.isis.viewer.restful.viewer.html.XhtmlTemplate;
-import org.apache.isis.viewer.restful.viewer.resources.ResourceAbstract;
-
-
-/**
- * Implementation note: it seems to be necessary to annotate the implementation with {@link Path} rather than
- * the interface (at least under RestEasy 1.0.2 and 1.1-RC2).
- */
-@Path("/user")
-public class UserResourceImpl extends ResourceAbstract implements UserResource {
-
-    public String user() {
-        init();
-
-        final XhtmlTemplate xhtml = new XhtmlTemplate("User", getServletRequest());
-        xhtml.appendToBody(asDivNofSession());
-        xhtml.appendToBody(resourcesDiv());
-        
-        final Element div = xhtmlRenderer.div_p("Roles", HtmlClass.SECTION);
-
-        final Element ul = xhtmlRenderer.ul(HtmlClass.ROLES);
-        final List<String> roles = getSession().getRoles();
-        for(final String role: roles) {
-            ul.appendChild(xhtmlRenderer.li_p(role, HtmlClass.ROLE));
-        }
-        div.appendChild(ul);
-        
-        xhtml.appendToBody(div);
-        
-        return xhtml.toXML();
-    }
-}
+package org.apache.isis.viewer.restful.viewer.resources.user;
+
+import java.util.List;
+
+import javax.ws.rs.Path;
+
+import nu.xom.Element;
+
+import org.apache.isis.viewer.restful.applib.resources.UserResource;
+import org.apache.isis.viewer.restful.viewer.html.HtmlClass;
+import org.apache.isis.viewer.restful.viewer.html.XhtmlTemplate;
+import org.apache.isis.viewer.restful.viewer.resources.ResourceAbstract;
+
+/**
+ * Implementation note: it seems to be necessary to annotate the implementation with {@link Path} rather than the
+ * interface (at least under RestEasy 1.0.2 and 1.1-RC2).
+ */
+@Path("/user")
+public class UserResourceImpl extends ResourceAbstract implements UserResource {
+
+    @Override
+    public String user() {
+        init();
+
+        final XhtmlTemplate xhtml = new XhtmlTemplate("User", getServletRequest());
+        xhtml.appendToBody(asDivNofSession());
+        xhtml.appendToBody(resourcesDiv());
+
+        final Element div = xhtmlRenderer.div_p("Roles", HtmlClass.SECTION);
+
+        final Element ul = xhtmlRenderer.ul(HtmlClass.ROLES);
+        final List<String> roles = getSession().getRoles();
+        for (final String role : roles) {
+            ul.appendChild(xhtmlRenderer.li_p(role, HtmlClass.ROLE));
+        }
+        div.appendChild(ul);
+
+        xhtml.appendToBody(div);
+
+        return xhtml.toXML();
+    }
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ActionUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ActionUtils.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ActionUtils.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ActionUtils.java Tue May  3 07:44:41 2011
@@ -16,35 +16,35 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.util;
-
-import java.util.List;
-
-import com.google.inject.internal.Lists;
-
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.ObjectActionSet;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-
-
-public final class ActionUtils {
-
-    private ActionUtils() {}
-
-    public static List<ObjectAction> flattened(final List<ObjectAction> objectActions) {
-        final List<ObjectAction> actions = Lists.newArrayList();
-        for (final ObjectAction action : objectActions) {
-            if (action.getType() == ActionType.SET) {
-                final ObjectActionSet actionSet = (ObjectActionSet) action;
-                final List<ObjectAction> subActions = actionSet.getActions();
-                for (final ObjectAction subAction : subActions) {
-                    actions.add(subAction);
-                }
-            } else {
-                actions.add(action);
-            }
-        }
-        return actions;
-    }
-
-}
+package org.apache.isis.viewer.restful.viewer.util;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.spec.ActionType;
+import org.apache.isis.core.metamodel.spec.ObjectActionSet;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+
+import com.google.inject.internal.Lists;
+
+public final class ActionUtils {
+
+    private ActionUtils() {
+    }
+
+    public static List<ObjectAction> flattened(final List<ObjectAction> objectActions) {
+        final List<ObjectAction> actions = Lists.newArrayList();
+        for (final ObjectAction action : objectActions) {
+            if (action.getType() == ActionType.SET) {
+                final ObjectActionSet actionSet = (ObjectActionSet) action;
+                final List<ObjectAction> subActions = actionSet.getActions();
+                for (final ObjectAction subAction : subActions) {
+                    actions.add(subAction);
+                }
+            } else {
+                actions.add(action);
+            }
+        }
+        return actions;
+    }
+
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/InputStreamUtil.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/InputStreamUtil.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/InputStreamUtil.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/InputStreamUtil.java Tue May  3 07:44:41 2011
@@ -16,50 +16,49 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.util;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-
-public final class InputStreamUtil {
-
-    private InputStreamUtil() {}
-
-	public static List<String> getArgs(final InputStream body) {
-		// will be sorted by arg
-	    final Map<String,String> args = new TreeMap<String,String>();
-	    if (body == null) {
-	        return listOfValues(args);
-	    }
-	    try {
-	        final InputStreamReader inputStreamReader = new InputStreamReader(body);
-	        final BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
-	        String readLine = bufferedReader.readLine();
-	        while (readLine != null) {
-		        final String[] keyValuePairs = readLine.split("&");
-		        for (final String keyValuePair : keyValuePairs) {
-		            final String[] keyThenValue = keyValuePair.split("=");
-		            args.put(keyThenValue[0], keyThenValue[1]);
-		        }
-		        readLine = bufferedReader.readLine();
-	        }
-	        return listOfValues(args);
-	    } catch (final IOException ex) {
-	        throw new RuntimeException(ex);
-	    }
-	}
-
-	private static ArrayList<String> listOfValues(final Map<String, String> args) {
-		// returns the values in the order of the keys
-		return new ArrayList<String>(args.values());
-	}
-
-
-}
+package org.apache.isis.viewer.restful.viewer.util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+public final class InputStreamUtil {
+
+    private InputStreamUtil() {
+    }
+
+    public static List<String> getArgs(final InputStream body) {
+        // will be sorted by arg
+        final Map<String, String> args = new TreeMap<String, String>();
+        if (body == null) {
+            return listOfValues(args);
+        }
+        try {
+            final InputStreamReader inputStreamReader = new InputStreamReader(body);
+            final BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
+            String readLine = bufferedReader.readLine();
+            while (readLine != null) {
+                final String[] keyValuePairs = readLine.split("&");
+                for (final String keyValuePair : keyValuePairs) {
+                    final String[] keyThenValue = keyValuePair.split("=");
+                    args.put(keyThenValue[0], keyThenValue[1]);
+                }
+                readLine = bufferedReader.readLine();
+            }
+            return listOfValues(args);
+        } catch (final IOException ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private static ArrayList<String> listOfValues(final Map<String, String> args) {
+        // returns the values in the order of the keys
+        return new ArrayList<String>(args.values());
+    }
+
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ListUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ListUtils.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ListUtils.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ListUtils.java Tue May  3 07:44:41 2011
@@ -16,23 +16,23 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public final class ListUtils {
-	
-	private ListUtils(){}
-
-	@SuppressWarnings("unchecked")
-	public
-	static <T> List<T> toList(final Object[] objects) {
-	    final List<T> list = new ArrayList<T>();
-	    for (final Object o : objects) {
-	        list.add((T) o);
-	    }
-	    return list;
-	}
-
-}
+package org.apache.isis.viewer.restful.viewer.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public final class ListUtils {
+
+    private ListUtils() {
+    }
+
+    @SuppressWarnings("unchecked")
+    public static <T> List<T> toList(final Object[] objects) {
+        final List<T> list = new ArrayList<T>();
+        for (final Object o : objects) {
+            list.add((T) o);
+        }
+        return list;
+    }
+
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/OidUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/OidUtils.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/OidUtils.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/OidUtils.java Tue May  3 07:44:41 2011
@@ -16,46 +16,41 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.util;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.stringable.OidStringifier;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManager;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
-
-public final class OidUtils {
-	
-	
-	private OidUtils(){}
-
-	public static ObjectAdapter getNakedObject(
-			final String oidEncodedStr,
-			final OidStringifier oidStringifier) {
-		String oidStr = UrlDecoderUtils.urlDecode(oidEncodedStr);
-		final Oid oid = oidStringifier.deString(oidStr);
-	    return getAdapterManager().getAdapterFor(oid);
-	}
-
-	public static String getOidStr(
-			final ObjectAdapter nakedObject,
-			final OidStringifier oidStringifier) {
-		final Oid oid = nakedObject.getOid();
-		return oid != null ? oidStringifier.enString(oid) : null;
-	}
-	
-    ////////////////////////////////////////////////////////////////
-    // Dependencies (from singletons)
-    ////////////////////////////////////////////////////////////////
-    
-	public static AdapterManager getAdapterManager() {
-		return getPersistenceSession().getAdapterManager();
-	}
-
-	protected static PersistenceSession getPersistenceSession() {
-		return IsisContext.getPersistenceSession();
-	}
-
-
-}
+package org.apache.isis.viewer.restful.viewer.util;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.stringable.OidStringifier;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManager;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
+
+public final class OidUtils {
+
+    private OidUtils() {
+    }
+
+    public static ObjectAdapter getNakedObject(final String oidEncodedStr, final OidStringifier oidStringifier) {
+        final String oidStr = UrlDecoderUtils.urlDecode(oidEncodedStr);
+        final Oid oid = oidStringifier.deString(oidStr);
+        return getAdapterManager().getAdapterFor(oid);
+    }
+
+    public static String getOidStr(final ObjectAdapter nakedObject, final OidStringifier oidStringifier) {
+        final Oid oid = nakedObject.getOid();
+        return oid != null ? oidStringifier.enString(oid) : null;
+    }
+
+    // //////////////////////////////////////////////////////////////
+    // Dependencies (from singletons)
+    // //////////////////////////////////////////////////////////////
+
+    public static AdapterManager getAdapterManager() {
+        return getPersistenceSession().getAdapterManager();
+    }
+
+    protected static PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+}

Modified: incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/PathUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/PathUtils.java?rev=1098948&r1=1098947&r2=1098948&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/PathUtils.java (original)
+++ incubator/isis/trunk/viewer/restful/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/PathUtils.java Tue May  3 07:44:41 2011
@@ -16,25 +16,24 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package org.apache.isis.viewer.restful.viewer.util;
-
-import javax.servlet.http.HttpServletRequest;
-
-
-public final class PathUtils {
-
-    private PathUtils() {}
-
-
-    public static String combine(final HttpServletRequest request, final String... pathElements) {
-        final StringBuilder buf = new StringBuilder(request.getContextPath());
-        for (final String pathElement : pathElements) {
-            if (!pathElement.startsWith("/")) {
-                buf.append("/");
-            }
-            buf.append(pathElement);
-        }
-        return buf.toString();
-    }
-
-}
+package org.apache.isis.viewer.restful.viewer.util;
+
+import javax.servlet.http.HttpServletRequest;
+
+public final class PathUtils {
+
+    private PathUtils() {
+    }
+
+    public static String combine(final HttpServletRequest request, final String... pathElements) {
+        final StringBuilder buf = new StringBuilder(request.getContextPath());
+        for (final String pathElement : pathElements) {
+            if (!pathElement.startsWith("/")) {
+                buf.append("/");
+            }
+            buf.append(pathElement);
+        }
+        return buf.toString();
+    }
+
+}