Skip to main content
3 of 4
added 409 characters in body; edited title
Anthony
  • 36.4k
  • 51
  • 185
  • 290

How to access the asset in workflow process step

I am trying to write a workflow process step for the DAM update asset such that the uploaded asset will be sent to an external service that will modify the asset and then the modified asset can be sent to the Metadata extraction step. So I've added my process step to the DAM update asset like this:

enter image description here

And my code looks like this so far:

public void execute(WorkItem item, WorkflowSession wfsession,MetaDataMap args) throws WorkflowException { try { log.info("Here in execute method"); log.info("Here2 in execute method"); //ensure that the execute method is invoked final Map<String, Object> map = new HashMap<String, Object>(); map.put( "user.jcr.session", wfsession.getSession()); ResourceResolver rr = resolverFactory.getResourceResolver(map); String path = item.getWorkflowData().getPayload().toString(); log.info("Here2 path: " + path); Resource resource = rr.getResource(path); Asset asset = resource.adaptTo(Asset.class); log.info("Here2 asset: " + asset); } catch (Exception e) { log.info("Here Error"); e.printStackTrace(); } } 

This is what I see in the logs when I upload an asset:

Here2 in execute method Here2 path: /content/dam/photo1.JPG/jcr:content/renditions/original Here2 asset: null

Question

  • Why is the asset coming to be null?

  • How can I send the asset to the external service? Is there a way I can get the absolute path to where the asset is saved on the file system?

  • Once the external service modifies the asset, what should I do so that the Metadata extraction step reads the modified asset instead of the original?

Anthony
  • 36.4k
  • 51
  • 185
  • 290