RM-1099 (Refactor Transfer and Accession reports)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@58333 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2013-11-26 23:28:33 +00:00
parent 1f0aab4256
commit 3f0e13cc5e
8 changed files with 406 additions and 185 deletions

View File

@@ -210,6 +210,23 @@
</view:properties> </view:properties>
</cm:content> </cm:content>
</cm:contains> </cm:contains>
<cm:contains>
<cm:content view:childName="cm:report_rmr_transferReport.html.ftl">
<view:aspects>
<cm:titled></cm:titled>
<cm:author></cm:author>
</view:aspects>
<view:properties>
<sys:store-protocol>workspace</sys:store-protocol>
<sys:store-identifier>SpacesStore</sys:store-identifier>
<sys:node-uuid>rmr_transferReport</sys:node-uuid>
<cm:description>Transfer report template.</cm:description>
<cm:content>contentUrl=classpath:alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_transferReport.html.ftl|mimetype=text/plain|encoding=UTF-8</cm:content>
<cm:title>Transfer Report Template</cm:title>
<cm:name>report_rmr_transfer.html.ftl</cm:name>
</view:properties>
</cm:content>
</cm:contains>
</view:associations> </view:associations>
</cm:folder> </cm:folder>
</cm:contains> </cm:contains>

View File

@@ -14,7 +14,6 @@
} }
--></style> --></style>
</head> </head>
<body bgcolor="#dddddd"> <body bgcolor="#dddddd">
<table width="100%" cellpadding="20" cellspacing="0" border="0" bgcolor="#dddddd"> <table width="100%" cellpadding="20" cellspacing="0" border="0" bgcolor="#dddddd">
<tr> <tr>
@@ -35,6 +34,7 @@
</td> </td>
<td> <td>
<div style="font-size: 22px; padding-bottom: 4px;"> <div style="font-size: 22px; padding-bottom: 4px;">
<#-- FIXME!!! -->
Destruction Report Destruction Report
</div> </div>
</td> </td>
@@ -43,37 +43,35 @@
<div style="font-size: 14px; margin: 12px 0px 24px 0px; padding-top: 10px; border-top: 1px solid #aaaaaa;"> <div style="font-size: 14px; margin: 12px 0px 24px 0px; padding-top: 10px; border-top: 1px solid #aaaaaa;">
<table cellpadding="2" cellspacing="3" border="0"> <table cellpadding="2" cellspacing="3" border="0">
<tr> <tr>
<#-- FIXME!!! -->
<td><i>Destroyed <#if node.hasAspect("rma:record")>Record<#else>Record Folder</#if>:</i></td> <td><i>Destroyed <#if node.hasAspect("rma:record")>Record<#else>Record Folder</#if>:</i></td>
<td>${node.properties["rma:identifier"]} <b>${node.properties.name}</b></td> <td>${node.properties["rma:identifier"]} <b>${node.properties.name}</b></td>
</tr> </tr>
<tr> <tr>
<#-- FIXME!!! -->
<td><i>Disposition Authority:</i></td> <td><i>Disposition Authority:</i></td>
<td>${node.properties["rma:recordSearchDispositionAuthority"]}</td> <td>${node.properties["rma:recordSearchDispositionAuthority"]}</td>
</tr> </tr>
<tr> <tr>
<#-- FIXME!!! -->
<td><i>Disposition Instructions:</i></td> <td><i>Disposition Instructions:</i></td>
<td>${node.properties["rma:recordSearchDispositionInstructions"]}</td> <td>${node.properties["rma:recordSearchDispositionInstructions"]}</td>
</tr> </tr>
</table> </table>
<#if node.childAssociations["cm:contains"]??> <#if node.childAssociations["cm:contains"]??>
<div style="font-size: 14px; margin: 12px 0px 24px 0px; padding-top: 10px; border-top: 1px solid #aaaaaa;"> <div style="font-size: 14px; margin: 12px 0px 24px 0px; padding-top: 10px; border-top: 1px solid #aaaaaa;">
<table cellpadding="2" cellspacing="3" border="0"> <table cellpadding="2" cellspacing="3" border="0">
<tr> <tr>
<#-- FIXME!!! -->
<td><i>Destroyed Records:</i></td> <td><i>Destroyed Records:</i></td>
<td></td> <td></td>
</tr> </tr>
</table> </table>
<table cellpadding="0" callspacing="0" border="0" bgcolor="#eeeeee" style="padding:10px; border: 1px solid #aaaaaa;"> <table cellpadding="0" callspacing="0" border="0" bgcolor="#eeeeee" style="padding:10px; border: 1px solid #aaaaaa;">
<tr> <tr>
<td> <td>
<table cellpadding="0" cellspacing="0" border="0"> <table cellpadding="0" cellspacing="0" border="0">
<#list node.childAssociations["cm:contains"] as child> <#list node.childAssociations["cm:contains"] as child>
<tr> <tr>
<td valign="top"> <td valign="top">
<img src="${url}/${child.icon32}" alt="" width="32" height="32" border="0" style="padding-right: 10px;" /> <img src="${url}/${child.icon32}" alt="" width="32" height="32" border="0" style="padding-right: 10px;" />
@@ -86,18 +84,13 @@
</table> </table>
</td> </td>
</tr> </tr>
</#list> </#list>
</table> </table>
</td> </td>
</tr> </tr>
</table> </table>
</#if> </#if>
<div style="font-size: 14px; margin: 12px 0px 24px 0px; padding-top: 10px; border-top: 1px solid #aaaaaa;"> <div style="font-size: 14px; margin: 12px 0px 24px 0px; padding-top: 10px; border-top: 1px solid #aaaaaa;">
</div> </div>
</td> </td>
</tr> </tr>

