RM-7028 review updates

This commit is contained in:
Sara Aspery
2019-11-18 15:59:54 +00:00
parent e9be5a4188
commit 30e3ea689f
3 changed files with 82 additions and 77 deletions

View File

@@ -27,6 +27,11 @@
package org.alfresco.module.org_alfresco_module_rm.audit.event; package org.alfresco.module.org_alfresco_module_rm.audit.event;
import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.EVERY_EVENT;
import java.io.Serializable;
import java.util.Map;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies; import org.alfresco.module.org_alfresco_module_rm.hold.HoldServicePolicies;
import org.alfresco.repo.policy.annotation.Behaviour; import org.alfresco.repo.policy.annotation.Behaviour;
@@ -36,11 +41,6 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import java.io.Serializable;
import java.util.Map;
import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.EVERY_EVENT;
/** /**
* Add to hold audit event. * Add to hold audit event.
* *
@@ -50,7 +50,9 @@ import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.EVERY_EVE
@BehaviourBean @BehaviourBean
public class AddToHoldAuditEvent extends AuditEvent implements HoldServicePolicies.OnAddToHoldPolicy public class AddToHoldAuditEvent extends AuditEvent implements HoldServicePolicies.OnAddToHoldPolicy
{ {
/** Node Service */ /**
* Node Service
*/
private NodeService nodeService; private NodeService nodeService;
/** /**

View File

@@ -51,7 +51,8 @@ import org.alfresco.service.cmr.security.PermissionService;
* @see FilePlanService#getNodeRefPath(NodeRef) * @see FilePlanService#getNodeRefPath(NodeRef)
* *
* @author Derek Hulley * @author Derek Hulley
* @since 3.2 * @author Sara Aspery
* @since 3.3
*/ */
public final class NamePathDataExtractor extends AbstractDataExtractor public final class NamePathDataExtractor extends AbstractDataExtractor
{ {

View File

@@ -27,6 +27,8 @@
package org.alfresco.module.org_alfresco_module_rm.test.util; package org.alfresco.module.org_alfresco_module_rm.test.util;
import static org.alfresco.util.GUID.generate;
import java.io.InputStream; import java.io.InputStream;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
@@ -66,8 +68,6 @@ import org.alfresco.service.namespace.QName;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import static org.alfresco.util.GUID.generate;
/** /**
* Common RM test utility methods. * Common RM test utility methods.
* *
@@ -75,6 +75,18 @@ import static org.alfresco.util.GUID.generate;
*/ */
public class CommonRMTestUtils implements RecordsManagementModel public class CommonRMTestUtils implements RecordsManagementModel
{ {
/**
* test values
*/
public static final String DEFAULT_DISPOSITION_AUTHORITY = "disposition authority";
public static final String DEFAULT_DISPOSITION_INSTRUCTIONS = "disposition instructions";
public static final String DEFAULT_DISPOSITION_DESCRIPTION = "disposition action description";
public static final String DEFAULT_EVENT_NAME = "case_closed";
public static final String PERIOD_NONE = "none|0";
public static final String PERIOD_IMMEDIATELY = "immediately|0";
public static final String PERIOD_ONE_WEEK = "week|1";
public static final String PERIOD_ONE_YEAR = "year|1";
public static final String PERIOD_THREE_YEARS = "year|3";
private DispositionService dispositionService; private DispositionService dispositionService;
private NodeService nodeService; private NodeService nodeService;
private ContentService contentService; private ContentService contentService;
@@ -85,33 +97,22 @@ public class CommonRMTestUtils implements RecordsManagementModel
private RecordService recordService; private RecordService recordService;
private HoldService holdService; private HoldService holdService;
/** test values */
public static final String DEFAULT_DISPOSITION_AUTHORITY = "disposition authority";
public static final String DEFAULT_DISPOSITION_INSTRUCTIONS = "disposition instructions";
public static final String DEFAULT_DISPOSITION_DESCRIPTION = "disposition action description";
public static final String DEFAULT_EVENT_NAME = "case_closed";
public static final String PERIOD_NONE = "none|0";
public static final String PERIOD_IMMEDIATELY = "immediately|0";
public static final String PERIOD_ONE_WEEK = "week|1";
public static final String PERIOD_ONE_YEAR = "year|1";
public static final String PERIOD_THREE_YEARS = "year|3";
/** /**
* Constructor * Constructor
* *
* @param applicationContext application context * @param applicationContext application context
*/ */
public CommonRMTestUtils(ApplicationContext applicationContext) public CommonRMTestUtils(ApplicationContext applicationContext)
{ {
dispositionService = (DispositionService)applicationContext.getBean("DispositionService"); dispositionService = (DispositionService) applicationContext.getBean("DispositionService");
nodeService = (NodeService)applicationContext.getBean("NodeService"); nodeService = (NodeService) applicationContext.getBean("NodeService");
contentService = (ContentService)applicationContext.getBean("ContentService"); contentService = (ContentService) applicationContext.getBean("ContentService");
actionService = (RecordsManagementActionService)applicationContext.getBean("RecordsManagementActionService"); actionService = (RecordsManagementActionService) applicationContext.getBean("RecordsManagementActionService");
modelSecurityService = (ModelSecurityService)applicationContext.getBean("ModelSecurityService"); modelSecurityService = (ModelSecurityService) applicationContext.getBean("ModelSecurityService");
filePlanRoleService = (FilePlanRoleService)applicationContext.getBean("FilePlanRoleService"); filePlanRoleService = (FilePlanRoleService) applicationContext.getBean("FilePlanRoleService");
capabilityService = (CapabilityService)applicationContext.getBean("CapabilityService"); capabilityService = (CapabilityService) applicationContext.getBean("CapabilityService");
recordService = (RecordService)applicationContext.getBean("RecordService"); recordService = (RecordService) applicationContext.getBean("RecordService");
holdService = (HoldService)applicationContext.getBean("HoldService"); holdService = (HoldService) applicationContext.getBean("HoldService");
} }
/** /**
@@ -128,26 +129,26 @@ public class CommonRMTestUtils implements RecordsManagementModel
/** /**
* Create test disposition schedule * Create test disposition schedule
*/ */
public DispositionSchedule createBasicDispositionSchedule( public DispositionSchedule createBasicDispositionSchedule(
NodeRef container, NodeRef container,
String dispositionInstructions, String dispositionInstructions,
String dispositionAuthority, String dispositionAuthority,
boolean isRecordLevel, boolean isRecordLevel,
boolean defaultDispositionActions) boolean defaultDispositionActions)
{ {
return createDispositionSchedule(container, dispositionInstructions, dispositionAuthority, isRecordLevel, defaultDispositionActions, false); return createDispositionSchedule(container, dispositionInstructions, dispositionAuthority, isRecordLevel, defaultDispositionActions, false);
} }
/** /**
* Create test disposition schedule * Create test disposition schedule
*/ */
public DispositionSchedule createDispositionSchedule( public DispositionSchedule createDispositionSchedule(
NodeRef container, NodeRef container,
String dispositionInstructions, String dispositionInstructions,
String dispositionAuthority, String dispositionAuthority,
boolean isRecordLevel, boolean isRecordLevel,
boolean defaultDispositionActions, boolean defaultDispositionActions,
boolean extendedDispositionSchedule) boolean extendedDispositionSchedule)
{ {
return createDispositionSchedule( return createDispositionSchedule(
container, container,
@@ -163,13 +164,13 @@ public class CommonRMTestUtils implements RecordsManagementModel
* Create test disposition schedule * Create test disposition schedule
*/ */
public DispositionSchedule createDispositionSchedule( public DispositionSchedule createDispositionSchedule(
NodeRef container, NodeRef container,
String dispositionInstructions, String dispositionInstructions,
String dispositionAuthority, String dispositionAuthority,
boolean isRecordLevel, boolean isRecordLevel,
boolean defaultDispositionActions, boolean defaultDispositionActions,
boolean extendedDispositionSchedule, boolean extendedDispositionSchedule,
String defaultEvent) String defaultEvent)
{ {
Map<QName, Serializable> dsProps = new HashMap<>(3); Map<QName, Serializable> dsProps = new HashMap<>(3);
dsProps.put(PROP_DISPOSITION_AUTHORITY, dispositionAuthority); dsProps.put(PROP_DISPOSITION_AUTHORITY, dispositionAuthority);
@@ -185,7 +186,7 @@ public class CommonRMTestUtils implements RecordsManagementModel
List<String> events = new ArrayList<>(1); List<String> events = new ArrayList<>(1);
events.add(defaultEvent); events.add(defaultEvent);
adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events); adParams.put(PROP_DISPOSITION_EVENT, (Serializable) events);
dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams);
@@ -214,8 +215,8 @@ public class CommonRMTestUtils implements RecordsManagementModel
/** /**
* Helper method to create a record in a record folder. * Helper method to create a record in a record folder.
* *
* @param recordFolder record folder * @param recordFolder record folder
* @param name name of record * @param name name of record
* @return {@link NodeRef} record node reference * @return {@link NodeRef} record node reference
*/ */
public NodeRef createRecord(NodeRef recordFolder, String name) public NodeRef createRecord(NodeRef recordFolder, String name)
@@ -226,9 +227,9 @@ public class CommonRMTestUtils implements RecordsManagementModel
/** /**
* Helper method to create a record in a record folder. * Helper method to create a record in a record folder.
* *
* @param recordFolder record folder * @param recordFolder record folder
* @param name name of the record * @param name name of the record
* @param title title of the record * @param title title of the record
* @return {@link NodeRef} record node reference * @return {@link NodeRef} record node reference
*/ */
public NodeRef createRecord(NodeRef recordFolder, String name, String title) public NodeRef createRecord(NodeRef recordFolder, String name, String title)
@@ -241,10 +242,10 @@ public class CommonRMTestUtils implements RecordsManagementModel
/** /**
* Helper method to create a record in a record folder. * Helper method to create a record in a record folder.
* *
* @param recordFolder record folder * @param recordFolder record folder
* @param name name of record * @param name name of record
* @param properties properties of the record * @param properties properties of the record
* @param content content of the record * @param content content of the record
* @return {@link NodeRef} record node reference * @return {@link NodeRef} record node reference
*/ */
public NodeRef createRecord(NodeRef recordFolder, String name, Map<QName, Serializable> properties, String content) public NodeRef createRecord(NodeRef recordFolder, String name, Map<QName, Serializable> properties, String content)
@@ -264,10 +265,10 @@ public class CommonRMTestUtils implements RecordsManagementModel
/** /**
* Helper method to create a record in a record folder. * Helper method to create a record in a record folder.
* *
* @param recordFolder record folder * @param recordFolder record folder
* @param name name of record * @param name name of record
* @param properties properties of the record * @param properties properties of the record
* @param content content of the record * @param content content of the record
* @return {@link NodeRef} record node reference * @return {@link NodeRef} record node reference
*/ */
public NodeRef createRecord(NodeRef recordFolder, String name, Map<QName, Serializable> properties, String mimetype, InputStream content) public NodeRef createRecord(NodeRef recordFolder, String name, Map<QName, Serializable> properties, String mimetype, InputStream content)
@@ -344,8 +345,7 @@ public class CommonRMTestUtils implements RecordsManagementModel
nodeService.setProperty(record, RecordsManagementModel.PROP_DATE_FILED, new Date()); nodeService.setProperty(record, RecordsManagementModel.PROP_DATE_FILED, new Date());
nodeService.setProperty(record, ContentModel.PROP_TITLE, "titleValue"); nodeService.setProperty(record, ContentModel.PROP_TITLE, "titleValue");
actionService.executeRecordsManagementAction(record, "declareRecord"); actionService.executeRecordsManagementAction(record, "declareRecord");
} } finally
finally
{ {
modelSecurityService.setEnabled(true); modelSecurityService.setEnabled(true);
} }
@@ -368,8 +368,7 @@ public class CommonRMTestUtils implements RecordsManagementModel
try try
{ {
actionService.executeRecordsManagementAction(recordFolder, "closeRecordFolder"); actionService.executeRecordsManagementAction(recordFolder, "closeRecordFolder");
} } finally
finally
{ {
modelSecurityService.setEnabled(true); modelSecurityService.setEnabled(true);
} }
@@ -378,7 +377,7 @@ public class CommonRMTestUtils implements RecordsManagementModel
}, AuthenticationUtil.getAdminUserName()); }, AuthenticationUtil.getAdminUserName());
} }
public Role createRole(NodeRef filePlan, String roleName, String ... capabilityNames) public Role createRole(NodeRef filePlan, String roleName, String... capabilityNames)
{ {
Set<Capability> capabilities = new HashSet<>(capabilityNames.length); Set<Capability> capabilities = new HashSet<>(capabilityNames.length);
for (String name : capabilityNames) for (String name : capabilityNames)
@@ -397,8 +396,8 @@ public class CommonRMTestUtils implements RecordsManagementModel
/** /**
* Helper method to complete event on disposable item * Helper method to complete event on disposable item
* *
* @param disposableItem disposable item (record or record folder) * @param disposableItem disposable item (record or record folder)
* @param eventName event name * @param eventName event name
*/ */
public void completeEvent(NodeRef disposableItem, String eventName) public void completeEvent(NodeRef disposableItem, String eventName)
{ {
@@ -412,7 +411,8 @@ public class CommonRMTestUtils implements RecordsManagementModel
/** /**
* Helper method to create a hold. * Helper method to create a hold.
* @param holdName hold name *
* @param holdName hold name
* @param holdReason hold reason * @param holdReason hold reason
* @return NodeRef hold node reference * @return NodeRef hold node reference
*/ */
@@ -423,7 +423,8 @@ public class CommonRMTestUtils implements RecordsManagementModel
/** /**
* Helper method to delete a hold. * Helper method to delete a hold.
* @param nodeRef hold node reference *
* @param nodeRef hold node reference
*/ */
public void deleteHold(NodeRef nodeRef) public void deleteHold(NodeRef nodeRef)
{ {
@@ -432,8 +433,9 @@ public class CommonRMTestUtils implements RecordsManagementModel
/** /**
* Util method to add content to a hold. * Util method to add content to a hold.
* @param holdNodeRef hold node reference *
* @param contentNodeRef content node reference * @param holdNodeRef hold node reference
* @param contentNodeRef content node reference
*/ */
public void addItemToHold(NodeRef holdNodeRef, NodeRef contentNodeRef) public void addItemToHold(NodeRef holdNodeRef, NodeRef contentNodeRef)
{ {