use of org.alfresco.opencmis.dictionary.FolderTypeDefintionWrapper in project alfresco-repository by Alfresco.
the class CMISConnector method createObjectId.
public String createObjectId(NodeRef nodeRef, boolean dropStoreRef) {
QName typeQName = nodeService.getType(nodeRef);
TypeDefinitionWrapper type = getOpenCMISDictionaryService().findNodeType(typeQName);
if (type instanceof ItemTypeDefinitionWrapper) {
return constructObjectId(nodeRef, null);
}
if (type instanceof FolderTypeDefintionWrapper) {
return constructObjectId(nodeRef, null, dropStoreRef);
}
Serializable versionLabel = getNodeService().getProperty(nodeRef, ContentModel.PROP_VERSION_LABEL);
if (versionLabel == null) {
versionLabel = CMISConnector.UNVERSIONED_VERSION_LABEL;
}
return constructObjectId(nodeRef, (String) versionLabel, dropStoreRef);
}
use of org.alfresco.opencmis.dictionary.FolderTypeDefintionWrapper in project alfresco-repository by Alfresco.
the class AlfrescoCmisServiceImpl method getDescendantsTree.
private void getDescendantsTree(String repositoryId, NodeRef folderNodeRef, int depth, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, Boolean includePathSegment, boolean foldersOnly, List<ObjectInFolderContainer> list) {
// get the children references
List<ChildAssociationRef> childrenList = connector.getNodeService().getChildAssocs(folderNodeRef);
for (ChildAssociationRef child : childrenList) {
try {
TypeDefinitionWrapper type = connector.getType(child.getChildRef());
if (type == null) {
continue;
}
boolean isFolder = (type instanceof FolderTypeDefintionWrapper);
if (foldersOnly && !isFolder) {
continue;
}
if (isFolder && type.getAlfrescoClass().equals(ContentModel.TYPE_SYSTEM_FOLDER)) {
continue;
}
if (connector.isHidden(child.getChildRef())) {
continue;
}
if (connector.filter(child.getChildRef())) {
continue;
}
boolean isObjectInfoRequired = getContext().isObjectInfoRequired();
// create a child CMIS object
ObjectInFolderDataImpl object = new ObjectInFolderDataImpl();
// note: checkExists=false (don't need to check again)
CMISNodeInfo ni = createNodeInfo(child.getChildRef(), null, false);
object.setObject(connector.createCMISObject(ni, filter, includeAllowableActions, includeRelationships, renditionFilter, false, false));
if (isObjectInfoRequired) {
getObjectInfo(repositoryId, ni.getObjectId(), includeRelationships);
}
if (includePathSegment) {
object.setPathSegment(connector.getName(child.getChildRef()));
}
// create the container
ObjectInFolderContainerImpl container = new ObjectInFolderContainerImpl();
container.setObject(object);
if ((depth != 1) && isFolder) {
container.setChildren(new ArrayList<ObjectInFolderContainer>());
getDescendantsTree(repositoryId, child.getChildRef(), depth - 1, filter, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, foldersOnly, container.getChildren());
}
// add it
list.add(container);
} catch (InvalidNodeRefException e) {
// ignore invalid children
} catch (CmisObjectNotFoundException e) {
// ignore objects that have not been found (perhaps because their type is unknown to CMIS)
}
}
}
use of org.alfresco.opencmis.dictionary.FolderTypeDefintionWrapper in project alfresco-repository by Alfresco.
the class CMISNodeInfoImpl method getParents.
@Override
public List<CMISNodeInfo> getParents() {
if ((objecVariant == CMISObjectVariant.INVALID_ID) || (objecVariant == CMISObjectVariant.NOT_A_CMIS_OBJECT) || (objecVariant == CMISObjectVariant.NOT_EXISTING) || (objecVariant == CMISObjectVariant.PERMISSION_DENIED)) {
return Collections.<CMISNodeInfo>emptyList();
}
if (parents == null) {
parents = new ArrayList<CMISNodeInfo>();
NodeRef nodeRefForParent = (isCurrentVersion() ? getCurrentNodeNodeRef() : nodeRef);
List<ChildAssociationRef> nodeParents = connector.getNodeService().getParentAssocs(nodeRefForParent, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
if (nodeParents != null) {
for (ChildAssociationRef parent : nodeParents) {
if (connector.getType(parent.getParentRef()) instanceof FolderTypeDefintionWrapper) {
parents.add(new CMISNodeInfoImpl(connector, parent.getParentRef()));
}
}
}
}
return parents;
}
Aggregations