incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1139763 [9/10] - in /incubator/isis/trunk/viewer: json/ json/applib2/ json/applib2/src/ json/applib2/src/main/ json/applib2/src/main/java/ json/applib2/src/main/java/META-INF/ json/applib2/src/main/java/org/ json/applib2/src/main/java/org/...
Date Sun, 26 Jun 2011 11:51:10 GMT
Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/collections/TableColumnOneToManyAssociationInvalidReason.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/collections/TableColumnOneToManyAssociationInvalidReason.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/collections/TableColumnOneToManyAssociationInvalidReason.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/collections/TableColumnOneToManyAssociationInvalidReason.java Sun Jun 26 11:51:01 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.restful.viewer.resources.objects.collections;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.viewer.restful.viewer.resources.objects.TableColumnNakedObjectMemberInvalidReason;
+import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
+
+public final class TableColumnOneToManyAssociationInvalidReason extends
+    TableColumnNakedObjectMemberInvalidReason<OneToManyAssociation> {
+
+    public TableColumnOneToManyAssociationInvalidReason(final AuthenticationSession session,
+        final ObjectAdapter nakedObject, final ResourceContext resourceContext) {
+        super(session, nakedObject, resourceContext);
+    }
+
+    @Override
+    protected String getDomId(final OneToManyAssociation member) {
+        return "collection-invalid-" + member.getId();
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/collections/TableColumnOneToManyAssociationName.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/collections/TableColumnOneToManyAssociationName.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/collections/TableColumnOneToManyAssociationName.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/collections/TableColumnOneToManyAssociationName.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,50 @@
+/*
+ *  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.restful.viewer.resources.objects.collections;
+
+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.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+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.tree.Element;
+import org.apache.isis.viewer.restful.viewer.xom.ResourceContext;
+
+public class TableColumnOneToManyAssociationName extends TableColumnNakedObjectMemberName<OneToManyAssociation> {
+
+    public TableColumnOneToManyAssociationName(final ObjectSpecification noSpec, final AuthenticationSession session,
+        final ObjectAdapter nakedObject, final ResourceContext resourceContext) {
+        super(noSpec, session, nakedObject, resourceContext);
+    }
+
+    @Override
+    public Element doTd(final OneToManyAssociation oneToManyAssociation) {
+        final String memberName = oneToManyAssociation.getIdentifier().getMemberName();
+        final String memberType = "collection";
+        final String uri =
+            MessageFormat.format("{0}/specs/{1}/{2}/{3}", getContextPath(), getNoSpec().getFullIdentifier(),
+                memberType, memberName);
+        return new Element(xhtmlRenderer.aHref(uri, oneToManyAssociation.getName(), "propertySpec", memberType,
+            HtmlClass.COLLECTION));
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/collections/TableColumnOneToManyAssociationRemoveFrom.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/collections/TableColumnOneToManyAssociationRemoveFrom.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/collections/TableColumnOneToManyAssociationRemoveFrom.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/collections/TableColumnOneToManyAssociationRemoveFrom.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,69 @@
+/*
+ *  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.restful.viewer.resources.objects.collections;
+
+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.OneToManyAssociation;
+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 TableColumnOneToManyAssociationRemoveFrom extends
+    TableColumnNakedObjectAssociationModifyAbstract<OneToManyAssociation> {
+
+    public TableColumnOneToManyAssociationRemoveFrom(final AuthenticationSession session,
+        final ObjectAdapter nakedObject, final ResourceContext resourceContext) {
+        super("RemoveFrom", session, nakedObject, resourceContext);
+    }
+
+    @Override
+    protected String getFormNamePrefix() {
+        return "collection-";
+    }
+
+    @Override
+    protected String getHtmlClassAttribute() {
+        return HtmlClass.COLLECTION;
+    }
+
+    @Override
+    protected String getFormButtonLabel() {
+        return "Remove";
+    }
+
+    /**
+     * Calls the <tt>removeFromCollection()</tt> Javascript function that lives in <tt>isis-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("removeFromCollection({0}, {1}, {2}.value);", StringUtil.quote(url),
+            StringUtil.quote(associationId), inputFieldName);
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/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/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationAccess.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationAccess.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationAccess.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,79 @@
+/*
+ *  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.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.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.tree.Element;
+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));
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/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/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationClear.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationClear.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationClear.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,68 @@
+/*
+ *  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.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>isis-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));
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/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/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationInvalidReason.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationInvalidReason.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationInvalidReason.java Sun Jun 26 11:51:01 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.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();
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/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/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationModify.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationModify.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationModify.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,69 @@
+/*
+ *  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.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>isis-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);
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/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/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationName.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationName.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationName.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,50 @@
+/*
+ *  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.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.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.tree.Element;
+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));
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/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/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationParseable.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationParseable.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/objects/properties/TableColumnOneToOneAssociationParseable.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,43 @@
+/*
+ *  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.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.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.tree.Element;
+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);
+    }
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/services/ServicesResourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/services/ServicesResourceImpl.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/services/ServicesResourceImpl.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/services/ServicesResourceImpl.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,65 @@
+/*
+ *  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.restful.viewer.resources.services;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import javax.ws.rs.Path;
+
+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;
+import org.apache.isis.viewer.restful.viewer.tree.Element;
+
+/**
+ * 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(asDivIsisSession());
+        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();
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/specs/SpecsResourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/specs/SpecsResourceImpl.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/specs/SpecsResourceImpl.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/specs/SpecsResourceImpl.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,435 @@
+/*
+ *  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.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 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.tree.Element;
+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(asDivIsisSession());
+        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(asDivIsisSession());
+
+        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(asDivIsisSession());
+
+        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(asDivIsisSession());
+
+        // 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(asDivIsisSession());
+
+        // 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(asDivIsisSession());
+
+        // 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(asDivIsisSession());
+
+        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(asDivIsisSession());
+
+        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(asDivIsisSession());
+
+        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();
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/user/UserResourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/user/UserResourceImpl.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/user/UserResourceImpl.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/resources/user/UserResourceImpl.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,59 @@
+/*
+ *  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.restful.viewer.resources.user;
+
+import java.util.List;
+
+import javax.ws.rs.Path;
+
+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;
+import org.apache.isis.viewer.restful.viewer.tree.Element;
+
+/**
+ * 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(asDivIsisSession());
+        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();
+    }
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/tree/Attribute.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/tree/Attribute.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/tree/Attribute.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/tree/Attribute.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,28 @@
+/**
+ *  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.restful.viewer.tree;
+
+public class Attribute {
+    
+    final org.jdom.Attribute xmlAttribute;
+
+    public Attribute(String name, String value) {
+        this.xmlAttribute = new org.jdom.Attribute(name, value);
+    }
+
+    
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/tree/Element.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/tree/Element.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/tree/Element.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/tree/Element.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,46 @@
+/**
+ *  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.restful.viewer.tree;
+
+public class Element {
+
+    public final org.jdom.Element xmlElement;
+    
+    public Element(String name) {
+        this.xmlElement = new org.jdom.Element(name);
+    }
+
+    public Element(Element aHref) {
+        this.xmlElement = (org.jdom.Element) aHref.xmlElement.clone();
+    }
+
+    public void appendChild(String headerText) {
+        xmlElement.addContent(headerText);
+    }
+
+    public void appendChild(Element element) {
+        xmlElement.addContent(element.xmlElement);
+    }
+
+    /**
+     * @param attribute
+     */
+    public void addAttribute(Attribute attribute) {
+        this.xmlElement.setAttribute(attribute.xmlAttribute);
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ActionUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ActionUtils.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ActionUtils.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ActionUtils.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,50 @@
+/*
+ *  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.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;
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/InputStreamUtil.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/InputStreamUtil.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/InputStreamUtil.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/InputStreamUtil.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,64 @@
+/*
+ *  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.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());
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ListUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ListUtils.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ListUtils.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/ListUtils.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,38 @@
+/*
+ *  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.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;
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/OidUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/OidUtils.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/OidUtils.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/OidUtils.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,56 @@
+/*
+ *  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.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();
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/PathUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/PathUtils.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/PathUtils.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/PathUtils.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,39 @@
+/*
+ *  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.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();
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/StringUtil.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/StringUtil.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/StringUtil.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/StringUtil.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,38 @@
+/*
+ *  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.restful.viewer.util;
+
+public final class StringUtil {
+
+    private StringUtil() {
+    }
+
+    public static String concat(final String... lines) {
+        final StringBuilder buf = new StringBuilder();
+        for (final String line : lines) {
+            buf.append(line);
+        }
+        return buf.toString();
+    }
+
+    public static String quote(final String val) {
+        return "\"" + val + "\"";
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/UrlDecoderUtils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/UrlDecoderUtils.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/UrlDecoderUtils.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/util/UrlDecoderUtils.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,41 @@
+/*
+ *  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.restful.viewer.util;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+
+import javax.ws.rs.WebApplicationException;
+
+import org.apache.isis.viewer.restful.viewer.Constants;
+
+public final class UrlDecoderUtils {
+
+    private UrlDecoderUtils() {
+    }
+
+    public static String urlDecode(final String oidStr) {
+        try {
+            return URLDecoder.decode(oidStr, Constants.URL_ENCODING_CHAR_SET);
+        } catch (final UnsupportedEncodingException e) {
+            throw new WebApplicationException(e);
+        }
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/DtDd.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/DtDd.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/DtDd.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/DtDd.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,39 @@
+/*
+ *  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.restful.viewer.xom;
+
+import org.apache.isis.viewer.restful.viewer.tree.Element;
+
+public class DtDd {
+    final Element dt;
+    final Element dd;
+
+    DtDd(final Element dt, final Element dd) {
+        this.dt = dt;
+        this.dd = dd;
+    }
+
+    public void appendTo(final Element dl) {
+        dl.appendChild(dt);
+        dl.appendChild(dd);
+    }
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/ElementBuilder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/ElementBuilder.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/ElementBuilder.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/ElementBuilder.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,93 @@
+/*
+ *  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.restful.viewer.xom;
+
+import org.apache.isis.viewer.restful.viewer.tree.Attribute;
+import org.apache.isis.viewer.restful.viewer.tree.Element;
+
+public class ElementBuilder  {
+
+    /**
+     * The element being built.
+     */
+    private Element element;
+
+    public ElementBuilder(final String name) {
+        el(name);
+    }
+
+    /**
+     * Creates an uninitialized builder.
+     * 
+     * <p>
+     * Must be followed by a call to {@link #el(String)}.
+     */
+    public ElementBuilder() {
+    }
+
+    public ElementBuilder el(final String name) {
+        assertNotInitialized();
+        this.element = new Element(name);
+        return this;
+    }
+
+    public ElementBuilder attr(final String name, final String value) {
+        assertInitialized();
+        element.addAttribute(new Attribute(name, value));
+        return this;
+    }
+
+    public ElementBuilder classAttr(final String htmlClassAttribute) {
+        if (htmlClassAttribute != null) {
+            element.addAttribute(new Attribute("class", htmlClassAttribute));
+        }
+        return this;
+    }
+
+    public ElementBuilder idAttr(final String idAttribute) {
+        if (idAttribute != null) {
+            element.addAttribute(new Attribute("id", idAttribute));
+        }
+        return this;
+    }
+
+    public ElementBuilder append(final String childText) {
+        if (childText != null) {
+            element.appendChild(childText);
+        }
+        return this;
+    }
+
+    public Element build() {
+        return element;
+    }
+
+    private void assertInitialized() {
+        if (element == null) {
+            throw new IllegalStateException("Element name not specified");
+        }
+    }
+
+    private void assertNotInitialized() {
+        if (element != null) {
+            throw new IllegalStateException("Element already specified");
+        }
+    }
+
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/ResourceContext.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/ResourceContext.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/ResourceContext.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/ResourceContext.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,76 @@
+/*
+ *  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.restful.viewer.xom;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Request;
+import javax.ws.rs.core.SecurityContext;
+import javax.ws.rs.core.UriInfo;
+
+public class ResourceContext {
+
+    private final HttpServletRequest httpServletRequest;
+
+    private final HttpServletResponse httpServletResponse;
+
+    private final Request request;
+
+    private final HttpHeaders httpHeaders;
+
+    private final UriInfo uriInfo;
+
+    private final SecurityContext securityContext;
+
+    public ResourceContext(final HttpHeaders httpHeaders, final UriInfo uriInfo, final Request request,
+        final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse,
+        final SecurityContext securityContext) {
+        this.httpHeaders = httpHeaders;
+        this.uriInfo = uriInfo;
+        this.request = request;
+        this.httpServletRequest = httpServletRequest;
+        this.httpServletResponse = httpServletResponse;
+        this.securityContext = securityContext;
+    }
+
+    public HttpHeaders getHttpHeaders() {
+        return httpHeaders;
+    }
+
+    public UriInfo getUriInfo() {
+        return uriInfo;
+    }
+
+    public Request getRequest() {
+        return request;
+    }
+
+    public HttpServletRequest getHttpServletRequest() {
+        return httpServletRequest;
+    }
+
+    public HttpServletResponse getServletResponse() {
+        return httpServletResponse;
+    }
+
+    public SecurityContext getSecurityContext() {
+        return securityContext;
+    }
+}

Added: incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/TableColumn.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/TableColumn.java?rev=1139763&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/TableColumn.java (added)
+++ incubator/isis/trunk/viewer/xhtml/viewer/src/main/java/org/apache/isis/viewer/restful/viewer/xom/TableColumn.java Sun Jun 26 11:51:01 2011
@@ -0,0 +1,34 @@
+/*
+ *  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.restful.viewer.xom;
+
+import org.apache.isis.viewer.restful.viewer.tree.Element;
+
+public interface TableColumn<T> {
+
+    public String getHeaderText();
+
+    public Element th();
+
+    public Element td(T t);
+
+}



Mime
View raw message