Created
September 30, 2016 20:50
-
-
Save davidtruchet/265068527c8410fdde23f51491ab4af7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected Asset getAssetFromPayload(WorkItem item, Session session) { | |
Asset asset = null; | |
if (item.getWorkflowData().getPayloadType().equals("JCR_PATH")) { | |
String path = item.getWorkflowData().getPayload().toString(); | |
Resource resource = getResourceResolver(session).getResource(path); | |
if (null != resource) | |
asset = DamUtil.resolveToAsset(resource); | |
else { | |
log.error("getAssetFromPaylod: asset [{}] in payload of workflow [{}] does not exist.", path, | |
item.getWorkflow().getId()); | |
} | |
} | |
return asset; | |
} | |
protected ResourceResolver getResourceResolver(Session session) { | |
return this.jcrResolverFactory.getResourceResolver(session); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment