Class TemplateResourceProcessor
java.lang.Object
org.alfresco.repo.virtual.template.TemplateResourceProcessor
- All Implemented Interfaces:
ResourceProcessor<VirtualFolderDefinition>
public class TemplateResourceProcessor
extends Object
implements ResourceProcessor<VirtualFolderDefinition>
Executes JavaScript virtual folders templates ensuring their required context and the
VirtualFolderDefinition post execution JSON map result unmarshalling.- Author:
- Bogdan Horje
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected FilingRuleasFilingRule(VirtualContext context, Object filing) Creates a filing rule based on the criteria (path, classification: type, aspects) given in the template.protected VirtualQueryasVirtualQuery(VirtualContext context, Map<String, Object> search) Creates a query based on the details: language, store, query statement given in the template.protected VirtualFolderDefinitionasVirtualStructure(VirtualContext context, Map<String, Object> result) Creates aVirtualFolderDefinitionthat represents the structure of the virtual folder.createScriptParameters(VirtualContext context) Adds the script virtual context to the parameters of the context.process(ClasspathResource classpath) Processes the JavaScript template given by theClasspathResourceand creates aVirtualFolderDefinition(composite) structure that represents the virtual folder.process(RepositoryResource repositoryResource) Processes the JavaScript template given by theRepositoryResourceand creates aVirtualFolderDefinition(composite) structure that represents the virtual folder.Processes a resource of typeResource.
-
Constructor Details
-
TemplateResourceProcessor
-
-
Method Details
-
process
Description copied from interface:ResourceProcessorProcesses a resource of typeResource.- Specified by:
processin interfaceResourceProcessor<VirtualFolderDefinition>- Parameters:
resource- aResourceto be processed.- Returns:
- generic parameter R that implementors are parameterised with.
- Throws:
ResourceProcessingError
-
process
Processes the JavaScript template given by theClasspathResourceand creates aVirtualFolderDefinition(composite) structure that represents the virtual folder.- Specified by:
processin interfaceResourceProcessor<VirtualFolderDefinition>- Parameters:
A-ClasspathResourcereference.- Returns:
- A
VirtualFolderDefinitionreference that represents the structure (tree of nodes) of the virtual folder. - Throws:
ResourceProcessingError
-
process
public VirtualFolderDefinition process(RepositoryResource repositoryResource) throws ResourceProcessingError Processes the JavaScript template given by theRepositoryResourceand creates aVirtualFolderDefinition(composite) structure that represents the virtual folder.- Specified by:
processin interfaceResourceProcessor<VirtualFolderDefinition>- Parameters:
A-RepositoryResourcereference.- Returns:
- A
VirtualFolderDefinitionreference that represents the structure (tree of nodes) of the virtual folder. - Throws:
ResourceProcessingError
-
createScriptParameters
protected Map<String,Object> createScriptParameters(VirtualContext context) throws ActualEnvironmentException Adds the script virtual context to the parameters of the context.- Parameters:
context- AVirtualContextreference.- Returns:
- A map of context parameters.
- Throws:
ActualEnvironmentException
-
asFilingRule
protected FilingRule asFilingRule(VirtualContext context, Object filing) throws ResourceProcessingError Creates a filing rule based on the criteria (path, classification: type, aspects) given in the template.- Parameters:
context- The context in which the virtualization process takes place.filing- A map containing the filing criteria used to create the rule.- Returns:
- A
FilingRulereference. - Throws:
ResourceProcessingError
-
asVirtualQuery
protected VirtualQuery asVirtualQuery(VirtualContext context, Map<String, Object> search) throws ResourceProcessingErrorCreates a query based on the details: language, store, query statement given in the template.- Parameters:
context- The context in which the virtualization process takes place.search- A map containing the details that define the query: language, store, query statement.- Returns:
- an
AlfrescoVirtualQueryreference. - Throws:
ResourceProcessingError
-
asVirtualStructure
protected VirtualFolderDefinition asVirtualStructure(VirtualContext context, Map<String, Object> result) throws ResourceProcessingErrorCreates aVirtualFolderDefinitionthat represents the structure of the virtual folder.- Parameters:
context- The context in which the virtualization process takes place.result- A map containing the details that define the virtual entries.- Returns:
- a
VirtualFolderDefinitionreference. - Throws:
ResourceProcessingError
-