incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmatth...@apache.org
Subject svn commit: r1072147 - in /incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher: ./ context/ view/ view/simple/
Date Fri, 18 Feb 2011 21:04:42 GMT
Author: rmatthews
Date: Fri Feb 18 21:04:41 2011
New Revision: 1072147

URL: http://svn.apache.org/viewvc?rev=1072147&view=rev
Log:
Minor improvements to Scimpi

Modified:
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java?rev=1072147&r1=1072146&r2=1072147&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java
(original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ForbiddenException.java
Fri Feb 18 21:04:41 2011
@@ -58,7 +58,7 @@ public class ForbiddenException extends 
     }
 
     public ForbiddenException(Identifier identifier, AuthenticationSession session, boolean
isVisibleAndUsabable) {
-        super((identifier.getType() == Identifier.Type.PROPERTY_OR_COLLECTION ? "Field" :
"Action") + " "
+        super((identifier.getType() == Identifier.Type.PROPERTY_OR_COLLECTION ? "Field" :
"Action") + " '"
                 + identifier.getMemberName() + "' in " + identifier.getClassNaturalName()
+ " is not "
                 + (isVisibleAndUsabable ? "visible/usable " : "visible") + " for " + session.getUserName()
+ " "
                 + session.getRoles());

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java?rev=1072147&r1=1072146&r2=1072147&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java
(original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/DefaultOidObjectMapping.java
Fri Feb 18 21:04:41 2011
@@ -124,7 +124,7 @@ public class DefaultOidObjectMapping imp
             String id = (isTransient ? "T" : "P") + object.getSpecification().getFullIdentifier()
+ "@" + encodedOid;
             LOG.debug("encoded " + oid + " as " + id + " ~ " + encodedOid);
             if (isTransient) {
-                TransientObjectMapping mapping = new TransientObjectMapping((ObjectAdapter)
object);
+                TransientObjectMapping mapping = new TransientObjectMapping((ObjectAdapter)
inObject);
                 if (scope == Scope.REQUEST) {
                     requestTransients.put(id, mapping);
                 } else if (scope ==Scope.INTERACTION || scope == Scope.SESSION) {

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java?rev=1072147&r1=1072146&r2=1072147&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
(original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
Fri Feb 18 21:04:41 2011
@@ -23,8 +23,11 @@ package org.apache.isis.viewer.scimpi.di
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.TreeSet;
@@ -35,7 +38,9 @@ import org.apache.isis.core.commons.auth
 import org.apache.isis.core.commons.factory.InstanceUtil;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.version.Version;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.runtime.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
 import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
@@ -171,11 +176,27 @@ public abstract class RequestContext {
             id = RESULT;
         }
 
-        ObjectAdapter mappedObject = objectMapping.mappedObject(id);
-        if (mappedObject instanceof ObjectAdapter) {
-            IsisContext.getPersistenceSession().resolveImmediately((ObjectAdapter) mappedObject);
+        String[] idParts = id.split("@");
+        if (idParts.length == 2) {
+            ObjectAdapter mappedObject = objectMapping.mappedObject(id);
+            if (mappedObject instanceof ObjectAdapter) {
+                IsisContext.getPersistenceSession().resolveImmediately((ObjectAdapter) mappedObject);
+            }
+            return mappedObject;
+        } else {
+            ObjectAdapter parentObject = objectMapping.mappedObject(idParts[0] + "@" + idParts[1]);
+            if (parentObject instanceof ObjectAdapter) {
+                IsisContext.getPersistenceSession().resolveImmediately((ObjectAdapter) parentObject);
+            }
+            ObjectAssociation association = parentObject.getSpecification().getAssociation(idParts[2]);
+            ObjectAdapter aggregatedAdapter = association.get(parentObject);
+            if (idParts.length == 4) {
+                CollectionFacet collectionFacet = aggregatedAdapter.getSpecification().getFacet(CollectionFacet.class);
+                List<ObjectAdapter> collection = new ArrayList<ObjectAdapter>(collectionFacet.collection(aggregatedAdapter));
+                aggregatedAdapter = collection.get(Integer.valueOf(idParts[3]));  //collectionFacet.firstElement(aggregatedAdapter);
+            }
+            return aggregatedAdapter;
         }
-        return mappedObject;
     }
 
     public boolean isValid() {

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java?rev=1072147&r1=1072146&r2=1072147&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java
(original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HelpLink.java
Fri Feb 18 21:04:41 2011
@@ -18,20 +18,37 @@
  */
 package org.apache.isis.viewer.scimpi.dispatcher.view;
 
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.runtime.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
 public class HelpLink {
 
+    private static String site;
+    private static String suffix;
+
     public static void append(Request request, String description, String helpReference)
{
         request.appendHtml(createHelpSegment(description, helpReference));
     }
 
     public static String createHelpSegment(String description, String helpReference) {
+        if (site == null) {
+            site = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT +
"scimpi.help-site", "/help/");
+        }
+        if (suffix == null) {   
+            suffix = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT
+ "scimpi.help-suffix", "shtml");
+            if (suffix == null || suffix.equals("")) {
+                suffix = "";
+            } else {
+                suffix = "." + suffix;
+            }
+        }
+        
         if (helpReference == null || helpReference.equals("No help available")) {
             return "";
         } else {
             String elementClass = "help-link";
-            String link = "help/" + helpReference + ".shtml";
+            String link = site + helpReference + suffix;
             String linkText = "Help";
             String target = "scimpi-help";
             return "<a class=\"" + elementClass + "\" href=\"" + link + "\" target=\""
+ target + "\" title=\"" + description + "\">" + linkText + "</a>";

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java?rev=1072147&r1=1072146&r2=1072147&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
(original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
Fri Feb 18 21:04:41 2011
@@ -43,7 +43,7 @@ public class RemoveElement extends Abstr
 
     @Override
     public void process(Request request) {
-        String title = request.getOptionalProperty(BUTTON_TITLE, "Delete");
+        String title = request.getOptionalProperty(BUTTON_TITLE, "Remove From List");
         String cls = request.getOptionalProperty(CLASS, "action in-line delete");
         String object = request.getOptionalProperty(OBJECT);
         String resultOverride = request.getOptionalProperty(RESULT_OVERRIDE);



Mime
View raw message