incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmatth...@apache.org
Subject svn commit: r1064648 - in /incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher: ./ action/ context/ debug/ edit/ processor/ view/ view/action/ view/debug/ view/display/ view/logon/ view/simple/ view/value/
Date Fri, 28 Jan 2011 12:54:44 GMT
Author: rmatthews
Date: Fri Jan 28 12:54:43 2011
New Revision: 1064648

URL: http://svn.apache.org/viewvc?rev=1064648&view=rev
Log:
Improved error handling & display of errors.

Added:
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/PrintAuthorizationClause.java   (with props)
Modified:
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
    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/ScimpiException.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.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/debug/DebugView.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java
    incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java Fri Jan 28 12:54:43 2011
@@ -113,12 +113,12 @@ public class Dispatcher {
             UserManager.endRequest(context.getSession());
 
         } catch (Throwable e) {
-            LOG.error(e.getMessage(), e);
+            LOG.debug(e.getMessage(), e);
             
             DebugString error = new DebugString();
             List<String> messages =  IsisContext.getMessageBroker().getMessages();
             for (String message : messages) {
-                context.getWriter().append("<div class=\"messaEge\">message: " + message + "</div>");
+                context.getWriter().append("<div class=\"message\">message: " + message + "</div>");
                 error.appendln("message", message);
             }
             messages =  IsisContext.getMessageBroker().getWarnings();
@@ -136,7 +136,7 @@ public class Dispatcher {
             }
             
             String message = "failed while processing " + servletPath;
-            LOG.error(message + "\n" + error + "\n" + message, e);
+            LOG.error(message + "\n" + error + "\n" + message);
 
             
             try {
@@ -152,6 +152,9 @@ public class Dispatcher {
                 ex = e;
             }
             if (ex instanceof ForbiddenException) {
+                context.addVariable("_security_error", ex.getMessage(), Scope.REQUEST); 
+                context.addVariable("_security_identifier", ((ForbiddenException) ex).getIdentifier(), Scope.REQUEST);
+                context.addVariable("_security_roles", ((ForbiddenException) ex).getRoles(), Scope.REQUEST);
                 context.raiseError(403);
             } else if (ex instanceof ScimpiNotFoundException) {
                 context.raiseError(404);
@@ -174,16 +177,16 @@ public class Dispatcher {
             requestContext.addVariable("_error-ref", ref, Scope.INTERACTION);
             String directory = IsisContext.getConfiguration().getString(ConfigurationConstants.ROOT + "scimpi.error-snapshots", ".");
             writer = new PrintWriter(new File(directory, "error_" + ref + ".html"));
-            writeErrorContent(requestContext, exception, error, writer, true);
+            writeErrorContent(requestContext, exception, new DebugString(), writer, true);
         } catch (FileNotFoundException e) {
             LOG.error("Failed to archive error page", e);
         }
     
-        String replace = "\\$\\{";
-        String withReplacement = "\\$&#x7B;";
+        String replace = "";
+        String withReplacement = "";
         String message = exception.getMessage();
-        requestContext.addVariable("_error-message", message == null ? "" : message.replaceAll(replace, withReplacement), Scope.INTERACTION);
-        requestContext.addVariable("_error-details", out.toString().replaceAll(replace, withReplacement), Scope.INTERACTION);
+        requestContext.addVariable("_error-message", message == null ? "" : message.replaceAll(replace, withReplacement), Scope.REQUEST);
+        requestContext.addVariable("_error-details", out.toString().replaceAll(replace, withReplacement), Scope.REQUEST);
         requestContext.clearTransientVariables();
     }
 
@@ -199,12 +202,7 @@ public class Dispatcher {
             errorView.header();
         }
         errorView.startTable();
-
-        errorView.divider("User");
-        errorView.appendRow("Session", requestContext.getSession());
-        errorView.appendRow("Name", requestContext.getSession().getUserName());
-        errorView.appendRow("Roles", requestContext.getSession().getRoles());
-
+        
         try {
             errorView.exception(exception);
             requestContext.append(errorView);

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=1064648&r1=1064647&r2=1064648&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 Jan 28 12:54:43 2011
@@ -17,17 +17,27 @@
  *  under the License.
  */
 
-
 package org.apache.isis.viewer.scimpi.dispatcher;
 
+import java.util.List;
+
+import org.apache.isis.applib.Identifier;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.facetapi.IdentifiedHolder;
 import org.apache.isis.core.runtime.context.IsisContext;
 
+
 /**
- * Indicates that request could not complete as it could not access (for security reasons) some of the content.
+ * Indicates that request could not complete as it could not access (for security reasons) some of the
+ * content.
  */
 public class ForbiddenException extends ScimpiException {
     private static final long serialVersionUID = 1L;
+    public static final boolean VISIBLE_AND_USABLE = true;
+    public static final boolean VISIBLE = false;
+
+    private Identifier identifier;
+    private AuthenticationSession session;
 
     public ForbiddenException() {}
 
@@ -42,12 +52,30 @@ public class ForbiddenException extends 
     public ForbiddenException(String message, Throwable cause) {
         super(appendUsers(message), cause);
     }
-    
+
+    public ForbiddenException(IdentifiedHolder target, boolean isVisibleAndUsabable) {
+        this(target.getIdentifier(), IsisContext.getAuthenticationSession(), isVisibleAndUsabable);
+    }
+
+    public ForbiddenException(Identifier identifier, AuthenticationSession session, boolean isVisibleAndUsabable) {
+        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());
+        this.identifier = identifier;
+        this.session = session;
+    }
+
     private static String appendUsers(String message) {
         AuthenticationSession session = IsisContext.getAuthenticationSession();
-        return  message + " " + session.getUserName() + " " + session.getRoles();
+        return message + " " + session.getUserName() + " " + session.getRoles();
     }
 
-}
-
+    public Identifier getIdentifier() {
+        return identifier;
+    }
 
+    public List<String> getRoles() {
+        return session.getRoles();
+    }
+}

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiException.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiException.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ScimpiException.java Fri Jan 28 12:54:43 2011
@@ -37,6 +37,10 @@ public class ScimpiException extends Run
         super(message, cause);
     }
 
