execute() is a default function and gets called automatically. Now as you mentioned that you have extended CreateThumbnailProcess class and want to run execute() from parent then you should do super.execute() instead creating the instance because in that way it always calls the child implementation if available (basic java rule).
Now i also want to suggest if you have not doing anything extra in execute() in you child class just calling the super.execute() then you need not require to override it in your child class again.
I hope it clarifies your doubt.
I'm not extending the CreateThumbnailProcess. The workflow process which I referred to as 'my workflow process' in my post is a general workflow process that is completely independent of the CreateThumbnailProcess.
1 person found this helpful
So couple of things which you can try out to check what's causing the issue.
1. If you comment
//proc.execute(item, session, args);
does it still causing the same issue. If yes, then problem would be somewhere in your workflow call or process execution which calling this process recurring (i can assume as not see the whole code) and, if not, then this call is only causing the issue which is pretty wierd (looking into possibility and will update you) if you do not have extended the same process as you mentioned above.
2. Not sure calling another process like this is correct way to do it because CreateThumbnailProcess automatically gets called in cq when image object created in system to create default renditions.
To answer you other question.
creating extra thumbnail apart from default renditions you should have to create workflow process as you already did but extend AbstractAssetWorkflowProcess (dont call CreateThumbnailProcess.execute() because there is default workflow process already setup.) and below code in execute method
Asset asset = getAssetFromPayload(workItem, workflowSession.getSession());
oriIs = asset.getOriginal().adaptTo(Node.class)
.getProperty(JcrConstants.JCR_CONTENT + "/" + JcrConstants.JCR_DATA).getBinary().getStream();
asset.addRendition(rendition, oriIs, mimetype); //mimetype and rendition you have to create it as an object based on your requirement.
also check http://dev.day.com/docs/en/cq/current/javadoc/com/day/cq/dam/core/process/CreateThumbnailP rocess.html for more detail.
Let me know for more information.
Thanks a lot for following up the problem!
1. If I comment out the line that you have mentioned, then there is no error which implies that the problem is with the execute() method of the CreateThumbnailProcess.
2. Yes, even I'm quite skeptical about the approach of calling the execute() method of another workflow process directly from within a workflow process.
I am yet to try out the code snippet that you have mentioned but I have two questions in my mind regarding the code snippet
1. How to set a document/file that I have as the workflow payload asset? Is there something like a setAssetInPayload() method?
2. If I'm creating the rendition as mentioned in your code snippet, where will it be located? I want the renditions to sit on my page. Is that possible?