mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-7028 review updates
This commit is contained in:
@@ -27,6 +27,11 @@
|
||||
|
||||
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.module.org_alfresco_module_rm.hold.HoldServicePolicies;
|
||||
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.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.
|
||||
*
|
||||
@@ -50,7 +50,9 @@ import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.EVERY_EVE
|
||||
@BehaviourBean
|
||||
public class AddToHoldAuditEvent extends AuditEvent implements HoldServicePolicies.OnAddToHoldPolicy
|
||||
{
|
||||
/** Node Service */
|
||||
/**
|
||||
* Node Service
|
||||
*/
|
||||
private NodeService nodeService;
|
||||
|
||||
/**
|
||||
|
@@ -51,7 +51,8 @@ import org.alfresco.service.cmr.security.PermissionService;
|
||||
* @see FilePlanService#getNodeRefPath(NodeRef)
|
||||
*
|
||||
* @author Derek Hulley
|
||||
* @since 3.2
|
||||
* @author Sara Aspery
|
||||
* @since 3.3
|
||||
*/
|
||||
public final class NamePathDataExtractor extends AbstractDataExtractor
|
||||
{
|
||||
|
@@ -27,6 +27,8 @@
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.util;
|
||||
|
||||
import static org.alfresco.util.GUID.generate;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
@@ -66,8 +68,6 @@ import org.alfresco.service.namespace.QName;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import static org.alfresco.util.GUID.generate;
|
||||
|
||||
/**
|
||||
* Common RM test utility methods.
|
||||
*
|
||||
@@ -75,6 +75,18 @@ import static org.alfresco.util.GUID.generate;
|
||||
*/
|
||||
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 NodeService nodeService;
|
||||
private ContentService contentService;
|
||||
@@ -85,33 +97,22 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
private RecordService recordService;
|
||||
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
|
||||
*
|
||||
* @param applicationContext application context
|
||||
* @param applicationContext application context
|
||||
*/
|
||||
public CommonRMTestUtils(ApplicationContext applicationContext)
|
||||
{
|
||||
dispositionService = (DispositionService)applicationContext.getBean("DispositionService");
|
||||
nodeService = (NodeService)applicationContext.getBean("NodeService");
|
||||
contentService = (ContentService)applicationContext.getBean("ContentService");
|
||||
actionService = (RecordsManagementActionService)applicationContext.getBean("RecordsManagementActionService");
|
||||
modelSecurityService = (ModelSecurityService)applicationContext.getBean("ModelSecurityService");
|
||||
filePlanRoleService = (FilePlanRoleService)applicationContext.getBean("FilePlanRoleService");
|
||||
capabilityService = (CapabilityService)applicationContext.getBean("CapabilityService");
|
||||
recordService = (RecordService)applicationContext.getBean("RecordService");
|
||||
holdService = (HoldService)applicationContext.getBean("HoldService");
|
||||
dispositionService = (DispositionService) applicationContext.getBean("DispositionService");
|
||||
nodeService = (NodeService) applicationContext.getBean("NodeService");
|
||||
contentService = (ContentService) applicationContext.getBean("ContentService");
|
||||
actionService = (RecordsManagementActionService) applicationContext.getBean("RecordsManagementActionService");
|
||||
modelSecurityService = (ModelSecurityService) applicationContext.getBean("ModelSecurityService");
|
||||
filePlanRoleService = (FilePlanRoleService) applicationContext.getBean("FilePlanRoleService");
|
||||
capabilityService = (CapabilityService) applicationContext.getBean("CapabilityService");
|
||||
recordService = (RecordService) applicationContext.getBean("RecordService");
|
||||
holdService = (HoldService) applicationContext.getBean("HoldService");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,26 +129,26 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
/**
|
||||
* Create test disposition schedule
|
||||
*/
|
||||
public DispositionSchedule createBasicDispositionSchedule(
|
||||
NodeRef container,
|
||||
String dispositionInstructions,
|
||||
String dispositionAuthority,
|
||||
boolean isRecordLevel,
|
||||
boolean defaultDispositionActions)
|
||||
{
|
||||
return createDispositionSchedule(container, dispositionInstructions, dispositionAuthority, isRecordLevel, defaultDispositionActions, false);
|
||||
}
|
||||
public DispositionSchedule createBasicDispositionSchedule(
|
||||
NodeRef container,
|
||||
String dispositionInstructions,
|
||||
String dispositionAuthority,
|
||||
boolean isRecordLevel,
|
||||
boolean defaultDispositionActions)
|
||||
{
|
||||
return createDispositionSchedule(container, dispositionInstructions, dispositionAuthority, isRecordLevel, defaultDispositionActions, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create test disposition schedule
|
||||
*/
|
||||
public DispositionSchedule createDispositionSchedule(
|
||||
NodeRef container,
|
||||
String dispositionInstructions,
|
||||
String dispositionAuthority,
|
||||
boolean isRecordLevel,
|
||||
boolean defaultDispositionActions,
|
||||
boolean extendedDispositionSchedule)
|
||||
NodeRef container,
|
||||
String dispositionInstructions,
|
||||
String dispositionAuthority,
|
||||
boolean isRecordLevel,
|
||||
boolean defaultDispositionActions,
|
||||
boolean extendedDispositionSchedule)
|
||||
{
|
||||
return createDispositionSchedule(
|
||||
container,
|
||||
@@ -163,13 +164,13 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
* Create test disposition schedule
|
||||
*/
|
||||
public DispositionSchedule createDispositionSchedule(
|
||||
NodeRef container,
|
||||
String dispositionInstructions,
|
||||
String dispositionAuthority,
|
||||
boolean isRecordLevel,
|
||||
boolean defaultDispositionActions,
|
||||
boolean extendedDispositionSchedule,
|
||||
String defaultEvent)
|
||||
NodeRef container,
|
||||
String dispositionInstructions,
|
||||
String dispositionAuthority,
|
||||
boolean isRecordLevel,
|
||||
boolean defaultDispositionActions,
|
||||
boolean extendedDispositionSchedule,
|
||||
String defaultEvent)
|
||||
{
|
||||
Map<QName, Serializable> dsProps = new HashMap<>(3);
|
||||
dsProps.put(PROP_DISPOSITION_AUTHORITY, dispositionAuthority);
|
||||
@@ -185,7 +186,7 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
|
||||
List<String> events = new ArrayList<>(1);
|
||||
events.add(defaultEvent);
|
||||
adParams.put(PROP_DISPOSITION_EVENT, (Serializable)events);
|
||||
adParams.put(PROP_DISPOSITION_EVENT, (Serializable) events);
|
||||
|
||||
dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams);
|
||||
|
||||
@@ -214,8 +215,8 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
/**
|
||||
* Helper method to create a record in a record folder.
|
||||
*
|
||||
* @param recordFolder record folder
|
||||
* @param name name of record
|
||||
* @param recordFolder record folder
|
||||
* @param name name of record
|
||||
* @return {@link NodeRef} record node reference
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param recordFolder record folder
|
||||
* @param name name of the record
|
||||
* @param title title of the record
|
||||
* @param recordFolder record folder
|
||||
* @param name name of the record
|
||||
* @param title title of the record
|
||||
* @return {@link NodeRef} record node reference
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param recordFolder record folder
|
||||
* @param name name of record
|
||||
* @param properties properties of the record
|
||||
* @param content content of the record
|
||||
* @param recordFolder record folder
|
||||
* @param name name of record
|
||||
* @param properties properties of the record
|
||||
* @param content content of the record
|
||||
* @return {@link NodeRef} record node reference
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param recordFolder record folder
|
||||
* @param name name of record
|
||||
* @param properties properties of the record
|
||||
* @param content content of the record
|
||||
* @param recordFolder record folder
|
||||
* @param name name of record
|
||||
* @param properties properties of the record
|
||||
* @param content content of the record
|
||||
* @return {@link NodeRef} record node reference
|
||||
*/
|
||||
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, ContentModel.PROP_TITLE, "titleValue");
|
||||
actionService.executeRecordsManagementAction(record, "declareRecord");
|
||||
}
|
||||
finally
|
||||
} finally
|
||||
{
|
||||
modelSecurityService.setEnabled(true);
|
||||
}
|
||||
@@ -368,8 +368,7 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
try
|
||||
{
|
||||
actionService.executeRecordsManagementAction(recordFolder, "closeRecordFolder");
|
||||
}
|
||||
finally
|
||||
} finally
|
||||
{
|
||||
modelSecurityService.setEnabled(true);
|
||||
}
|
||||
@@ -378,7 +377,7 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
}, 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);
|
||||
for (String name : capabilityNames)
|
||||
@@ -397,8 +396,8 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
/**
|
||||
* Helper method to complete event on disposable item
|
||||
*
|
||||
* @param disposableItem disposable item (record or record folder)
|
||||
* @param eventName event name
|
||||
* @param disposableItem disposable item (record or record folder)
|
||||
* @param eventName event name
|
||||
*/
|
||||
public void completeEvent(NodeRef disposableItem, String eventName)
|
||||
{
|
||||
@@ -412,7 +411,8 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
|
||||
/**
|
||||
* Helper method to create a hold.
|
||||
* @param holdName hold name
|
||||
*
|
||||
* @param holdName hold name
|
||||
* @param holdReason hold reason
|
||||
* @return NodeRef hold node reference
|
||||
*/
|
||||
@@ -423,7 +423,8 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
|
||||
/**
|
||||
* Helper method to delete a hold.
|
||||
* @param nodeRef hold node reference
|
||||
*
|
||||
* @param nodeRef hold node reference
|
||||
*/
|
||||
public void deleteHold(NodeRef nodeRef)
|
||||
{
|
||||
@@ -432,8 +433,9 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user