mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-1027: Can't copy closed folder.
* then you copy a closed record folder the copy will not be closed * ensured that disposition details are freshed when copying a record folder git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@56274 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -279,6 +279,21 @@ public class RecordCopyBehaviours implements RecordsManagementModel
|
|||||||
{
|
{
|
||||||
final NodeService nodeService = rmServiceRegistry.getNodeService();
|
final NodeService nodeService = rmServiceRegistry.getNodeService();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<QName, Serializable> getCopyProperties(QName classRef, CopyDetails copyDetails, Map<QName, Serializable> properties)
|
||||||
|
{
|
||||||
|
Map<QName, Serializable> sourceProperties = super.getCopyProperties(classRef, copyDetails, properties);
|
||||||
|
|
||||||
|
// ensure that the 'closed' status of the record folder is not copied
|
||||||
|
if (sourceProperties.containsKey(PROP_IS_CLOSED))
|
||||||
|
{
|
||||||
|
sourceProperties.remove(PROP_IS_CLOSED);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sourceProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the targets parent is a Record Folder -- Do Not Allow Copy
|
* If the targets parent is a Record Folder -- Do Not Allow Copy
|
||||||
*
|
*
|
||||||
@@ -289,7 +304,18 @@ public class RecordCopyBehaviours implements RecordsManagementModel
|
|||||||
@Override
|
@Override
|
||||||
public boolean getMustCopy(QName classQName, CopyDetails copyDetails)
|
public boolean getMustCopy(QName classQName, CopyDetails copyDetails)
|
||||||
{
|
{
|
||||||
return nodeService.getType(copyDetails.getTargetParentNodeRef()).equals(TYPE_RECORD_FOLDER) ? false : true;
|
boolean result = true;
|
||||||
|
|
||||||
|
if (nodeService.getType(copyDetails.getTargetParentNodeRef()).equals(TYPE_RECORD_FOLDER) == true)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
else if (unwantedAspects.contains(classQName) == true)
|
||||||
|
{
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
package org.alfresco.module.org_alfresco_module_rm.test;
|
package org.alfresco.module.org_alfresco_module_rm.test;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM1008Test;
|
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM1008Test;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM1027Test;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM1030Test;
|
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM1030Test;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM452Test;
|
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM452Test;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM994Test;
|
import org.alfresco.module.org_alfresco_module_rm.test.issue.RM994Test;
|
||||||
@@ -38,7 +39,8 @@ import org.junit.runners.Suite.SuiteClasses;
|
|||||||
RM452Test.class,
|
RM452Test.class,
|
||||||
RM994Test.class,
|
RM994Test.class,
|
||||||
RM1008Test.class,
|
RM1008Test.class,
|
||||||
RM1030Test.class
|
RM1030Test.class,
|
||||||
|
RM1027Test.class
|
||||||
})
|
})
|
||||||
public class IssueTestSuite
|
public class IssueTestSuite
|
||||||
{
|
{
|
||||||
|
@@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.test.issue;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for RM-1027 .. can't copy a closed folder
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
* @since 2.1
|
||||||
|
*/
|
||||||
|
public class RM1027Test extends BaseRMTestCase
|
||||||
|
{
|
||||||
|
public void testCopyingAClosedFolder() throws Exception
|
||||||
|
{
|
||||||
|
final NodeRef recordFolder = doTestInTransaction(new Test<NodeRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public NodeRef run()
|
||||||
|
{
|
||||||
|
// create a folder and close it
|
||||||
|
NodeRef recordFolder = rmService.createRecordFolder(rmContainer, "My Closed Record Folder");
|
||||||
|
utils.closeFolder(recordFolder);
|
||||||
|
|
||||||
|
assertTrue((Boolean)nodeService.getProperty(recordFolder, PROP_IS_CLOSED));
|
||||||
|
|
||||||
|
return recordFolder;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
doTestInTransaction(new Test<NodeRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public NodeRef run() throws Exception
|
||||||
|
{
|
||||||
|
// create a destination for the copy
|
||||||
|
NodeRef destination = filePlanService.createRecordCategory(filePlan, "Copy Destination");
|
||||||
|
|
||||||
|
// try and copy the closed record folder
|
||||||
|
FileInfo copyInfo = fileFolderService.copy(recordFolder, destination, null);
|
||||||
|
|
||||||
|
return copyInfo.getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void test(NodeRef copy) throws Exception
|
||||||
|
{
|
||||||
|
assertNotNull(copy);
|
||||||
|
|
||||||
|
assertNotNull(nodeService.getProperty(copy, PROP_IDENTIFIER));
|
||||||
|
assertFalse((Boolean)nodeService.getProperty(copy, PROP_IS_CLOSED));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyingAFolderWithADispositionSchedule() throws Exception
|
||||||
|
{
|
||||||
|
final NodeRef recordFolder = doTestInTransaction(new Test<NodeRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public NodeRef run()
|
||||||
|
{
|
||||||
|
// create a folder
|
||||||
|
NodeRef recordFolder = rmService.createRecordFolder(rmContainer, "My Closed Record Folder");
|
||||||
|
|
||||||
|
// show that the default disposition schedule has been applied
|
||||||
|
assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
|
||||||
|
|
||||||
|
return recordFolder;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
doTestInTransaction(new Test<NodeRef>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public NodeRef run() throws Exception
|
||||||
|
{
|
||||||
|
// create a destination for the copy
|
||||||
|
NodeRef destination = filePlanService.createRecordCategory(filePlan, "Copy Destination");
|
||||||
|
|
||||||
|
// try and copy the closed record folder
|
||||||
|
FileInfo copyInfo = fileFolderService.copy(recordFolder, destination, null);
|
||||||
|
|
||||||
|
return copyInfo.getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void test(NodeRef copy) throws Exception
|
||||||
|
{
|
||||||
|
assertNotNull(copy);
|
||||||
|
|
||||||
|
assertNotNull(nodeService.getProperty(copy, PROP_IDENTIFIER));
|
||||||
|
assertFalse(nodeService.hasAspect(copy, ASPECT_DISPOSITION_LIFECYCLE));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user