Package org.jbpm.process.workitem.jpa
Class JPAWorkItemHandler
- java.lang.Object
-
- org.jbpm.process.workitem.core.AbstractLogOrThrowWorkItemHandler
-
- org.jbpm.process.workitem.jpa.JPAWorkItemHandler
-
- All Implemented Interfaces:
org.kie.api.runtime.process.WorkItemHandler,org.kie.internal.runtime.Cacheable
@Wid(widfile="JPADefinitions.wid",name="JPA",displayName="JPA",defaultHandler="mvel: new org.jbpm.process.workitem.jpa.JPAWorkItemHandler(\"persistenceUnit\", \"classloader\")",documentation="jpa-workitem/index.html",category="jpa-workitem",icon="JPA.png",parameters={@WidParameter(name="Type",runtimeType="java.lang.Object"),@WidParameter(name="Id",runtimeType="java.lang.Object"),@WidParameter(name="Entity",runtimeType="java.lang.Object"),@WidParameter(name="Action",required=true,runtimeType="java.lang.Object"),@WidParameter(name="Query",runtimeType="java.lang.Object"),@WidParameter(name="QueryParameters",runtimeType="java.lang.Object"),@WidParameter(name="QueryResults",runtimeType="java.lang.Object")},results=@WidResult(name="Result",runtimeType="java.util.Map"),mavenDepends=@WidMavenDepends(group="org.jbpm.contrib",artifact="jpa-workitem",version="7.68.0.Final"),serviceInfo=@WidService(category="JPA",description="Perform JPA operation",keywords="jpa,query,named,entity",action=@WidAction(title="Perform a JPA operation"),authinfo=@WidAuth(required=true,params="persistenceUnit",paramsdescription="Persistence Unit name",referencesite=""))) public class JPAWorkItemHandler extends org.jbpm.process.workitem.core.AbstractLogOrThrowWorkItemHandler implements org.kie.internal.runtime.CacheableA WorkItemHandler to perform JPA operations.
An Action must be provided as an input parameter. The supported value for the Action parameters:- Create: Persist the object and return the attached entity. TO persist an object you must provide the object using the WIH parameter Entity
- Update: Update an attached entity and returns the updated entity. You must provide the attached entity using the Entity WIH parameter.
- Delete: Delete an attached entity. You must provide the attached entity using the Entity WIH parameter.
- Get: Get an entity by ID. You must provide the return type using the Type parameter with the FQN of the target class and the ID using the Id parameter.
- Query: Executes a named query and return the list of results (if any). The query must be provided using the Query input parameter and you may provide query parameters in the form of a Map with key String and value Object using the QueryParameters WIH input parameter. The result of the query is put on the output parameter QueryResults.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCREATE_ACTIONstatic StringDELETE_ACTIONstatic StringGET_ACTIONstatic StringP_ACTIONstatic StringP_ENTITYstatic StringP_IDstatic StringP_QUERYstatic StringP_QUERY_PARAMSstatic StringP_QUERY_RESULTSstatic StringP_RESULTstatic StringP_TYPEstatic StringQUERY_ACTIONstatic StringUPDATE_ACTION
-
Constructor Summary
Constructors Constructor Description JPAWorkItemHandler(String persistenceUnit)JPAWorkItemHandler(String persistenceUnit, ClassLoader classloader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortWorkItem(org.kie.api.runtime.process.WorkItem wi, org.kie.api.runtime.process.WorkItemManager wim)voidclose()voidexecuteWorkItem(org.kie.api.runtime.process.WorkItem wi, org.kie.api.runtime.process.WorkItemManager wim)
-
-
-
Field Detail
-
P_RESULT
public static final String P_RESULT
- See Also:
- Constant Field Values
-
P_TYPE
public static final String P_TYPE
- See Also:
- Constant Field Values
-
P_ID
public static final String P_ID
- See Also:
- Constant Field Values
-
P_ENTITY
public static final String P_ENTITY
- See Also:
- Constant Field Values
-
P_ACTION
public static final String P_ACTION
- See Also:
- Constant Field Values
-
P_QUERY
public static final String P_QUERY
- See Also:
- Constant Field Values
-
P_QUERY_PARAMS
public static final String P_QUERY_PARAMS
- See Also:
- Constant Field Values
-
P_QUERY_RESULTS
public static final String P_QUERY_RESULTS
- See Also:
- Constant Field Values
-
CREATE_ACTION
public static final String CREATE_ACTION
- See Also:
- Constant Field Values
-
UPDATE_ACTION
public static final String UPDATE_ACTION
- See Also:
- Constant Field Values
-
GET_ACTION
public static final String GET_ACTION
- See Also:
- Constant Field Values
-
DELETE_ACTION
public static final String DELETE_ACTION
- See Also:
- Constant Field Values
-
QUERY_ACTION
public static final String QUERY_ACTION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JPAWorkItemHandler
public JPAWorkItemHandler(String persistenceUnit)
-
JPAWorkItemHandler
public JPAWorkItemHandler(String persistenceUnit, ClassLoader classloader)
-
-
Method Detail
-
executeWorkItem
public void executeWorkItem(org.kie.api.runtime.process.WorkItem wi, org.kie.api.runtime.process.WorkItemManager wim)- Specified by:
executeWorkItemin interfaceorg.kie.api.runtime.process.WorkItemHandler
-
close
public void close()
- Specified by:
closein interfaceorg.kie.internal.runtime.Cacheable
-
abortWorkItem
public void abortWorkItem(org.kie.api.runtime.process.WorkItem wi, org.kie.api.runtime.process.WorkItemManager wim)- Specified by:
abortWorkItemin interfaceorg.kie.api.runtime.process.WorkItemHandler
-
-