As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<%– if folder, use this actionLink –%> <a:actionLink id="col1-act2" value="#{r.name}" actionListener="#{BrowseBean.clickSpace}" rendered="#{r.nodeType=='folder'}"> <f:param name="id" value="#{r.id}" /> </a:actionLink> <%– if not folder, use this actionLink –%> <a:actionLink id="col9-act2" value="#{r.name}" href="#{r.url}" target="new" rendered="#{r.nodeType == 'content'}" /> <r:lockIcon id="col9-lock" value="#{r.nodeRef}" align="absmiddle" rendered="#{r.nodeType == 'content'}"/>
package xxx.portal.web.bean; import java.util.ArrayList; import java.util.List; import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import org.alfresco.model.ContentModel; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.web.app.context.IContextListener; import org.alfresco.web.app.context.UIContextService; import org.alfresco.web.bean.BrowseBean; import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.NodePropertyResolver; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * * LightBrowseBean is a simplified interface for external users. * * @author jmbailly - Sogeti Luxembourg SA * @date Sep 5, 2006 3:16:52 PM * */ public class LightBrowseBean implements IContextListener { public static final String FOLDER_TYPE = "folder"; public static final String CONTENT_TYPE = "content"; public static final String NODE_TYPE = "nodeType"; private Log logger = LogFactory.getLog(LightBrowseBean.class); private List<Node> items; protected BrowseBean browseBean; protected DictionaryService dictionaryService; /** * Constructor * * * @author jmbailly - Sogeti Luxembourg SA * @date Sep 5, 2006 5:19:58 PM */ public LightBrowseBean() { UIContextService.getInstance(FacesContext.getCurrentInstance()).registerBean(this); } /** * @param browseBean The browseBean to set. * * @author jmbailly - Sogeti Luxembourg SA * @date Sep 5, 2006 5:16:52 PM */ public void setBrowseBean(BrowseBean browseBean) { this.browseBean = browseBean; } /** * @param dictionaryService The dictionaryService to set. * * @author jmbailly - Sogeti Luxembourg SA * @date Sep 5, 2006 5:19:50 PM */ public void setDictionaryService(DictionaryService dictionaryService) { this.dictionaryService = dictionaryService; } /* (non-Javadoc) * @see org.alfresco.web.app.context.IContextListener#contextUpdated() */ public void contextUpdated() { items = null; } /** * @return Returns the items. * * @author jmbailly - Sogeti Luxembourg SA * @date Sep 5, 2006 4:21:48 PM */ public List<Node> getItems() { if (logger.isDebugEnabled()) logger.debug("LightBrowseBean.getItems()"); int nodeSize = 0; if (browseBean.getNodes()!=null && !browseBean.getNodes().isEmpty()) nodeSize = browseBean.getNodes().size(); int contentSize = 0; if (browseBean.getContent()!=null && !browseBean.getContent().isEmpty()) contentSize = browseBean.getContent().size(); items = new ArrayList<Node>(nodeSize+contentSize); if (nodeSize > 0) for( Node node : browseBean.getNodes()) { node.addPropertyResolver(NODE_TYPE,this.resolverType); items.add(node); } if (contentSize > 0) for(Node node : browseBean.getContent()) { node.addPropertyResolver(NODE_TYPE,this.resolverType); items.add(node); } return items; } /** * Resolver uses to determine if node is content or folder. */ public NodePropertyResolver resolverType = new NodePropertyResolver() { public Object get(Node node) { String strType = CONTENT_TYPE; if (dictionaryService.isSubClass(node.getType(),ContentModel.TYPE_FOLDER)) strType = FOLDER_TYPE; return strType; } }; }
<managed-bean> <description>Back bean for external user browsing</description> <managed-bean-name>LightBrowseBean</managed-bean-name> <managed-bean-class>xxx.portal.web.bean.LightBrowseBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> <managed-property> <property-name>dictionaryService</property-name> <value>#{DictionaryService}</value> </managed-property> <managed-property> <property-name>browseBean</property-name> <value>#{BrowseBean}</value> </managed-property> </managed-bean>