RM-581 (A user will receive notification of rejected records)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@46114 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2013-01-31 18:47:35 +00:00
parent 336ef19c99
commit d08b441438
8 changed files with 177 additions and 149 deletions

View File

@@ -1139,21 +1139,17 @@
</properties>
</aspect>
<!-- Aspect to hold the information about the original location of a record -->
<aspect name="rma:originalLocation">
<title>The original location of a record</title>
<!-- Aspect to hold the originating details of a record -->
<aspect name="rma:recordOriginatingDetails">
<title>The originating details of a record</title>
<properties>
<property name="rma:orgLocation">
<property name="rma:recordOrginalLocation">
<type>d:any</type>
</property>
</properties>
</aspect>
<!-- Aspect to hold the information about reject reason of a record -->
<aspect name="rma:rejectReasonRecord">
<title>The reject reason of a record</title>
<properties>
<property name="rma:rejectReason">
<property name="rma:recordCreationDate">
<type>d:date</type>
</property>
<property name="rma:recordUserId">
<type>d:text</type>
</property>
</properties>

View File

@@ -4,7 +4,7 @@
<beans>
<!-- Helper beans -->
<bean id="baseTransaction" abstract="true" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager">
<ref bean="transactionManager"/>
@@ -15,7 +15,7 @@
</props>
</property>
</bean>
<bean id="baseSecurity" abstract="true" class="org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor">
<property name="authenticationManager">
<ref bean="authenticationManager"/>
@@ -27,7 +27,7 @@
<ref bean="afterInvocationManager"/>
</property>
</bean>
<bean id="baseService" abstract="true">
<property name="nodeService" ref="NodeService"/>
<property name="dictionaryService" ref="DictionaryService"/>
@@ -433,9 +433,9 @@
</value>
</property>
</bean>
<!-- File Plan Service -->
<bean id="filePlanService"
parent="baseService"
class="org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanServiceImpl">
@@ -460,7 +460,7 @@
<bean id="FilePlanService_transaction" parent="baseTransaction" />
<bean id="FilePlanService_security" parent="baseSecurity">
<bean id="FilePlanService_security" parent="baseSecurity">
<property name="objectDefinitionSource">
<value>
<![CDATA[
@@ -474,7 +474,7 @@
</bean>
<!-- File Plan Permission Service -->
<bean id="filePlanPermissionService"
class="org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionServiceImpl"
init-method="init">
@@ -541,8 +541,8 @@
<property name="authorityService" ref="AuthorityService"/>
<property name="permissionService" ref="PermissionService"/>
<property name="nodeService" ref="NodeService"/>
<property name="policyComponent" ref="policyComponent"/>
<property name="filePlanService" ref="FilePlanService" />
<property name="policyComponent" ref="policyComponent"/>
<property name="filePlanService" ref="FilePlanService" />
</bean>
<bean id="FilePlanRoleService" class="org.springframework.aop.framework.ProxyFactoryBean">
@@ -601,7 +601,7 @@
</property>
</bean>
<!-- Records Management Extended Security Service -->
@@ -1080,9 +1080,9 @@
</value>
</property>
</bean>
<!-- Record Folder Service -->
<bean id="recordFolderService" class="org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderServiceImpl" init-method="init">
<property name="nodeService" ref="NodeService"/>
<property name="policyComponent" ref="policyComponent" />
@@ -1101,6 +1101,7 @@
<property name="policyComponent" ref="policyComponent" />
<property name="dispositionService" ref="DispositionService" />
<property name="filePlanService" ref="FilePlanService" />
<property name="notificationService" ref="NotificationService"/>
</bean>
<bean id="RecordService" class="org.springframework.aop.framework.ProxyFactoryBean">

View File

@@ -116,7 +116,7 @@ public class HideRecordAction extends ActionExecuterAbstractBase implements Reco
else
{
// remove the child association
NodeRef originalLocation = (NodeRef) nodeService.getProperty(actionedUponNodeRef, PROP_ORIGINAL_LOCATION);
NodeRef originalLocation = (NodeRef) nodeService.getProperty(actionedUponNodeRef, PROP_RECORD_ORIGINAL_LOCATION);
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(actionedUponNodeRef);
for (ChildAssociationRef childAssociationRef : parentAssocs)
{

View File

@@ -232,10 +232,8 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
public static final QName PROP_READERS = QName.createQName(RM_URI, "readers");
// Original location of a record
public static final QName ASPECT_ORIGINAL_LOCATION = QName.createQName(RM_URI, "originalLocation");
public static final QName PROP_ORIGINAL_LOCATION = QName.createQName(RM_URI, "orgLocation");
// Reject reason of a record
public static final QName ASPECT_REJECT_REASON_RECORD = QName.createQName(RM_URI, "rejectReasonRecord");
public static final QName PROP_REJECT_REASON = QName.createQName(RM_URI, "rejectReason");
public static final QName ASPECT_RECORD_ORIGINATING_DETAILS = QName.createQName(RM_URI, "recordOriginatingDetails");
public static final QName PROP_RECORD_ORIGINAL_LOCATION = QName.createQName(RM_URI, "recordOrginalLocation");
public static final QName PROP_RECORD_CREATION_DATE = QName.createQName(RM_URI, "recordCreationDate");
public static final QName PROP_RECORD_USER_ID = QName.createQName(RM_URI, "recordUserId");
}

View File

@@ -21,6 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.record;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -38,6 +39,7 @@ import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordServiceImpl;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.notification.EMailNotificationProvider;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
@@ -46,6 +48,8 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.service.cmr.dictionary.AspectDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.notification.NotificationContext;
import org.alfresco.service.cmr.notification.NotificationService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -53,9 +57,11 @@ import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.ParameterCheck;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.mail.MailPreparationException;
/**
* Record service implementation
@@ -95,6 +101,9 @@ public class RecordServiceImpl implements RecordService,
/** File plan service */
private FilePlanService filePlanService;
/** Notification service */
private NotificationService notificationService;
/** Policy component */
private PolicyComponent policyComponent;
@@ -177,6 +186,14 @@ public class RecordServiceImpl implements RecordService,
this.filePlanService = filePlanService;
}
/**
* @param notificationService notification service
*/
public void setNotificationService(NotificationService notificationService)
{
this.notificationService = notificationService;
}
/**
* @param policyComponent policy component
*/
@@ -290,6 +307,9 @@ public class RecordServiceImpl implements RecordService,
nodeRef.toString());
}
// Save the id of the currently logged in user
final String userId = AuthenticationUtil.getRunAsUser();
// do the work of creating the record as the system user
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@@ -315,9 +335,11 @@ public class RecordServiceImpl implements RecordService,
nodeService.moveNode(nodeRef, newRecordContainer, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName());
// Add the information about the original location
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(1);
aspectProperties.put(PROP_ORIGINAL_LOCATION, (Serializable) parentAssoc.getParentRef());
nodeService.addAspect(nodeRef, ASPECT_ORIGINAL_LOCATION, aspectProperties);
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(3);
aspectProperties.put(PROP_RECORD_ORIGINAL_LOCATION, (Serializable) parentAssoc.getParentRef());
aspectProperties.put(PROP_RECORD_USER_ID, userId);
aspectProperties.put(PROP_RECORD_CREATION_DATE, new Date());
nodeService.addAspect(nodeRef, ASPECT_RECORD_ORIGINATING_DETAILS, aspectProperties);
// make the document a record
makeRecord(nodeRef);
@@ -440,7 +462,7 @@ public class RecordServiceImpl implements RecordService,
public Void doWork() throws Exception
{
// first remove the secondary link association
NodeRef originalLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_ORIGINAL_LOCATION);
NodeRef originalLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINAL_LOCATION);
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
for (ChildAssociationRef childAssociationRef : parentAssocs)
{
@@ -461,17 +483,31 @@ public class RecordServiceImpl implements RecordService,
// get the records primary parent association
ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef);
// save the reject reason
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(1);
aspectProperties.put(PROP_REJECT_REASON, reason);
nodeService.addAspect(nodeRef, ASPECT_REJECT_REASON_RECORD, aspectProperties);
// move the record into the collaboration site
nodeService.moveNode(nodeRef, originalLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName());
// remove all extended readers
extendedSecurityService.removeAllExtendedReaders(nodeRef);
// Send an email to the record creator
String recordCreator = (String) nodeService.getProperty(nodeRef, PROP_RECORD_USER_ID);
if (StringUtils.isNotBlank(recordCreator))
{
NotificationContext context = new NotificationContext();
context.addTo(recordCreator);
// FIXME: Subject -> i18n
context.setSubject("Record rejected");
// FIXME: Use email template
context.setBody(reason);
notificationService.sendNotification(EMailNotificationProvider.NAME, context);
}
else
{
throw new MailPreparationException("The id of the record creator cannot be found!");
}
return null;
}
});

