Expand my Community achievements bar.

SOLVED

DAM Asset Upload Workflow status

Avatar

Level 10

Hello All,

Is there  a way to identify the workflow status of the asset, i.e> if renditions have been generated etc. I tried uploading an asset using assetManager.createAsset(), passing an inputstream, and then tried to identify the workflow status using the 

WorkflowStatus wfStatus=assetResource.adaptTo(WorkflowStatus.class);
    boolean isinWF = wfStatus.isInRunningWorkflow(false);  

this always returned false.

I tried to use, thread.sleep(5000), but looks like thread.sleep(10000) works, but i want to use thread.sleep based on the workflow status.

Scenario, After successfully uploading the asset if the asset's hash value is different since the first upload, then assetmanager.createAsset should upload the new asset with the renditions displayed,

Please help

1 Accepted Solution

Avatar

Correct answer by
Level 10

NitroHazeDev wrote...

Yes Sham i pointed it to /jcr:contnt/renditions/original and got the status though gotta wait until the workflow kicks in, got some help on that, and that works for the initial upload,  

But now for the second upload, with same name but different hash, if the asset hash value is different , i wanted to have a condition check with workflow status  to check if workflow is complete, since the renditions would already be present by he first upload and can't think of a way to figure out if the renditions for the second asset upload is complete or not.

Now using just isInWorkflow status, i tried recreating the asset, but now for some reason it complains with "Version Exception Node is checked in", cannot create renditions for the asset.

Appreciate advice

 

What happened with first approach ? Is assetResource pointing to right resource?   This should solve your problem.

Alternate how about custom workflow step added to dam_update_ workflow?

View solution in original post

7 Replies

Avatar

Level 10

Usage looks right to me. Make sure assetResource pointing to right resource.  Example at /libs/cq/workflow/components/inbox/list/json.jsp

alternative though not recommended you can check at jcr node <path>/jcr:content/rendition/<name>

Avatar

Level 10

Yes Sham i pointed it to /jcr:contnt/renditions/original and got the status though gotta wait until the workflow kicks in, got some help on that, and that works for the initial upload,  

But now for the second upload, with same name but different hash, if the asset hash value is different , i wanted to have a condition check with workflow status  to check if workflow is complete, since the renditions would already be present by he first upload and can't think of a way to figure out if the renditions for the second asset upload is complete or not.

Now using just isInWorkflow status, i tried recreating the asset, but now for some reason it complains with "Version Exception Node is checked in", cannot create renditions for the asset.

Appreciate advice

Avatar

Correct answer by
Level 10

NitroHazeDev wrote...

Yes Sham i pointed it to /jcr:contnt/renditions/original and got the status though gotta wait until the workflow kicks in, got some help on that, and that works for the initial upload,  

But now for the second upload, with same name but different hash, if the asset hash value is different , i wanted to have a condition check with workflow status  to check if workflow is complete, since the renditions would already be present by he first upload and can't think of a way to figure out if the renditions for the second asset upload is complete or not.

Now using just isInWorkflow status, i tried recreating the asset, but now for some reason it complains with "Version Exception Node is checked in", cannot create renditions for the asset.

Appreciate advice

 

What happened with first approach ? Is assetResource pointing to right resource?   This should solve your problem.

Alternate how about custom workflow step added to dam_update_ workflow?

Avatar

Level 10

Sham HC wrote...

NitroHazeDev wrote...

Yes Sham i pointed it to /jcr:contnt/renditions/original and got the status though gotta wait until the workflow kicks in, got some help on that, and that works for the initial upload,  

But now for the second upload, with same name but different hash, if the asset hash value is different , i wanted to have a condition check with workflow status  to check if workflow is complete, since the renditions would already be present by he first upload and can't think of a way to figure out if the renditions for the second asset upload is complete or not.

Now using just isInWorkflow status, i tried recreating the asset, but now for some reason it complains with "Version Exception Node is checked in", cannot create renditions for the asset.

Appreciate advice

 

What happened with first approach ? Is assetResource pointing to right resource?   This should solve your problem.

Alternate how about custom workflow step added to dam_update_ workflow?

 

So the first approach, used the payloadResource- path to the original file , and then obtained the status having a thread.sleep for a while, that solved the problem, you are right,

We are actually parsing an XML which contains image references along with other data and we are persisting all in AEM, so asset upload and versioning is also a part, hence if on second upload if the sha1 or hash values don't match then upload the new asset streaming it and generate renditions, i don't want to delete the old asset since it has version history associated to it. Once streamed i have to upversion the asset

Avatar

Level 10

NitroHazeDev wrote...

Sham HC wrote...

NitroHazeDev wrote...

Yes Sham i pointed it to /jcr:contnt/renditions/original and got the status though gotta wait until the workflow kicks in, got some help on that, and that works for the initial upload,  

But now for the second upload, with same name but different hash, if the asset hash value is different , i wanted to have a condition check with workflow status  to check if workflow is complete, since the renditions would already be present by he first upload and can't think of a way to figure out if the renditions for the second asset upload is complete or not.

Now using just isInWorkflow status, i tried recreating the asset, but now for some reason it complains with "Version Exception Node is checked in", cannot create renditions for the asset.

Appreciate advice

 

What happened with first approach ? Is assetResource pointing to right resource?   This should solve your problem.

Alternate how about custom workflow step added to dam_update_ workflow?

 

So the first approach, used the payloadResource- path to the original file , and then obtained the status having a thread.sleep for a while, that solved the problem, you are right,

We are actually parsing an XML which contains image references along with other data and we are persisting all in AEM, so asset upload and versioning is also a part, hence if on second upload if the sha1 or hash values don't match then upload the new asset streaming it and generate renditions, i don't want to delete the old asset since it has version history associated to it. Once streamed i have to upversion the asset

 


When you upload an asset with same name and different hash,  You will have option to 'Create Version'  or replace.  If you use create version nothing will be deleted.   Hash comes to picture during internal storage & workflow will not have any effect since payload path is same. The workflow status api will work & rendition will automatically of new one.  You do not need any custom implementation here and happens out of the box. Not able to see the picture of custom implementation trying to implement.  File a daycare ticket if above is not happening.  

Avatar

Level 10

So,Here i am programmatically tried to upload bulk assets(not using the GUI), and used assetManager.createAsset(), but what happens is that few assets get the renditions complete but the rest don't. assetManager.createAsset works for few assets but assets in count of 10 , few have updated renditions and few don't

Avatar

Level 10

NitroHazeDev wrote...

So,Here i am programmatically tried to upload bulk assets(not using the GUI), and used assetManager.createAsset(), but what happens is that few assets get the renditions complete but the rest don't. assetManager.createAsset works for few assets but assets in count of 10 , few have updated renditions and few don't

 


You should see in logs why rendition was not created