Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Stardust/Knowledge Base/Java API/IWorklistMonitor Example"

m
 
(5 intermediate revisions by one other user not shown)
Line 6: Line 6:
 
#Create a text file named '''org.eclipse.stardust.engine.core.spi.monitoring.IWorklistMonitor'''. The file contents needs to be the fully qualified <u>name of your implementation class</u>, e.g. ''org.eclipse.stardust.example.WorklistInterceptor .''  
 
#Create a text file named '''org.eclipse.stardust.engine.core.spi.monitoring.IWorklistMonitor'''. The file contents needs to be the fully qualified <u>name of your implementation class</u>, e.g. ''org.eclipse.stardust.example.WorklistInterceptor .''  
 
#Place the file into the '''META-INF/services''' folder of the jar that will contain your implementation class
 
#Place the file into the '''META-INF/services''' folder of the jar that will contain your implementation class
 +
 +
Note: you can also try to create a separate jar file, that contains only the above folder and use it as described in Stardust Forum thread [http://www.eclipse.org/forums/index.php/t/551904/]
  
 
{{warning2|text=Use this interface with caution! We do not recommend to use this functionality to constantly synchronize the worklists into another system. To maintain the worklists in two systems is a bad architectural design typically resulting from shortcuts taken. It usually leads to problems further down the road.}}  
 
{{warning2|text=Use this interface with caution! We do not recommend to use this functionality to constantly synchronize the worklists into another system. To maintain the worklists in two systems is a bad architectural design typically resulting from shortcuts taken. It usually leads to problems further down the road.}}  

Latest revision as of 12:14, 16 October 2013

The IWorklistMonitor service provider interface can be used to execute custom code when item are added to or removed from a workflow participant's worklist. Typically this SPI is used to implement push notification to users (UI alerts, email, ...) or other systems.

To use this interface you need to:

  1. Implement the IWorklistMonitor interface as shown below.
  2. Create a text file named org.eclipse.stardust.engine.core.spi.monitoring.IWorklistMonitor. The file contents needs to be the fully qualified name of your implementation class, e.g. org.eclipse.stardust.example.WorklistInterceptor .
  3. Place the file into the META-INF/services folder of the jar that will contain your implementation class

Note: you can also try to create a separate jar file, that contains only the above folder and use it as described in Stardust Forum thread [1]

Use this interface with caution! We do not recommend to use this functionality to constantly synchronize the worklists into another system. To maintain the worklists in two systems is a bad architectural design typically resulting from shortcuts taken. It usually leads to problems further down the road.

package org.eclipse.stardust.example;
 
import org.eclipse.stardust.engine.api.model.IParticipant;
import org.eclipse.stardust.engine.core.runtime.beans.IActivityInstance;
import org.eclipse.stardust.engine.core.spi.monitoring.IWorklistMonitor;
 
public class WorklistInterceptor implements IWorklistMonitor {
 
    @Override
    public void addedToWorklist(IParticipant arg0, IActivityInstance arg1) {
	System.out.println("ADDED TO WORKLIST: " + arg0.getId() + " Activity OID: " + arg1.getOID());
 
    }
 
    @Override
    public void removedFromWorklist(IParticipant arg0, IActivityInstance arg1) {
	System.out.println("REMOVED FROM WORKLIST: " + arg0.getId() + " Activity OID: "+ arg1.getOID());
    }
 
}

Back to the top