mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-1099 (Refactor Transfer and Accession reports)
* Fixed failing tests git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@58683 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,6 +24,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionResult;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction;
|
import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction;
|
import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction;
|
import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction;
|
||||||
@@ -135,14 +136,12 @@ public class ReportServiceImplTest extends BaseRMTestCase implements ReportModel
|
|||||||
*/
|
*/
|
||||||
private Report generateTransfertReport()
|
private Report generateTransfertReport()
|
||||||
{
|
{
|
||||||
nodeService.setProperty(rmFolder, PROP_TRANSFER_ACCESSION_INDICATOR, false);
|
|
||||||
nodeService.setProperty(rmFolder, PROP_TRANSFER_LOCATION, filePlan.toString());
|
|
||||||
Map<String, Serializable> properties = new HashMap<String, Serializable>(2);
|
Map<String, Serializable> properties = new HashMap<String, Serializable>(2);
|
||||||
ArrayList<TransferNode> transferNodes = new ArrayList<TransferNode>(1);
|
ArrayList<TransferNode> transferNodes = new ArrayList<TransferNode>(1);
|
||||||
String dispositionAuthority = StringUtils.EMPTY;
|
String dispositionAuthority = StringUtils.EMPTY;
|
||||||
properties.put("transferNodes", transferNodes);
|
properties.put("transferNodes", transferNodes);
|
||||||
properties.put("dispositionAuthority", dispositionAuthority);
|
properties.put("dispositionAuthority", dispositionAuthority);
|
||||||
return reportService.generateReport(TYPE_TRANSFER_REPORT, rmFolder, MimetypeMap.MIMETYPE_HTML, properties);
|
return reportService.generateReport(TYPE_TRANSFER_REPORT, getTransferObject(), MimetypeMap.MIMETYPE_HTML, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -195,30 +194,54 @@ public class ReportServiceImplTest extends BaseRMTestCase implements ReportModel
|
|||||||
@Override
|
@Override
|
||||||
public Void run() throws Exception
|
public Void run() throws Exception
|
||||||
{
|
{
|
||||||
NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
// Create transfer report for the transfer object
|
||||||
utils.createDispositionSchedule(
|
Map<String, Serializable> params = new HashMap<String, Serializable>(2);
|
||||||
recordCategory,
|
params.put(TransferReportAction.REPORT_TYPE, "rmr:transferReport");
|
||||||
CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS,
|
params.put(TransferReportAction.DESTINATION, filePlan.toString());
|
||||||
CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY,
|
RecordsManagementActionResult transferReportAction = rmActionService.executeRecordsManagementAction(getTransferObject(), TransferReportAction.NAME, params);
|
||||||
false, // record level
|
// Check transfer report result
|
||||||
true, // set the default actions
|
String transferReportName = (String) transferReportAction.getValue();
|
||||||
true); // extended disposition schedule
|
assertFalse(StringUtils.isBlank(transferReportName));
|
||||||
NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate());
|
|
||||||
|
|
||||||
nodeService.setProperty(recordFolder, PROP_TRANSFER_ACCESSION_INDICATOR, false);
|
|
||||||
nodeService.setProperty(recordFolder, PROP_TRANSFER_LOCATION, filePlan.toString());
|
|
||||||
|
|
||||||
Map<String, Serializable> params = new HashMap<String, Serializable>(1);
|
|
||||||
params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME);
|
|
||||||
rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params);
|
|
||||||
rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME);
|
|
||||||
rmActionService.executeRecordsManagementAction(recordFolder, TransferAction.NAME);
|
|
||||||
Map<String, Serializable> fileReportParams = new HashMap<String, Serializable>(2);
|
|
||||||
fileReportParams.put(TransferReportAction.REPORT_TYPE, "rmr:transferReport");
|
|
||||||
fileReportParams.put(TransferReportAction.DESTINATION, filePlan.toString());
|
|
||||||
rmActionService.executeRecordsManagementAction(recordFolder, TransferReportAction.NAME, fileReportParams);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method for creating a transfer object
|
||||||
|
*
|
||||||
|
* @return Node reference of the transfer object
|
||||||
|
*/
|
||||||
|
private NodeRef getTransferObject()
|
||||||
|
{
|
||||||
|
NodeRef recordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||||
|
utils.createDispositionSchedule(
|
||||||
|
recordCategory,
|
||||||
|
CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS,
|
||||||
|
CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY,
|
||||||
|
false, // record level
|
||||||
|
true, // set the default actions
|
||||||
|
true); // extended disposition schedule
|
||||||
|
|
||||||
|
NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate());
|
||||||
|
|
||||||
|
// Set the record folder identifier
|
||||||
|
String identifier = identifierService.generateIdentifier(TYPE_RECORD_FOLDER, recordCategory);
|
||||||
|
nodeService.setProperty(recordFolder, PROP_IDENTIFIER, identifier);
|
||||||
|
|
||||||
|
// Complete event
|
||||||
|
Map<String, Serializable> params = new HashMap<String, Serializable>(1);
|
||||||
|
params.put(CompleteEventAction.PARAM_EVENT_NAME, CommonRMTestUtils.DEFAULT_EVENT_NAME);
|
||||||
|
rmActionService.executeRecordsManagementAction(recordFolder, CompleteEventAction.NAME, params);
|
||||||
|
|
||||||
|
// Cut off folder
|
||||||
|
rmActionService.executeRecordsManagementAction(recordFolder, CutOffAction.NAME);
|
||||||
|
|
||||||
|
// Transfer folder
|
||||||
|
RecordsManagementActionResult transferAction = rmActionService.executeRecordsManagementAction(recordFolder, TransferAction.NAME);
|
||||||
|
NodeRef transferObject = (NodeRef) transferAction.getValue();
|
||||||
|
assertTrue(transferObject != null);
|
||||||
|
|
||||||
|
return transferObject;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,6 +35,7 @@ import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService;
|
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType;
|
import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||||
@@ -147,6 +148,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
|||||||
protected ExtendedSecurityService extendedSecurityService;
|
protected ExtendedSecurityService extendedSecurityService;
|
||||||
protected ReportService reportService;
|
protected ReportService reportService;
|
||||||
protected RecordsManagementAuditService rmAuditService;
|
protected RecordsManagementAuditService rmAuditService;
|
||||||
|
protected IdentifierService identifierService;
|
||||||
|
|
||||||
/** test data */
|
/** test data */
|
||||||
protected String siteId;
|
protected String siteId;
|
||||||
@@ -385,6 +387,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
|||||||
extendedSecurityService = (ExtendedSecurityService) applicationContext.getBean("ExtendedSecurityService");
|
extendedSecurityService = (ExtendedSecurityService) applicationContext.getBean("ExtendedSecurityService");
|
||||||
reportService = (ReportService) applicationContext.getBean("ReportService");
|
reportService = (ReportService) applicationContext.getBean("ReportService");
|
||||||
rmAuditService = (RecordsManagementAuditService) applicationContext.getBean("RecordsManagementAuditService");
|
rmAuditService = (RecordsManagementAuditService) applicationContext.getBean("RecordsManagementAuditService");
|
||||||
|
identifierService = (IdentifierService) applicationContext.getBean("recordsManagementIdentifierService");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user