SAIL-371 (SAIL-294): NodeDAO: RepoTransferReceiverImplTest.testJira_ALF_2772 (do not try to remove mandatory aspects on node update - see also r20654)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20703 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2010-06-18 10:47:13 +00:00
parent 570c8a7f03
commit 9c6e89af06
3 changed files with 33 additions and 1 deletions

View File

@@ -98,6 +98,7 @@
class="org.alfresco.repo.transfer.DefaultManifestProcessorFactoryImpl">
<property name="nodeService" ref="NodeService" />
<property name="contentService" ref="ContentService" />
<property name="dictionaryService" ref="DictionaryService" />
<property name="nodeResolverFactory" ref="transferNodeResolverFactory" />
</bean>

View File

@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.List;
import org.alfresco.repo.transfer.manifest.TransferManifestProcessor;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.transfer.TransferReceiver;
@@ -35,6 +36,7 @@ public class DefaultManifestProcessorFactoryImpl implements ManifestProcessorFac
{
private NodeService nodeService;
private ContentService contentService;
private DictionaryService dictionaryService;
private CorrespondingNodeResolverFactory nodeResolverFactory;
/*
@@ -51,6 +53,7 @@ public class DefaultManifestProcessorFactoryImpl implements ManifestProcessorFac
primaryProcessor.setContentService(contentService);
primaryProcessor.setNodeResolver(nodeResolver);
primaryProcessor.setNodeService(nodeService);
primaryProcessor.setDictionaryService(dictionaryService);
processors.add(primaryProcessor);
RepoSecondaryManifestProcessorImpl secondaryProcessor = new RepoSecondaryManifestProcessorImpl(receiver, transferId);
@@ -76,6 +79,15 @@ public class DefaultManifestProcessorFactoryImpl implements ManifestProcessorFac
{
this.contentService = contentService;
}
/**
* @param dictionaryService
* the dictionaryService to set
*/
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/**
* @param nodeResolverFactory the nodeResolverFactory to set

View File

@@ -34,6 +34,8 @@ import org.alfresco.repo.transfer.manifest.TransferManifestDeletedNode;
import org.alfresco.repo.transfer.manifest.TransferManifestHeader;
import org.alfresco.repo.transfer.manifest.TransferManifestNode;
import org.alfresco.repo.transfer.manifest.TransferManifestNormalNode;
import org.alfresco.service.cmr.dictionary.AspectDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentService;
@@ -72,6 +74,7 @@ public class RepoPrimaryManifestProcessorImpl extends AbstractManifestProcessorB
private NodeService nodeService;
private ContentService contentService;
private DictionaryService dictionaryService;
private CorrespondingNodeResolver nodeResolver;
private Map<NodeRef, List<ChildAssociationRef>> orphans = new HashMap<NodeRef, List<ChildAssociationRef>>(89);
@@ -379,7 +382,14 @@ public class RepoPrimaryManifestProcessorImpl extends AbstractManifestProcessorB
Set<QName> suppliedAspects = new HashSet<QName>(node.getAspects());
Set<QName> existingAspects = nodeService.getAspects(nodeToUpdate);
Set<QName> aspectsToRemove = new HashSet<QName>(existingAspects);
// Add mandatory aspects to the supplied aspects (eg. should not explicitly remove auditable aspect from a folder - see also DMDeploymentTarget for similar)
List<AspectDefinition> aspectDefs = dictionaryService.getType(nodeService.getType(nodeToUpdate)).getDefaultAspects(true);
for (AspectDefinition aspectDef : aspectDefs)
{
suppliedAspects.add(aspectDef.getName());
}
aspectsToRemove.removeAll(suppliedAspects);
suppliedAspects.removeAll(existingAspects);
@@ -588,6 +598,15 @@ public class RepoPrimaryManifestProcessorImpl extends AbstractManifestProcessorB
{
this.contentService = contentService;
}
/**
* @param dictionaryService
* the dictionaryService to set
*/
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/**
* @param nodeResolver