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

@@ -82,7 +82,6 @@ import org.alfresco.jlan.util.WildCard;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.admin.SysAdminParams;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.content.encoding.ContentCharsetFinder;
import org.alfresco.repo.node.archive.NodeArchiveService;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.security.authentication.AuthenticationContext;
@@ -90,11 +89,13 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.lock.LockService;
import org.alfresco.service.cmr.lock.LockType;
import org.alfresco.service.cmr.lock.NodeLockedException;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentIOException;
import org.alfresco.service.cmr.repository.ContentService;
@@ -177,6 +178,7 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
private CifsHelper cifsHelper;
private NamespaceService namespaceService;
private NodeService nodeService;
private CheckOutCheckInService checkOutCheckInService;
private SearchService searchService;
private ContentService contentService;
private MimetypeService mimetypeService;
@@ -244,7 +246,15 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
{
return this.nodeService;
}
/**
* @return service to provide information on check-in and check-out
*/
public CheckOutCheckInService getCheckOutCheckInService()
{
return checkOutCheckInService;
}
/**
* Return the content service
*
@@ -359,7 +369,15 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
{
this.nodeService = nodeService;
}
/**
* @param checkOutCheckInService used to check for checked out nodes
*/
public void setCheckOutCheckInService(CheckOutCheckInService checkOutCheckInService)
{
this.checkOutCheckInService = checkOutCheckInService;
}
/**
* @param searchService the search service
*/
@@ -3198,15 +3216,12 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
// Check if the node is a working copy
if ( nodeService.hasAspect( targetNodeRef, ContentModel.ASPECT_WORKING_COPY)) {
NodeRef mainNodeRef = checkOutCheckInService.getCheckedOut(targetNodeRef);
if ( mainNodeRef != null)
{
// Check if the main document is still locked
NodeRef mainNodeRef = (NodeRef) nodeService.getProperty( targetNodeRef, ContentModel.PROP_COPY_REFERENCE);
if ( mainNodeRef != null) {
LockType lockTyp = lockService.getLockType( mainNodeRef);
logger.debug(" Main node ref lock type = " + lockTyp);
}
LockType lockTyp = lockService.getLockType( mainNodeRef);
logger.debug(" Main node ref lock type = " + lockTyp);
}
}
}
@@ -4083,12 +4098,13 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
if ( nodeService.hasAspect( fromNode, ContentModel.ASPECT_COPIEDFROM)) {
// Add the copied from aspect to the new file
NodeRef copiedFromNode = (NodeRef) nodeService.getProperty( fromNode, ContentModel.PROP_COPY_REFERENCE);
Map<QName, Serializable> copiedFromProperties = new HashMap<QName, Serializable>(1);
copiedFromProperties.put(ContentModel.PROP_COPY_REFERENCE, copiedFromNode);
nodeService.addAspect( toNode, ContentModel.ASPECT_COPIEDFROM, copiedFromProperties);
List<AssociationRef> assocs = nodeService.getSourceAssocs(fromNode, ContentModel.ASSOC_ORIGINAL);
if (assocs.size() > 0)
{
AssociationRef assoc = assocs.get(0);
NodeRef originalNodeRef = assoc.getTargetRef();
nodeService.createAssociation(toNode, originalNodeRef, ContentModel.ASSOC_ORIGINAL);
}
// Remove the copied from aspect from old working copy file
@@ -4099,19 +4115,19 @@ public class ContentDiskDriver extends AlfrescoDiskDriver implements DiskInterfa
if ( logger.isDebugEnabled() && ctx.hasDebug(AlfrescoContext.DBG_RENAME))
logger.debug(" Moved aspect " + ContentModel.ASPECT_COPIEDFROM + " to new document");
// Check if the original node is locked
if ( lockService.getLockType( copiedFromNode) == null) {
// Add the lock back onto the original file
lockService.lock( copiedFromNode, LockType.READ_ONLY_LOCK);
// DEBUG
if ( logger.isDebugEnabled() && ctx.hasDebug(AlfrescoContext.DBG_RENAME))
logger.debug(" Re-locked copied from node " + copiedFromNode);
}
// // Check if the original node is locked
//
// if ( lockService.getLockType( copiedFromNode) == null) {
//
// // Add the lock back onto the original file
//
// lockService.lock( copiedFromNode, LockType.READ_ONLY_LOCK);
//
// // DEBUG
//
// if ( logger.isDebugEnabled() && ctx.hasDebug(AlfrescoContext.DBG_RENAME))
// logger.debug(" Re-locked copied from node " + copiedFromNode);
// }
}
// Copy over all aspects from non-system namespaces (we will copy their properties later)

View File

@@ -31,7 +31,6 @@ import org.alfresco.filesys.alfresco.DesktopTarget;
import org.alfresco.filesys.alfresco.IOControl;
import org.alfresco.filesys.alfresco.IOControlHandler;
import org.alfresco.jlan.server.SrvSession;
import org.alfresco.jlan.server.auth.ClientInfo;
import org.alfresco.jlan.server.filesys.IOControlNotImplementedException;
import org.alfresco.jlan.server.filesys.NetworkFile;
import org.alfresco.jlan.server.filesys.TreeConnection;
@@ -41,6 +40,7 @@ import org.alfresco.jlan.smb.nt.NTIOCtl;
import org.alfresco.jlan.util.DataBuffer;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
import org.alfresco.service.cmr.lock.LockType;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -127,6 +127,14 @@ public class ContentIOControlHandler implements IOControlHandler
return contentDriver.getNodeService();
}
/**
* @return the service to provide check-in and check-out data
*/
public final CheckOutCheckInService getCheckOutCheckInService()
{
return contentDriver.getCheckOutCheckInService();
}
/**
* Return the filesystem driver
*
@@ -374,14 +382,10 @@ public class ContentIOControlHandler implements IOControlHandler
String owner = (String) getNodeService().getProperty( childNode, ContentModel.PROP_WORKING_COPY_OWNER);
String copiedFrom = null;
if ( getNodeService().hasAspect( childNode, ContentModel.ASPECT_COPIEDFROM))
{
// Get the path of the file the working copy was generated from
NodeRef fromNode = (NodeRef) getNodeService().getProperty( childNode, ContentModel.PROP_COPY_REFERENCE);
if ( fromNode != null)
copiedFrom = (String) getNodeService().getProperty( fromNode, ContentModel.PROP_NAME);
}
// Get the path of the file the working copy was generated from
NodeRef fromNode = getCheckOutCheckInService().getCheckedOut(childNode);
if ( fromNode != null)
copiedFrom = (String) getNodeService().getProperty( fromNode, ContentModel.PROP_NAME);
// Pack the owner and copied from values