mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed Accession Report
- shows incorrect location - shows incorrect title git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/DEV/DODRECERT@51220 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -59,14 +59,14 @@ import org.springframework.extensions.webscripts.WebScriptResponse;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Files a transfer report as a record.
|
* Files a transfer report as a record.
|
||||||
*
|
*
|
||||||
* @author Gavin Cornwell
|
* @author Gavin Cornwell
|
||||||
*/
|
*/
|
||||||
public class TransferReportPost extends BaseTransferWebScript
|
public class TransferReportPost extends BaseTransferWebScript
|
||||||
{
|
{
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static Log logger = LogFactory.getLog(TransferReportPost.class);
|
private static Log logger = LogFactory.getLog(TransferReportPost.class);
|
||||||
|
|
||||||
protected static final String REPORT_FILE_PREFIX = "report_";
|
protected static final String REPORT_FILE_PREFIX = "report_";
|
||||||
protected static final String REPORT_FILE_SUFFIX = ".html";
|
protected static final String REPORT_FILE_SUFFIX = ".html";
|
||||||
protected static final String PARAM_DESTINATION = "destination";
|
protected static final String PARAM_DESTINATION = "destination";
|
||||||
@@ -74,65 +74,65 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
protected static final String RESPONSE_RECORD = "record";
|
protected static final String RESPONSE_RECORD = "record";
|
||||||
protected static final String RESPONSE_RECORD_NAME = "recordName";
|
protected static final String RESPONSE_RECORD_NAME = "recordName";
|
||||||
protected static final String FILE_ACTION = "file";
|
protected static final String FILE_ACTION = "file";
|
||||||
|
|
||||||
protected DictionaryService ddService;
|
protected DictionaryService ddService;
|
||||||
protected RecordsManagementActionService rmActionService;
|
protected RecordsManagementActionService rmActionService;
|
||||||
protected RecordsManagementService rmService;
|
protected RecordsManagementService rmService;
|
||||||
protected DispositionService dispositionService;
|
protected DispositionService dispositionService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the DictionaryService instance
|
* Sets the DictionaryService instance
|
||||||
*
|
*
|
||||||
* @param ddService The DictionaryService instance
|
* @param ddService The DictionaryService instance
|
||||||
*/
|
*/
|
||||||
public void setDictionaryService(DictionaryService ddService)
|
public void setDictionaryService(DictionaryService ddService)
|
||||||
{
|
{
|
||||||
this.ddService = ddService;
|
this.ddService = ddService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the RecordsManagementService instance
|
* Sets the RecordsManagementService instance
|
||||||
*
|
*
|
||||||
* @param rmService RecordsManagementService instance
|
* @param rmService RecordsManagementService instance
|
||||||
*/
|
*/
|
||||||
public void setRecordsManagementService(RecordsManagementService rmService)
|
public void setRecordsManagementService(RecordsManagementService rmService)
|
||||||
{
|
{
|
||||||
this.rmService = rmService;
|
this.rmService = rmService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the disposition service
|
* Sets the disposition service
|
||||||
*
|
*
|
||||||
* @param dispositionService disposition service
|
* @param dispositionService disposition service
|
||||||
*/
|
*/
|
||||||
public void setDispositionService(DispositionService dispositionService)
|
public void setDispositionService(DispositionService dispositionService)
|
||||||
{
|
{
|
||||||
this.dispositionService = dispositionService;
|
this.dispositionService = dispositionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the RecordsManagementActionService instance
|
* Sets the RecordsManagementActionService instance
|
||||||
*
|
*
|
||||||
* @param rmActionService RecordsManagementActionService instance
|
* @param rmActionService RecordsManagementActionService instance
|
||||||
*/
|
*/
|
||||||
public void setRecordsManagementActionService(RecordsManagementActionService rmActionService)
|
public void setRecordsManagementActionService(RecordsManagementActionService rmActionService)
|
||||||
{
|
{
|
||||||
this.rmActionService = rmActionService;
|
this.rmActionService = rmActionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected File executeTransfer(NodeRef transferNode,
|
protected File executeTransfer(NodeRef transferNode,
|
||||||
WebScriptRequest req, WebScriptResponse res,
|
WebScriptRequest req, WebScriptResponse res,
|
||||||
Status status, Cache cache) throws IOException
|
Status status, Cache cache) throws IOException
|
||||||
{
|
{
|
||||||
File report = null;
|
File report = null;
|
||||||
|
|
||||||
// retrieve requested format
|
// retrieve requested format
|
||||||
String format = req.getFormat();
|
String format = req.getFormat();
|
||||||
Map<String, Object> model = new HashMap<String, Object>();
|
Map<String, Object> model = new HashMap<String, Object>();
|
||||||
model.put("status", status);
|
model.put("status", status);
|
||||||
model.put("cache", cache);
|
model.put("cache", cache);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// extract the destination parameter, ensure it's present and it is
|
// extract the destination parameter, ensure it's present and it is
|
||||||
@@ -140,63 +140,63 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent()));
|
JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent()));
|
||||||
if (!json.has(PARAM_DESTINATION))
|
if (!json.has(PARAM_DESTINATION))
|
||||||
{
|
{
|
||||||
status.setCode(HttpServletResponse.SC_BAD_REQUEST,
|
status.setCode(HttpServletResponse.SC_BAD_REQUEST,
|
||||||
"Mandatory '" + PARAM_DESTINATION + "' parameter has not been supplied");
|
"Mandatory '" + PARAM_DESTINATION + "' parameter has not been supplied");
|
||||||
Map<String, Object> templateModel = createTemplateParameters(req, res, model);
|
Map<String, Object> templateModel = createTemplateParameters(req, res, model);
|
||||||
sendStatus(req, res, status, cache, format, templateModel);
|
sendStatus(req, res, status, cache, format, templateModel);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String destinationParam = json.getString(PARAM_DESTINATION);
|
String destinationParam = json.getString(PARAM_DESTINATION);
|
||||||
NodeRef destination = new NodeRef(destinationParam);
|
NodeRef destination = new NodeRef(destinationParam);
|
||||||
|
|
||||||
if (!this.nodeService.exists(destination))
|
if (!this.nodeService.exists(destination))
|
||||||
{
|
{
|
||||||
status.setCode(HttpServletResponse.SC_NOT_FOUND,
|
status.setCode(HttpServletResponse.SC_NOT_FOUND,
|
||||||
"Node " + destination.toString() + " does not exist");
|
"Node " + destination.toString() + " does not exist");
|
||||||
Map<String, Object> templateModel = createTemplateParameters(req, res, model);
|
Map<String, Object> templateModel = createTemplateParameters(req, res, model);
|
||||||
sendStatus(req, res, status, cache, format, templateModel);
|
sendStatus(req, res, status, cache, format, templateModel);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure the node is a filePlan object
|
// ensure the node is a filePlan object
|
||||||
if (!RecordsManagementModel.TYPE_RECORD_FOLDER.equals(this.nodeService.getType(destination)))
|
if (!RecordsManagementModel.TYPE_RECORD_FOLDER.equals(this.nodeService.getType(destination)))
|
||||||
{
|
{
|
||||||
status.setCode(HttpServletResponse.SC_BAD_REQUEST,
|
status.setCode(HttpServletResponse.SC_BAD_REQUEST,
|
||||||
"Node " + destination.toString() + " is not a record folder");
|
"Node " + destination.toString() + " is not a record folder");
|
||||||
Map<String, Object> templateModel = createTemplateParameters(req, res, model);
|
Map<String, Object> templateModel = createTemplateParameters(req, res, model);
|
||||||
sendStatus(req, res, status, cache, format, templateModel);
|
sendStatus(req, res, status, cache, format, templateModel);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("Filing transfer report as record in record folder: " + destination);
|
logger.debug("Filing transfer report as record in record folder: " + destination);
|
||||||
|
|
||||||
// generate the report (will be in JSON format)
|
// generate the report (will be in JSON format)
|
||||||
report = generateHTMLTransferReport(transferNode);
|
report = generateHTMLTransferReport(transferNode);
|
||||||
|
|
||||||
// file the report as a record
|
// file the report as a record
|
||||||
NodeRef record = fileTransferReport(report, destination);
|
NodeRef record = fileTransferReport(report, destination);
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("Filed transfer report as new record: " + record);
|
logger.debug("Filed transfer report as new record: " + record);
|
||||||
|
|
||||||
// return success flag and record noderef as JSON
|
// return success flag and record noderef as JSON
|
||||||
JSONObject responseJSON = new JSONObject();
|
JSONObject responseJSON = new JSONObject();
|
||||||
responseJSON.put(RESPONSE_SUCCESS, (record != null));
|
responseJSON.put(RESPONSE_SUCCESS, (record != null));
|
||||||
if (record != null)
|
if (record != null)
|
||||||
{
|
{
|
||||||
responseJSON.put(RESPONSE_RECORD, record.toString());
|
responseJSON.put(RESPONSE_RECORD, record.toString());
|
||||||
responseJSON.put(RESPONSE_RECORD_NAME,
|
responseJSON.put(RESPONSE_RECORD_NAME,
|
||||||
(String)nodeService.getProperty(record, ContentModel.PROP_NAME));
|
(String)nodeService.getProperty(record, ContentModel.PROP_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup response
|
// setup response
|
||||||
String jsonString = responseJSON.toString();
|
String jsonString = responseJSON.toString();
|
||||||
res.setContentType(MimetypeMap.MIMETYPE_JSON);
|
res.setContentType(MimetypeMap.MIMETYPE_JSON);
|
||||||
res.setContentEncoding("UTF-8");
|
res.setContentEncoding("UTF-8");
|
||||||
res.setHeader("Content-Length", Long.toString(jsonString.length()));
|
res.setHeader("Content-Length", Long.toString(jsonString.length()));
|
||||||
|
|
||||||
// write the JSON response
|
// write the JSON response
|
||||||
res.getWriter().write(jsonString);
|
res.getWriter().write(jsonString);
|
||||||
}
|
}
|
||||||
@@ -204,14 +204,14 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
{
|
{
|
||||||
throw createStatusException(je, req, res);
|
throw createStatusException(je, req, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the file for deletion
|
// return the file for deletion
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a File containing the JSON representation of a transfer report.
|
* Generates a File containing the JSON representation of a transfer report.
|
||||||
*
|
*
|
||||||
* @param transferNode The transfer node
|
* @param transferNode The transfer node
|
||||||
* @return File containing JSON representation of a transfer report
|
* @return File containing JSON representation of a transfer report
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
@@ -224,16 +224,16 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
{
|
{
|
||||||
// get all 'transferred' nodes
|
// get all 'transferred' nodes
|
||||||
NodeRef[] itemsToTransfer = getTransferNodes(transferNode);
|
NodeRef[] itemsToTransfer = getTransferNodes(transferNode);
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Generating HTML transfer report for " + itemsToTransfer.length +
|
logger.debug("Generating HTML transfer report for " + itemsToTransfer.length +
|
||||||
" items into file: " + report.getAbsolutePath());
|
" items into file: " + report.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the writer
|
// create the writer
|
||||||
writer = new FileWriter(report);
|
writer = new FileWriter(report);
|
||||||
|
|
||||||
// use RMService to get disposition authority
|
// use RMService to get disposition authority
|
||||||
String dispositionAuthority = null;
|
String dispositionAuthority = null;
|
||||||
if (itemsToTransfer.length > 0)
|
if (itemsToTransfer.length > 0)
|
||||||
@@ -245,11 +245,19 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
dispositionAuthority = ds.getDispositionAuthority();
|
dispositionAuthority = ds.getDispositionAuthority();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// write the HTML header
|
// write the HTML header
|
||||||
writer.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n");
|
writer.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n");
|
||||||
writer.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n");
|
writer.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n");
|
||||||
writer.write("<title>Transfer Report</title></head>\n");
|
Boolean isAccession = (Boolean)this.nodeService.getProperty(transferNode, PROP_TRANSFER_ACCESSION_INDICATOR);
|
||||||
|
if (isAccession == true)
|
||||||
|
{
|
||||||
|
writer.write("<title>Accession Report</title></head>\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writer.write("<title>Transfer Report</title></head>\n");
|
||||||
|
}
|
||||||
writer.write("<style>\n");
|
writer.write("<style>\n");
|
||||||
writer.write("body { font-family: arial,verdana; font-size: 81%; color: #333; }\n");
|
writer.write("body { font-family: arial,verdana; font-size: 81%; color: #333; }\n");
|
||||||
writer.write(".records { margin-left: 20px; margin-top: 10px; }\n");
|
writer.write(".records { margin-left: 20px; margin-top: 10px; }\n");
|
||||||
@@ -258,30 +266,44 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
writer.write(".nodeName { font-weight: bold; }\n");
|
writer.write(".nodeName { font-weight: bold; }\n");
|
||||||
writer.write(".transferred-item { background-color: #eee; padding: 10px; margin-bottom: 15px; }\n");
|
writer.write(".transferred-item { background-color: #eee; padding: 10px; margin-bottom: 15px; }\n");
|
||||||
writer.write("</style>\n");
|
writer.write("</style>\n");
|
||||||
writer.write("<body>\n<h1>Transfer Report</h1>\n");
|
if (isAccession == true)
|
||||||
|
{
|
||||||
|
writer.write("<body>\n<h1>Accession Report</h1>\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writer.write("<body>\n<h1>Transfer Report</h1>\n");
|
||||||
|
}
|
||||||
|
|
||||||
writer.write("<table cellpadding=\"3\" cellspacing=\"3\">");
|
writer.write("<table cellpadding=\"3\" cellspacing=\"3\">");
|
||||||
writer.write("<tr><td class=\"label\">Transfer Date:</td><td>");
|
writer.write("<tr><td class=\"label\">Transfer Date:</td><td>");
|
||||||
Date transferDate = (Date)this.nodeService.getProperty(transferNode, ContentModel.PROP_CREATED);
|
Date transferDate = (Date)this.nodeService.getProperty(transferNode, ContentModel.PROP_CREATED);
|
||||||
writer.write(StringEscapeUtils.escapeHtml(transferDate.toString()));
|
writer.write(StringEscapeUtils.escapeHtml(transferDate.toString()));
|
||||||
writer.write("</td></tr>");
|
writer.write("</td></tr>");
|
||||||
writer.write("<tr><td class=\"label\">Transfer Location:</td><td>");
|
writer.write("<tr><td class=\"label\">Transfer Location:</td><td>");
|
||||||
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(transferNode,
|
if (isAccession == true)
|
||||||
|
{
|
||||||
|
writer.write("NARA");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(transferNode,
|
||||||
RecordsManagementModel.PROP_TRANSFER_LOCATION)));
|
RecordsManagementModel.PROP_TRANSFER_LOCATION)));
|
||||||
|
}
|
||||||
writer.write("</td></tr>");
|
writer.write("</td></tr>");
|
||||||
writer.write("<tr><td class=\"label\">Performed By:</td><td>");
|
writer.write("<tr><td class=\"label\">Performed By:</td><td>");
|
||||||
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(transferNode,
|
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(transferNode,
|
||||||
ContentModel.PROP_CREATOR)));
|
ContentModel.PROP_CREATOR)));
|
||||||
writer.write("</td></tr>");
|
writer.write("</td></tr>");
|
||||||
writer.write("<tr><td class=\"label\">Disposition Authority:</td><td>");
|
writer.write("<tr><td class=\"label\">Disposition Authority:</td><td>");
|
||||||
writer.write(dispositionAuthority != null ? StringEscapeUtils.escapeHtml(dispositionAuthority) : "");
|
writer.write(dispositionAuthority != null ? StringEscapeUtils.escapeHtml(dispositionAuthority) : "");
|
||||||
writer.write("</td></tr></table>\n");
|
writer.write("</td></tr></table>\n");
|
||||||
|
|
||||||
writer.write("<h2>Transferred Items</h2>\n");
|
writer.write("<h2>Transferred Items</h2>\n");
|
||||||
|
|
||||||
// write out HTML representation of items to transfer
|
// write out HTML representation of items to transfer
|
||||||
generateTransferItemsHTML(writer, itemsToTransfer);
|
generateTransferItemsHTML(writer, itemsToTransfer);
|
||||||
|
|
||||||
// write the HTML footer
|
// write the HTML footer
|
||||||
writer.write("</body></html>");
|
writer.write("</body></html>");
|
||||||
}
|
}
|
||||||
@@ -292,13 +314,13 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
try { writer.close(); } catch (IOException ioe) {}
|
try { writer.close(); } catch (IOException ioe) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the JSON to represent the given NodeRefs
|
* Generates the JSON to represent the given NodeRefs
|
||||||
*
|
*
|
||||||
* @param writer Writer to write to
|
* @param writer Writer to write to
|
||||||
* @param itemsToTransfer NodeRefs being transferred
|
* @param itemsToTransfer NodeRefs being transferred
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
@@ -320,10 +342,10 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
writer.write("</div>\n");
|
writer.write("</div>\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the JSON to represent the given folder.
|
* Generates the JSON to represent the given folder.
|
||||||
*
|
*
|
||||||
* @param writer Writer to write to
|
* @param writer Writer to write to
|
||||||
* @param folderNode Folder being transferred
|
* @param folderNode Folder being transferred
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
@@ -332,19 +354,19 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
writer.write("<span class=\"nodeName\">");
|
writer.write("<span class=\"nodeName\">");
|
||||||
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(folderNode,
|
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(folderNode,
|
||||||
ContentModel.PROP_NAME)));
|
ContentModel.PROP_NAME)));
|
||||||
writer.write("</span> (Unique Folder Identifier: ");
|
writer.write("</span> (Unique Folder Identifier: ");
|
||||||
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(folderNode,
|
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(folderNode,
|
||||||
RecordsManagementModel.PROP_IDENTIFIER)));
|
RecordsManagementModel.PROP_IDENTIFIER)));
|
||||||
writer.write(")\n");
|
writer.write(")\n");
|
||||||
|
|
||||||
writer.write("<div class=\"records\">\n");
|
writer.write("<div class=\"records\">\n");
|
||||||
|
|
||||||
// NOTE: we don't expect any nested folder structures so just render
|
// NOTE: we don't expect any nested folder structures so just render
|
||||||
// the records contained in the folder.
|
// the records contained in the folder.
|
||||||
|
|
||||||
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(folderNode,
|
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(folderNode,
|
||||||
ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
|
||||||
for (ChildAssociationRef child : assocs)
|
for (ChildAssociationRef child : assocs)
|
||||||
{
|
{
|
||||||
@@ -354,13 +376,13 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
generateTransferRecordHTML(writer, childRef);
|
generateTransferRecordHTML(writer, childRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.write("\n</div>\n");
|
writer.write("\n</div>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the JSON to represent the given record.
|
* Generates the JSON to represent the given record.
|
||||||
*
|
*
|
||||||
* @param writer Writer to write to
|
* @param writer Writer to write to
|
||||||
* @param recordNode Record being transferred
|
* @param recordNode Record being transferred
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
@@ -370,29 +392,29 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
{
|
{
|
||||||
writer.write("<div class=\"record\">\n");
|
writer.write("<div class=\"record\">\n");
|
||||||
writer.write(" <span class=\"nodeName\">");
|
writer.write(" <span class=\"nodeName\">");
|
||||||
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(recordNode,
|
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(recordNode,
|
||||||
ContentModel.PROP_NAME)));
|
ContentModel.PROP_NAME)));
|
||||||
writer.write("</span> (Unique Record Identifier: ");
|
writer.write("</span> (Unique Record Identifier: ");
|
||||||
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(recordNode,
|
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(recordNode,
|
||||||
RecordsManagementModel.PROP_IDENTIFIER)));
|
RecordsManagementModel.PROP_IDENTIFIER)));
|
||||||
writer.write(")");
|
writer.write(")");
|
||||||
|
|
||||||
if (this.nodeService.hasAspect(recordNode, RecordsManagementModel.ASPECT_DECLARED_RECORD))
|
if (this.nodeService.hasAspect(recordNode, RecordsManagementModel.ASPECT_DECLARED_RECORD))
|
||||||
{
|
{
|
||||||
Date declaredOn = (Date)this.nodeService.getProperty(recordNode, RecordsManagementModel.PROP_DECLARED_AT);
|
Date declaredOn = (Date)this.nodeService.getProperty(recordNode, RecordsManagementModel.PROP_DECLARED_AT);
|
||||||
writer.write(" declared by ");
|
writer.write(" declared by ");
|
||||||
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(recordNode,
|
writer.write(StringEscapeUtils.escapeHtml((String)this.nodeService.getProperty(recordNode,
|
||||||
RecordsManagementModel.PROP_DECLARED_BY)));
|
RecordsManagementModel.PROP_DECLARED_BY)));
|
||||||
writer.write(" on ");
|
writer.write(" on ");
|
||||||
writer.write(StringEscapeUtils.escapeHtml(declaredOn.toString()));
|
writer.write(StringEscapeUtils.escapeHtml(declaredOn.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.write("\n</div>\n");
|
writer.write("\n</div>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Files the given transfer report as a record in the given record folder.
|
* Files the given transfer report as a record in the given record folder.
|
||||||
*
|
*
|
||||||
* @param report Report to file
|
* @param report Report to file
|
||||||
* @param destination The destination record folder
|
* @param destination The destination record folder
|
||||||
* @return NodeRef of the created record
|
* @return NodeRef of the created record
|
||||||
@@ -401,17 +423,17 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
{
|
{
|
||||||
ParameterCheck.mandatory("report", report);
|
ParameterCheck.mandatory("report", report);
|
||||||
ParameterCheck.mandatory("destination", destination);
|
ParameterCheck.mandatory("destination", destination);
|
||||||
|
|
||||||
NodeRef record = null;
|
NodeRef record = null;
|
||||||
|
|
||||||
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);
|
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);
|
||||||
properties.put(ContentModel.PROP_NAME, report.getName());
|
properties.put(ContentModel.PROP_NAME, report.getName());
|
||||||
|
|
||||||
// file the transfer report as an undeclared record
|
// file the transfer report as an undeclared record
|
||||||
record = this.nodeService.createNode(destination,
|
record = this.nodeService.createNode(destination,
|
||||||
ContentModel.ASSOC_CONTAINS,
|
ContentModel.ASSOC_CONTAINS,
|
||||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
|
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI,
|
||||||
QName.createValidLocalName(report.getName())),
|
QName.createValidLocalName(report.getName())),
|
||||||
ContentModel.TYPE_CONTENT, properties).getChildRef();
|
ContentModel.TYPE_CONTENT, properties).getChildRef();
|
||||||
|
|
||||||
// Set the content
|
// Set the content
|
||||||
@@ -419,10 +441,10 @@ public class TransferReportPost extends BaseTransferWebScript
|
|||||||
writer.setMimetype(MimetypeMap.MIMETYPE_HTML);
|
writer.setMimetype(MimetypeMap.MIMETYPE_HTML);
|
||||||
writer.setEncoding("UTF-8");
|
writer.setEncoding("UTF-8");
|
||||||
writer.putContent(report);
|
writer.putContent(report);
|
||||||
|
|
||||||
// file the node as a record
|
// file the node as a record
|
||||||
this.rmActionService.executeRecordsManagementAction(record, FILE_ACTION);
|
this.rmActionService.executeRecordsManagementAction(record, FILE_ACTION);
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user