CQ Workflow, purpose of "Handler Advance"? - aem

I am working with some custom WorkflowProcess classes in Adobe CQ 5.4
When I configure the workflow step as part of my workflow model, there is an checkbox entitled "Handler Advance, Check if your handler will advance to the next step"
My Java classes do in fact progress the workflow (and sometimes terminate the workflow).
i.e.
workflowSession.complete(workItem, routes.get(0));
workflowSession.terminateWorkflow(workItem.getWorkflow());
Given that this custom WorkflowProcess performs these operations, I think that I should be checking the "Handler Advance" option.
I was hoping for a better explanation on this option.
Thanks!

The handler advance option when true (checked), will advance the workflow to the next step after the current process is done with its execution.
In case the handler advance option is false (unchecked), the process script has to take care of advancing the workflow to the next step. In case the script doesn't handle this, the workflow would remain in the running state without proceeding further from the current step.
Since your custom workflow process progresses the workflow to the next step, it doesn't make any difference having the handler advanced option checked or unchecked.

Related

Queue of workflows' launchers

I am working on AEM6, but this problem is also applicable to previous version of the platform.
I have noticed that default workflows "DAM Update Asset" and "DAM Parse Word Documents" are started by launchers /etc/workflow/launcher/config/update_asset_create and /etc/workflow/launcher/config/parse_word_docx_create. These workflows are always started in the same order (parse word docx is started after update asset create). I wanted to implement similar functionality, so I created my own workflow with one process and then created launcher very similar to docx parser launcher.
The problem is that my launcher starts before default DAM Update Asset workflow. Is there any way to set an order of the launchers?
I would suggest trying to avoid depending on this behavior. Instead, why not invoke your processes as part of the DAM Update Asset workflow?
You Can use the Process Step inside one workflow, and on the basis of completion of one task you can invoke other workflow from inside it. Please Refer this Answer : CQ5 Programmatically Run a Workflow .
Thanks

Eclipse: how to avoid blocking user input of frequent saves with build on save enabled?

I have activated an option "Build on resource save". My typing habits is to save the code every few seconds and whenever previous build is not complete before I save again, I get a window like this:
Basically Eclipse is forcing me to wait before it will finish the previous build and start a new one. Can I somehow configure it, so that it will start new build automatically once the previous is completed and will not block my input? It is okay if it will incorporate multiple consequent saves of the code.
Essentially, my solution was not to build on save. As scottb mentioned in comments it is too complicated to actually decide when it is save to build and when it is not.

Passing an object as a parameter to a command

I Have two commands in my eclipse plugin. (Upload and Run). They can be invoked by the user one after another. So it only makes sense to invoke Run after the upload command is done.
Since the upload command possibly takes some time it will schedule a WorkspaceJob for actual execution. And returns right after it scheduled the job.
What i like to do know is to add another command called "Upload and Run" which (suprisingly) is supposed to first upload and then run the selection. Therefore it must be notified when the WorkspaceJob started in the Upload command has finished.
So i'd like to parameterize the command with an additional IJobChangeListener which it will add when the WorkspaceJob is scheduled.
Unfortunately it seems to me like it's only possible to pass Strings as parameters to a command or Objects that can be converted to Strings easily. However a Listener like this cannot be passed as a String.
How can i provide the command with such an Listener Object?
Is there maybe an other way of providing the Listener Object to the Command (other than passing it as a prameter) that i didn't think of?
Since your "Upload and Run" action is going to start the upload, you could then just schedule another job for the Run-action which simply calls join() on the workspace job-reference you have before doing anything else.
Update:
I think you're running into a limitation of the framework there. The commands are intended as an abstraction on the user-interface, not as an abstraction of getting things done. I'd simply go with reusing the Java code that you have, and directly invoke the code for both actions from the button for the joint functionality.

Can eclipse notify me when a task has finished running?

I am often stuck twiddling my thumbs for a couple minutes while eclipse cleans, builds, or loads my projects. It would be nice if eclipse could notify me with a beep when the last task in the Progress view has finished running, so I can stop reading the internet and get back to work. Is there a setting or plugin that does this?
Edit: I tried adapting the plugin template that nonty provided below, which adds a listener to the JobManager. I tried implementing done() to beep only when the job change event's name contains "Building workspace," as that is the task that usually takes the longest in my setup. Exasperatingly, the task that builds the workspace never sends a done() call, just scheduled() and aboutToRun() calls. Any other ideas?
There are no preference for this - yet.
The JobManager have the needed API to support this functionality...
EDIT: I have constructed and attached a very simple plug-in that will beep for every job that terminates. That turns out to be rather often :-) . You can modify it to filter out all the false positives, e.g. by getPriority() and getName(). Also you can make the listener play a tune, popup a message (don't!) or whatever...
See jobnotifier.zip.
UPDATED the link above again

Eclipse Plugin development: How do you prevent another job from running

Greetings all.
I have 2 actions: "Find" and "Run". They can be invoked in 3 ways: Find only; Run only; and Find and Run.
I want to put both actions in Jobs.
For the case of "Find and Run", what is the best way in Eclipse to have the "Run" job wait for the "Find" job to complete. Importantly, the "Run" job depends on the results from the Find job.
As I understand it, I could use a lock, or I could use a rule, though the docs indicate that a single rule is the same thing as a lock.
I know I can accomplish this by adding a post-run event onto the Find job which would then invoke the Run job, but I think the platform provides an preferred mechanism for the behavior I need and I wish to use that... just not sure what that mechanism is.
Thanks for advice
Found this in the Eclipse FAQ.
http://wiki.eclipse.org/FAQ_How_do_I_prevent_two_jobs_from_running_at_the_same_time%3F
I'm assuming since it's the answer given in the FAQ that it is, indeed, the best way to solve this problem