mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-783: File destruction report action (part one)
* ReportService added ... will be used to consolidate the various reports withing RM (specifically those needed for DOD complicance) * Base and declarative implementations of report generators added * Destruction report configured with place holder implementation (still need to do name generation, meta-data and final template) * Report model added, with destructionReport type defined * FileDestructionReport capability added (and capability patch bean updated) * Repository action added to file destruction report * UI configured to show 'file destruction report' action .. (creates a report and files it as an unfiled record as the destruction report type) * fixed up destruction capabilities and actions (capability to destroy record regardless of its current dispostion state did not work) * added "AtLeastOne" composite capability condition * TODO destruction report template, name and meta-data generation * TODO patch to add report template structure to rm data dictionary area * TODO start refactor of existing reports including transfer, accession, userRights, filePlan and audit!! git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@52562 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -32,18 +32,21 @@ import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
*
|
||||
* Parameter processor component
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
public class ParameterProcessorComponent
|
||||
{
|
||||
/** regex used to parse parameters */
|
||||
private static final String REG_EX = "\\$\\{([^\\$\\{]+)\\}";
|
||||
|
||||
/** registry of parameter processors */
|
||||
private Map<String, ParameterProcessor> processors = new HashMap<String, ParameterProcessor>(5);
|
||||
|
||||
/**
|
||||
* Register parameter processor
|
||||
*
|
||||
* @param processor
|
||||
*/
|
||||
@@ -70,41 +73,59 @@ public class ParameterProcessorComponent
|
||||
{
|
||||
if (DataTypeDefinition.TEXT.equals(def.getType()) == true)
|
||||
{
|
||||
// get the parameter value
|
||||
String parameterValue = (String)entry.getValue();
|
||||
|
||||
// match the substitution pattern
|
||||
Pattern patt = Pattern.compile(REG_EX);
|
||||
Matcher m = patt.matcher(parameterValue);
|
||||
StringBuffer sb = new StringBuffer(parameterValue.length());
|
||||
|
||||
while (m.find())
|
||||
{
|
||||
String text = m.group(1);
|
||||
|
||||
// lookup parameter processor to use
|
||||
ParameterProcessor processor = lookupProcessor(text);
|
||||
if (processor == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("A parameter processor has not been found for the substitution string " + text);
|
||||
}
|
||||
else
|
||||
{
|
||||
// process each substitution value
|
||||
text = processor.process(text, actionedUponNodeRef);
|
||||
}
|
||||
|
||||
// append new value
|
||||
m.appendReplacement(sb, Matcher.quoteReplacement(text));
|
||||
}
|
||||
m.appendTail(sb);
|
||||
|
||||
// set the updated parameter value
|
||||
ruleItem.setParameterValue(parameterName, sb.toString());
|
||||
ruleItem.setParameterValue(parameterName, process(parameterValue, actionedUponNodeRef));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the value for substitution within the context of the provided node.
|
||||
*
|
||||
* @param value value
|
||||
* @param nodeRef node reference
|
||||
* @return String resulting value
|
||||
*/
|
||||
public String process(String value, NodeRef nodeRef)
|
||||
{
|
||||
// match the substitution pattern
|
||||
Pattern patt = Pattern.compile(REG_EX);
|
||||
Matcher m = patt.matcher(value);
|
||||
StringBuffer sb = new StringBuffer(value.length());
|
||||
|
||||
while (m.find())
|
||||
{
|
||||
String text = m.group(1);
|
||||
|
||||
// lookup parameter processor to use
|
||||
ParameterProcessor processor = lookupProcessor(text);
|
||||
if (processor == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("A parameter processor has not been found for the substitution string " + text);
|
||||
}
|
||||
else
|
||||
{
|
||||
// process each substitution value
|
||||
text = processor.process(text, nodeRef);
|
||||
}
|
||||
|
||||
// append new value
|
||||
m.appendReplacement(sb, Matcher.quoteReplacement(text));
|
||||
}
|
||||
m.appendTail(sb);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up parameter processor
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private ParameterProcessor lookupProcessor(String value)
|
||||
{
|
||||
ParameterProcessor result = null;
|
||||
|
Reference in New Issue
Block a user