diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/classified-content-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/classified-content-context.xml
index a222a6e7ac..d5316533ae 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/classified-content-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/classified-content-context.xml
@@ -80,10 +80,13 @@
+
+
clazz = iterator.next().getClass();
if (NodeRef.class.isAssignableFrom(clazz))
{
- result = processNodeRef(collection, iterator);
+ result = processNodeRef(collection);
}
if (AssociationRef.class.isAssignableFrom(clazz))
{
- result = processAssociationRef(collection, iterator);
+ result = processAssociationRef(collection);
}
if (ChildAssociationRef.class.isAssignableFrom(clazz))
{
- result = processChildAssociationRef(collection, iterator);
+ result = processChildAssociationRef(collection);
}
}
}
@@ -135,7 +135,7 @@ public abstract class CollectionPostMethodInvocationProcessor extends BasePostMe
* @return The processed collection
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
- private Collection processNodeRef(Collection collection, Iterator iterator)
+ private Collection processNodeRef(Collection collection)
{
return CollectionUtils.filter(collection, new Filter()
{
@@ -154,7 +154,7 @@ public abstract class CollectionPostMethodInvocationProcessor extends BasePostMe
* @return The processed collection
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
- private Collection processAssociationRef(Collection collection, Iterator iterator)
+ private Collection processAssociationRef(Collection collection)
{
return CollectionUtils.filter(collection, new Filter()
{
@@ -173,7 +173,7 @@ public abstract class CollectionPostMethodInvocationProcessor extends BasePostMe
* @return The processed collection
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
- private Collection processChildAssociationRef(Collection collection, Iterator iterator)
+ private Collection processChildAssociationRef(Collection collection)
{
return CollectionUtils.filter(collection, new Filter()
{
diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationPostMethodInvocationTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationPostMethodInvocationTest.java
new file mode 100644
index 0000000000..e1cd6d2be9
--- /dev/null
+++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/classification/ClassificationPostMethodInvocationTest.java
@@ -0,0 +1,148 @@
+/*
+ * 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 .
+ */
+package org.alfresco.module.org_alfresco_module_rm.test.integration.classification;
+
+import static com.google.common.collect.Lists.newArrayList;
+import static com.google.common.collect.Sets.newHashSet;
+import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_USER;
+import static org.alfresco.util.GUID.generate;
+
+import java.util.List;
+import java.util.Set;
+
+import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship;
+import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
+import org.alfresco.service.cmr.repository.ChildAssociationRef;
+import org.alfresco.service.cmr.repository.NodeRef;
+
+/**
+ * Classification Post Method Invocation Test
+ *
+ * @author Tuna Aksoy
+ * @since 3.0
+ */
+public class ClassificationPostMethodInvocationTest extends BaseRMTestCase
+{
+ private static final String LEVEL1 = "level1";
+ private static final String LEVEL3 = "level3";
+ private static final String REASON = "Test Reason 1";
+
+ public void testClassificationPostMethodInvocation()
+ {
+ /**
+ * Given a test user has been created
+ * and added to the RM user role
+ * and a category, a folder and two records have been created
+ *
+ * When the user has been granted filing permissions
+ * and the clearance level 3 for the test user has been set
+ * and one of the records has been classified as level 1
+ * and a relationship between those two records has been created
+ *
+ * Then the admin user should see both records in the folder
+ * and the admin user should see in the relationship table
+ * (in the details page of the record) the other record
+ *
+ * and the test user should see only the unclassified record in the same folder
+ * and the relationship table should be empty.
+ */
+ doBehaviourDrivenTest(new BehaviourDrivenTest()
+ {
+ private String myUser;
+ private NodeRef category;
+ private NodeRef folder;
+ private NodeRef record1;
+ private NodeRef record2;
+
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given()
+ */
+ @Override
+ public void given() throws Exception
+ {
+ myUser = generate();
+ createPerson(myUser);
+ filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_USER, myUser);
+
+ category = filePlanService.createRecordCategory(filePlan, generate());
+ folder = recordFolderService.createRecordFolder(category, generate());
+ record1 = utils.createRecord(folder, generate());
+ record2 = utils.createRecord(folder, generate());
+ }
+
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when()
+ */
+ @Override
+ public void when() throws Exception
+ {
+ filePlanPermissionService.setPermission(category, myUser, FILING);
+ securityClearanceService.setUserSecurityClearance(myUser, LEVEL3);
+ contentClassificationService.classifyContent(LEVEL1, generate(), newHashSet(REASON), record1);
+ relationshipService.addRelationship(CUSTOM_REF_RENDITION.getLocalName(), record1, record2);
+ }
+
+ /**
+ * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then()
+ */
+ @Override
+ public void then() throws Exception
+ {
+ doTestInTransaction(new Test()
+ {
+ @Override
+ public Void run()
+ {
+ List childAssocs = nodeService.getChildAssocs(folder);
+ assertEquals(2, childAssocs.size());
+
+ List recordList = newArrayList(record1, record2);
+ assertTrue(recordList.contains(childAssocs.get(0).getChildRef()));
+ assertTrue(recordList.contains(childAssocs.get(1).getChildRef()));
+
+ Set relationshipsFrom = relationshipService.getRelationshipsFrom(record1);
+ assertEquals(1, relationshipsFrom.size());
+ Relationship relationship1 = relationshipsFrom.iterator().next();
+ assertEquals(record1, relationship1.getSource());
+ assertEquals(record2, relationship1.getTarget());
+ assertEquals(CUSTOM_REF_RENDITION.getLocalName(), relationship1.getUniqueName());
+
+ return null;
+ }
+ });
+
+ doTestInTransaction(new Test()
+ {
+ @Override
+ public Void run()
+ {
+ List childAssocs = nodeService.getChildAssocs(folder);
+ assertEquals(1, childAssocs.size());
+ assertEquals(record2, childAssocs.get(0).getChildRef());
+
+ Set relationshipsFrom = relationshipService.getRelationshipsFrom(record2);
+ assertEquals(0, relationshipsFrom.size());
+
+ return null;
+ }
+ }, myUser);
+ }
+ });
+ }
+}