From fe1770f616b647a1db1bbc504bf81f1b4ef09281 Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Tue, 11 Mar 2008 13:19:00 +0000 Subject: [PATCH] Merged V2.2 to HEAD 8405: Added causal exception to the runtime generated 8408: AR-2136, AR-2137, AR-2138 8410: WCM-1110, WCM-1111 8417: Stopped chiba:match() function from being inserted into bindings for xforms model elements of type xs:integer. 8419: Fixes for correct use of .empty in name spaces of QNames 8420: Finally fixes WCM-1108 and WCM-1109 8489: Merged V2.1 to V2.2 8482: Fix For AR-2163 8507: Merged V2.1 to V2.2 8504: Fix for AR-2165 - respect repo read only setting during authentication git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8508 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/web/bean/wcm/SandboxFactory.java | 3 ++ .../web/forms/xforms/Schema2XForms.java | 29 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/source/java/org/alfresco/web/bean/wcm/SandboxFactory.java b/source/java/org/alfresco/web/bean/wcm/SandboxFactory.java index 08a3fbe6f5..70f5956695 100644 --- a/source/java/org/alfresco/web/bean/wcm/SandboxFactory.java +++ b/source/java/org/alfresco/web/bean/wcm/SandboxFactory.java @@ -226,6 +226,7 @@ public final class SandboxFactory // Set store permission masks String currentUser = Application.getCurrentUser(context).getUserName(); permissionService.setPermission(dirRef.getStoreRef(), currentUser, PermissionService.CHANGE_PERMISSIONS, true); + permissionService.setPermission(dirRef.getStoreRef(), currentUser, PermissionService.READ_PERMISSIONS, true); permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true); } @@ -245,6 +246,8 @@ public final class SandboxFactory // give the manager change permissions permission in the staging area store permissionService.setPermission(dirRef.getStoreRef(), manager, PermissionService.CHANGE_PERMISSIONS, true); + permissionService.setPermission(dirRef.getStoreRef(), manager, + PermissionService.READ_PERMISSIONS, true); } } diff --git a/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java b/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java index 8a8d8e823c..1a3c9cd9fd 100644 --- a/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java +++ b/source/java/org/alfresco/web/forms/xforms/Schema2XForms.java @@ -38,6 +38,7 @@ import org.apache.commons.jxpath.Pointer; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.xerces.impl.xs.SchemaSymbols; import org.apache.xerces.xs.*; import org.chiba.xml.dom.DOMUtil; import org.chiba.xml.ns.NamespaceConstants; @@ -2804,7 +2805,33 @@ public class Schema2XForms implements Serializable typeName); } final StringList lexicalPatterns = ((XSSimpleTypeDefinition)controlType).getLexicalPattern(); - for (int i = 0; lexicalPatterns != null && i < lexicalPatterns.getLength(); i++) + + // NOTE: from glen.johnson@alfresco.com + // Workaround to fix issue WCM-952 + // + // I added expression '&& !typeName.equals(SchemaSymbols.ATTVAL_INTEGER') + // onto the end of loop condition expression below. + // + // This is to stop the pattern matching constraint (using deprecated chiba:match() function) + // from being generated into binding elements that are linked to "xs:integer" + // elements (in the xform instance) + // + // If this pattern match constraint is indeed added to the binding element linked to + // a "xs:integer" element in the xform instance, then a value is always required + // for that element - even if the corresponding schema has minOccurs="0" for + // that element i.e. it causes a value to be required for "optional" xs:integer + // elements. + // + // Note that the chiba:match() function is unsupported and will be removed from Chiba + // in the future, so a solution enabling its complete removal will need to be found. + // I do not see why it has been included here. The Schema inside the xform + // model should take care of most validation needs. + // In the past, when I have completely removed this constraint (see CHK-2333), restrictions + // using in the Schema fail to get enforced - + // Causing the failure of org.alfresco.web.forms.xforms.Schema2XFormsTest.testConstraint() + // + for (int i = 0; lexicalPatterns != null && i < lexicalPatterns.getLength() + && !typeName.equals(SchemaSymbols.ATTVAL_INTEGER); i++) { constraints.add("chiba:match(., '" + lexicalPatterns.item(i) + "',null)"); }