Modifying Bonita Process Instance after Started - bonita

Is it possible to change the processinstance create/start date time after once it has been instantiated?

Process Instance create/start date time automatically generated by system,
and also all bpm transaction (flow node, case, process, task,...) .
All engine APIs or apiAccess only have read access from the database.
But you can modify directly from database ;)

Related

How to auto start an activiti workflow periodically in a certain schedule in Alfresco 5.0.c?

I created a custom review and approve activiti workflow. I need to start this workflow automatically in every certain period , say every 30 minutes. For this i used timer start event as below:
<startEvent id="timerStart" name="Timer start" activiti:formKey="scheduledtask:submitParallelReviewTask">
<timerEventDefinition>
<timeCycle>R5/PT30M</timeCycle>
</timerEventDefinition>
</startEvent>
This created new process instance in every 30 minutes and repetition occured 5 times as required. But in the new timer started processes' tasks , initiator and other process variables were null. Also if i set the process variables as mandatory, timer executor job failed.
How can i set the initiator and other mandatory process variables in the newly created i.e. timer auto started process instances and its respective tasks?
Please suggest how to fix these bugs.
Thank you in advance !
Well I guess for the solution you should use cron job of alfresco.
For using cron job you can find below link usefull.
https://wiki.alfresco.com/wiki/Scheduled_Actions
Use workflowService for setting parameters.

How to let user set time to run a task in google app engine

My customer wants to set time (ex: Dec 13, 16:00 pm) to run a certain task.
I dont think cron job fits for it because customer dont know how to use google app engine SDK.
Is there any other way to do it?
Thanks
You can create a task and set the time when you want this task to be executed. From the documentation:
X-AppEngine-TaskETA, the target execution time of the task, specified
in milliseconds since January 1st 1970.
You can use the task queue API: https://cloud.google.com/appengine/docs/python/taskqueue/ or even the defer API: https://cloud.google.com/appengine/articles/deferred
If your customer is a user of your application, and there may be several users requesting tasks to be executed at different times, then you can save these requests to the datastore. Create a cron job to run every hour (or however precise you need the timeframe) which checks the datastore to see if there are any tasks to run at that time - if so, run the proper script.
If this is just a one-time, or small number of tasks, you can do as Andrei suggested.

Restore processes instances from database. JBPM6

I succesfully connected jbpm to my database (PostgreSQL) and i store logs into it. I made it by:
KieServices ks = KieServices.Factory.get();
KieContainer kContainer = ks.getKieClasspathContainer();
KieSession kSession = kContainer.newKieSession("WorkflowSession");
EntityManagerFactory emf = new EnvironmentProducer().getEntityManagerFactory();
AbstractAuditLogger auditLogger = AuditLoggerFactory.newJPAInstance(emf);
kSession.addEventListener(auditLogger);
I would like to restore all active processes after server falling. For example:
Start scenario (start process)
Server fall down (the process is in database register as active)
After turn on server again have this process loaded to my new KieSession
Please help me with this problem.
Thanks
There's no need to reload process instances after server shutdown. Process instances are always stored in the database, and whenever they are needed, they are loaded from there. This includes user requests related to the process instance (e.g. tasks completed, signals sent), but also timers firing etc.
The only thing you should try to do upon initialization of the application in case you embed the engine yourself is to make sure the runtime manager is instantiated (for keeping track of timers). If you use the execution server (part of the jbpm-console), it will automatically do that for you.

how to index data in solr from database automatically

I have MySql database for my application. i implemented solr search and used dataimporthandler(DIH)to index data from database into solr. my question is: is there any way that if database gets updated then my solr indexes automatically gets update for new data added in the database. . It means i need not to run index process manually every time data base tables changes.If yes then please tell me how can i achieve this.
I don't think there is a possibility in Solr which lets you index the data when any updates happens to DB.
But there could be possibilities like, with the help of Triggers - there is a possibility to run an external application from triggers.
Write a CRON to trigger PHP script which does reading from the DB and indexing it in Solr. Write a trigger (which calls this script) for CRUD operation and dump it into DB, so, whenever something happens to DB, this trigger will call the above script and indexing could happen.
Please see:
Invoking a PHP script from a MySQL trigger
Automatic Scheduling:
Please see this post How can I Schedule data imports in Solr for more information on scheduling. The second answer, explains how to import using Cron.
Since you used a DataImportHandler to initially load your data into Solr... You could create a Delta Import Handler that is executed using curl from a cron job to periodically add changes in the database to the index. Also, if you need more real time updates, as #Rakesh suggested, you could use a trigger in your database and have that kick off the curl call to the Delta DIH.
you can import the data using your browser and task manager.
do the following steps on windows server...
GO to Administrative tools => task Schedular
Click "Create Task"
Now a screen of Create Task will be open with the TAB
General,Triggers,Actions,Conditions,Settings.
In the genral tab enter the task name "Solrdataimport" and in discriptions enter "Import mysql data"
Now go to Triggers tab CLick new in Setting check Daily.In Advanced setting Repeat task every ... Put time there whatever you want.click OK
Now go to Actions button click new Button IN setting put Program/Script "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" this is the installation path of chrome browser.In the Add Arguments enter http://localhost:8983/solr/#/collection1/dataimport//dataimport?command=full-import&clean=true And click OK
Using the all above process Data import will Run automatically.In case of Stop the Imort process follow the all above process just change the Program/Script "taskkill" in place of "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" under Actions Tab In arguments enter "f /im chrome.exe"
Set the triggers timing according the requirements
What you're looking for is a "delta-import", and a lot of the other posts have information about that covered. I created a Windows WPF application and service to issue commands to Solr on a recurring schedule, as using CRON jobs and Task Scheduler is a bit difficult to maintain if you have a lot of cores / environments.
https://github.com/systemidx/SolrScheduler
You basically just drop in a JSON file in a specified folder and it will use a REST client to issue the commands to Solr.

Identify current session within Windows Forms application: session ID?

In ASP.NET, each session can be identified by its SessionID variable. Currently, I'm working on a project for which I want to be able to identify each separate user session. In other words, I'm looking for a session identifier or an equivalent variable.
I've looked in the Application, Environment and AppDomain classes, but I couldn't find such a variable. So my question is: how should one identify the session(s) an application is currently handling?
Maybe System.Diagnostics.Process.GetCurrentProcess().Id would cover your needs? That will give you a number that uniquely identifies the currently running process on the system. The number is valid only while the process runs, and when it has quit any other process may be assigned the same number when it is started.
I'm not quite sure I follow you, but if you're trying to track each instance of the application's lifecycle, you could create a GUID as an instance member somewhere appropriate. Whenever you feel a new "session" has been created, you can create and store this GUID - probably when the user logs in (or the main form loads if you don't have a login mechanism).
I'm assuming of course you have a multi-user enviroment with some kind of server attached, otherwise I can't really see a need for sessions.
You could check some of the options in the Environment class such as Environment.UserName, Environment.MachineName or Environment.UserDomainName

Resources