View File

@@ -0,0 +1,72 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<#assign isAccession=node.property["rma:transferAccessionIndicator"]>
<head>
<#if isAccession>
<#-- FIXME: Label -->
<title>Transfer Report</title>
<#else>
<#-- FIXME: Label -->
<title>Transfer Report</title>
</#if>
<style>
body { font-family: arial,verdana; font-size: 81%; color: #333; }
.records { margin-left: 20px; margin-top: 10px; }
.record { padding: 5px; }
.label { color: #111; }
.nodeName { font-weight: bold; }
.transferred-item { background-color: #eee; padding: 10px; margin-bottom: 15px; }
</style>
</head>
<body>
<#if isAccession>
<#-- FIXME: Label -->
<h1>Accession Report</h1>
<#else>
<#-- FIXME: Label -->
<h1>Transfer Report</h1>
</#if>
<table cellpadding="3" cellspacing="3">
<tr>
<#-- FIXME: Label -->
<td class="label">Transfer Date:</td>
<#-- FIXME: Escape, toString -->
<td>${node.property["cm:created"]}</td>
</tr>
<tr>
<#-- FIXME: Label -->
<td class="label">Transfer Location:</td>
<td>
<#if isAccession>
<#-- FIXME: Label -->
NARA
<#else>
<#-- FIXME: String, Escape -->
${node.property["rma:transferLocation"]}
</#if>
</td>
</tr>
<tr>
<#-- FIXME: Label -->
<td class="label">Performed By:</td>
<#-- FIXME: String, Escape -->
<td> ${node.property["cm:creator"]}</td>
</tr>
<tr>
<#-- FIXME: Label -->
<td class="label">Disposition Authority:</td>
<#-- FIXME: Disposition Authority - Check, escape -->
<td></td>
</tr>
</table>
<#-- FIXME: Label -->
<h2>Transferred Items</h2>
<div class="transferred-item">
<#--
<span class="nodeName">folder</span>&nbsp;(Unique Folder Identifier:&nbsp;2013-1385393610833)
<div class="records">
</div>
-->
</div>
</body>
</html>

View File

@@ -1,2 +1,2 @@
report.rmr_destructionReport.name=Destruction Report (${node.rma:identifier} ${node.cm:name}).html report.rmr_destructionReport.name=Destruction Report (${node.rma:identifier} ${node.cm:name}).html
report.rmr_transferReport.name=Transfer Report (${node.rma:identifier} ${node.cm:name}).html

View File

@@ -30,17 +30,18 @@
</namespaces> </namespaces>
<types> <types>
<type name="rmr:report"> <type name="rmr:report">
<title>Report</title> <title>Report</title>
<parent>cm:content</parent> <parent>cm:content</parent>
</type> </type>
<type name="rmr:destructionReport"> <type name="rmr:destructionReport">
<title>Report</title> <title>Report</title>
<parent>rmr:report</parent> <parent>rmr:report</parent>
</type> </type>
<type name="rmr:transferReport">
<title>Transfer</title>
<parent>rmr:report</parent>
</type>
</types> </types>
</model> </model>

View File

@@ -87,6 +87,10 @@
<property name="reportTypeName" value="rmr:destructionReport" /> <property name="reportTypeName" value="rmr:destructionReport" />
</bean> </bean>
<bean id="transferReportGenerator" parent="declarativeReportGenerator">
<property name="reportTypeName" value="rmr:transferReport" />
</bean>
<!-- Report Actions --> <!-- Report Actions -->
<bean id="fileDestructionReport_proxy" parent="rmProxyAction" > <bean id="fileDestructionReport_proxy" parent="rmProxyAction" >
@@ -118,4 +122,35 @@
<property name="reportType" value="rmr:destructionReport" /> <property name="reportType" value="rmr:destructionReport" />
</bean> </bean>
<bean id="fileTransferReport_proxy" parent="rmProxyAction" >
<property name="target">
<ref bean="fileTransferReport"/>
</property>
<property name="interceptorNames">
<list>
<idref bean="fileTransferReport_security"/>
</list>
</property>
</bean>
<bean id="fileTransferReport_security" class="org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor" parent="actionSecurity">
<property name="objectDefinitionSource">
<value>
<!-- FIXME -->
<!-- org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.FileDestructionReport -->
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW
org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW
</value>
</property>
</bean>
<bean id="fileTransferReport"
class="org.alfresco.module.org_alfresco_module_rm.report.action.FileTransferAction"
parent="rmAction">
<property name="reportService" ref="ReportService" />
<property name="filePlanService" ref="FilePlanService" />
<property name="reportType" value="rmr:transferReport" />
</bean>
</beans> </beans>

View File

@@ -33,4 +33,5 @@ public interface ReportModel
public static final QName TYPE_REPORT = QName.createQName(RMR_URI, "report"); public static final QName TYPE_REPORT = QName.createQName(RMR_URI, "report");
public static final QName TYPE_DESTRUCTION_REPORT = QName.createQName(RMR_URI, "destructionReport"); public static final QName TYPE_DESTRUCTION_REPORT = QName.createQName(RMR_URI, "destructionReport");
public static final QName TYPE_TRANSFER_REPORT = QName.createQName(RMR_URI, "transferReport");
} }

View File

@@ -0,0 +1,102 @@
/*
* Copyright (C) 2005-2013 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 <http://www.gnu.org/licenses/>.
*/
package org.alfresco.module.org_alfresco_module_rm.report.action;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.report.Report;
import org.alfresco.module.org_alfresco_module_rm.report.ReportModel;
import org.alfresco.module.org_alfresco_module_rm.report.ReportService;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.ParameterCheck;
/**
* FIXME!!!
*
* @author Tuna Aksoy
* @since 2.2
*/
public class FileTransferAction extends RMActionExecuterAbstractBase implements ReportModel
{
/** report service */
protected ReportService reportService;
/** file plan service */
protected FilePlanService filePlanService;
/** report type string value */
private String reportType;
/**
* @param reportService report service
*/
public void setReportService(ReportService reportService)
{
this.reportService = reportService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @param reportType report type string value
*/
public void setReportType(String reportType)
{
this.reportType = reportType;
}
/**
* @return QName report type
*/
protected QName getReportType()
{
ParameterCheck.mandatory("this.reportType", reportType);
return QName.createQName(reportType, namespaceService);
}
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
// TODO check that the actionedUponNodeRef is in a state to generate a destruction report
// ie: is it eligable for destruction .. use fileDestructionReport capability!
// TODO allow the mimetype of the report to be specified as a parameter
NodeRef filePlan = filePlanService.getFilePlan(actionedUponNodeRef);
if (filePlan == null)
{
throw new AlfrescoRuntimeException("Unable to file destruction report, because file plan could not be resolved.");
}
Report report = reportService.generateReport(getReportType(), actionedUponNodeRef);
reportService.fileReport(filePlan, report);
}
}