How to trigger scheduler job immediately in liferay 6.1.1 - quartz-scheduler

for project needed, I need a button when I click it it will trigger a scheduler job immediately in liferay 6.1.1. I know before liferay 4.2 there is a API JobScheduler.triggerJob() to make it happen. but in the 6.1.1 this API is removed, is there any other way I can do this? Thanks a lot.

I guess better way is to execute your process service method on button click event rather than manually triggering a job. If you already have a job, it can call the same process service method.
However below information can be useful if you want to got with custom schedule a job.
SchedulerEngineHelperUtil.schedule menthod will accept custom trigger. Liferay allows to specify cron express as trigger. You can use below expression to trigger immediately.
* * * * * ? *
An example code custom scheduler can be found in LayoutServiceImpl.schedulePublishToLive method.
I believe you can do similar with above cron express to invoke a job immediately.
Trigger trigger = new CronTrigger(
jobName, groupName, schedulerStartDate, schedulerEndDate, cronText);
SchedulerEngineHelperUtil.schedule(
trigger, StorageType.PERSISTED, description,
DestinationNames.LAYOUTS_LOCAL_PUBLISHER, publisherRequest, 0);

Related

Azure Devops Boards - can we block task from done if there isn't any test attatched?

We are trying to implement a new method for our QA team.
I have looked around the setting but couldn't find an answer:
Is it possible to prevent them from dragging the task to 'Done' if they haven't added a test case into it?
On the same logic - can we block the 'committed' column from them if they haven't added a bug to the task?
Thank you.
There is currently no build-in feature to help you achieve this directly.
Here is a work around for your demand:
Create a new filed named "TestCaseLinked"
Every time a Test Case is linked to the task WIT, you need to manually put a value into this field. And use the WIT rule to check the value when changing the WIT status to "Done"

Can I change node proeprty value in a AEM custom worklfow process?

I have created a new workflow for activate later. It includes a custom workflow process step written by me. The custom step changes some properties of the payload step and then Activate Page process is called to activate the page. The changed properties are reflected in the author instance but not on the publish instance. Just wanted to confirm if this is possible or the workflow creates a copy of the node and then executes on it (like passing a parameter to a function)?
Thanks in advance :D
It should work fine, however you have to commit changes using resourceResolver.commit()

Email notification in jenkins based on a script output

I am stuck at a point where I run a perl script through jenkins and I want a conditional email notification to be sent.
For eg ..
if at the end of script the value of a certain variable is > 1 then send the email notification
else
dont send
Can anybody help me with this ? or knows a better way to do this ?
This can be solved using
Email-ext plug-in
https://wiki.jenkins.io/display/JENKINS/Email-ext+plugin
And you can use the above link to view information regarding plugin
if i'm correct you want to send mails based on your build condition result.
you can use triggers for this in Editable email notification.
you can use post build step and pre build steps to trigger emails based on your conditions
you need to write a script for your requirement and place it in post & pre build steps.
I haven't any of this, however:
There is an Any Build Step plugin. Among other things, it allows post-build actions to be executed as build steps. In theory, this should allow you to execute "Editable Email Notification" post-build step as a build step. This is the biggest wildcard in this solution. Try this first. I don't know if the email notification will work properly when done before the Jenkins' "build cycle" of a job is complete.
Next, there is Conditional Build Step plugin. It allows you to execute a build step based on various conditions.
If you were able to trigger email in the middle of the build cycle with "Any Build Step" plugin, you should be able to wrap it with the "Conditional Build Step" plugin to be executed conditionally.
Let me know if this actually works
I was having a similar condition where I need to send out an email when jenkins build log has a string. Here is how I handled in the presend script of the jenkins job.
logger.println(build.getLog(50))
if (build.getLog(50).contains("NoChangesPresent")) {
cancel = true;
}
I am trying to get the last 50 lines of build log and search through it to see if there is a string present. If it is present then I am setting cancel to true which would stop triggering the email from jenkins.
Hope this helps.
I like siri's answer. There is one think missing.
logger.println(build.getLog(50)) if
(build.getLog(50).toString().contains("NoChangesPresent")) { cancel = true; }
It doesn't appear that contains will function without converting it first to a string. Good luck!

TYPO3: Schedule SQL statement

Is there and easy way to schedule a SQL call in TYPO3?
A core function or extension to schedule a custom SQL call?
It is for old TYPO3 4.5.29.
If someone now same thing for TYPO3 6.1/6.2 then I would like to read about that too.
There is a Scheduler, that is supposed to be executed via cronjob. You can add your own tasks to the Scheduler from an extension and define how often it should be executed. The Scheduler comes with the core. You maybe have to install it.
Further Information about how to do it:
http://docs.typo3.org/typo3cms/extensions/scheduler/latest/DevelopersGuide/CreatingTasks/Index.html
http://www.typo3lexikon.de/typo3-tutorials/extensions/scheduler.html
http://docs.typo3.org/typo3cms/extensions/scheduler/latest/Index.html

Plugin and dialog together

If I use a dialog to create an instance of an entity, will it fire the plugin registered to that message (i.e. Create on EntityA)?
If not, how can I link that plugin to that message?
Yes, the plugin will always fire regardless of the source of the message.
You're safe to use the plugin. It will catch the dispatched message as long as you've registered it correctly.
The plugin will, in fact, react to the following events.
Creation of an instance (a record) by the user from the GUI.
Creation of an instance by a workflow.
Creation of an instance by a dialog.
Creation of an instance by a code from an extern program.
Creation of an instance by... anything.