Package com.adobe.acs.commons.util
Interface WorkflowHelper
@ProviderType
public interface WorkflowHelper
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA simple tuple which contains a resolved asset and a resource resolver, so that the resource resolver can later be closed. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionString[]buildArguments(com.day.cq.workflow.metadata.MetaDataMap metaData) Build an arguments array from the metadata map.getAssetFromPayload(com.day.cq.workflow.exec.WorkItem item, com.day.cq.workflow.WorkflowSession workflowSession) Resolve the asset for the workflow's payload and return it, along with a resolved resource resolver.getExtension(String mimetype) Return the extension corresponding to the mime type.org.apache.sling.api.resource.ResourcegetPageOrAssetResource(org.apache.sling.api.resource.ResourceResolver resourceResolver, String path) Derives either an Asset or Page resource (dam:Asset or cq:Page) that the provided path belongs to.doublegetQuality(double base, String qualityStr) Parse the provided quality string, from 1 to 100, and apply it to the base.org.apache.sling.api.resource.ResourceResolvergetResourceResolver(com.adobe.granite.workflow.WorkflowSession workflowSession) Convenience method for getting a ResourceResolver object from a Granite based Workflow Process.org.apache.sling.api.resource.ResourceResolvergetResourceResolver(com.day.cq.workflow.WorkflowSession workflowSession) Convenience method for getting a ResourceResolver object from a CQ based Workflow Process.getValuesFromArgs(String name, String[] args) Parse a workflow args string in the formaat >name<:>value<,>name<:>value< and extract the values with the specified name.booleanisPathTypedPayload(com.adobe.granite.workflow.exec.WorkflowData workflowData) Method for Granite Workflow APIs.booleanisPathTypedPayload(com.day.cq.workflow.exec.WorkflowData workflowData) Method for CQ Workflow APIs.
-
Field Details
-
PROCESS_ARGS
- See Also:
-
TYPE_JCR_PATH
- See Also:
-
PAYLOAD_TYPE_JCR_PATH
- See Also:
-
-
Method Details
-
getResourceResolver
org.apache.sling.api.resource.ResourceResolver getResourceResolver(com.adobe.granite.workflow.WorkflowSession workflowSession) Convenience method for getting a ResourceResolver object from a Granite based Workflow Process.- Parameters:
workflowSession- the granite workflow session- Returns:
- the associated ResourceResolver object
-
getResourceResolver
org.apache.sling.api.resource.ResourceResolver getResourceResolver(com.day.cq.workflow.WorkflowSession workflowSession) throws org.apache.sling.api.resource.LoginException Convenience method for getting a ResourceResolver object from a CQ based Workflow Process.- Parameters:
workflowSession- the CQ workflow session- Returns:
- the associated ResourceResolver object
- Throws:
org.apache.sling.api.resource.LoginException
-
getAssetFromPayload
WorkflowHelper.AssetResourceResolverPair getAssetFromPayload(com.day.cq.workflow.exec.WorkItem item, com.day.cq.workflow.WorkflowSession workflowSession) Resolve the asset for the workflow's payload and return it, along with a resolved resource resolver.- Parameters:
item- the workflow workitemworkflowSession- the workflow session- Returns:
- a tuple containing the asset and resource resolver or null if the asset cannot be resolved
-
getExtension
Return the extension corresponding to the mime type.- Parameters:
mimetype- the mimetype- Returns:
- the corresponding extension
-
buildArguments
Build an arguments array from the metadata map.- Parameters:
metaData- the metadata maps- Returns:
- the values array
-
getValuesFromArgs
Parse a workflow args string in the formaat >name<:>value<,>name<:>value< and extract the values with the specified name.- Parameters:
name- the argument nameargs- the arguments array- Returns:
- the values list
-
getQuality
Parse the provided quality string, from 1 to 100, and apply it to the base. Allows for a constant scale to be used and applied to different image types which support different quality scales.- Parameters:
base- the maximal quality valuequalityStr- the string to parse- Returns:
- a usable quality value
-
getPageOrAssetResource
org.apache.sling.api.resource.Resource getPageOrAssetResource(org.apache.sling.api.resource.ResourceResolver resourceResolver, String path) Derives either an Asset or Page resource (dam:Asset or cq:Page) that the provided path belongs to. Example: When path = /content/dam/foo.png/jcr:content/renditions/original, this method will return the resource at /content/dam/foo.png Example: When path = /content/site/bar/jcr:content/root/text, this method will return the resource at /content/site/bar- Parameters:
resourceResolver- the resourceResolver to resolve the path to the appropriate resourcepath- the path to resolve to an Asset or Page- Returns:
- the resource representing the resolver dam:Asset or cq:Page, if neither can be resolved, null is returned.
-
isPathTypedPayload
boolean isPathTypedPayload(com.day.cq.workflow.exec.WorkflowData workflowData) Method for CQ Workflow APIs.- Parameters:
workflowData- the Workflow data- Returns:
- true of the WorkflowData payload is of type JCR_PATH
-
isPathTypedPayload
boolean isPathTypedPayload(com.adobe.granite.workflow.exec.WorkflowData workflowData) Method for Granite Workflow APIs.- Parameters:
workflowData- the Workflow data- Returns:
- true of the WorkflowData payload is of type JCR_PATH
-