use of org.alfresco.service.cmr.repository.ChildAssociationRef in project acs-community-packaging by Alfresco.
the class UIChildAssociationEditor method renderExistingAssociations.
/**
* @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#renderExistingAssociations(javax.faces.context.FacesContext, javax.faces.context.ResponseWriter, org.alfresco.service.cmr.repository.NodeService, boolean)
*/
protected void renderExistingAssociations(FacesContext context, ResponseWriter out, NodeService nodeService, boolean allowMany) throws IOException {
boolean itemsRendered = false;
// show the associations from the original list if they are not in the removed list
Iterator iter = this.originalAssocs.values().iterator();
while (iter.hasNext()) {
ChildAssociationRef assoc = (ChildAssociationRef) iter.next();
if (removed.containsKey(assoc.getChildRef().toString()) == false) {
renderExistingAssociation(context, out, nodeService, assoc.getChildRef(), allowMany);
itemsRendered = true;
}
}
// also show any associations added in this session
iter = this.added.values().iterator();
while (iter.hasNext()) {
ChildAssociationRef assoc = (ChildAssociationRef) iter.next();
renderExistingAssociation(context, out, nodeService, assoc.getChildRef(), allowMany);
itemsRendered = true;
}
// show the none selected message if no items were rendered
if (itemsRendered == false && allowMany == true) {
renderNone(context, out);
}
}
use of org.alfresco.service.cmr.repository.ChildAssociationRef in project acs-community-packaging by Alfresco.
the class UIChildAssociationEditor method renderReadOnlyAssociations.
/**
* @see org.alfresco.web.ui.repo.component.property.BaseAssociationEditor#renderReadOnlyAssociations(javax.faces.context.FacesContext, javax.faces.context.ResponseWriter, org.alfresco.service.cmr.repository.NodeService)
*/
protected void renderReadOnlyAssociations(FacesContext context, ResponseWriter out, NodeService nodeService) throws IOException {
if (this.originalAssocs.size() > 0) {
out.write("<table cellspacing='0' cellpadding='2' border='0'>");
Iterator iter = this.originalAssocs.values().iterator();
while (iter.hasNext()) {
out.write("<tr><td>");
ChildAssociationRef assoc = (ChildAssociationRef) iter.next();
NodeRef targetNode = assoc.getChildRef();
// if the node represents a person, show the username instead of the name
if (ContentModel.TYPE_PERSON.equals(nodeService.getType(targetNode))) {
out.write(Utils.encode(User.getFullName(nodeService, targetNode)));
} else if (ContentModel.TYPE_AUTHORITY_CONTAINER.equals(nodeService.getType(targetNode))) {
// if the node represents a group, show the group display name instead of the name
String groupDisplayName = (String) nodeService.getProperty(targetNode, ContentModel.PROP_AUTHORITY_DISPLAY_NAME);
if (groupDisplayName == null || groupDisplayName.length() == 0) {
String group = (String) nodeService.getProperty(targetNode, ContentModel.PROP_AUTHORITY_NAME);
groupDisplayName = group.substring(PermissionService.GROUP_PREFIX.length());
}
out.write(Utils.encode(groupDisplayName));
} else {
out.write(Repository.getDisplayPath(nodeService.getPath(targetNode)));
out.write("/");
out.write(Repository.getNameForNode(nodeService, targetNode));
}
out.write("</td></tr>");
}
out.write("</table>");
}
}
use of org.alfresco.service.cmr.repository.ChildAssociationRef in project acs-community-packaging by Alfresco.
the class UISpaceSelector method getChildrenForNode.
public Collection<NodeRef> getChildrenForNode(FacesContext context) {
NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), this.navigationId);
List<ChildAssociationRef> allKids = getNodeService(context).getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
DictionaryService dd = getDictionaryService(context);
NodeService service = getFastNodeService(context);
// filter out those children that are not spaces
List<NodeRef> spaceKids = new ArrayList<NodeRef>();
for (ChildAssociationRef ref : allKids) {
if (dd.isSubClass(service.getType(ref.getChildRef()), ContentModel.TYPE_FOLDER) && dd.isSubClass(service.getType(ref.getChildRef()), ContentModel.TYPE_SYSTEM_FOLDER) == false) {
spaceKids.add(ref.getChildRef());
}
}
return spaceKids;
}
use of org.alfresco.service.cmr.repository.ChildAssociationRef in project acs-community-packaging by Alfresco.
the class UISpaceSelector method getParentNodeId.
public String getParentNodeId(FacesContext context) {
String id = null;
if (this.navigationId != null && this.navigationId.equals(Application.getCompanyRootId(context)) == false) {
try {
ChildAssociationRef parentRef = getFastNodeService(context).getPrimaryParent(new NodeRef(Repository.getStoreRef(), this.navigationId));
id = parentRef.getParentRef().getId();
} catch (AccessDeniedException accessErr) {
// cannot navigate to parent id will be null
}
}
return id;
}
use of org.alfresco.service.cmr.repository.ChildAssociationRef in project acs-community-packaging by Alfresco.
the class UICategorySelector method getChildrenForNode.
public Collection<NodeRef> getChildrenForNode(FacesContext context) {
NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), this.navigationId);
Collection<ChildAssociationRef> childRefs = getCategoryService(context).getChildren(nodeRef, CategoryService.Mode.SUB_CATEGORIES, CategoryService.Depth.IMMEDIATE);
Collection<NodeRef> refs = new ArrayList<NodeRef>(childRefs.size());
for (ChildAssociationRef childRef : childRefs) {
refs.add(childRef.getChildRef());
}
return refs;
}
Aggregations