Merged DEV to HEAD

- ALF-8806 RINF 41: Lucene Removal: Fix CopyService
     - ALF-9028: RINF 41: Fix Aspect cm:copiedFrom
   - ALF-9029 RINF 49: Lucene Removal: CheckOutCheckInService API
     - ALF-9032: RINF 49: fixes to cm:workingcopy aspect

   28996: Dev branch for De-Lucene work pending patches
   29004: Evaluator runs in read-only txn
   29006: Additional PermissionCheckedCollection.create method
          - Use an existing collection's permission check data (cut-off, etc) to wrap a new collection
   29007:
          CopyService and CheckOutCheckInService refactors to remove Lucene
          
          CopyService:
          
          Removed cm:source property from cm:copiedfrom aspect and replaced with a cm:original association.
          Added CQ-based APIs to query for copies
          Added APIs to support bi-directional walking of copy association
          Fixed sundry uses of cm:copiedfrom esp. all uses related to cm:workingcopy
          
          CheckOutCheckInService:
          
          Check-out now creates a source aspect cm:checkedOut with 1:1 relationship to cm:workingcopy via cm:workingcopylink
          Removed explicit use of cm:workingcopy aspect and replaced it with calls to COCI API
          
   29083: Audit tests fail when indexing is turned off.
          Also removed a getReader() call during rule evaluation, leading to a 'sub-action' read being recorded.
   29113: NodeDAO.getNodesWithAspects supports paging
   29135: Removed unused patch queries
   29139: Basic patch (still terminates with error) to upgrade cm:copiedfrom and cm:workingcopy
   29157: Tested patch for cm:copiedfrom and cm:workingcopy aspects


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29159 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2011-07-19 03:22:11 +00:00
parent 8a561b38ca
commit 6ec3f44c29
58 changed files with 2277 additions and 1845 deletions

View File

