List of usage examples for javax.transaction UserTransaction begin
void begin() throws NotSupportedException, SystemException;
From source file:org.alfresco.web.bean.ajax.CategoryBrowserPluginBean.java
/** * Retrieves the child folders for the noderef given in the 'noderef' parameter and caches the nodes against the area * in the 'area' parameter.//from w ww. j av a2s . c om */ public void retrieveChildren() throws IOException { FacesContext context = FacesContext.getCurrentInstance(); ResponseWriter out = context.getResponseWriter(); UserTransaction tx = null; try { tx = Repository.getUserTransaction(context, true); tx.begin(); Map params = context.getExternalContext().getRequestParameterMap(); String nodeRefStr = (String) params.get("nodeRef"); // work out which list to cache the nodes in Map<String, TreeNode> currentNodes = getNodesMap(); if (nodeRefStr != null && currentNodes != null) { // get the given node's details NodeRef parentNodeRef = new NodeRef(nodeRefStr); TreeNode parentNode = currentNodes.get(parentNodeRef.toString()); parentNode.setExpanded(true); if (logger.isDebugEnabled()) logger.debug("retrieving children for noderef: " + parentNodeRef); // remove any existing children as the latest ones will be added // below parentNode.removeChildren(); // get all the child folder objects for the parent List<ChildAssociationRef> childRefs = this.getNodeService().getChildAssocs(parentNodeRef, ContentModel.ASSOC_SUBCATEGORIES, RegexQNamePattern.MATCH_ALL); List<TreeNode> sortedNodes = new ArrayList<TreeNode>(); for (ChildAssociationRef ref : childRefs) { NodeRef nodeRef = ref.getChildRef(); logger.debug("retrieving child : " + nodeRef); // build the XML representation of the child node TreeNode childNode = createTreeNode(nodeRef); parentNode.addChild(childNode); currentNodes.put(childNode.getNodeRef(), childNode); sortedNodes.add(childNode); } // order the tree nodes by the tree label if (sortedNodes.size() > 1) { QuickSort sorter = new QuickSort(sortedNodes, "name", true, IDataContainer.SORT_CASEINSENSITIVE); sorter.sort(); } // generate the XML representation StringBuilder xml = new StringBuilder( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><nodes>"); for (TreeNode childNode : sortedNodes) { xml.append(childNode.toXML()); } xml.append("</nodes>"); // send the generated XML back to the tree out.write(xml.toString()); if (logger.isDebugEnabled()) logger.debug("returning XML: " + xml.toString()); } // commit the transaction tx.commit(); } catch (Throwable err) { try { if (tx != null) { tx.rollback(); } } catch (Exception tex) { } } }
From source file:org.alfresco.web.bean.ajax.NavigatorPluginBean.java
/** * Retrieves the child folders for the noderef given in the * 'noderef' parameter and caches the nodes against the area in * the 'area' parameter.//w w w . j a v a 2 s . c o m */ public void retrieveChildren() throws IOException { FacesContext context = FacesContext.getCurrentInstance(); ResponseWriter out = context.getResponseWriter(); UserTransaction tx = null; try { tx = Repository.getUserTransaction(context, true); tx.begin(); Map params = context.getExternalContext().getRequestParameterMap(); String nodeRefStr = (String) params.get("nodeRef"); String area = (String) params.get("area"); if (logger.isDebugEnabled()) logger.debug("retrieveChildren: area = " + area + ", nodeRef = " + nodeRefStr); // work out which list to cache the nodes in Map<String, TreeNode> currentNodes = getNodesMapForArea(area); if (nodeRefStr != null && currentNodes != null) { // get the given node's details NodeRef parentNodeRef = new NodeRef(nodeRefStr); TreeNode parentNode = currentNodes.get(parentNodeRef.toString()); parentNode.setExpanded(true); if (logger.isDebugEnabled()) logger.debug("retrieving children for noderef: " + parentNodeRef); // remove any existing children as the latest ones will be added below parentNode.removeChildren(); // get all the child folder objects for the parent List<ChildAssociationRef> childRefs = this.getNodeService().getChildAssocs(parentNodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); List<TreeNode> sortedNodes = new ArrayList<TreeNode>(); for (ChildAssociationRef ref : childRefs) { NodeRef nodeRef = ref.getChildRef(); if (isAddableChild(nodeRef)) { // build the XML representation of the child node TreeNode childNode = createTreeNode(nodeRef); parentNode.addChild(childNode); currentNodes.put(childNode.getNodeRef(), childNode); sortedNodes.add(childNode); } } // order the tree nodes by the tree label if (sortedNodes.size() > 1) { QuickSort sorter = new QuickSort(sortedNodes, "name", true, IDataContainer.SORT_CASEINSENSITIVE); sorter.sort(); } // generate the XML representation StringBuilder xml = new StringBuilder( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><nodes>"); for (TreeNode childNode : sortedNodes) { xml.append(childNode.toXML()); } xml.append("</nodes>"); // send the generated XML back to the tree out.write(xml.toString()); if (logger.isDebugEnabled()) logger.debug("returning XML: " + xml.toString()); } // commit the transaction tx.commit(); } catch (Throwable err) { try { if (tx != null) { tx.rollback(); } } catch (Exception tex) { } } }
From source file:org.alfresco.web.bean.ajax.NavigatorPluginBean.java
/** * Returns the root nodes for the company home panel. * <p>/*from w w w. j a v a 2 s . co m*/ * As the user expands and collapses nodes in the client this * cache will be updated with the appropriate nodes and states. * </p> * * @return List of root nodes for the company home panel */ public List<TreeNode> getCompanyHomeRootNodes() { if (this.companyHomeRootNodes == null) { this.companyHomeRootNodes = new ArrayList<TreeNode>(); this.companyHomeNodes = new HashMap<String, TreeNode>(); UserTransaction tx = null; try { FacesContext fc = FacesContext.getCurrentInstance(); tx = Repository.getUserTransaction(fc, true); tx.begin(); // query for the child nodes of company home NodeRef root = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc)); List<ChildAssociationRef> childRefs = this.getNodeService().getChildAssocs(root, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref : childRefs) { NodeRef child = ref.getChildRef(); if (isAddableChild(child)) { TreeNode node = createTreeNode(child); this.companyHomeRootNodes.add(node); this.companyHomeNodes.put(node.getNodeRef(), node); } } tx.commit(); } catch (Throwable err) { Utils.addErrorMessage("NavigatorPluginBean exception in getCompanyHomeRootNodes()", err); try { if (tx != null) { tx.rollback(); } } catch (Exception tex) { } } } return this.companyHomeRootNodes; }
From source file:org.alfresco.web.bean.ajax.NavigatorPluginBean.java
/** * Returns the root nodes for the my home panel. * <p>/*from www. j a v a2s . c o m*/ * As the user expands and collapses nodes in the client this * cache will be updated with the appropriate nodes and states. * </p> * * @return List of root nodes for the my home panel */ public List<TreeNode> getMyHomeRootNodes() { if (this.myHomeRootNodes == null) { this.myHomeRootNodes = new ArrayList<TreeNode>(); this.myHomeNodes = new HashMap<String, TreeNode>(); UserTransaction tx = null; try { tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); tx.begin(); // query for the child nodes of the user's home NodeRef root = new NodeRef(Repository.getStoreRef(), Application.getCurrentUser(FacesContext.getCurrentInstance()).getHomeSpaceId()); List<ChildAssociationRef> childRefs = this.getNodeService().getChildAssocs(root, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref : childRefs) { NodeRef child = ref.getChildRef(); if (isAddableChild(child)) { TreeNode node = createTreeNode(child); this.myHomeRootNodes.add(node); this.myHomeNodes.put(node.getNodeRef(), node); } } tx.commit(); } catch (Throwable err) { Utils.addErrorMessage("NavigatorPluginBean exception in getMyHomeRootNodes()", err); try { if (tx != null) { tx.rollback(); } } catch (Exception tex) { } } } return this.myHomeRootNodes; }
From source file:org.alfresco.web.bean.ajax.NavigatorPluginBean.java
/** * Returns the root nodes for the guest home panel. * <p>/*from w ww . j a va2 s.c om*/ * As the user expands and collapses nodes in the client this * cache will be updated with the appropriate nodes and states. * </p> * * @return List of root nodes for the guest home panel */ public List<TreeNode> getGuestHomeRootNodes() { if (this.guestHomeRootNodes == null) { this.guestHomeRootNodes = new ArrayList<TreeNode>(); this.guestHomeNodes = new HashMap<String, TreeNode>(); UserTransaction tx = null; try { tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); tx.begin(); // query for the child nodes of the guest home space NavigationBean navBean = getNavigationBean(); if (navBean != null) { NodeRef root = navBean.getGuestHomeNode().getNodeRef(); List<ChildAssociationRef> childRefs = this.getNodeService().getChildAssocs(root, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef ref : childRefs) { NodeRef child = ref.getChildRef(); if (isAddableChild(child)) { TreeNode node = createTreeNode(child); this.guestHomeRootNodes.add(node); this.guestHomeNodes.put(node.getNodeRef(), node); } } } tx.commit(); } catch (Throwable err) { Utils.addErrorMessage("NavigatorPluginBean exception in getGuestHomeRootNodes()", err); try { if (tx != null) { tx.rollback(); } } catch (Exception tex) { } } } return this.guestHomeRootNodes; }
From source file:org.alfresco.web.bean.ajax.PickerBean.java
/** * Return the JSON objects representing a list of categories. * /*www . ja v a 2 s .c om*/ * IN: "parent" - null for root categories, else the parent noderef of the categories to retrieve. * * The pseudo root node 'Categories' is not selectable. */ @InvokeCommand.ResponseMimetype(value = MimetypeMap.MIMETYPE_HTML) public void getCategoryNodes() throws Exception { FacesContext fc = FacesContext.getCurrentInstance(); UserTransaction tx = null; try { tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); tx.begin(); Collection<ChildAssociationRef> childRefs; NodeRef parentRef = null; Map params = fc.getExternalContext().getRequestParameterMap(); String strParentRef = Utils.encode((String) params.get(PARAM_PARENT)); if (strParentRef == null || strParentRef.length() == 0) { childRefs = this.getCategoryService().getRootCategories(Repository.getStoreRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE); } else { parentRef = new NodeRef(strParentRef); childRefs = this.getCategoryService().getChildren(parentRef, CategoryService.Mode.SUB_CATEGORIES, CategoryService.Depth.IMMEDIATE); } JSONWriter out = new JSONWriter(fc.getResponseWriter()); out.startObject(); out.startValue(ID_PARENT); out.startObject(); if (parentRef == null) { out.writeNullValue(ID_ID); out.writeValue(ID_NAME, Application.getMessage(fc, MSG_CATEGORIES)); out.writeValue(ID_ISROOT, true); out.writeValue(ID_SELECTABLE, false); } else { out.writeValue(ID_ID, strParentRef); out.writeValue(ID_NAME, Repository.getNameForNode(this.getInternalNodeService(), parentRef)); } out.endObject(); out.endValue(); out.startValue(ID_CHILDREN); out.startArray(); for (ChildAssociationRef ref : childRefs) { NodeRef nodeRef = ref.getChildRef(); out.startObject(); out.writeValue(ID_ID, nodeRef.toString()); out.writeValue(ID_NAME, Repository.getNameForNode(this.getInternalNodeService(), nodeRef)); out.endObject(); } out.endArray(); out.endValue(); out.endObject(); tx.commit(); } catch (Throwable err) { Utils.addErrorMessage("PickerBean exception in getCategoryRootNodes()", err); fc.getResponseWriter().write("ERROR: " + err.getMessage()); try { if (tx != null) { tx.rollback(); } } catch (Exception tex) { } } }
From source file:org.alfresco.web.bean.ajax.PickerBean.java
/** * Return the JSON objects representing a list of cm:folder nodes. * /*from ww w . ja v a2s. c o m*/ * IN: "parent" - noderef (can be null) of the parent to retrieve the child folder nodes for. Null is valid * and specifies the Company Home root as the parent. * IN: "child" - non-null value of the child noderef to retrieve the siblings for - the parent value returned * in the JSON response will be the parent of the specified child. * * The 16x16 pixel folder icon path is output as the 'icon' property for each child folder. */ @InvokeCommand.ResponseMimetype(value = MimetypeMap.MIMETYPE_HTML) public void getTagNodes() throws Exception { FacesContext fc = FacesContext.getCurrentInstance(); UserTransaction tx = null; try { tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); tx.begin(); Collection<ChildAssociationRef> childRefs; NodeRef parentRef = null; Map params = fc.getExternalContext().getRequestParameterMap(); String strParentRef = Utils.encode((String) params.get(ID_PARENT)); if (strParentRef == null || strParentRef.length() == 0) { childRefs = this.getCategoryService().getRootCategories(Repository.getStoreRef(), ContentModel.ASPECT_TAGGABLE); } else { parentRef = new NodeRef(strParentRef); childRefs = this.getCategoryService().getChildren(parentRef, CategoryService.Mode.SUB_CATEGORIES, CategoryService.Depth.IMMEDIATE); } JSONWriter out = new JSONWriter(fc.getResponseWriter()); out.startObject(); out.startValue(ID_PARENT); out.startObject(); if (parentRef == null) { out.writeNullValue(ID_ID); out.writeValue(ID_NAME, Application.getMessage(fc, MSG_TAGS)); out.writeValue(ID_ISROOT, true); out.writeValue(ID_SELECTABLE, false); } else { out.writeValue(ID_ID, strParentRef); out.writeValue(ID_NAME, Repository.getNameForNode(this.getInternalNodeService(), parentRef)); } out.endObject(); out.endValue(); out.startValue(ID_CHILDREN); out.startArray(); for (ChildAssociationRef ref : childRefs) { NodeRef nodeRef = ref.getChildRef(); out.startObject(); out.writeValue(ID_ID, nodeRef.toString()); out.writeValue(ID_NAME, Repository.getNameForNode(this.getInternalNodeService(), nodeRef)); out.endObject(); } out.endArray(); out.endValue(); out.endObject(); tx.commit(); } catch (Throwable err) { Utils.addErrorMessage("PickerBean exception in getTagNodes()", err); fc.getResponseWriter().write("ERROR: " + err.getMessage()); try { if (tx != null) { tx.rollback(); } } catch (Exception tex) { } } }
From source file:org.alfresco.web.bean.ajax.PickerBean.java
@InvokeCommand.ResponseMimetype(value = MimetypeMap.MIMETYPE_HTML) public void getFolderNodes() throws Exception { FacesContext fc = FacesContext.getCurrentInstance(); UserTransaction tx = null; try {//ww w . j a v a 2 s. co m tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); tx.begin(); List<ChildAssociationRef> childRefs; NodeRef companyHomeRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc)); NodeRef parentRef = null; Map params = fc.getExternalContext().getRequestParameterMap(); String strChildRef = Utils.encode((String) params.get(PARAM_CHILD)); if (strChildRef != null && strChildRef.length() != 0) { // TODO: check permission on the parent NodeRef childRef = new NodeRef(strChildRef); parentRef = this.getNodeService().getPrimaryParent(childRef).getParentRef(); } else { // TODO: check permission on the parent String strParentRef = Utils.encode((String) params.get(PARAM_PARENT)); if (strParentRef == null || strParentRef.length() == 0) { parentRef = companyHomeRef; strParentRef = parentRef.toString(); } else { parentRef = new NodeRef(strParentRef); } } List<FileInfo> folders = this.getFileFolderService().listFolders(parentRef); JSONWriter out = new JSONWriter(fc.getResponseWriter()); out.startObject(); out.startValue(ID_PARENT); out.startObject(); out.writeValue(ID_ID, parentRef.toString()); out.writeValue(ID_NAME, Repository.getNameForNode(this.getInternalNodeService(), parentRef)); if (parentRef.equals(companyHomeRef)) { out.writeValue(ID_ISROOT, true); } out.endObject(); out.endValue(); out.startValue(ID_CHILDREN); out.startArray(); // filter out those children that are not spaces for (FileInfo folder : folders) { out.startObject(); out.writeValue(ID_ID, folder.getNodeRef().toString()); out.writeValue(ID_NAME, (String) folder.getProperties().get(ContentModel.PROP_NAME)); String icon = (String) folder.getProperties().get(ApplicationModel.PROP_ICON); out.writeValue(ID_ICON, FOLDER_IMAGE_PREFIX + (icon != null ? icon + "-16.gif" : BrowseBean.SPACE_SMALL_DEFAULT + ".gif")); out.endObject(); } out.endArray(); out.endValue(); out.endObject(); tx.commit(); } catch (Throwable err) { Utils.addErrorMessage("PickerBean exception in getFolderNodes()", err); fc.getResponseWriter().write("ERROR: " + err.getMessage()); try { if (tx != null) { tx.rollback(); } } catch (Exception tex) { } } }
From source file:org.alfresco.web.bean.ajax.PickerBean.java
/** * Return the JSON objects representing a list of cm:folder and cm:content nodes. * /*from w w w . ja v a 2s.c o m*/ * IN: "parent" - noderef (can be null) of the parent to retrieve the child nodes for. Null is valid * and specifies the Company Home root as the parent. * IN: "child" - non-null value of the child noderef to retrieve the siblings for - the parent value returned * in the JSON response will be the parent of the specified child. * IN: "mimetypes" (optional) - if set, a comma separated list of mimetypes to restrict the file list. * * It is assumed that only files should be selectable, all cm:folder nodes will be marked with the * 'selectable:false' property. Therefore the parent (which is a folder) is not selectable. * * The 16x16 pixel node icon path is output as the 'icon' property for each child, in addition each * cm:content node has an property of 'url' for content download. */ @InvokeCommand.ResponseMimetype(value = MimetypeMap.MIMETYPE_HTML) public void getFileFolderNodes() throws Exception { FacesContext fc = FacesContext.getCurrentInstance(); UserTransaction tx = null; try { tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true); tx.begin(); DictionaryService dd = Repository.getServiceRegistry(fc).getDictionaryService(); ContentService cs = Repository.getServiceRegistry(fc).getContentService(); List<ChildAssociationRef> childRefs; NodeRef companyHomeRef = new NodeRef(Repository.getStoreRef(), Application.getCompanyRootId(fc)); NodeRef parentRef = null; Map params = fc.getExternalContext().getRequestParameterMap(); String strChildRef = Utils.encode((String) params.get(PARAM_CHILD)); if (strChildRef != null && strChildRef.length() != 0) { // TODO: check permission on the parent NodeRef childRef = new NodeRef(strChildRef); parentRef = this.getNodeService().getPrimaryParent(childRef).getParentRef(); } else { // TODO: check permission on the parent String strParentRef = Utils.encode((String) params.get(PARAM_PARENT)); if (strParentRef == null || strParentRef.length() == 0) { parentRef = companyHomeRef; strParentRef = parentRef.toString(); } else { parentRef = new NodeRef(strParentRef); } } // look for mimetype restriction parameter Set<String> mimetypes = null; String mimetypeParam = (String) params.get(PARAM_MIMETYPES); if (mimetypeParam != null && mimetypeParam.length() != 0) { // convert to a set of mimetypes to test each file against mimetypes = new HashSet<String>(); for (StringTokenizer t = new StringTokenizer(mimetypeParam, ","); t.hasMoreTokens(); /**/) { mimetypes.add(t.nextToken()); } } List<FileInfo> items = this.getFileFolderService().list(parentRef); JSONWriter out = new JSONWriter(fc.getResponseWriter()); out.startObject(); out.startValue(ID_PARENT); out.startObject(); out.writeValue(ID_ID, parentRef.toString()); out.writeValue(ID_NAME, Repository.getNameForNode(this.getInternalNodeService(), parentRef)); if (parentRef.equals(companyHomeRef)) { out.writeValue(ID_ISROOT, true); } out.writeValue(ID_SELECTABLE, false); out.endObject(); out.endValue(); out.startValue(ID_CHILDREN); out.startArray(); for (FileInfo item : items) { if (dd.isSubClass(this.getInternalNodeService().getType(item.getNodeRef()), ContentModel.TYPE_FOLDER)) { // found a folder out.startObject(); out.writeValue(ID_ID, item.getNodeRef().toString()); String name = (String) item.getProperties().get(ContentModel.PROP_NAME); out.writeValue(ID_NAME, name); String icon = (String) item.getProperties().get(ApplicationModel.PROP_ICON); out.writeValue(ID_ICON, FOLDER_IMAGE_PREFIX + (icon != null ? icon + "-16.gif" : BrowseBean.SPACE_SMALL_DEFAULT + ".gif")); out.writeValue(ID_SELECTABLE, false); out.endObject(); } else { // must be a file boolean validFile = true; if (mimetypes != null) { validFile = false; ContentReader reader = cs.getReader(item.getNodeRef(), ContentModel.PROP_CONTENT); if (reader != null) { String mimetype = reader.getMimetype(); validFile = (mimetype != null && mimetypes.contains(mimetype)); } } if (validFile) { out.startObject(); out.writeValue(ID_ID, item.getNodeRef().toString()); String name = (String) item.getProperties().get(ContentModel.PROP_NAME); out.writeValue(ID_NAME, name); String icon = FileTypeImageUtils.getFileTypeImage(fc, name, FileTypeImageSize.Small); out.writeValue(ID_ICON, icon); out.writeValue(ID_URL, DownloadContentServlet.generateBrowserURL(item.getNodeRef(), name)); out.endObject(); } } } out.endArray(); out.endValue(); out.endObject(); tx.commit(); } catch (Throwable err) { Utils.addErrorMessage("PickerBean exception in getFileFolderNodes()", err); fc.getResponseWriter().write("ERROR: " + err.getMessage()); try { if (tx != null) { tx.rollback(); } } catch (Exception tex) { } } }
From source file:org.alfresco.web.bean.BrowseBean.java
/** * Page accessed bean method to get the parent container nodes currently being browsed * * @return List of parent container Node objects for the current browse location *///from www. j av a 2s .c om public List<Node> getParentNodes(NodeRef currNodeRef) { // As per AWC-1507 there are two scenarios for navigating to the space details. First // scenario is to show space details of the current space. Second scenario is to show // space details of a child space of the current space. For now, added an extra query // so that existing context remains unaffected for second scenario, although it does // mean that in first scenario there will be an extra query even though parentContainerNodes // and containerNodes will contain the same list. if (this.parentContainerNodes == null) { long startTime = 0; if (logger.isDebugEnabled()) startTime = System.currentTimeMillis(); UserTransaction tx = null; try { FacesContext context = FacesContext.getCurrentInstance(); tx = Repository.getUserTransaction(context, true); tx.begin(); NodeRef parentRef = getNodeService().getPrimaryParent(currNodeRef).getParentRef(); List<FileInfo> children = this.getFileFolderService().list(parentRef); this.parentContainerNodes = new ArrayList<Node>(children.size()); for (FileInfo fileInfo : children) { // create our Node representation from the NodeRef NodeRef nodeRef = fileInfo.getNodeRef(); // find it's type so we can see if it's a node we are interested in QName type = this.getNodeService().getType(nodeRef); // make sure the type is defined in the data dictionary TypeDefinition typeDef = this.getDictionaryService().getType(type); if (typeDef != null) { MapNode node = null; // look for Space folder node if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_FOLDER) == true && this.getDictionaryService().isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false) { // create our Node representation node = new MapNode(nodeRef, this.getNodeService(), fileInfo.getProperties()); node.addPropertyResolver("icon", this.resolverSpaceIcon); node.addPropertyResolver("smallIcon", this.resolverSmallIcon); this.parentContainerNodes.add(node); } else if (ApplicationModel.TYPE_FOLDERLINK.equals(type)) { // create our Folder Link Node representation node = new MapNode(nodeRef, this.getNodeService(), fileInfo.getProperties()); node.addPropertyResolver("icon", this.resolverSpaceIcon); node.addPropertyResolver("smallIcon", this.resolverSmallIcon); this.parentContainerNodes.add(node); } } else { if (logger.isWarnEnabled()) logger.warn("Found invalid object in database: id = " + nodeRef + ", type = " + type); } } // commit the transaction tx.commit(); } catch (InvalidNodeRefException refErr) { Utils.addErrorMessage(MessageFormat.format( Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_NODEREF), new Object[] { refErr.getNodeRef() }), refErr); this.parentContainerNodes = Collections.<Node>emptyList(); try { if (tx != null) { tx.rollback(); } } catch (Exception tex) { } } catch (Throwable err) { Utils.addErrorMessage(MessageFormat.format( Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); this.parentContainerNodes = Collections.<Node>emptyList(); try { if (tx != null) { tx.rollback(); } } catch (Exception tex) { } } if (logger.isDebugEnabled()) { long endTime = System.currentTimeMillis(); logger.debug("Time to query and build map parent nodes: " + (endTime - startTime) + "ms"); } } List<Node> result = this.parentContainerNodes; // we clear the member variable during invalidateComponents() return result; }