Skip to main content
deleted 69 characters in body
Source Link
Anthony
  • 36.4k
  • 51
  • 185
  • 290

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); Assetlog.info("Here2 assetresource: " + resource);  InputStream is = resource.adaptTo(AssetInputStream.class); log.info("Here2 assetassets IS: " + assetis); } 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?

    My external service has an API accepting requests over HTTP. How should I send over the asset to the external service?
  • 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?

    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?

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?

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("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); log.info("Here2 resource: " + resource);  InputStream is = resource.adaptTo(InputStream.class); log.info("Here2 assets IS: " + is); } 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

  • My external service has an API accepting requests over HTTP. How should I send over the asset to the external service?
  • 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?
added 409 characters in body; edited title
Source Link
Anthony
  • 36.4k
  • 51
  • 185
  • 290

How to sendaccess the asset to an external service?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

  • 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?

    Why is the asset coming to be null?

  • 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?

    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?

How to send the asset to an external service?

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"); 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(); Resource resource = rr.getResource(path); Asset asset = resource.adaptTo(Asset.class); } catch (Exception e) { log.info("Here Error"); e.printStackTrace(); } } 

Question

  • 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?

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?

deleted 43 characters in body
Source Link
Anthony
  • 36.4k
  • 51
  • 185
  • 290

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"); //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(); Resource resource = rr.getResource(path); Asset asset = resource.adaptTo(Asset.class); } catch (Exception e) { log.info("Here Error"); e.printStackTrace(); } } 

Question

  • 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?

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"); //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(); Resource resource = rr.getResource(path); Asset asset = resource.adaptTo(Asset.class); } catch (Exception e) { log.info("Here Error"); e.printStackTrace(); } } 

Question

  • 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?

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"); 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(); Resource resource = rr.getResource(path); Asset asset = resource.adaptTo(Asset.class); } catch (Exception e) { log.info("Here Error"); e.printStackTrace(); } } 

Question

  • 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?
Source Link
Anthony
  • 36.4k
  • 51
  • 185
  • 290
Loading