mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Derek's fix to return FAILURE_INVALID_PARENT when restoring a node
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2835 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -23,6 +23,7 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.repo.node.archive.RestoreNodeReport.RestoreStatus;
|
import org.alfresco.repo.node.archive.RestoreNodeReport.RestoreStatus;
|
||||||
import org.alfresco.repo.transaction.TransactionUtil;
|
import org.alfresco.repo.transaction.TransactionUtil;
|
||||||
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
import org.alfresco.repo.transaction.TransactionUtil.TransactionWork;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
@@ -133,6 +134,23 @@ public class NodeArchiveServiceImpl implements NodeArchiveService
|
|||||||
{
|
{
|
||||||
report.setStatus(RestoreStatus.FAILURE_INVALID_PARENT);
|
report.setStatus(RestoreStatus.FAILURE_INVALID_PARENT);
|
||||||
}
|
}
|
||||||
|
else if (destinationNodeRef == null)
|
||||||
|
{
|
||||||
|
// get the original parent of the archived node
|
||||||
|
ChildAssociationRef originalParentAssocRef = (ChildAssociationRef) nodeService.getProperty(
|
||||||
|
archivedNodeRef,
|
||||||
|
ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC);
|
||||||
|
NodeRef originalParentNodeRef = originalParentAssocRef.getParentRef();
|
||||||
|
if (EqualsHelper.nullSafeEquals(originalParentNodeRef, invalidNodeRef))
|
||||||
|
{
|
||||||
|
report.setStatus(RestoreStatus.FAILURE_INVALID_PARENT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// some other invalid node was detected
|
||||||
|
report.setStatus(RestoreStatus.FAILURE_OTHER);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// some other invalid node was detected
|
// some other invalid node was detected
|
||||||
|
Reference in New Issue
Block a user