mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged BRANCHES/DEV/V4.0-BUG-FIX to HEAD:
33109: ALF-11479: When upgrading from Alfresco Community 3.4.d to 4.0.b, some nodes that are blocked and have versions fail after the upgrade git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@33263 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -44,6 +44,7 @@ import org.alfresco.repo.policy.BehaviourFilter;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
@@ -376,6 +377,7 @@ public class CopiedFromAspectPatch extends AbstractPatch
|
||||
}
|
||||
|
||||
private static final QName PROP_SOURCE = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "source");
|
||||
private static final StoreRef VERSION_STORE = new StoreRef("workspace://version2Store"); // see http://wiki.alfresco.com/wiki/Version_Store
|
||||
/**
|
||||
* Does the per-node manipulation as stated in the class's docs
|
||||
*
|
||||
@@ -393,6 +395,7 @@ public class CopiedFromAspectPatch extends AbstractPatch
|
||||
NodeRef sourceNodeRef = DefaultTypeConverter.INSTANCE.convert(
|
||||
NodeRef.class,
|
||||
nodeService.getProperty(nodeRef, PROP_SOURCE));
|
||||
|
||||
// Does the source exist?
|
||||
if (sourceNodeRef == null || !nodeService.exists(sourceNodeRef))
|
||||
{
|
||||
@@ -474,7 +477,7 @@ public class CopiedFromAspectPatch extends AbstractPatch
|
||||
writeLine(file, "Removing cm:workingcopy from node: " + nodePair);
|
||||
nodeService.removeAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY);
|
||||
}
|
||||
else
|
||||
else if (!VERSION_STORE.equals(nodeRef.getStoreRef()))
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
@@ -488,6 +491,24 @@ public class CopiedFromAspectPatch extends AbstractPatch
|
||||
// Create the association
|
||||
nodeService.createAssociation(sourceNodeRef, nodeRef, ContentModel.ASSOC_WORKING_COPY_LINK);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ALF-11479:
|
||||
// - No cm:workingcopylink to the target node.
|
||||
// - Source node hasn't got the cm:checkedout aspect.
|
||||
// - But don't fix up the association, since the target node is in the version store
|
||||
// and *versions* of a working copy shouldn't have the cm:workingcopy aspect: there should
|
||||
// be one, and only one working copy.
|
||||
// - Therefore, remove this phantom cm:workingcopy aspect.
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("\tP: Found version of working copy marked as actual working copy: " + nodeRef);
|
||||
logger.debug("\tP: Removing cm:workingcopy: " + nodePair);
|
||||
}
|
||||
writeLine(file, "Found version of working copy marked as actual working copy: " + nodePair);
|
||||
writeLine(file, "Removing cm:workingcopy: " + nodePair);
|
||||
nodeService.removeAspect(nodeRef, ContentModel.ASPECT_WORKING_COPY);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove the property if it exists
|
||||
|
Reference in New Issue
Block a user