From 86b95d10597ef610d7765b7e0dc74b31966a382a Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Tue, 19 Jan 2010 11:23:38 +0000 Subject: [PATCH] Merged V3.2E to HEAD 17429: Fixed ETHREEOH-2319 "Share - Sticky image or videos in web view" 17435: Fixed EETHREEOH-3325 "Add group button is disabled on Admin Console - New User page" 17445: Fixed ETHREEOH-3306 "Large number of root groups causes Groups admin tool to lockup the sever and Share" - Search panel is now the default panel and the loading of root groups only occurs if you click the "Browse" button and change to the browse panel 17446: Fix for unreported issue where the InMemoryTicketComponent did not check for null value from ticketsCache. Can occur on tomcat sesson expire and caused NPE to be logged. 17449: Merged V3.1 to V3.2 17257: *RECORD ONLY* Merged V3.2 to V3.1 13685: ACT 8490 - TinyMCE fails if told to load unsupported language (interim fix only) (ETHREEOH-1615) 17372: First part of fix for ETHREEOH-2519. 17448: Merged DEV-TEMPORARY to V3.1 17390: ETHREEOH-1619: Letters and special symbols can be typed in Date value of property while creation of Content Rule and it leads to error 17391: ETHREEOH-1058: It is possible to send invite email message with no subject from Web Project Wizard Step Seven - Email Users page ETHREEOH-1060: It is possible to send empty invitation email from Web Project Wizard Step Seven - Email users page 17452: Fixed ETHREEOH-3306 "Large number of root groups causes Groups admin tool to lockup the sever and Share" part 2 - A "no result"-message was displayed to the user even though no search had been performed, now replaced by a usage message 17453: Fixed ETHREEOH-2329 " Search doesn't work correctly on Groups page" 17454: Fix for ETHREEOH-3084 - Error message appears in My Web Files part of My Alfresco Dashboard after configuring of the dashboard. - added new JavaScript and Template APIs to retrieve child nodes of a specific type - using fast direct DB NodeService call. 17455: Fixed ETHREEOH-2329 " Search doesn't work correctly on Groups page" part 2 - Added the prefix "*" to admin console group search as well to make it consistent git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18122 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/repo/jscript/ScriptNode.java | 22 ++++++++++ .../InMemoryTicketComponentImpl.java | 17 ++++---- .../alfresco/repo/template/TemplateNode.java | 40 +++++++++++++++++++ 3 files changed, 72 insertions(+), 7 deletions(-) diff --git a/source/java/org/alfresco/repo/jscript/ScriptNode.java b/source/java/org/alfresco/repo/jscript/ScriptNode.java index 8843f03acf..ac7216114f 100644 --- a/source/java/org/alfresco/repo/jscript/ScriptNode.java +++ b/source/java/org/alfresco/repo/jscript/ScriptNode.java @@ -715,6 +715,28 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol return getChildAssocs(); } + /** + * Return an Array of the associations from this Node that match a specific object type. + * node.getChildAssocsByType("cm:folder")[0] + * + * @return Array of child associations from this Node that match a specific object type. + */ + @SuppressWarnings("unchecked") + public Scriptable getChildAssocsByType(String type) + { + // get the list of child assoc nodes for each association type + Set types = new HashSet(1, 1.0f); + types.add(createQName(type)); + List refs = this.nodeService.getChildAssocs(this.nodeRef, types); + Object[] nodes = new Object[refs.size()]; + for (int i=0; i getChildAssocsByType(String type) + { + Set types = new HashSet(1, 1.0f); + types.add(createQName(type)); + List refs = this.services.getNodeService().getChildAssocs(this.nodeRef, types); + List nodes = new ArrayList(refs.size()); + for (ChildAssociationRef ref : refs) + { + String qname = ref.getTypeQName().toString(); + nodes.add( new TemplateNode(ref.getChildRef(), this.services, this.imageResolver) ); + } + return nodes; + } + /** * @return true if the node is currently locked */ @@ -520,6 +539,27 @@ public class TemplateNode extends BasePermissionsNode implements NamespacePrefix return this.imageResolver; } + /** + * Helper to create a QName from either a fully qualified or short-name QName string + * + * @param s Fully qualified or short-name QName string + * + * @return QName + */ + private QName createQName(String s) + { + QName qname; + if (s.indexOf(NAMESPACE_BEGIN) != -1) + { + qname = QName.createQName(s); + } + else + { + qname = QName.createQName(s, this.services.getNamespaceService()); + } + return qname; + } + // ------------------------------------------------------------------------------ // Inner classes