Java Doc for JbpmContext.java in  » Workflow-Engines » jbpm-jpdl-3.2.2 » org » jbpm » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » jbpm jpdl 3.2.2 » org.jbpm 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jbpm.JbpmContext

JbpmContext
public class JbpmContext implements Serializable(Code)
is used to surround persistent operations to processes.

Obtain JbpmContext's via org.jbpm.JbpmConfiguration.createJbpmContext and put it in a try-finally block like this:

 JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
 try {
 TaskInstance taskInstance = ...
 ...do your process operations...
 // in case you update a process object that was not fetched
 // with a ...ForUpdate method, you have to save it.
 jbpmContext.save(processInstance);
 finally {
 jbpmContext.close();
 }
 

A JbpmContext separates jBPM from a sprecific environment. For each service that jBPM uses, there is an interface specified in the jBPM codebase. jBPM also includes implementations that implement these services by using services in a specific environment. e.g. a hibernate session, a JMS asynchronous messaging system, ...

A JbpmContext can demarcate a transaction. When a PersistenceService is fetched from the JbpmContext, the default implementation for the persistence service will create a hibernate session and start a transaction. So that transactions can be configured in the hibernate configuration.

A JbpmContext allows the user to overwrite (or make complete) the configuration by injecting objects programmatically. like e.g. a hibernate session factory or a hibernate session or any other resource that can be fetched or created from the configuration.

Last but not least, JbpmContext provides convenient access to the most common operations such as JbpmContext.getTaskList(String) , JbpmContext.newProcessInstance(String)JbpmContext.loadTaskInstanceForUpdate(long) and JbpmContext.save(ProcessInstance) .

All the ...ForUpdate(...) methods will automatically save the loaded objects at jbpmContext.close();



Field Summary
final public static  StringDEFAULT_JBPM_CONTEXT_NAME
    
 ListautoSaveProcessInstances
    
static  ThreadLocalcurrentContextsStack
    
 JbpmConfigurationjbpmConfiguration
    
 ObjectFactoryobjectFactory
    
 Servicesservices
    

Constructor Summary
public  JbpmContext(Services services, ObjectFactory objectFactory)
     normally, JbpmContext object are created via a JbpmConfiguration .

Method Summary
 voidaddAutoSaveProcessInstance(ProcessInstance processInstance)
    
 voidaddAutoSaveTaskInstance(TaskInstance taskInstance)
    
 voidaddAutoSaveToken(Token token)
    
 voidautoSave()
    
public  voidclose()
     make sure you close your JbpmContext in a finally block.
public  voiddeployProcessDefinition(ProcessDefinition processDefinition)
     deploys a process definition.
public  StringgetActorId()
     retrieves the current authenticated actor from the authentication service.
public  ConnectiongetConnection()
     gets the jdbc connection from the default configured persistence service.
public  ContextSessiongetContextSession()
     more variables related database access.
public static  JbpmContextgetCurrentJbpmContext()
     obtains the current JbpmContext from a thread local.
public  GraphSessiongetGraphSession()
     more graph (process) related database access.
public  ListgetGroupTaskList(List actorIds)
     fetches all the task instances for which at least one of the given actorIds is a candidate (pooled actor). Typically, for an actor, his/her personal actorId plus all the actorIds representing the groups that person belongs to form the actorIds.
public  JbpmConfigurationgetJbpmConfiguration()
    
public  JobSessiongetJobSession()
     more job related database access.
public  LoggingSessiongetLoggingSession()
     more logging related database access.
public  ObjectFactorygetObjectFactory()
     gives access to the object factory containing the configuration for creating the service factories.
 PersistenceServicegetPersistenceService()
    
public  ProcessInstancegetProcessInstance(long processInstanceId)
     gets a process instance from the db. Consider using JbpmContext.loadProcessInstanceForUpdate(long) if you plan to perform an update operation on the process instance.
public  ProcessInstancegetProcessInstance(ProcessDefinition processDefinition, String key)
     returns the process instance with the given key or null if no such instance exists.
public  ProcessInstancegetProcessInstanceForUpdate(long processInstanceId)
     gets a process instances from the db and registers it for auto-save. The loaded process instance will be JbpmContext.save(ProcessInstance) d automatically at the JbpmContext.close() .
public  ProcessInstancegetProcessInstanceForUpdate(ProcessDefinition processDefinition, String key)
     returns the process instance with the given key or null if no such instance exists.
public  ServiceFactorygetServiceFactory(String name)
    
public  ServicesgetServices()
     gives access to the services and service factories.
public  SessiongetSession()
     gets the hibernate session from the default configured persistence service.
public  SessionFactorygetSessionFactory()
     gets the hibernate session factory from the default configured persistence service.
public  TaskInstancegetTaskInstance(long taskInstanceId)
     gets a task instance from the db. the task instance or null in case no such task instance exists.
public  TaskInstancegetTaskInstanceForUpdate(long taskInstanceId)
     gets a task instance from the db and registers it for auto-save. The loaded task instance will be save automatically at the JbpmContext.close() . This is a convenience method in case you plan to do update operations on this task instance. the task instance or null in case no such task instance exists.
public  ListgetTaskList()
     fetches the tasklist for the current authenticated actor.
public  ListgetTaskList(String actorId)
     fetches the tasklist for the given actor.
public  TaskMgmtSessiongetTaskMgmtSession()
     more task related database access.
public  TokengetToken(long tokenId)
     gets a token from the db.
public  TokengetTokenForUpdate(long tokenId)
     get a token from the db and registers it for auto-save.
public  ProcessInstanceloadProcessInstance(long processInstanceId)
     loads a process instance from the db. Consider using JbpmContext.loadProcessInstanceForUpdate(long) if you plan to perform an update operation on the process instance.
public  ProcessInstanceloadProcessInstance(ProcessDefinition processDefinition, String key)
     returns the process instance with the given key or throws an exception if no such instance exists.
public  ProcessInstanceloadProcessInstanceForUpdate(long processInstanceId)
     loads a process instances from the db and registers it for auto-save. The loaded process instance will be JbpmContext.save(ProcessInstance) d automatically at the JbpmContext.close() .
public  ProcessInstanceloadProcessInstanceForUpdate(ProcessDefinition processDefinition, String key)
     returns the process instance with the given key or throws an exception if no such instance exists.
public  TaskInstanceloadTaskInstance(long taskInstanceId)
     loads a task instance from the db.
public  TaskInstanceloadTaskInstanceForUpdate(long taskInstanceId)
     loads a task instance from the db and registers it for auto-save.
public  TokenloadToken(long tokenId)
     loads a token from the db.
public  TokenloadTokenForUpdate(long tokenId)
     loads a token from the db and registers it for auto-save.
public  ProcessInstancenewProcessInstance(String processDefinitionName)
     creates a new process instance for the latest version of the process definition with the given name.
public  ProcessInstancenewProcessInstanceForUpdate(String processDefinitionName)
     creates a new process instance for the latest version of the process definition with the given name and registers it for auto-save.
static  voidreset()
     resets static members for test isolation.
public  voidsave(ProcessInstance processInstance)
     saves the process instance.
public  voidsave(Token token)
     saves the complete process instance for this token.
public  voidsave(TaskInstance taskInstance)
     saves the complete process instance for this task instance.
public  voidsetActorId(String actorId)
     sets the currently authenticated actorId.
public  voidsetConnection(Connection connection)
     allows users to provide a jdbc connection to be used when the hibernate session is created.
public  voidsetRollbackOnly()
     mark this transaction for rollback only in the persistence service.
public  voidsetSession(Session session)
     sets the hibernate session into the default configured persistence service, preventing the creation of a session from the configured session factory (if there is one configured).
public  voidsetSessionFactory(SessionFactory sessionFactory)
     sets the hibernate session factory into the default configured persistence service, overwriting the configured session factory (if there is one configured).

Field Detail
DEFAULT_JBPM_CONTEXT_NAME
final public static String DEFAULT_JBPM_CONTEXT_NAME(Code)



autoSaveProcessInstances
List autoSaveProcessInstances(Code)



currentContextsStack
static ThreadLocal currentContextsStack(Code)



jbpmConfiguration
JbpmConfiguration jbpmConfiguration(Code)



objectFactory
ObjectFactory objectFactory(Code)



services
Services services(Code)




Constructor Detail
JbpmContext
public JbpmContext(Services services, ObjectFactory objectFactory)(Code)
normally, JbpmContext object are created via a JbpmConfiguration .




Method Detail
addAutoSaveProcessInstance
void addAutoSaveProcessInstance(ProcessInstance processInstance)(Code)



addAutoSaveTaskInstance
void addAutoSaveTaskInstance(TaskInstance taskInstance)(Code)



addAutoSaveToken
void addAutoSaveToken(Token token)(Code)



autoSave
void autoSave()(Code)



close
public void close()(Code)
make sure you close your JbpmContext in a finally block.



deployProcessDefinition
public void deployProcessDefinition(ProcessDefinition processDefinition)(Code)
deploys a process definition. For parsing process definitions from archives, see the static parseXxx methods on ProcessDefinition .



getActorId
public String getActorId()(Code)
retrieves the current authenticated actor from the authentication service.



getConnection
public Connection getConnection()(Code)
gets the jdbc connection from the default configured persistence service.
throws:
  ClassCastException - if another persistence service is configured then the default.



getContextSession
public ContextSession getContextSession()(Code)
more variables related database access.



getCurrentJbpmContext
public static JbpmContext getCurrentJbpmContext()(Code)
obtains the current JbpmContext from a thread local. The current JbpmContexts are maintained in a stack so that you can do nested context operations for different jbpm configurations. JbpmConfiguration



getGraphSession
public GraphSession getGraphSession()(Code)
more graph (process) related database access.



getGroupTaskList
public List getGroupTaskList(List actorIds)(Code)
fetches all the task instances for which at least one of the given actorIds is a candidate (pooled actor). Typically, for an actor, his/her personal actorId plus all the actorIds representing the groups that person belongs to form the actorIds. Then the user interface should show only the option to take these tasks to the actor's personal task list (with TaskInstance.setActorId(String) ). Only task instances that are assigned to the actor directly should be offered the possibility for performing the actual task.



getJbpmConfiguration
public JbpmConfiguration getJbpmConfiguration()(Code)



getJobSession
public JobSession getJobSession()(Code)
more job related database access.



getLoggingSession
public LoggingSession getLoggingSession()(Code)
more logging related database access.



getObjectFactory
public ObjectFactory getObjectFactory()(Code)
gives access to the object factory containing the configuration for creating the service factories.



getPersistenceService
PersistenceService getPersistenceService()(Code)



getProcessInstance
public ProcessInstance getProcessInstance(long processInstanceId)(Code)
gets a process instance from the db. Consider using JbpmContext.loadProcessInstanceForUpdate(long) if you plan to perform an update operation on the process instance. the token or null in case no such token exists.
See Also:   JbpmContext.loadProcessInstance(long)
See Also:   
See Also:   JbpmContext.loadProcessInstanceForUpdate(long)
See Also:   
See Also:   JbpmContext.getProcessInstanceForUpdate(long)
See Also:   



getProcessInstance
public ProcessInstance getProcessInstance(ProcessDefinition processDefinition, String key)(Code)
returns the process instance with the given key or null if no such instance exists.



getProcessInstanceForUpdate
public ProcessInstance getProcessInstanceForUpdate(long processInstanceId)(Code)
gets a process instances from the db and registers it for auto-save. The loaded process instance will be JbpmContext.save(ProcessInstance) d automatically at the JbpmContext.close() . This is a convenience method in case you plan to do update operations on this process instance. the token or null in case no such token exists.
See Also:   JbpmContext.loadProcessInstance(long)
See Also:   
See Also:   JbpmContext.getProcessInstance(long)
See Also:   
See Also:   JbpmContext.loadProcessInstanceForUpdate(long)
See Also:   



getProcessInstanceForUpdate
public ProcessInstance getProcessInstanceForUpdate(ProcessDefinition processDefinition, String key)(Code)
returns the process instance with the given key or null if no such instance exists. Upon close of this jbpmContext, the fetched process instance will be automatically saved.



getServiceFactory
public ServiceFactory getServiceFactory(String name)(Code)



getServices
public Services getServices()(Code)
gives access to the services and service factories.



getSession
public Session getSession()(Code)
gets the hibernate session from the default configured persistence service.
throws:
  ClassCastException - if another persistence service is configured then the default.



getSessionFactory
public SessionFactory getSessionFactory()(Code)
gets the hibernate session factory from the default configured persistence service.
throws:
  ClassCastException - if another persistence service is configured then the default.



getTaskInstance
public TaskInstance getTaskInstance(long taskInstanceId)(Code)
gets a task instance from the db. the task instance or null in case no such task instance exists.
See Also:   JbpmContext.loadTaskInstance(long)
See Also:   JbpmContext.loadTaskInstanceForUpdate(long)
See Also:   JbpmContext.getTaskInstanceForUpdate(long)



getTaskInstanceForUpdate
public TaskInstance getTaskInstanceForUpdate(long taskInstanceId)(Code)
gets a task instance from the db and registers it for auto-save. The loaded task instance will be save automatically at the JbpmContext.close() . This is a convenience method in case you plan to do update operations on this task instance. the task instance or null in case no such task instance exists.
See Also:   JbpmContext.loadTaskInstance(long)
See Also:   JbpmContext.getTaskInstance(long)
See Also:   JbpmContext.loadTaskInstanceForUpdate(long)



getTaskList
public List getTaskList()(Code)
fetches the tasklist for the current authenticated actor. With the default configured authentication service, you can set the authenticated user with JbpmContext.setActorId(String) , then all the subsequent operations will be performed on behalf of that actor.



getTaskList
public List getTaskList(String actorId)(Code)
fetches the tasklist for the given actor.



getTaskMgmtSession
public TaskMgmtSession getTaskMgmtSession()(Code)
more task related database access.



getToken
public Token getToken(long tokenId)(Code)
gets a token from the db. the token or null in case no such token exists.
See Also:   JbpmContext.loadToken(long)
See Also:   
See Also:   JbpmContext.loadTokenForUpdate(long)
See Also:   
See Also:   JbpmContext.getTokenForUpdate(long)
See Also:   



getTokenForUpdate
public Token getTokenForUpdate(long tokenId)(Code)
get a token from the db and registers it for auto-save. The loaded token will be JbpmContext.save(Token) d automatically at the JbpmContext.close() . This is a convenience method in case you plan to do update operations on this token. the token or null in case no such token exists.
See Also:   JbpmContext.getToken(long)
See Also:   
See Also:   JbpmContext.loadToken(long)
See Also:   
See Also:   JbpmContext.loadTokenForUpdate(long)
See Also:   



loadProcessInstance
public ProcessInstance loadProcessInstance(long processInstanceId)(Code)
loads a process instance from the db. Consider using JbpmContext.loadProcessInstanceForUpdate(long) if you plan to perform an update operation on the process instance.
throws:
  JbpmException - in case no such process instance exists.
See Also:   JbpmContext.getProcessInstance(long)
See Also:   
See Also:   JbpmContext.loadProcessInstanceForUpdate(long)
See Also:   
See Also:   JbpmContext.getProcessInstanceForUpdate(long)
See Also:   



loadProcessInstance
public ProcessInstance loadProcessInstance(ProcessDefinition processDefinition, String key)(Code)
returns the process instance with the given key or throws an exception if no such instance exists.



loadProcessInstanceForUpdate
public ProcessInstance loadProcessInstanceForUpdate(long processInstanceId)(Code)
loads a process instances from the db and registers it for auto-save. The loaded process instance will be JbpmContext.save(ProcessInstance) d automatically at the JbpmContext.close() . This is a convenience method in case you plan to do update operations on this process instance.
throws:
  JbpmException - in case no such process instance exists.
See Also:   JbpmContext.loadProcessInstance(long)
See Also:   
See Also:   JbpmContext.getProcessInstance(long)
See Also:   
See Also:   JbpmContext.getProcessInstanceForUpdate(long)
See Also:   



loadProcessInstanceForUpdate
public ProcessInstance loadProcessInstanceForUpdate(ProcessDefinition processDefinition, String key)(Code)
returns the process instance with the given key or throws an exception if no such instance exists. Upon close of this jbpmContext, the fetched process instance will be automatically saved.



loadTaskInstance
public TaskInstance loadTaskInstance(long taskInstanceId)(Code)
loads a task instance from the db.
throws:
  JbpmException - in case no such task instance exists
See Also:   JbpmContext.getTaskInstance(long)
See Also:   JbpmContext.loadTaskInstanceForUpdate(long)
See Also:   JbpmContext.getTaskInstanceForUpdate(long)



loadTaskInstanceForUpdate
public TaskInstance loadTaskInstanceForUpdate(long taskInstanceId)(Code)
loads a task instance from the db and registers it for auto-save. The loaded task instance will be save automatically at the JbpmContext.close() . This is a convenience method in case you plan to do update operations on this task instance.
throws:
  JbpmException - in case no such task instance exists
See Also:   JbpmContext.loadTaskInstance(long)
See Also:   JbpmContext.getTaskInstance(long)
See Also:   JbpmContext.getTaskInstanceForUpdate(long)



loadToken
public Token loadToken(long tokenId)(Code)
loads a token from the db.
throws:
  JbpmException - in case no such token exists.
See Also:   JbpmContext.getToken(long)
See Also:   
See Also:   JbpmContext.loadTokenForUpdate(long)
See Also:   
See Also:   JbpmContext.getTokenForUpdate(long)
See Also:   



loadTokenForUpdate
public Token loadTokenForUpdate(long tokenId)(Code)
loads a token from the db and registers it for auto-save. The loaded token will be JbpmContext.save(Token) d automatically at the JbpmContext.close() . This is a convenience method in case you plan to do update operations on this token.
throws:
  JbpmException - in case no such token exists.
See Also:   JbpmContext.getToken(long)
See Also:   
See Also:   JbpmContext.loadToken(long)
See Also:   
See Also:   JbpmContext.getTokenForUpdate(long)
See Also:   



newProcessInstance
public ProcessInstance newProcessInstance(String processDefinitionName)(Code)
creates a new process instance for the latest version of the process definition with the given name.
throws:
  JbpmException - when no processDefinition with the given name is deployed.



newProcessInstanceForUpdate
public ProcessInstance newProcessInstanceForUpdate(String processDefinitionName)(Code)
creates a new process instance for the latest version of the process definition with the given name and registers it for auto-save.
throws:
  JbpmException - when no processDefinition with the given name is deployed.



reset
static void reset()(Code)
resets static members for test isolation.



save
public void save(ProcessInstance processInstance)(Code)
saves the process instance.



save
public void save(Token token)(Code)
saves the complete process instance for this token.



save
public void save(TaskInstance taskInstance)(Code)
saves the complete process instance for this task instance.



setActorId
public void setActorId(String actorId)(Code)
sets the currently authenticated actorId.
throws:
  ClassCastException - if another authentication service is configured then the default.



setConnection
public void setConnection(Connection connection)(Code)
allows users to provide a jdbc connection to be used when the hibernate session is created.
throws:
  ClassCastException - if another persistence service is configured then the default.



setRollbackOnly
public void setRollbackOnly()(Code)
mark this transaction for rollback only in the persistence service. The JbpmContext.close() operation will then perform a rollback.



setSession
public void setSession(Session session)(Code)
sets the hibernate session into the default configured persistence service, preventing the creation of a session from the configured session factory (if there is one configured).
throws:
  ClassCastException - if another persistence service is configured then the default.



setSessionFactory
public void setSessionFactory(SessionFactory sessionFactory)(Code)
sets the hibernate session factory into the default configured persistence service, overwriting the configured session factory (if there is one configured).
throws:
  ClassCastException - if another persistence service is configured then the default.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.