Merged V3.4-BUG-FIX to HEAD

30744: ALF-9524: WCM: Defining a complex type with 'abstract' attribute to true does not allow other complex types to define elements with the same name 
      - Fix by Pavel
   30804: ALF-9524: Fix to NPE by Pavel
   30812: ALF-718: Rules Fire Emails before Transaction Commit/Rollback
   Added tests and moved email sending into a post commit callback.
   30820: Fix for ALF-10516 - 'My Sites' dashlet should indicate it is loading rather than say 'No sites'
   30824: Fixed ALF-10470: DeclaritiveRegistry is looping continuously and re-initializing
    - Only replicate removals for the cache.  The reset always does a remove first.
       <cache 
           name="org.alfresco.cache.webScriptsRegistryCache"
                                    ...
                                    replicateUpdates = false,
                                    ...
       </cache>
   30827: ALF-10513 60k Site Performance: Unable to delete user + request not acknowledged for 2 minutes
     Now about 3 to 4 seconds
   30828: Andy H recommended change to lucene indexer values
   30831: ALF-718: Fix for InvitationServiceImplTest
   Fixes behaviour broken by original fix for ALF-718: the send-after-commit does NOT work for the invitation service, so it was necessary
   to change the code to only send-after-commit in the context of a rule.  
   30843: Fixed ALF-7698 "Defects in tags picker in SHARE." according to feedback provided in ALF-9953 "Decide order where new items shall appear in the object finder."
   30844: ALF-9544 - Inbound email restricts file name to 86 characters or less.
     used QName.createQNameWithValidLocalName()  as suggested.
     added new EmailServiceImplTest
   30849: Fixed ALF-8776 "Rule details dialog handling of apostrophes"
   30862: Merged DEV/TEMPORARY to V3.4-BUG-FIX (with improvements)
      30856: ALF-10288: Regression of ALF-1997: non domain users cannot bypass SSO in Share using /share/page?pt=login
         In SSOAuthenticationFilter.doFilter() method added check (PAGE_SERVLET_PATH.equals(req.getServletPath()) && LOGIN_PATH_INFORMATION.equals(req.getPathInfo()).
   30864: SMTP Server, To and From address format.
     - Out standards for from and to address were stuck in the 1980s!
   30867: ALF-10517 - 'My Content' slow
    - performance improvements by reworking Lucene queries used to retrieve recently modified and recently created content for a user
    - converted queries to fts-alfresco
    - improvements from 3.5sec per page render down to 1.1 secs
   30874: MERGE DEV to V3.4-BUG-FIX
         30851 : ALF-9558 - Unchecked Return Value
   30882: - ScriptGroup.isRootGroup() now stops if it finds a single parent rather than doing a size on all parent groups.
     Not sure the logic (not changed by me) is correct as it includes parents that are site groups.
   - SiteServiceImpl now only gets the specified number of sites. Sometimes it would have return more if AuthorityDAOImpl
     switched approach used to get containing authorities.
   - Overloaded getContainingAuthorities to take a size parameter, deprecated other and switched calling code
     Done for isRootGroup activity.
   30910: - Fix build error
   - Found a better way to use filter in AuthorityDAOImpl.getContainingAuthoritiesInZone
     so that we don't need to reset the filter, by using the +ve hits from first approach
     if we switch to second approach.
   30925: - ALF-10501 60k Site Performance: Searching for a group to add to a site with a value that matches a few sites takes 2 minutes
     ALF-10502 60k Site Performance: Admin Console | Groups: search with a value that matches a few sites takes 70 seconds
     ALF-10504 60k Site Performance: Admin Console | Groups | Browse Groups page appears corrupt as it never finishes loading
     - All the above were slow as a result of ScriptGroup.isRootGroup()
     - ScriptGroup.isRootGroup() and ScriptGroup.isAdminGroup() removed - Checked with KevinR that these are not needed any more.
     - Removed code added on 30 Sep 11 to support isRootGroup (the size parameter to AuthorityDAO.getContainingAuthorities)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30935 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2011-10-03 16:23:14 +00:00
parent be601d31b4
commit 3e33fa90ae

View File

@@ -1299,7 +1299,7 @@ public class Schema2XForms implements Serializable
} }
private Element addElementWithMultipleCompatibleTypes(final Document xformsDocument, private Element addElementWithMultipleCompatibleTypes(final Document xformsDocument,
final Element modelSection, Element modelSection,
final Element defaultInstanceElement, final Element defaultInstanceElement,
final Element formSection, final Element formSection,
final XSModel schema, final XSModel schema,
@@ -1411,9 +1411,42 @@ public class Schema2XForms implements Serializable
final Element caseElement = caseTypes.get(type.getName()); final Element caseElement = caseTypes.get(type.getName());
switchElement.appendChild(caseElement); switchElement.appendChild(caseElement);
// ALF-9524 fix, add an extra element to the instance for each type that extends the abstract parent
Element newDefaultInstanceElement = xformsDocument.createElement(getElementName(type, xformsDocument));
Attr nodesetAttr = modelSection.getAttributeNodeNS(NamespaceConstants.XFORMS_NS, "nodeset");
// construct the nodeset that is used in bind for abstract type
String desiredBindNodeset = getElementName(elementDecl, xformsDocument) + (isRepeated ? "[position() != last()]" : "");
// check the current bind
if (nodesetAttr == null || !nodesetAttr.getValue().equals(desiredBindNodeset))
{
// look for desired bind in children
Element newModelSection = DOMUtil.getElementByAttributeValueNS(modelSection, NamespaceConstants.XFORMS_NS, "bind", NamespaceConstants.XFORMS_NS, "nodeset", desiredBindNodeset);
if (newModelSection == null)
{
// look for absolute path
desiredBindNodeset = "/" + desiredBindNodeset;
newModelSection = DOMUtil.getElementByAttributeValueNS(modelSection, NamespaceConstants.XFORMS_NS, "bind", NamespaceConstants.XFORMS_NS, "nodeset", desiredBindNodeset);
}
modelSection = newModelSection;
}
// create the extra bind for each child of abstract type
Element bindElement3 = this.createBind(xformsDocument, getElementName(type, xformsDocument));
modelSection.appendChild(bindElement3);
bindElement3 = this.startBindElement(bindElement3, schema, controlType, elementDecl, occurs);
// add the relevant attribute that checks the value of parent' @xsi:type
bindElement3.setAttributeNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":relevant",
"../@xsi:type='" + type.getName() + "'");
final Element groupElement = this.addComplexType(xformsDocument, final Element groupElement = this.addComplexType(xformsDocument,
modelSection, modelSection,
defaultInstanceElement, newDefaultInstanceElement,
caseElement, caseElement,
schema, schema,
(XSComplexTypeDefinition) type, (XSComplexTypeDefinition) type,
@@ -1427,13 +1460,15 @@ public class Schema2XForms implements Serializable
NamespaceConstants.XFORMS_PREFIX + ":appearance", NamespaceConstants.XFORMS_PREFIX + ":appearance",
""); "");
defaultInstanceElement.appendChild(newDefaultInstanceElement.cloneNode(true));
// modify bind to add a "relevant" attribute that checks the value of @xsi:type // modify bind to add a "relevant" attribute that checks the value of @xsi:type
if (LOGGER.isDebugEnabled()) if (LOGGER.isDebugEnabled())
{ {
LOGGER.debug("[addElementWithMultipleCompatibleTypes] Model section =\n" + XMLUtil.toString(bindElement2)); LOGGER.debug("[addElementWithMultipleCompatibleTypes] Model section =\n" + XMLUtil.toString(bindElement3));
} }
final NodeList binds = bindElement2.getElementsByTagNameNS(NamespaceConstants.XFORMS_NS, "bind"); final NodeList binds = bindElement3.getElementsByTagNameNS(NamespaceConstants.XFORMS_NS, "bind");
for (int i = 0; i < binds.getLength(); i++) for (int i = 0; i < binds.getLength(); i++)
{ {
final Element subBind = (Element) binds.item(i); final Element subBind = (Element) binds.item(i);
@@ -1443,7 +1478,7 @@ public class Schema2XForms implements Serializable
name = repeatableNamePattern.matcher(name).replaceAll(""); name = repeatableNamePattern.matcher(name).replaceAll("");
if (!subBind.getParentNode().getAttributes().getNamedItem("id").getNodeValue().equals( if (!subBind.getParentNode().getAttributes().getNamedItem("id").getNodeValue().equals(
bindElement2.getAttribute("id"))) bindElement3.getAttribute("id")))
{ {
continue; continue;
} }
@@ -1470,12 +1505,12 @@ public class Schema2XForms implements Serializable
//test sub types of this type //test sub types of this type
//TreeSet subCompatibleTypes = (TreeSet) typeTree.get(type); //TreeSet subCompatibleTypes = (TreeSet) typeTree.get(type);
String newRelevant = "../@xsi:type='" + type.getName() + "'"; String newRelevant = "../../@xsi:type='" + type.getName() + "'";
if (this.typeTree.containsKey(type.getName())) if (this.typeTree.containsKey(type.getName()))
{ {
for (XSTypeDefinition otherType : this.typeTree.get(type.getName())) for (XSTypeDefinition otherType : this.typeTree.get(type.getName()))
{ {
newRelevant = newRelevant + " or ../@xsi:type='" + otherType.getName() + "'"; newRelevant = newRelevant + " or ../../@xsi:type='" + otherType.getName() + "'";
} }
} }
@@ -1835,6 +1870,13 @@ public class Schema2XForms implements Serializable
//repeatSection.setAttributeNS(NamespaceConstants.XFORMS_NS,NamespaceConstants.XFORMS_PREFIX + ":nodeset",pathToRoot); //repeatSection.setAttributeNS(NamespaceConstants.XFORMS_NS,NamespaceConstants.XFORMS_PREFIX + ":nodeset",pathToRoot);
// bind -> last element in the modelSection // bind -> last element in the modelSection
Element bind = DOMUtil.getLastChildElement(modelSection); Element bind = DOMUtil.getLastChildElement(modelSection);
// ALF-9524 fix, previously we've added extra bind element, so last child is not correct for repeatable switch
if (controlType instanceof XSComplexTypeDefinition && ((XSComplexTypeDefinition)controlType).getDerivationMethod() == XSConstants.DERIVATION_EXTENSION)
{
bind = modelSection;
}
String bindId = null; String bindId = null;
if (bind != null && if (bind != null &&
@@ -2990,7 +3032,7 @@ public class Schema2XForms implements Serializable
* @param xformsDocument * @param xformsDocument
* @return The element name * @return The element name
*/ */
private String getElementName(final XSElementDeclaration element, private String getElementName(final XSObject element,
final Document xformsDocument) final Document xformsDocument)
{ {
String elementName = element.getName(); String elementName = element.getName();