+    public String getHtmlMessage() {
+        return getMessage();
+    }
+
 }
 
 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/Attributes.java Fri Jan 28 12:54:43 2011
@@ -23,9 +23,9 @@ package org.apache.isis.viewer.scimpi.di
 import java.util.Enumeration;
 import java.util.Vector;
 
+import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.htmlparser.Attribute;
 import org.htmlparser.nodes.TagNode;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 
 
 public class Attributes {
@@ -41,7 +41,13 @@ public class Attributes {
 
     public boolean isPropertySet(String name) {
         String attribute = tagNode.getAttribute(name);
-        return attribute != null && !context.replaceVariables(attribute, false).equals("");
+        int end = attribute.length() - 1;
+        int pos = attribute.indexOf(':');
+        end = pos == -1 ? end : pos; 
+        String variabelName = attribute.substring(2, end);
+        Object value = context.getVariable(variabelName);
+        return value != null;
+//        return attribute != null && !context.replaceVariables(attribute).equals("");
     }
 
     public boolean isPropertySpecified(String name) {
@@ -55,7 +61,7 @@ public class Attributes {
 
     public String getOptionalProperty(String name, String defaultValue, boolean ensureVariablesExists) {
         String attribute = tagNode.getAttribute(name);
-        return attribute == null ? defaultValue : context.replaceVariables(attribute, ensureVariablesExists);
+        return attribute == null ? defaultValue : context.replaceVariables(attribute);
     }
 
     public String getRequiredProperty(String name, boolean ensureVariablesExists) {
@@ -65,7 +71,7 @@ public class Attributes {
         } else if (attribute.equals("")) {
             throw new RequiredPropertyException("Property not set: " + name);
        } else {
-           return context.replaceVariables(attribute, ensureVariablesExists);
+           return context.replaceVariables(attribute);
         }
     }
     

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=1064648&r1=1064647&r2=1064648&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 Jan 28 12:54:43 2011
@@ -204,6 +204,14 @@ public abstract class RequestContext {
     // Debug
     // ////////////////////////////
     public void append(DebugView view) {
+        view.divider("User");
+        AuthenticationSession session = getSession();
+        view.appendRow("Session", session);
+        if (session != null) {
+            view.appendRow("Name", session.getUserName());
+            view.appendRow("Roles", session.getRoles());
+        }
+
         view.divider("context");
         view.appendRow("Parent request path", requestedParentPath);
         view.appendRow("Requested file", requestedFile);
@@ -330,7 +338,7 @@ public abstract class RequestContext {
         if (value == null) {
             return null;
         } else {
-            return replaceVariables(value, true);
+            return replaceVariables(value);
         }
     }
 
@@ -345,8 +353,7 @@ public abstract class RequestContext {
         return null;
     }
 
-    public String replaceVariables(String value, boolean ensureExists) {
-        LOG.debug("replacing" + value);
+    public String replaceVariables(String value) {
         int start = value.indexOf("${");
         if (start == -1) {
             return value;
@@ -359,25 +366,43 @@ public abstract class RequestContext {
             }
             String name = value.substring(start + 2, end);
             if (name != null) {
-                Object replacementValue = getParameter(name);
-                if (replacementValue == null) {
-                    replacementValue = getVariable(name);
-                }
-                if (replacementValue == null) {
-                    replacementValue = getBuiltIn(name);
-                }
-                if (replacementValue == null) {
-                    // REVIEW should we have a special tag that shows that a variable must exist?
-                    if (ensureExists) {
-                        throw new PropertyException("No value for the variable " + value.substring(start, end + 1));
-                    } else {
-                        replacementValue = "";
+                int pos = name.indexOf(":");
+                String variableName = pos == -1 ? name : name.substring(0, pos);
+                String qualifier = pos == -1 ? "none" : name.substring(pos); 
+                Object replacementValue;
+                boolean embed = qualifier.indexOf("embed") > -1;
+                if (embed) {
+                    replacementValue = "${" + variableName + "}";
+                } else {
+                    replacementValue = getParameter(variableName);
+                    if (replacementValue == null) {
+                        replacementValue = getVariable(variableName);
+                    }
+                    if (replacementValue == null) {
+                        replacementValue = getBuiltIn(variableName);
                     }
+                    
+                    if (replacementValue == null) {
+                        boolean ensureExists = qualifier.indexOf("optional") == -1;
+                        if (ensureExists) {
+                            throw new PropertyException("No value for the variable " + value.substring(start, end + 1));
+                        } else {
+                            replacementValue = "";
+                        }
+                    }
+                }
+                boolean repeat = qualifier.indexOf("repeat") > -1;
+                if (repeat) {
+                    value = value.substring(0, start) + replacementValue + value.substring(end + 1);
+                    return replaceVariables(value);
+                } else {                
+                    String remainder = replaceVariables(value.substring(end + 1));
+                    value = value.substring(0, start) + replacementValue + remainder;
+                    return value;
                 }
-                value = value.substring(0, start) + replacementValue + value.substring(end + 1);
-                return replaceVariables(value, ensureExists);
+                
             } else {
-                throw new PropertyException("No value for " + name);
+                throw new PropertyException("No variable name speceified");
             }
         }
     }
@@ -477,7 +502,12 @@ public abstract class RequestContext {
     }
 
     public String getParameter(String name) {
-        return (String) getVariable(name);
+        Object variable = getVariable(name);
+        if (variable instanceof String || variable == null) {
+            return (String) variable;
+        } else {
+            return variable.toString();
+        }
     }
     
     public Iterator<Entry<String, Object>> interactionParameters() {

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugView.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugView.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugView.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/debug/DebugView.java Fri Jan 28 12:54:43 2011
@@ -21,8 +21,10 @@
 package org.apache.isis.viewer.scimpi.dispatcher.debug;
 
 import java.io.PrintWriter;
+import java.io.StringWriter;
 
 import org.apache.isis.core.commons.debug.DebugString;
+import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
 
 
 public class DebugView {
@@ -61,15 +63,19 @@ public class DebugView {
 
     public void exception(Throwable e) {
         divider("Exception");
-        String message = e.getMessage();
+        String message = e instanceof  ScimpiException ? ((ScimpiException) e).getHtmlMessage() : e.getMessage();
         if (message != null) {
             writer.println("<tr><td class=\"error\" colspan=\"2\" >" + message + "<td></tr>");
-            debug.appendln(message);
         }
         causingException(e);
         writer.println("<tr><td class=\"code\" colspan=\"2\" >");
         e.printStackTrace(writer);
         writer.println("<td></tr>");
+        
+        StringWriter stringWriter = new StringWriter();
+        PrintWriter printWriter = new PrintWriter(stringWriter);
+        e.printStackTrace(printWriter);
+        debug.appendln(stringWriter.toString());
     }
 
     private void causingException(Throwable throwable) {

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java Fri Jan 28 12:54:43 2011
@@ -57,7 +57,7 @@ public class RemoveAction implements Act
                 throw new ScimpiException("No field " + fieldName + " in " + parent.getSpecification().getFullIdentifier());
             }
             if (field.isVisible(IsisContext.getAuthenticationSession(), parent).isVetoed()) {
-                throw new ForbiddenException("Field " + fieldName + " in " + parent + " is not visible");
+                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
             }
 
             ((OneToManyAssociation) field).removeElement(parent, row);       

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/HtmlFileParser.java Fri Jan 28 12:54:43 2011
@@ -77,7 +77,7 @@ public class HtmlFileParser {
         Node node = null;
         try {
             Stack<Snippet> tags = allTags;
-            String lineNumbers = "0";
+            String lineNumbers = "1";
             String template = null;
             tags.push(new HtmlSnippet(lineNumbers, filePath));
 
@@ -114,7 +114,7 @@ public class HtmlFileParser {
                         if (context.isDebug()) { 
                             context.getWriter().println("<!-- " +  "import file " + importFile + " -->"); 
                         } 
-                        importFile = context.replaceVariables(importFile, true);
+                        importFile = context.replaceVariables(importFile);
                         parseHtmlFile(loadPath, importFile, context, tags, tagsForPreviousTemplate);
                     }
 
@@ -126,7 +126,7 @@ public class HtmlFileParser {
                             throw new ScimpiException("Template tag can only be used once within a file");
                         }
                         template = tagNode.getAttribute("file");
-                        template = context.replaceVariables(template, true);
+                        template = context.replaceVariables(template);
                         if (context.isDebug()) { 
                             context.getWriter().println("<!-- " +  "apply template " + template + " -->"); 
                         } 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/ProcessorLookup.java Fri Jan 28 12:54:43 2011
@@ -38,6 +38,7 @@ import org.apache.isis.viewer.scimpi.dis
 import org.apache.isis.viewer.scimpi.dispatcher.view.debug.Debug;
 import org.apache.isis.viewer.scimpi.dispatcher.view.debug.Diagnostics;
 import org.apache.isis.viewer.scimpi.dispatcher.view.debug.Members;
+import org.apache.isis.viewer.scimpi.dispatcher.view.debug.PrintAuthorizationClause;
 import org.apache.isis.viewer.scimpi.dispatcher.view.debug.Specification;
 import org.apache.isis.viewer.scimpi.dispatcher.view.debug.ThrowException;
 import org.apache.isis.viewer.scimpi.dispatcher.view.display.AddMessage;
@@ -152,6 +153,7 @@ public class ProcessorLookup {
         addElementProcessor(new PageTitle());
         addElementProcessor(new Parameter());
         addElementProcessor(new ParameterName());
+        addElementProcessor(new PrintAuthorizationClause());
         addElementProcessor(new RadioListField());
         addElementProcessor(new RemoveElement());
         addElementProcessor(new RunAction());

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/Request.java Fri Jan 28 12:54:43 2011
@@ -75,7 +75,7 @@ public class Request implements PageWrit
             index++;
             Snippet snippet = snippets.get(index);
             if (snippet instanceof HtmlSnippet) {
-                append(snippet);
+                append((HtmlSnippet) snippet);
             } else {
                 SwfTag tag = (SwfTag) snippet;
                 String name = tag.getName();
@@ -85,17 +85,21 @@ public class Request implements PageWrit
         }
     }
 
-    private void append(Snippet snippet) {
+    private void append(HtmlSnippet snippet) {
+        String html = snippet.getHtml();
         try {
-            String html = snippet.getHtml();
-            if (((HtmlSnippet) snippet).isContainsVariable()) {
-                html = context.replaceVariables(html, true);
+            if (snippet.isContainsVariable()) {
+                html = context.replaceVariables(html);
             }
             appendHtml(html);
         } catch (TagProcessingException e) {
             throw e;
         } catch (RuntimeException e) {
-            throw new TagProcessingException(snippet.errorAt(), e);
+            String replace = "<";
+            String withReplacement = "&lt;";
+            html = html.replaceAll(replace, withReplacement);
+
+            throw new TagProcessingException("Error while processing html block at " + snippet.errorAt() + " - " + e.getMessage(), html, e);
         }
     }
 
@@ -109,13 +113,13 @@ public class Request implements PageWrit
             LOG.debug("processing " + processor.getName() + " " + tag);
             appendDebug("\n" + tag.debug()); 
             if (tag.getType() == SwfTag.END) { 
-                throw new TagProcessingException(tag.errorAt() + " - end tag mistaken for a start tag"); 
+                throw new TagProcessingException(tag.errorAt() + " - end tag mistaken for a start tag", tag.toString()); 
             } 
             processor.process(this);
         } catch (TagProcessingException e) {
             throw e;
         } catch (RuntimeException e) {
-            throw new TagProcessingException( "Error while processing " + tag.getName().toLowerCase() + " element at " + tag.errorAt(), e); 
+            throw new TagProcessingException( "Error while processing " + tag.getName().toLowerCase() + " element at " + tag.errorAt() + " - " + e.getMessage(), tag.toString(), e); 
         }
     }
 
@@ -128,7 +132,7 @@ public class Request implements PageWrit
             index++;
             Snippet snippet = snippets.get(index);
             if (snippet instanceof HtmlSnippet) {
-                append(snippet);
+                append((HtmlSnippet)snippet);
             } else {
                 SwfTag nextTag = (SwfTag) snippet;
                 if (tag.getName().equals(nextTag.getName())) {
@@ -138,7 +142,8 @@ public class Request implements PageWrit
                 }
                 String name = nextTag.getName();
                 if (nextTag.getType() == SwfTag.END && !tag.getName().equals(name)) { 
-                    throw new TagProcessingException("Expected " + nextTag.getName().toLowerCase() + " tag but found " + tag.getName().toLowerCase() + " tag at " + nextTag.errorAt()); 
+                    throw new TagProcessingException("Expected " + nextTag.getName().toLowerCase() + " tag but found " + tag.getName().toLowerCase() +
+                            " tag at " + nextTag.errorAt(), tag.toString()); 
                 } 
                 ElementProcessor processor = processors.getFor(name);
                 process(nextTag, processor);

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/processor/TagProcessingException.java Fri Jan 28 12:54:43 2011
@@ -24,23 +24,39 @@ import org.apache.isis.viewer.scimpi.dis
 
 public class TagProcessingException extends ScimpiException {
     private static final long serialVersionUID = 1L;
+    private String context;
 
     public TagProcessingException() {
         super();
     }
 
-    public TagProcessingException(String message, Throwable cause) {
+    public TagProcessingException(String message, String context, Throwable cause) {
         super(message, cause);
+        this.context = context;
     }
 
-    public TagProcessingException(String message) {
+    public TagProcessingException(String message, String context) {
         super(message);
+        this.context = context;
     }
 
     public TagProcessingException(Throwable cause) {
         super(cause);
     }
 
+    public String getContext() {
+        return context;
+    }
+
+    @Override
+    public String getMessage() {
+        return super.getMessage() + "\n" + getContext();
+    }
+
+    @Override
+    public String getHtmlMessage() {
+        return super.getMessage() + "<pre>" + getContext() + "</pre>";
+    }
 }
 
 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/HtmlSnippet.java Fri Jan 28 12:54:43 2011
@@ -45,7 +45,7 @@ public class HtmlSnippet implements Snip
     }
     
     public String errorAt() {
-        return "Error while processing '<pre>" + html + "</pre>' element at " + path + ":" + lineNumbers;
+        return path + ":" + lineNumbers;
     }
 }
 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/action/RunAction.java Fri Jan 28 12:54:43 2011
@@ -24,9 +24,8 @@ import java.util.List;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-import org.apache.isis.core.runtime.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
@@ -54,17 +53,7 @@ public class RunAction extends AbstractE
         ObjectAdapter[] parameters = parameterBlock.getParameters(request);
 
         if (!MethodsUtils.isVisibleAndUsable(object, action)) {
-            throw new ScimpiException("Action '" + action.getId() + "' is not visible/enabled in "
-                    + action.getOnType().getFullIdentifier() + ", for " + IsisContext.getSession().getAuthenticationSession().getRoles());
-            /* TODO remove if the above is correct
-            if (action.isContributed()) {
-                throw new ScimpiException("Action '" + action.getId() + "' is not visible/enabled in "
-                        + action.getOnType().getFullIdentifier() + ", for " + IsisContext.getSession().getAuthenticationSession().getRoles());
-            } else {
-                throw new ScimpiException("Action '" + action.getId() + "' is not visible/enabled in "
-                        + object.getSpecification().getFullIdentifier() + ", for " + IsisContext.getSession().getAuthenticationSession().getRoles());
-            }
-            */
+            throw new ForbiddenException(action, ForbiddenException.VISIBLE_AND_USABLE);
         }
 
         // swap null parameter of the object's type to run a contributed method

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/Members.java Fri Jan 28 12:54:43 2011
@@ -52,7 +52,7 @@ public class Members extends AbstractEle
         if (fieldName != null) {
             field = object.getSpecification().getAssociation(fieldName);
             if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) {
-                throw new ForbiddenException("Field " + fieldName + " in " + object + " is not visible");
+                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
             }
             object = field.get(object);
         }

Added: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/PrintAuthorizationClause.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/PrintAuthorizationClause.java?rev=1064648&view=auto
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/PrintAuthorizationClause.java (added)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/PrintAuthorizationClause.java Fri Jan 28 12:54:43 2011
@@ -0,0 +1,35 @@
+package org.apache.isis.viewer.scimpi.dispatcher.view.debug;
+
+import java.util.List;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
+
+public class PrintAuthorizationClause extends AbstractElementProcessor {
+
+    public String getName() {
+        return "print-authorization-clause";
+    }
+
+    public void process(Request request) {
+        Identifier identifier = (Identifier) request.getContext().getVariable("_security_identifier");
+        List<String> roles =  (List<String>) request.getContext().getVariable("_security_roles");
+        StringBuffer roleList = new StringBuffer();
+        for (String role : roles) {
+            if (roleList.length() > 0) {
+                roleList.append("|");
+            }
+            roleList.append(role);
+        }
+        
+        request.appendHtml("<pre>" );
+        request.appendHtml(identifier.toClassIdentityString() + ":" + roleList + "\n");
+        request.appendHtml(identifier.toString() + ":" + roleList);
+        request.appendHtml( "</pre>");
+    }
+
+}
+
+
+// Copyright (c) Naked Objects Group Ltd.

Propchange: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/PrintAuthorizationClause.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/debug/ThrowException.java Fri Jan 28 12:54:43 2011
@@ -22,7 +22,6 @@ package org.apache.isis.viewer.scimpi.di
 
 import org.apache.isis.core.commons.exceptions.IsisException;
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldLabel.java Fri Jan 28 12:54:43 2011
@@ -40,7 +40,7 @@ public class FieldLabel extends Abstract
             throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
         }
         if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) {
-            throw new ForbiddenException("Field " + fieldName + " in " + object.getSpecification().getFullIdentifier() + " is not visible");
+            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
         }
         String delimiter = request.getOptionalProperty("delimiter");
         if (delimiter == null) {

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/FieldValue.java Fri Jan 28 12:54:43 2011
@@ -46,7 +46,7 @@ public class FieldValue extends Abstract
             throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
         }
         if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) {
-            throw new ForbiddenException("Field " + fieldName + " in " + object + " is not visible");
+            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
         }
         boolean isIconShowing = request.isRequested(SHOW_ICON, true);
         String truncateTo = request.getOptionalProperty(TRUNCATE, "0");

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/GetField.java Fri Jan 28 12:54:43 2011
@@ -52,8 +52,7 @@ public class GetField extends AbstractEl
         }
         AuthenticationSession session = IsisContext.getAuthenticationSession();
         if (field.isVisible(session, object).isVetoed()) {
-            throw new ForbiddenException("Field '" + fieldName + "' in " + object.getSpecification().getFullIdentifier()
-                    + " is not visible for " + session.getUserName() + " " + session.getRoles());
+            throw new ForbiddenException(field, ForbiddenException.VISIBLE); 
         }
 
         String pattern = request.getOptionalProperty("decimal-format");

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/IncludeObject.java Fri Jan 28 12:54:43 2011
@@ -48,7 +48,7 @@ public class IncludeObject extends Abstr
         if (fieldName != null) {
             ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
             if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) {
-                throw new ForbiddenException("Field " + fieldName + " in " + object + " is not visible");
+                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
             }
             object = field.get(object);
             id = request.getContext().mapObject(object, Scope.REQUEST);

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Title.java Fri Jan 28 12:54:43 2011
@@ -41,7 +41,7 @@ public class Title extends AbstractEleme
         if (fieldName != null) {
             ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
             if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) {
-                throw new ForbiddenException("Field " + fieldName + " in " + object + " is not visible");
+                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
             }
             object = field.get(object);
         }

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/logon/Logon.java Fri Jan 28 12:54:43 2011
@@ -56,6 +56,11 @@ public class Logon extends AbstractEleme
    
         InputField nameField = new InputField("username");
         nameField.setType(InputField.TEXT);
+        String width = request.getOptionalProperty("width");
+        if (width != null) {
+            int w = Integer.valueOf(width).intValue();
+            nameField.setWidth(w);
+        }
         nameField.setLabel("User Name");
    
         InputField passwordField = new InputField("password");
@@ -66,7 +71,7 @@ public class Logon extends AbstractEleme
    
         String formTitle = request.getOptionalProperty(FORM_TITLE);
         String loginButtonTitle = request.getOptionalProperty(BUTTON_TITLE, "Log in");
-        String className = request.getOptionalProperty(CLASS, "login");
+        String className = request.getOptionalProperty(CLASS, "action login full");
         String  id = request.getOptionalProperty(ID);
         HtmlFormBuilder.createForm(request, "logon.app", hiddenFields.toArray(new HiddenInputField[hiddenFields.size()]), fields, className, id, formTitle, null, null, loginButtonTitle);
     }

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java Fri Jan 28 12:54:43 2011
@@ -121,10 +121,9 @@ public abstract class AbstractConditiona
             if (fld == null) {
                 processTags(true, request);
             } else {
-                    CollectionFacet facet = fld.getSpecification().getFacet(CollectionFacet.class);
-                    boolean isEmpty = facet != null &&   facet.size(fld) == 0;
-                    // boolean isEmpty = fld == null || (fld instanceof CollectionAdapter && ((CollectionAdapter) fld).size() == 0);
-                    processTags(isEmpty, request);
+                CollectionFacet facet = fld.getSpecification().getFacet(CollectionFacet.class);
+                boolean isEmpty = facet != null &&   facet.size(fld) == 0;
+                processTags(isEmpty, request);
             }
             return;
         }

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java Fri Jan 28 12:54:43 2011
@@ -51,7 +51,7 @@ public abstract class AbstractLink exten
                 throw new ScimpiException("No field " + fieldName + " in " + adapter.getSpecification().getFullIdentifier());
             }
             if (field.isVisible(IsisContext.getAuthenticationSession(), adapter).isVetoed()) {
-                throw new ForbiddenException("Field " + fieldName + " in " + object + " is not visible");
+                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
             }
             IsisContext.getPersistenceSession().resolveField(adapter, field);
             adapter = field.get(adapter);

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=1064648&r1=1064647&r2=1064648&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 Jan 28 12:54:43 2011
@@ -78,7 +78,7 @@ public class RemoveElement extends Abstr
             throw new ScimpiException("No field " + fieldName + " in " + adapter.getSpecification().getFullIdentifier());
         }
         if (field.isVisible(IsisContext.getAuthenticationSession(), adapter).isVetoed()) {
-            throw new ForbiddenException("Field " + fieldName + " in " + adapter.getSpecification().getFullIdentifier() + " is not visible");
+            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
         }
         IsisContext.getPersistenceSession().resolveField(adapter, field);
 

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/FieldName.java Fri Jan 28 12:54:43 2011
@@ -40,7 +40,7 @@ public class FieldName extends AbstractE
             throw new ScimpiException("No field " + fieldName + " in " + object.getSpecification().getFullIdentifier());
         }
         if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) {
-            throw new ForbiddenException("Field " + fieldName + " in " + object.getSpecification().getFullIdentifier() + " is not visible");
+            throw new ForbiddenException(field, ForbiddenException.VISIBLE);
         }
         request.appendHtml(field.getName());
     }

Modified: incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java?rev=1064648&r1=1064647&r2=1064648&view=diff
==============================================================================
--- incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java (original)
+++ incubator/isis/trunk/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/value/TitleString.java Fri Jan 28 12:54:43 2011
@@ -42,7 +42,7 @@ public class TitleString extends Abstrac
         } else {
             ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
             if (field.isVisible(IsisContext.getAuthenticationSession(), object).isVetoed()) {
-                throw new ForbiddenException("Field " + fieldName + " in " + object + " is not visible");
+                throw new ForbiddenException(field, ForbiddenException.VISIBLE);
             }
             ObjectAdapter fieldReference = field.get(object);
             if (fieldReference != null) {



Mime
View raw message