mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged DEV/SWIFT to HEAD
27125: Subtasks of ALF-7072: RSOLR 013: Remote API to get ACLs and readers - ALF-8334: RSOLR 013: Modify ACL schema to record change times - ALF-8336: RSOLR 013: DB upgrade scripts for ACL changes - TODO: Query APIs 27128: Added TooManyResultsException as a concurrency detection trigger - Usually too many results indicates that the DB table key is not as specific as it should be, but it's AVM that showed this up. 27132: Clean up: javadocs; non-javadocs; uncommented fields; @since tags; etc. 27134: Removed empty directory 27135: Fix for ALF-8333: CMIS query: JOIN on an aspect results in CmisInvalidArgumentException - incorrect scope used when building orderings 27139: Fixed SORL transaction tracking queries - Queries were using incompatible boolean comparisons - Added SOLRDAO to test suite - Cleaned up code and reformatted code 27141: Minor additions to CannedQuery interface - get parameter bean - construct sort details from a list - ALF-7167: Canned queries 27146: RINF 09 / RINF 10: DB-based paged query for get children (DocLib & CMIS) - milestone check-in for sprint demo & review (WIP) - added new FileFolderService (paged) list query (public API is subject to change) - moved temp JavaScript sorting to Java - example usage by DocLib (via ScriptNode) and CMIS (via AlfrescoCmisService) - implemented as demo "canned query" including embedded use of "list" permission interceptor - ALF-7402 / ALF-7168 27150: RINF 09 / RINF 10: DB-based paged query for get children (DocLib & CMIS) - missed file (follow-on to r27146) 27158: ALF-7070, ALF-7072: SOLR tracking (node and changeset) - Pulled non-DAO code into SOLRTrackingComponent - DAO code and related tests just test basic CRUD - SOLRTrackingComponent does complex cross-schema manipulation 27159: Fixed line ending and removed svn:eol-style 27160: ALF-8334: RSOLR 013: Fixed SQL Server syntax 27165: RINF 09 / RINF 10: DB-based paged query for get children (DocLib & CMIS) - fix listDeepFolders (causing Imap*Test to fail) - all private methods now order files followed by folders (consistent with existing public APIs such as FileFolderService.search & ScriptNode.childFileFolders*) - follow-on to r27146 28271: Consolidate diagnostic logging for max perm checks (ALF-8388 + ALF-8419) - note: this should be a trivial merge to HEAD git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28292 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -32,10 +32,10 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.TreeSet;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
@@ -45,16 +45,18 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.opencmis.dictionary.CMISActionEvaluator;
|
||||
import org.alfresco.opencmis.dictionary.CMISAllowedActionEnum;
|
||||
import org.alfresco.opencmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.opencmis.dictionary.CMISPropertyAccessor;
|
||||
import org.alfresco.opencmis.dictionary.DocumentTypeDefinitionWrapper;
|
||||
import org.alfresco.opencmis.dictionary.FolderTypeDefintionWrapper;
|
||||
import org.alfresco.opencmis.dictionary.PropertyDefintionWrapper;
|
||||
import org.alfresco.opencmis.dictionary.TypeDefinitionWrapper;
|
||||
import org.alfresco.opencmis.mapping.DirectProperty;
|
||||
import org.alfresco.opencmis.search.CMISQueryOptions;
|
||||
import org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode;
|
||||
import org.alfresco.opencmis.search.CMISQueryService;
|
||||
import org.alfresco.opencmis.search.CMISResultSet;
|
||||
import org.alfresco.opencmis.search.CMISResultSetColumn;
|
||||
import org.alfresco.opencmis.search.CMISResultSetRow;
|
||||
import org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||
@@ -74,6 +76,7 @@ import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.InvalidAspectException;
|
||||
import org.alfresco.service.cmr.model.FileExistsException;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.model.FileNotFoundException;
|
||||
import org.alfresco.service.cmr.rendition.RenditionService;
|
||||
import org.alfresco.service.cmr.repository.AspectMissingException;
|
||||
@@ -87,8 +90,8 @@ import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.repository.Path.ChildAssocElement;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.repository.Path.ChildAssocElement;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.AccessPermission;
|
||||
@@ -1015,6 +1018,11 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
public TypeDefinitionWrapper getType(NodeRef nodeRef)
|
||||
{
|
||||
QName typeQName = nodeService.getType(nodeRef);
|
||||
return getType(typeQName);
|
||||
}
|
||||
|
||||
private TypeDefinitionWrapper getType(QName typeQName)
|
||||
{
|
||||
return cmisDictionaryService.findNodeType(typeQName);
|
||||
}
|
||||
|
||||
@@ -1142,6 +1150,23 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
/**
|
||||
* Creates the CMIS object for a node.
|
||||
*/
|
||||
public ObjectData createCMISObject(FileInfo node, String filter, boolean includeAllowableActions,
|
||||
IncludeRelationships includeRelationships, String renditionFilter, boolean includePolicyIds,
|
||||
boolean includeAcl)
|
||||
{
|
||||
NodeRef nodeRef = node.getNodeRef();
|
||||
TypeDefinitionWrapper type = getType(node.getType());
|
||||
if (type == null)
|
||||
{
|
||||
throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?");
|
||||
}
|
||||
|
||||
Properties nodeProps = getNodeProperties(node, filter, type);
|
||||
|
||||
return createCMISObjectImpl(nodeRef, type, nodeProps, filter, includeAllowableActions,
|
||||
includeRelationships, renditionFilter, includePolicyIds, includeAcl);
|
||||
}
|
||||
|
||||
public ObjectData createCMISObject(NodeRef nodeRef, String filter, boolean includeAllowableActions,
|
||||
IncludeRelationships includeRelationships, String renditionFilter, boolean includePolicyIds,
|
||||
boolean includeAcl)
|
||||
@@ -1151,7 +1176,17 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
{
|
||||
throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?");
|
||||
}
|
||||
|
||||
|
||||
Properties nodeProps = getNodeProperties(nodeRef, filter, type);
|
||||
|
||||
return createCMISObjectImpl(nodeRef, type, nodeProps, filter, includeAllowableActions,
|
||||
includeRelationships, renditionFilter, includePolicyIds, includeAcl);
|
||||
}
|
||||
|
||||
private ObjectData createCMISObjectImpl(NodeRef nodeRef, TypeDefinitionWrapper type, Properties nodeProps, String filter, boolean includeAllowableActions,
|
||||
IncludeRelationships includeRelationships, String renditionFilter, boolean includePolicyIds,
|
||||
boolean includeAcl)
|
||||
{
|
||||
// get the current version
|
||||
NodeRef currentVersionNodeRef = nodeRef;
|
||||
if (type instanceof DocumentTypeDefinitionWrapper)
|
||||
@@ -1178,7 +1213,7 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
ObjectDataImpl result = new ObjectDataImpl();
|
||||
|
||||
// set properties
|
||||
result.setProperties(getNodeProperties(nodeRef, filter, type));
|
||||
result.setProperties(nodeProps);
|
||||
|
||||
// set allowable actions
|
||||
if (includeAllowableActions)
|
||||
@@ -1427,6 +1462,44 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public Properties getNodeProperties(FileInfo node, String filter, TypeDefinitionWrapper type)
|
||||
{
|
||||
PropertiesImpl result = new PropertiesImpl();
|
||||
|
||||
Set<String> filterSet = splitFilter(filter);
|
||||
|
||||
Map<QName, Serializable> nodeProps = node.getProperties();
|
||||
|
||||
for (PropertyDefintionWrapper propDef : type.getProperties())
|
||||
{
|
||||
if (!propDef.getPropertyId().equals(PropertyIds.OBJECT_ID))
|
||||
{
|
||||
// don't filter the object id
|
||||
if ((filterSet != null) && (!filterSet.contains(propDef.getPropertyDefinition().getQueryName())))
|
||||
{
|
||||
// skip properties that are not in the filter
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Serializable value = null;
|
||||
|
||||
CMISPropertyAccessor accessor = propDef.getPropertyAccessor();
|
||||
if (accessor instanceof DirectProperty)
|
||||
{
|
||||
value = nodeProps.get(accessor.getMappedProperty());
|
||||
}
|
||||
else
|
||||
{
|
||||
value = propDef.getPropertyAccessor().getValue(node.getNodeRef());
|
||||
}
|
||||
|
||||
result.addProperty(getProperty(propDef.getPropertyDefinition().getPropertyType(), propDef, value));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public Properties getAssocProperties(AssociationRef assocRef, String filter, TypeDefinitionWrapper type)
|
||||
{
|
||||
|
Reference in New Issue
Block a user