View File

@@ -89,7 +89,7 @@ public class HideRecordActionTest extends BaseRMTestCase
assertTrue(recordService.isRecord(doc));
// The record should have the original location information
assertNotNull(nodeService.getProperty(doc, PROP_ORIGINAL_LOCATION));
assertNotNull(nodeService.getProperty(doc, PROP_RECORD_ORIGINAL_LOCATION));
// Check the parents. In this case the document should have two parents (doclib and fileplan)
assertTrue(nodeService.getParentAssocs(doc).size() == 2);

View File

@@ -75,7 +75,7 @@ public class RejectActionTest extends BaseRMTestCase
assertTrue(recordService.isRecord(dmDocument));
// The record should have the original location information
assertNotNull(nodeService.getProperty(dmDocument, PROP_ORIGINAL_LOCATION));
assertNotNull(nodeService.getProperty(dmDocument, PROP_RECORD_ORIGINAL_LOCATION));
// Check the parents. In this case the document should have two parents (doclib and fileplan)
assertTrue(nodeService.getParentAssocs(dmDocument).size() == 2);
@@ -114,9 +114,6 @@ public class RejectActionTest extends BaseRMTestCase
// The "identifier" property should be removed
assertNull(nodeService.getProperty(dmDocument, PROP_IDENTIFIER));
// The reject reason should be saved
assertTrue(((String) nodeService.getProperty(dmDocument, PROP_REJECT_REASON)).equals(REJECT_REASON));
// The record should be removed from the file plan
assertTrue(nodeService.getParentAssocs(dmDocument).size() == 1);

