Interface DynamicScriptResolverService


  • @ConsumerType
    public interface DynamicScriptResolverService
    Provides hooks for injecting additional MCP process definitions. For example, definitions that are not written in Java as OSGi services. Identifier is up to the resolver to determine, examples might be a unique name or a path. It is recommended to use something as specific as JCR path if at all possible for identifier.
    • Method Detail

      • getDetectedProcesDefinitionFactories

        Map<String,​ProcessDefinitionFactory> getDetectedProcesDefinitionFactories​(org.apache.sling.api.resource.ResourceResolver rr)
        Prepare a list of custom process definition factory instances
        Parameters:
        rr - Resource resolver to use (note this will usually be the MCP service user, so make sure that doesn't cause ACL issues)
        Returns:
        Map of String (Path or identifier) -> ProessDefinitionFactory instances
      • getScriptByIdentifier

        default ProcessDefinitionFactory getScriptByIdentifier​(org.apache.sling.api.resource.ResourceResolver rr,
                                                               String identifier)
        Given an identifier, look up the process definition factory. The default definition should be sufficient for most uses but can be overridden if needed.
        Parameters:
        rr - Resource resolver to use (note this will usually be the MCP service user, so make sure that doesn't cause ACL issues)
        identifier - JCR path or other applicable script identifier
        Returns:
        PrccessDefinitionFactory if available, null otherwise.
      • geFieldComponentsForProcessDefinition

        Map<String,​FieldComponent> geFieldComponentsForProcessDefinition​(String identifier,
                                                                               org.apache.sling.api.scripting.SlingScriptHelper sling)
                                                                        throws ReflectiveOperationException
        Generate list of components needed to build the start dialog of a process
        Parameters:
        identifier - JCR path or other applicable script identifier
        sling - Sling helper
        Returns:
        Map of String (variable name) -> FieldComponent for process if it exists (can be an empty map), null if process definition doesn't exist.
        Throws:
        ReflectiveOperationException - If needed because reflection is used to generate this list