mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged BRANCHES/V2.3 to HEAD:
94195: RM-978 (Unable to navigate to copied folder from a collaboration site to RM site) 94196: RM-1863: Declare As Record Version is available for non-versionable document 94216: Latest changes for the move functionality causes problems in RM actions. Commented out the bean definition in rm-model-context.xml. Need to add more tests to cover the functionality on RM side. 94231: Tests for moving documents/folders should be included after fixing the functionality on RM site. 94253: RM-978 (Unable to navigate to copied folder from a collaboration site to RM site) 94260: RM-978 (Unable to navigate to copied folder from a collaboration site to RM site) 94263: RM-978 (Unable to navigate to copied folder from a collaboration site to RM site) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@94264 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -56,6 +56,9 @@
|
|||||||
<property name="behaviourFilter" ref="policyBehaviourFilter" />
|
<property name="behaviourFilter" ref="policyBehaviourFilter" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<!-- dm model type -->
|
||||||
|
<bean id="dm.object" class="org.alfresco.module.org_alfresco_module_rm.model.rma.type.ObjectType" parent="rm.baseBehaviour"/>
|
||||||
|
|
||||||
<!-- rma model types -->
|
<!-- rma model types -->
|
||||||
|
|
||||||
<bean id="rma.recordsManagementContainer" class="org.alfresco.module.org_alfresco_module_rm.model.rma.type.RecordsManagementContainerType" parent="rm.baseBehaviour">
|
<bean id="rma.recordsManagementContainer" class="org.alfresco.module.org_alfresco_module_rm.model.rma.type.RecordsManagementContainerType" parent="rm.baseBehaviour">
|
||||||
|
@@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2015 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.model.rma.type;
|
||||||
|
|
||||||
|
import static org.alfresco.util.ParameterCheck.mandatory;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||||
|
import org.alfresco.repo.copy.CopyServicePolicies;
|
||||||
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
|
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||||
|
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||||
|
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cm:cmobject behaviour bean
|
||||||
|
*
|
||||||
|
* @author Tuna Aksoy
|
||||||
|
* @since 2.3
|
||||||
|
*/
|
||||||
|
@BehaviourBean
|
||||||
|
(
|
||||||
|
defaultType = "cm:cmobject"
|
||||||
|
)
|
||||||
|
public class ObjectType extends BaseBehaviourBean implements NodeServicePolicies.OnMoveNodePolicy, CopyServicePolicies.BeforeCopyPolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Behaviour
|
||||||
|
(
|
||||||
|
kind = BehaviourKind.CLASS
|
||||||
|
)
|
||||||
|
public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef)
|
||||||
|
{
|
||||||
|
mandatory("oldChildAssocRef", oldChildAssocRef);
|
||||||
|
mandatory("newChildAssocRef", newChildAssocRef);
|
||||||
|
|
||||||
|
NodeRef sourceParent = oldChildAssocRef.getParentRef();
|
||||||
|
boolean isSourceParentFilePlanComponent = isFilePlanComponent(sourceParent);
|
||||||
|
|
||||||
|
NodeRef targetParent = newChildAssocRef.getParentRef();
|
||||||
|
boolean isTargetParentFilePlanComponent = isFilePlanComponent(targetParent);
|
||||||
|
|
||||||
|
// If we are doing the move operation within the RM site then we can stop here
|
||||||
|
// The method should just check move operations from outside of RM into the RM site
|
||||||
|
if (isSourceParentFilePlanComponent && isTargetParentFilePlanComponent)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeRef object = oldChildAssocRef.getChildRef();
|
||||||
|
QName objectType = nodeService.getType(object);
|
||||||
|
|
||||||
|
// Only documents can be moved into the RM site
|
||||||
|
if (!objectType.equals(ContentModel.TYPE_CONTENT) && isTargetParentFilePlanComponent)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Only documents can be moved from a collaboration site into a RM site.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Documents can be moved only into a RM folder
|
||||||
|
if (isTargetParentFilePlanComponent && !isRecordFolder(targetParent))
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("A document can only be moved into a folder in RM site.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.copy.CopyServicePolicies.BeforeCopyPolicy#beforeCopy(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Behaviour
|
||||||
|
(
|
||||||
|
kind = BehaviourKind.CLASS
|
||||||
|
)
|
||||||
|
public void beforeCopy(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef)
|
||||||
|
{
|
||||||
|
mandatory("sourceNodeRef", sourceNodeRef);
|
||||||
|
mandatory("targetNodeRef", targetNodeRef);
|
||||||
|
|
||||||
|
NodeRef sourceParentNodeRef = nodeService.getPrimaryParent(sourceNodeRef).getParentRef();
|
||||||
|
boolean isSourceParentFilePlanComponent = isFilePlanComponent(sourceParentNodeRef);
|
||||||
|
boolean isTargetNodeFilePlanComponent = isFilePlanComponent(targetNodeRef);
|
||||||
|
|
||||||
|
// If we are doing the copy operation within the RM site then we can stop here
|
||||||
|
// The method should just check copy operations from outside of RM into the RM site
|
||||||
|
if (isSourceParentFilePlanComponent && isTargetNodeFilePlanComponent)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not allow to copy anything outside of RM site into the RM site
|
||||||
|
if (!isSourceParentFilePlanComponent && isTargetNodeFilePlanComponent)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Nothing can be copied from a collaboration site into a RM site.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -43,7 +43,8 @@ import org.junit.runners.Suite.SuiteClasses;
|
|||||||
RM994Test.class,
|
RM994Test.class,
|
||||||
RM1039Test.class,
|
RM1039Test.class,
|
||||||
RM1799Test.class,
|
RM1799Test.class,
|
||||||
RM1814Test.class
|
RM1814Test.class,
|
||||||
|
RM978Test.class
|
||||||
})
|
})
|
||||||
public class IssueTestSuite
|
public class IssueTestSuite
|
||||||
{
|
{
|
||||||
|
@@ -0,0 +1,868 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2015 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.integration.issue;
|
||||||
|
|
||||||
|
import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName;
|
||||||
|
import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
|
import org.alfresco.repo.site.SiteModel;
|
||||||
|
import org.alfresco.repo.site.SiteServiceImpl;
|
||||||
|
import org.alfresco.service.cmr.model.FileExistsException;
|
||||||
|
import org.alfresco.service.cmr.model.FileNotFoundException;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteVisibility;
|
||||||
|
import org.alfresco.util.GUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test for RM-978
|
||||||
|
*
|
||||||
|
* @author Tuna Aksoy
|
||||||
|
* @since 2.3
|
||||||
|
*/
|
||||||
|
public class RM978Test extends BaseRMTestCase
|
||||||
|
{
|
||||||
|
private NodeRef documentLibrary2;
|
||||||
|
private String user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected boolean isCollaborationSiteTest()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupCollaborationSiteTestDataImpl()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void setupCollaborationSiteTestDataImpl()
|
||||||
|
{
|
||||||
|
super.setupCollaborationSiteTestDataImpl();
|
||||||
|
|
||||||
|
String collabSiteId2 = GUID.generate();
|
||||||
|
siteService.createSite("site-dashboard", collabSiteId2, GUID.generate(), GUID.generate(), SiteVisibility.PUBLIC);
|
||||||
|
documentLibrary2 = SiteServiceImpl.getSiteContainer(
|
||||||
|
collabSiteId2,
|
||||||
|
SiteService.DOCUMENT_LIBRARY,
|
||||||
|
true,
|
||||||
|
siteService,
|
||||||
|
transactionService,
|
||||||
|
taggingService);
|
||||||
|
|
||||||
|
assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary2);
|
||||||
|
|
||||||
|
user = GUID.generate();
|
||||||
|
createPerson(user);
|
||||||
|
siteService.setMembership(collabSiteId, user, SiteModel.SITE_CONTRIBUTOR);
|
||||||
|
siteService.setMembership(collabSiteId2, user, SiteModel.SITE_CONTRIBUTOR);
|
||||||
|
siteService.setMembership(siteId, user, SiteModel.SITE_CONSUMER);
|
||||||
|
filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_POWER_USER, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMoveDocumentToFolderInCollabSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef folder2;
|
||||||
|
private NodeRef document1;
|
||||||
|
private String document1Name = GUID.generate();
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.move(document1, folder2, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder1ChildAssocs = nodeService.getChildAssocs(folder1);
|
||||||
|
assertEquals(0, folder1ChildAssocs.size());
|
||||||
|
|
||||||
|
List<ChildAssociationRef> folder2ChildAssocs = nodeService.getChildAssocs(folder2);
|
||||||
|
assertNotNull(folder2ChildAssocs);
|
||||||
|
assertEquals(1, folder2ChildAssocs.size());
|
||||||
|
NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef();
|
||||||
|
String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME);
|
||||||
|
assertEquals(document1Name, movedDocumentName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMoveDocumentToDocumentLibraryInCollabSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef document1;
|
||||||
|
private String document1Name = GUID.generate();
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.move(document1, documentLibrary, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder1ChildAssocs = nodeService.getChildAssocs(folder1);
|
||||||
|
assertEquals(0, folder1ChildAssocs.size());
|
||||||
|
|
||||||
|
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(documentLibrary);
|
||||||
|
assertNotNull(childAssocs);
|
||||||
|
|
||||||
|
List<String> childNames = new ArrayList<String>();
|
||||||
|
for (ChildAssociationRef childAssociationRef : childAssocs)
|
||||||
|
{
|
||||||
|
NodeRef childRef = childAssociationRef.getChildRef();
|
||||||
|
childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME));
|
||||||
|
}
|
||||||
|
|
||||||
|
assertTrue(childNames.contains(document1Name));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMoveFolderToFolderInCollabSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef folder2;
|
||||||
|
private String folder1Name = GUID.generate();
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.move(folder1, folder2, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder2ChildAssocs = nodeService.getChildAssocs(folder2);
|
||||||
|
assertEquals(1, folder2ChildAssocs.size());
|
||||||
|
NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef();
|
||||||
|
String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME);
|
||||||
|
assertEquals(folder1Name, movedDocumentName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMoveDocumentToFolderInDifferentCollabSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef folder2;
|
||||||
|
private NodeRef document1;
|
||||||
|
private String document1Name = GUID.generate();
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.move(document1, folder2, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder1ChildAssocs = nodeService.getChildAssocs(folder1);
|
||||||
|
assertEquals(0, folder1ChildAssocs.size());
|
||||||
|
|
||||||
|
List<ChildAssociationRef> folder2ChildAssocs = nodeService.getChildAssocs(folder2);
|
||||||
|
assertNotNull(folder2ChildAssocs);
|
||||||
|
assertEquals(1, folder2ChildAssocs.size());
|
||||||
|
NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef();
|
||||||
|
String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME);
|
||||||
|
assertEquals(document1Name, movedDocumentName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMoveDocumentToDocumentLibraryInDifferentCollabSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef document1;
|
||||||
|
private String document1Name = GUID.generate();
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.move(document1, documentLibrary2, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder1ChildAssocs = nodeService.getChildAssocs(folder1);
|
||||||
|
assertEquals(0, folder1ChildAssocs.size());
|
||||||
|
|
||||||
|
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(documentLibrary2);
|
||||||
|
assertNotNull(childAssocs);
|
||||||
|
|
||||||
|
List<String> childNames = new ArrayList<String>();
|
||||||
|
for (ChildAssociationRef childAssociationRef : childAssocs)
|
||||||
|
{
|
||||||
|
NodeRef childRef = childAssociationRef.getChildRef();
|
||||||
|
childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME));
|
||||||
|
}
|
||||||
|
|
||||||
|
assertTrue(childNames.contains(document1Name));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMoveFolderToFolderInDifferentCollabSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef folder2;
|
||||||
|
private String folder1Name = GUID.generate();
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.move(folder1, folder2, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder2ChildAssocs = nodeService.getChildAssocs(folder2);
|
||||||
|
assertEquals(1, folder2ChildAssocs.size());
|
||||||
|
NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef();
|
||||||
|
String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME);
|
||||||
|
assertEquals(folder1Name, movedDocumentName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMoveDocumentInFilePlanInRmSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef document1;
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.move(document1, filePlan, GUID.generate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMoveDocumentInCategoryInRmSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef document1;
|
||||||
|
private NodeRef rmCategory;
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
|
||||||
|
runAs(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, getAdminUserName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.move(document1, rmCategory, GUID.generate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMoveDocumentInFolderInRmSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef document1;
|
||||||
|
private String document1Name = GUID.generate();
|
||||||
|
private NodeRef rmCategory;
|
||||||
|
private NodeRef rmFolder;
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
|
||||||
|
runAs(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||||
|
rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate());
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, getAdminUserName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
runAs(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, getAdminUserName());
|
||||||
|
|
||||||
|
fileFolderService.move(document1, rmFolder, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder1ChildAssocs = nodeService.getChildAssocs(folder1);
|
||||||
|
assertEquals(0, folder1ChildAssocs.size());
|
||||||
|
|
||||||
|
List<ChildAssociationRef> rmFolderChildAssocs = nodeService.getChildAssocs(rmFolder);
|
||||||
|
assertEquals(1, rmFolderChildAssocs.size());
|
||||||
|
NodeRef movedDocument = rmFolderChildAssocs.iterator().next().getChildRef();
|
||||||
|
String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME);
|
||||||
|
assertEquals(document1Name, movedDocumentName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMoveFolderInFilePlanInRmSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.move(folder1, filePlan, GUID.generate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMoveFolderInCategoryInRmSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef rmCategory;
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
|
||||||
|
runAs(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, getAdminUserName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.move(folder1, rmCategory, GUID.generate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMoveFolderInFolderInRmSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef rmCategory;
|
||||||
|
private NodeRef rmFolder;
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
|
||||||
|
runAs(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||||
|
rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate());
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, getAdminUserName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.move(folder1, rmFolder, GUID.generate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyDocumentToFolderInCollabSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef folder2;
|
||||||
|
private NodeRef document1;
|
||||||
|
private String document1Name = GUID.generate();
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.copy(document1, folder2, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder1ChildAssocs = nodeService.getChildAssocs(folder1);
|
||||||
|
assertEquals(1, folder1ChildAssocs.size());
|
||||||
|
|
||||||
|
List<ChildAssociationRef> folder2ChildAssocs = nodeService.getChildAssocs(folder2);
|
||||||
|
assertNotNull(folder2ChildAssocs);
|
||||||
|
assertEquals(1, folder2ChildAssocs.size());
|
||||||
|
NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef();
|
||||||
|
String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME);
|
||||||
|
assertEquals(document1Name, movedDocumentName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyDocumentToDocumentLibraryInCollabSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef document1;
|
||||||
|
private String document1Name = GUID.generate();
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.copy(document1, documentLibrary, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder1ChildAssocs = nodeService.getChildAssocs(folder1);
|
||||||
|
assertEquals(1, folder1ChildAssocs.size());
|
||||||
|
|
||||||
|
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(documentLibrary);
|
||||||
|
assertNotNull(childAssocs);
|
||||||
|
|
||||||
|
List<String> childNames = new ArrayList<String>();
|
||||||
|
for (ChildAssociationRef childAssociationRef : childAssocs)
|
||||||
|
{
|
||||||
|
NodeRef childRef = childAssociationRef.getChildRef();
|
||||||
|
childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME));
|
||||||
|
}
|
||||||
|
|
||||||
|
assertTrue(childNames.contains(document1Name));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyFolderToFolderInCollabSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef folder2;
|
||||||
|
private String folder1Name = GUID.generate();
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.copy(folder1, folder2, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder2ChildAssocs = nodeService.getChildAssocs(folder2);
|
||||||
|
assertEquals(1, folder2ChildAssocs.size());
|
||||||
|
NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef();
|
||||||
|
String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME);
|
||||||
|
assertEquals(folder1Name, movedDocumentName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyDocumentToFolderInDifferentCollabSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef folder2;
|
||||||
|
private NodeRef document1;
|
||||||
|
private String document1Name = GUID.generate();
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.copy(document1, folder2, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder1ChildAssocs = nodeService.getChildAssocs(folder1);
|
||||||
|
assertEquals(1, folder1ChildAssocs.size());
|
||||||
|
|
||||||
|
List<ChildAssociationRef> folder2ChildAssocs = nodeService.getChildAssocs(folder2);
|
||||||
|
assertNotNull(folder2ChildAssocs);
|
||||||
|
assertEquals(1, folder2ChildAssocs.size());
|
||||||
|
NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef();
|
||||||
|
String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME);
|
||||||
|
assertEquals(document1Name, movedDocumentName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyDocumentToDocumentLibraryInDifferentCollabSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef document1;
|
||||||
|
private String document1Name = GUID.generate();
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.copy(document1, documentLibrary2, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder1ChildAssocs = nodeService.getChildAssocs(folder1);
|
||||||
|
assertEquals(1, folder1ChildAssocs.size());
|
||||||
|
|
||||||
|
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(documentLibrary2);
|
||||||
|
assertNotNull(childAssocs);
|
||||||
|
|
||||||
|
List<String> childNames = new ArrayList<String>();
|
||||||
|
for (ChildAssociationRef childAssociationRef : childAssocs)
|
||||||
|
{
|
||||||
|
NodeRef childRef = childAssociationRef.getChildRef();
|
||||||
|
childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME));
|
||||||
|
}
|
||||||
|
|
||||||
|
assertTrue(childNames.contains(document1Name));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyFolderToFolderInDifferentCollabSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef folder2;
|
||||||
|
private String folder1Name = GUID.generate();
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.copy(folder1, folder2, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void then()
|
||||||
|
{
|
||||||
|
List<ChildAssociationRef> folder2ChildAssocs = nodeService.getChildAssocs(folder2);
|
||||||
|
assertEquals(1, folder2ChildAssocs.size());
|
||||||
|
NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef();
|
||||||
|
String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME);
|
||||||
|
assertEquals(folder1Name, movedDocumentName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyDocumentInFilePlanInRmSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef document1;
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.copy(document1, filePlan, GUID.generate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyDocumentInCategoryInRmSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef document1;
|
||||||
|
private NodeRef rmCategory;
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
|
||||||
|
runAs(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, getAdminUserName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.copy(document1, rmCategory, GUID.generate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyDocumentInFolderInRmSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef document1;
|
||||||
|
private String document1Name = GUID.generate();
|
||||||
|
private NodeRef rmCategory;
|
||||||
|
private NodeRef rmFolder;
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||||
|
|
||||||
|
runAs(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||||
|
rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate());
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, getAdminUserName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
runAs(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, getAdminUserName());
|
||||||
|
|
||||||
|
fileFolderService.copy(document1, rmFolder, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyFolderInFilePlanInRmSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.copy(folder1, filePlan, GUID.generate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyFolderInCategoryInRmSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef rmCategory;
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
|
||||||
|
runAs(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, getAdminUserName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.copy(folder1, rmCategory, GUID.generate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyFolderInFolderInRmSite()
|
||||||
|
{
|
||||||
|
doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user)
|
||||||
|
{
|
||||||
|
private NodeRef folder1;
|
||||||
|
private NodeRef rmCategory;
|
||||||
|
private NodeRef rmFolder;
|
||||||
|
|
||||||
|
public void given()
|
||||||
|
{
|
||||||
|
folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef();
|
||||||
|
|
||||||
|
runAs(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||||
|
rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate());
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, getAdminUserName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void when() throws FileExistsException, FileNotFoundException
|
||||||
|
{
|
||||||
|
fileFolderService.copy(folder1, rmFolder, GUID.generate());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user