View File

@@ -38,7 +38,7 @@ import org.alfresco.service.namespace.QName;
/**
* Records Service Implementation Test
*
*
* @author Roy Wetherall
* @author Tuna Askoy
* @since 2.1
@@ -47,7 +47,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
{
/** Services */
protected ActionService dmActionService;
protected PermissionService dmPermissionService;
protected PermissionService dmPermissionService;
protected ExtendedSecurityService extendedSecurityService;
/**
@@ -65,7 +65,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
/**
* This is a user test
*
*
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest()
*/
@Override
@@ -76,7 +76,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
/**
* This is a record test
*
*
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isRecordTest()
*/
@Override
@@ -84,7 +84,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
{
return true;
}
/**
* This is a collaboration site test
*/
@@ -114,18 +114,18 @@ public class RecordServiceImplTest extends BaseRMTestCase
/**
* Helper method for getting a list of record meta data aspects
*
*
* @return Record meta data aspects as list
*/
private List<QName> getAspectList()
{
QName[] aspects = new QName[]
{
QName[] aspects = new QName[]
{
DOD5015Model.ASPECT_DIGITAL_PHOTOGRAPH_RECORD,
DOD5015Model.ASPECT_PDF_RECORD,
DOD5015Model.ASPECT_PDF_RECORD,
DOD5015Model.ASPECT_WEB_RECORD,
DOD5015Model.ASPECT_SCANNED_RECORD,
ASPECT_RECORD_META_DATA
DOD5015Model.ASPECT_SCANNED_RECORD,
ASPECT_RECORD_META_DATA
};
return Arrays.asList(aspects);
@@ -170,7 +170,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
}
});
}
public void testUnfiled() throws Exception
{
doTestInTransaction(new VoidTest()
@@ -184,7 +184,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
assertTrue(recordService.isFiled(recordOne));
assertTrue(recordService.isFiled(recordDeclaredOne));
}
});
});
}
/**
@@ -198,13 +198,13 @@ public class RecordServiceImplTest extends BaseRMTestCase
"Can not create a record from a document if you do not have WRITE permissions.",
AccessDeniedException.class
)
{
{
public void run() throws Exception
{
recordService.createRecord(filePlan, dmDocument);
}
}, dmConsumer);
// create record from document
doTestInTransaction(new Test<Void>()
{
@@ -212,55 +212,55 @@ public class RecordServiceImplTest extends BaseRMTestCase
public Void run()
{
NodeRef originalLocation = nodeService.getPrimaryParent(dmDocument).getParentRef();
assertFalse(recordService.isRecord(dmDocument));
assertFalse(extendedSecurityService.hasExtendedReaders(dmDocument));
checkPermissions(READ_RECORDS,
AccessStatus.DENIED, // file plan
checkPermissions(READ_RECORDS,
AccessStatus.DENIED, // file plan
AccessStatus.DENIED, // unfiled container
AccessStatus.DENIED, // record category
AccessStatus.DENIED, // record folder
AccessStatus.DENIED); // doc/record
assertEquals(AccessStatus.DENIED,
assertEquals(AccessStatus.DENIED,
dmPermissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
checkPermissions(FILING,
AccessStatus.DENIED, // file plan
checkPermissions(FILING,
AccessStatus.DENIED, // file plan
AccessStatus.DENIED, // unfiled container
AccessStatus.DENIED, // record category
AccessStatus.DENIED, // record folder
AccessStatus.DENIED); // doc/record
recordService.createRecord(filePlan, dmDocument);
checkPermissions(READ_RECORDS,
AccessStatus.ALLOWED, // file plan
checkPermissions(READ_RECORDS,
AccessStatus.ALLOWED, // file plan
AccessStatus.ALLOWED, // unfiled container
AccessStatus.DENIED, // record category
AccessStatus.DENIED, // record folder
AccessStatus.ALLOWED); // doc/record
assertEquals(AccessStatus.ALLOWED,
AccessStatus.ALLOWED); // doc/record
assertEquals(AccessStatus.ALLOWED,
dmPermissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
checkPermissions(FILING,
AccessStatus.DENIED, // file plan
checkPermissions(FILING,
AccessStatus.DENIED, // file plan
AccessStatus.DENIED, // unfiled container
AccessStatus.DENIED, // record category
AccessStatus.DENIED, // record folder
AccessStatus.DENIED); // doc/record
AccessStatus.DENIED); // doc/record
assertTrue(recordService.isRecord(dmDocument));
assertTrue(extendedSecurityService.hasExtendedReaders(dmDocument));
assertFalse(recordService.isFiled(dmDocument));
// show that the record has meta-data about it's original location
assertTrue(nodeService.hasAspect(dmDocument, ASPECT_ORIGINAL_LOCATION));
assertEquals(originalLocation, nodeService.getProperty(dmDocument, PROP_ORIGINAL_LOCATION));
assertTrue(nodeService.hasAspect(dmDocument, ASPECT_RECORD_ORIGINATING_DETAILS));
assertEquals(originalLocation, nodeService.getProperty(dmDocument, PROP_RECORD_ORIGINAL_LOCATION));
assertFalse(originalLocation == nodeService.getPrimaryParent(dmDocument).getParentRef());
// show that the record is linked to it's original location
assertEquals(2, nodeService.getParentAssocs(dmDocument).size());
@@ -268,7 +268,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
}
}, dmCollaborator);
}
public void testCreateRecordNoLink() throws Exception
{
// show that users without WRITE can not create a record from a document
@@ -277,13 +277,13 @@ public class RecordServiceImplTest extends BaseRMTestCase
"Can not create a record from a document if you do not have WRITE permissions.",
AccessDeniedException.class
)
{
{
public void run() throws Exception
{
recordService.createRecord(filePlan, dmDocument, false);
}
}, dmConsumer);
// create record from document
final NodeRef originalLocation = doTestInTransaction(new Test<NodeRef>()
{
@@ -291,64 +291,64 @@ public class RecordServiceImplTest extends BaseRMTestCase
public NodeRef run()
{
NodeRef originalLocation = nodeService.getPrimaryParent(dmDocument).getParentRef();
assertFalse(recordService.isRecord(dmDocument));
assertFalse(extendedSecurityService.hasExtendedReaders(dmDocument));
checkPermissions(READ_RECORDS,
AccessStatus.DENIED, // file plan
checkPermissions(READ_RECORDS,
AccessStatus.DENIED, // file plan
AccessStatus.DENIED, // unfiled container
AccessStatus.DENIED, // record category
AccessStatus.DENIED, // record folder
AccessStatus.DENIED); // doc/record
assertEquals(AccessStatus.DENIED,
assertEquals(AccessStatus.DENIED,
dmPermissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
checkPermissions(FILING,
AccessStatus.DENIED, // file plan
checkPermissions(FILING,
AccessStatus.DENIED, // file plan
AccessStatus.DENIED, // unfiled container
AccessStatus.DENIED, // record category
AccessStatus.DENIED, // record folder
AccessStatus.DENIED); // doc/record
recordService.createRecord(filePlan, dmDocument, false);
checkPermissions(READ_RECORDS,
AccessStatus.DENIED, // file plan
checkPermissions(READ_RECORDS,
AccessStatus.DENIED, // file plan
AccessStatus.DENIED, // unfiled container
AccessStatus.DENIED, // record category
AccessStatus.DENIED, // record folder
AccessStatus.DENIED); // doc/record
assertEquals(AccessStatus.DENIED,
AccessStatus.DENIED); // doc/record
assertEquals(AccessStatus.DENIED,
dmPermissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
checkPermissions(FILING,
AccessStatus.DENIED, // file plan
checkPermissions(FILING,
AccessStatus.DENIED, // file plan
AccessStatus.DENIED, // unfiled container
AccessStatus.DENIED, // record category
AccessStatus.DENIED, // record folder
AccessStatus.DENIED); // doc/record
AccessStatus.DENIED); // doc/record
return originalLocation;
}
}, dmCollaborator);
}, dmCollaborator);
doTestInTransaction(new Test<Void>()
{
@Override
public Void run()
{
{
assertTrue(recordService.isRecord(dmDocument));
assertFalse(extendedSecurityService.hasExtendedReaders(dmDocument));
assertFalse(recordService.isFiled(dmDocument));
// show that the record has meta-data about it's original location
assertTrue(nodeService.hasAspect(dmDocument, ASPECT_ORIGINAL_LOCATION));
assertEquals(originalLocation, nodeService.getProperty(dmDocument, PROP_ORIGINAL_LOCATION));
assertTrue(nodeService.hasAspect(dmDocument, ASPECT_RECORD_ORIGINATING_DETAILS));
assertEquals(originalLocation, nodeService.getProperty(dmDocument, PROP_RECORD_ORIGINAL_LOCATION));
assertFalse(originalLocation == nodeService.getPrimaryParent(dmDocument).getParentRef());
// show that the record is linked to it's original location
assertEquals(1, nodeService.getParentAssocs(dmDocument).size());
@@ -356,7 +356,7 @@ public class RecordServiceImplTest extends BaseRMTestCase
}
}, rmAdminName);
}
public void testFileNewContent() throws Exception
{
doTestInTransaction(new Test<NodeRef>()
@@ -365,26 +365,26 @@ public class RecordServiceImplTest extends BaseRMTestCase
public NodeRef run()
{
NodeRef record = fileFolderService.create(rmFolder, "test101.txt" , TYPE_CONTENT).getNodeRef();
ContentWriter writer = contentService.getWriter(record, PROP_CONTENT, true);
writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent("hello world this is some test content");
return record;
}
@Override
public void test(NodeRef record) throws Exception
public void test(NodeRef record) throws Exception
{
assertTrue(recordService.isRecord(record));
assertTrue(recordService.isFiled(record));
assertNotNull(nodeService.getProperty(record, PROP_DATE_FILED));
}
});
}
});
}
public void testFileUnfiledrecord() throws Exception
{
doTestInTransaction(new Test<NodeRef>()
@@ -393,28 +393,28 @@ public class RecordServiceImplTest extends BaseRMTestCase
public NodeRef run() throws Exception
{
recordService.createRecord(filePlan, dmDocument);
assertTrue(recordService.isRecord(dmDocument));
assertFalse(recordService.isFiled(dmDocument));
assertNull(nodeService.getProperty(dmDocument, PROP_DATE_FILED));
fileFolderService.move(dmDocument, rmFolder, "record.txt");
return dmDocument;
}
@Override
public void test(NodeRef record) throws Exception
public void test(NodeRef record) throws Exception
{
assertTrue(recordService.isRecord(record));
assertTrue(recordService.isFiled(record));
assertNotNull(nodeService.getProperty(record, PROP_DATE_FILED));
}
});
}
});
}
public void testFileDirectlyFromCollab() throws Exception
{
doTestInTransaction(new Test<NodeRef>()
@@ -423,38 +423,38 @@ public class RecordServiceImplTest extends BaseRMTestCase
public NodeRef run() throws Exception
{
assertNull(nodeService.getProperty(dmDocument, PROP_DATE_FILED));
fileFolderService.move(dmDocument, rmFolder, "record.txt");
return dmDocument;
}
@Override
public void test(NodeRef record) throws Exception
public void test(NodeRef record) throws Exception
{
assertTrue(recordService.isRecord(record));
assertTrue(recordService.isFiled(record));
assertNotNull(nodeService.getProperty(record, PROP_DATE_FILED));
}
});
}
});
}
private void checkPermissions(String permission, AccessStatus filePlanExpected,
AccessStatus unfiledExpected,
private void checkPermissions(String permission, AccessStatus filePlanExpected,
AccessStatus unfiledExpected,
AccessStatus recordCatExpected,
AccessStatus recordFolderExpected,
AccessStatus recordExpected)
{
assertEquals(filePlanExpected,
dmPermissionService.hasPermission(filePlan, permission));
assertEquals(unfiledExpected,
assertEquals(filePlanExpected,
dmPermissionService.hasPermission(filePlan, permission));
assertEquals(unfiledExpected,
dmPermissionService.hasPermission(unfiledContainer, permission));
assertEquals(recordCatExpected,
assertEquals(recordCatExpected,
dmPermissionService.hasPermission(rmContainer, permission));
assertEquals(recordFolderExpected,
assertEquals(recordFolderExpected,
dmPermissionService.hasPermission(rmFolder, permission));
assertEquals(recordExpected,
dmPermissionService.hasPermission(dmDocument, permission));
assertEquals(recordExpected,
dmPermissionService.hasPermission(dmDocument, permission));
}
}