Merged HEAD-BUG-FIX (Cloud33/4.3) to HEAD (Cloud33/4.3)

62917: Merged PLATFORM1 (Cloud33) to HEAD-BUG-FIX (Cloud33/4.3)
      62451: ACE-33 - CMIS item support.   CRUD of cmis items, cmis item shown as children of folders.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62971 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-20 14:35:00 +00:00
parent 50f699b961
commit 2e25d15ed1
4 changed files with 1700 additions and 1638 deletions

View File

@@ -30,8 +30,10 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
@@ -462,11 +464,19 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
PagingRequest pageRequest = new PagingRequest(skip, max, null);
pageRequest.setRequestTotalCountMax(skip + 10000); // TODO make this optional/configurable
// - affects whether numItems may be returned
// - affects whether numItems may be returned
Set<QName> typeqnames = new HashSet<QName>();
List<TypeDefinitionWrapper> allTypes = connector.getOpenCMISDictionaryService().getAllTypes();
for (TypeDefinitionWrapper type : allTypes)
{
typeqnames.add(type.getAlfrescoClass());
}
PagingResults<FileInfo> pageOfNodeInfos = connector.getFileFolderService().list(
folderNodeRef, true, true,
null, sortProps, pageRequest);
folderNodeRef,
typeqnames,
null, //ignoreAspectQNames,
sortProps,
pageRequest);
if (max > 0)
{
@@ -733,7 +743,7 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
throw new CmisConstraintException("Relationships are not fileable!");
}
if (info.isFolder() && !info.isRootFolder())
if (info.isItem() || (info.isFolder() && !info.isRootFolder()))
{
List<CMISNodeInfo> parentInfos = info.getParents();
if (!parentInfos.isEmpty())
@@ -1072,11 +1082,21 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
NamespaceService.CONTENT_MODEL_1_0_URI,
QName.createValidLocalName(name));
ChildAssociationRef newRef = connector.getNodeService().createNode(parentInfo.getNodeRef(), ContentModel.ASSOC_CONTAINS, assocQName, type.getAlfrescoClass());
Map<QName, Serializable> props = new HashMap<QName, Serializable>(11);
props.put(ContentModel.PROP_NAME, (Serializable) assocQName.getLocalName());
ChildAssociationRef newRef = connector.getNodeService().createNode(
parentInfo.getNodeRef(),
ContentModel.ASSOC_CONTAINS,
assocQName,
type.getAlfrescoClass(),
props);
NodeRef nodeRef = newRef.getChildRef();
connector.setProperties(nodeRef, type, properties, new String[] { PropertyIds.NAME, PropertyIds.OBJECT_TYPE_ID });
connector.getNodeService().setProperty(nodeRef, ContentModel.PROP_NAME, assocQName.getLocalName());
connector.applyPolicies(nodeRef, type, policies);
connector.applyACL(nodeRef, type, addAces, removeAces);
@@ -2780,6 +2800,11 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
info.setSupportsDescendants(true);
info.setSupportsFolderTree(true);
}
else if (ni.isItem())
{
info.setHasAcl(true);
info.setHasContent(false);
}
return info;
}

View File

@@ -58,6 +58,8 @@ import org.alfresco.opencmis.dictionary.CMISNodeInfo;
import org.alfresco.opencmis.dictionary.CMISObjectVariant;
import org.alfresco.opencmis.dictionary.CMISPropertyAccessor;
import org.alfresco.opencmis.dictionary.DocumentTypeDefinitionWrapper;
import org.alfresco.opencmis.dictionary.FolderTypeDefintionWrapper;
import org.alfresco.opencmis.dictionary.ItemTypeDefinitionWrapper;
import org.alfresco.opencmis.dictionary.PropertyDefinitionWrapper;
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper;
import org.alfresco.opencmis.mapping.DirectProperty;
@@ -1262,15 +1264,15 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
*/
public String createObjectId(NodeRef currentVersionNodeRef)
{
FileInfo fileInfo = getFileFolderService().getFileInfo(currentVersionNodeRef);
if(fileInfo == null)
QName typeQName = nodeService.getType(currentVersionNodeRef);
TypeDefinitionWrapper type = getOpenCMISDictionaryService().findNodeType(typeQName);
if(type instanceof ItemTypeDefinitionWrapper)
{
// not a file or a folder
return constructObjectId(currentVersionNodeRef, null);
}
if(fileInfo.isFolder())
if(type instanceof FolderTypeDefintionWrapper)
{
return constructObjectId(currentVersionNodeRef, null);
}

View File

@@ -429,4 +429,18 @@ public interface FileFolderService
*/
@Deprecated
public void setHidden(NodeRef nodeRef, boolean isHidden);
/**
* Lists page of immediate child objects of the given context node
* with specification of which types to list and optional filtering (exclusion of certain child file/folder subtypes) and sorting
* @param rootNodeRef
* @param searchTypeQNames QNames of types to list
* @param ignoreAspectQNames
* @param sortProps
* @param pagingRequest
* @return list of node refs, never null
*/
@Auditable(parameters = {"rootNodeRef"})
public PagingResults<FileInfo> list(NodeRef rootNodeRef, Set<QName> searchTypeQNames, Set<QName> ignoreAspectQNames, List<Pair<QName, Boolean>> sortProps, PagingRequest pagingRequest);
}