public void cancel() { WorkItem workItem = getWorkItem(); if (workItem != null && workItem.getState() != WorkItem.COMPLETED && workItem.getState() != WorkItem.ABORTED) { try { ((WorkItemManager) ((ProcessInstance) getProcessInstance()) .getKnowledgeRuntime().getWorkItemManager()).internalAbortWorkItem(workItemId); } catch (WorkItemHandlerNotFoundException wihnfe) { getProcessInstance().setState(ProcessInstance.STATE_ABORTED); throw wihnfe; } } if (exceptionHandlingProcessInstanceId > -1) { ProcessInstance processInstance = null; KieRuntime kruntime = getKieRuntimeForSubprocess(); processInstance = (ProcessInstance) kruntime.getProcessInstance(exceptionHandlingProcessInstanceId); if (processInstance != null) { processInstance.setState(ProcessInstance.STATE_ABORTED); } } super.cancel(); }
WorkItemNode workItemNode = getWorkItemNode(); if (workItemNode != null && workItem.getState() == WorkItem.COMPLETED) { validateWorkItemResultVariable(getProcessInstance().getProcessName(), workItemNode.getOutAssociations(), workItem); for (Iterator<DataAssociation> iterator = getWorkItemNode().getOutAssociations().iterator(); iterator.hasNext();) {
public static void writeWorkItem_v1(MarshallerWriteContext context, WorkItem workItem) throws IOException { ObjectOutputStream stream = context.stream; stream.writeLong( workItem.getId() ); stream.writeLong( workItem.getProcessInstanceId() ); stream.writeUTF( workItem.getName() ); stream.writeInt( workItem.getState() ); //Work Item Parameters Map<String, Object> parameters = workItem.getParameters(); Collection<Object> notNullValues = new ArrayList<Object>(); for ( Object value : parameters.values() ) { if ( value != null ) { notNullValues.add( value ); } } stream.writeInt( notNullValues.size() ); for ( String key : parameters.keySet() ) { Object object = parameters.get( key ); if ( object != null ) { stream.writeUTF( key ); int index = context.objectMarshallingStrategyStore.getStrategy( object ); stream.writeInt( index ); ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategy( index ); if ( strategy.accept( object ) ) { strategy.write( stream, object ); } } } }
@Override public void transform() { this.state = workItem.getState(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { MarshallerWriteContext context = new MarshallerWriteContext( baos, null, null, null, null, this.env); ProtobufOutputMarshaller.writeWorkItem(context, workItem); context.close(); this.workItemByteArray = baos.toByteArray(); } catch ( IOException e ) { throw new IllegalArgumentException( "IOException while storing workItem " + workItem.getId() + ": " + e.getMessage() ); } }
public static void writeWorkItem_v1(MarshallerWriteContext context, WorkItem workItem) throws IOException { ObjectOutputStream stream = context.stream; stream.writeLong( workItem.getId() ); stream.writeLong( workItem.getProcessInstanceId() ); stream.writeUTF( workItem.getName() ); stream.writeInt( workItem.getState() ); //Work Item Parameters Map<String, Object> parameters = workItem.getParameters(); Collection<Object> notNullValues = new ArrayList<Object>(); for ( Object value : parameters.values() ) { if ( value != null ) { notNullValues.add( value ); } } stream.writeInt( notNullValues.size() ); for ( String key : parameters.keySet() ) { Object object = parameters.get( key ); if ( object != null ) { stream.writeUTF( key ); int index = context.objectMarshallingStrategyStore.getStrategy( object ); stream.writeInt( index ); ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategy( index ); if ( strategy.accept( object ) ) { strategy.write( stream, object ); } } } }
public void cancel() { WorkItem workItem = getWorkItem(); if (workItem != null && workItem.getState() != WorkItem.COMPLETED && workItem.getState() != WorkItem.ABORTED) { try { ((WorkItemManager) ((ProcessInstance) getProcessInstance()) .getKnowledgeRuntime().getWorkItemManager()).internalAbortWorkItem(workItemId); } catch (WorkItemHandlerNotFoundException wihnfe) { getProcessInstance().setState(ProcessInstance.STATE_ABORTED); throw wihnfe; } } if (exceptionHandlingProcessInstanceId > -1) { ProcessInstance processInstance = null; KieRuntime kruntime = getKieRuntimeForSubprocess(); processInstance = (ProcessInstance) kruntime.getProcessInstance(exceptionHandlingProcessInstanceId); if (processInstance != null) { processInstance.setState(ProcessInstance.STATE_ABORTED); } } super.cancel(); }
WorkItemNode workItemNode = getWorkItemNode(); if (workItemNode != null && workItem.getState() == WorkItem.COMPLETED) { validateWorkItemResultVariable(getProcessInstance().getProcessName(), workItemNode.getOutAssociations(), workItem); for (Iterator<DataAssociation> iterator = getWorkItemNode().getOutAssociations().iterator(); iterator.hasNext();) {