@@ -32,7 +32,6 @@ import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.query.CannedQuery;
import org.alfresco.query.CannedQueryFactory;
import org.alfresco.query.CannedQueryPageDetails;
import org.alfresco.query.CannedQueryParameters;
import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;
@@ -43,6 +42,7 @@ import org.alfresco.repo.copy.CopyBehaviourCallback.ChildAssocCopyAction;
import org.alfresco.repo.copy.CopyBehaviourCallback.ChildAssocRecurseAction;
import org.alfresco.repo.copy.CopyBehaviourCallback.CopyAssociationDetails;
import org.alfresco.repo.copy.CopyBehaviourCallback.CopyChildAssociationDetails;
import org.alfresco.repo.copy.query.AbstractCopyCannedQueryFactory;
import org.alfresco.repo.policy.ClassPolicyDelegate;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
@@ -61,8 +61,6 @@ import org.alfresco.service.cmr.repository.CopyServiceException;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.rule.RuleService;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.AccessPermission;
import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.PermissionService;
@@ -90,7 +88,6 @@ public class CopyServiceImpl implements CopyService
/* Query names */
private static final String QUERY_FACTORY_GET_COPIES = "getCopiesCannedQueryFactory";
private static final String QUERY_FACTORY_GET_COPIED = "getCopiesCannedQueryFactory";
/* I18N labels */
private static final String COPY_OF_LABEL = "copy_service.copy_of_label";
@@ -100,7 +97,6 @@ public class CopyServiceImpl implements CopyService
private NodeService internalNodeService;
private NamedObjectRegistry<CannedQueryFactory<CopyInfo>> cannedQueryRegistry;
private DictionaryService dictionaryService;
private SearchService searchService;
private PolicyComponent policyComponent;
private RuleService ruleService;
private PermissionService permissionService;
@@ -148,14 +144,6 @@ public class CopyServiceImpl implements CopyService
this.policyComponent = policyComponent;
}
/**
* @param searchService the search service
*/
public void setSearchService(SearchService searchService)
{
this.searchService = searchService;
}
/**
* @param ruleService the rule service
*/
@@ -192,15 +180,15 @@ public class CopyServiceImpl implements CopyService
// Register policy behaviours
this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "getCopyCallback"),
CopyServicePolicies.OnCopyNodePolicy.QNAME,
ContentModel.ASPECT_COPIEDFROM,
new JavaBehaviour(this, "getCallbackForCopiedFromAspect"));
this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "getCopyCallback"),
CopyServicePolicies.OnCopyNodePolicy.QNAME,
ContentModel.TYPE_FOLDER,
new JavaBehaviour(this, "getCallbackForFolderType"));
this.policyComponent.bindClassBehaviour(
QName.createQName(NamespaceService.ALFRESCO_URI, "getCopyCallback"),
CopyServicePolicies.OnCopyNodePolicy.QNAME,
ContentModel.ASPECT_OWNABLE,
new JavaBehaviour(this, "getCallbackForOwnableAspect"));
}
@@ -376,34 +364,40 @@ public class CopyServiceImpl implements CopyService
invokeCopyComplete(sourceNodeRef, targetNodeRef, false, copiedNodeRefs);
}
@Override
public NodeRef getOriginal(NodeRef nodeRef)
{
List<AssociationRef> assocs = internalNodeService.getTargetAssocs(nodeRef, ContentModel.ASSOC_ORIGINAL);
if (assocs.size() > 1)
{
logger.warn("Multiple cm:orignal associations from node: " + nodeRef);
}
if (assocs.size() == 0)
{
return null;
}
else
{
return assocs.get(0).getTargetRef();
}
}
@Override
public List<NodeRef> getCopies(NodeRef nodeRef)
{
List<NodeRef> copies = new ArrayList<NodeRef>();
// Do a search to find the origional document
ResultSet resultSet = null;
try
PagingRequest pagingRequest = new PagingRequest(1000);
PagingResults<CopyInfo> page = getCopies(nodeRef, pagingRequest);
if (page.hasMoreItems())
{
resultSet = this.searchService.query(
nodeRef.getStoreRef(),
SearchService.LANGUAGE_LUCENE,
"+@\\{http\\://www.alfresco.org/model/content/1.0\\}" + ContentModel.PROP_COPY_REFERENCE.getLocalName() + ":\"" + nodeRef.toString() + "\"");
for (NodeRef copy : resultSet.getNodeRefs())
{
copies.add(copy);
}
logger.warn("Trimmed page size for deprecated getCopies() call.");
}
finally
List<CopyInfo> pageResults = page.getPage();
List<NodeRef> results = new ArrayList<NodeRef>(pageResults.size());
for (CopyInfo copyInfo : pageResults)
{
if (resultSet != null)
{
resultSet.close();
}
results.add(copyInfo.getNodeRef());
}
return copies;
return results;
}
@Override
@@ -411,9 +405,9 @@ public class CopyServiceImpl implements CopyService
{
CannedQueryFactory<CopyInfo> queryFactory = cannedQueryRegistry.getNamedObject(QUERY_FACTORY_GET_COPIES);
CannedQueryParameters params = new CannedQueryParameters(
originalNodeRef,
new CannedQueryPageDetails(pagingRequest),
null);
new AbstractCopyCannedQueryFactory.CopyCannedQueryDetail(originalNodeRef),
null,
pagingRequest);
CannedQuery<CopyInfo> query = queryFactory.getCannedQuery(params);
return query.execute();
}
@@ -421,14 +415,14 @@ public class CopyServiceImpl implements CopyService
@Override
public PagingResults<CopyInfo> getCopies(
NodeRef originalNodeRef,
NodeRef copyParentNodeRef, Set<QName> copyNodeAspectsToIgnore,
NodeRef copyParentNodeRef,
PagingRequest pagingRequest)
{
CannedQueryFactory<CopyInfo> queryFactory = cannedQueryRegistry.getNamedObject(QUERY_FACTORY_GET_COPIES);
CannedQueryParameters params = new CannedQueryParameters(
originalNodeRef,
new CannedQueryPageDetails(pagingRequest),
null);
new AbstractCopyCannedQueryFactory.CopyCannedQueryDetail(originalNodeRef, copyParentNodeRef),
null,
pagingRequest);
CannedQuery<CopyInfo> query = queryFactory.getCannedQuery(params);
return query.execute();
}
@@ -593,10 +587,16 @@ public class CopyServiceImpl implements CopyService
// Copy residual properties
copyResidualProperties(copyDetails, copyTarget);
// Apply the copy aspect to the new node
Map<QName, Serializable> copyProperties = new HashMap<QName, Serializable>();
copyProperties.put(ContentModel.PROP_COPY_REFERENCE, sourceNodeRef);
internalNodeService.addAspect(copyTarget, ContentModel.ASPECT_COPIEDFROM, copyProperties);
// Link the new node to the original, but ensure that we only keep track of the last copy
List<AssociationRef> originalAssocs = internalNodeService.getTargetAssocs(copyTarget, ContentModel.ASSOC_ORIGINAL);
for (AssociationRef originalAssoc : originalAssocs)
{
internalNodeService.removeAssociation(
originalAssoc.getSourceRef(),
originalAssoc.getTargetRef(),
ContentModel.ASSOC_ORIGINAL);
}
internalNodeService.createAssociation(copyTarget, sourceNodeRef, ContentModel.ASSOC_ORIGINAL);
// Copy permissions
copyPermissions(sourceNodeRef, copyTarget);
@@ -1389,5 +1389,5 @@ public class CopyServiceImpl implements CopyService
public CopyBehaviourCallback getCallbackForOwnableAspect(QName classRef, CopyDetails copyDetails)
{
return DoNothingCopyBehaviourCallback.getInstance();
}
}
}