public void write(MarshallerWriteContext context) throws IOException { context.writeInt( WorkingMemoryAction.SignalProcessInstanceAction ); context.writeLong(processInstanceId); context.writeUTF(type); context.writeBoolean(event != null); if (event != null) { context.writeObject(event); } }
/** * <code>optional .org.drools.core.marshalling.Trigger trigger = 2;</code> */ public org.drools.core.marshalling.impl.ProtobufMessages.Trigger getTrigger() { return trigger_ == null ? org.drools.core.marshalling.impl.ProtobufMessages.Trigger.getDefaultInstance() : trigger_; } /**
public SignalProcessInstanceAction(MarshallerReaderContext context) throws IOException, ClassNotFoundException { processInstanceId = context.readLong(); type = context.readUTF(); if (context.readBoolean()) { event = context.readObject(); } }
MarshallingConfigurationImpl marshallingConfigurationImpl = null; if (env != null) { marshallingConfigurationImpl = new MarshallingConfigurationImpl((ObjectMarshallingStrategy[]) env.get(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES), false, false); } else { marshallingConfigurationImpl = new MarshallingConfigurationImpl(new ObjectMarshallingStrategy[]{new SerializablePlaceholderResolverStrategy(ClassObjectMarshallingStrategyAcceptor.DEFAULT)}, false, false); ObjectMarshallingStrategyStore objectMarshallingStrategyStore = marshallingConfigurationImpl.getObjectMarshallingStrategyStore(); context = new MarshallerReaderContext(stream, null, null, objectMarshallingStrategyStore, null, env); if (classloader != null) { context.classLoader = classloader; context.classLoader = ContentMarshallerHelper.class.getClassLoader(); ExtensionRegistry registry = PersisterHelper.buildRegistry(context, null); Header _header = PersisterHelper.readFromStreamWithHeaderPreloaded(context, registry); VariableContainer parseFrom = JBPMMessages.VariableContainer.parseFrom(_header.getPayload(), registry); Map<String, Object> value = ProtobufProcessMarshaller.unmarshallVariableContainerValue(context, parseFrom);
private Environment createEnvironment() { Environment env = PersistenceUtil.createEnvironment(context); env.set(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES, new ObjectMarshallingStrategy[]{ new JPAPlaceholderResolverStrategy(env), new SerializablePlaceholderResolverStrategy( ClassObjectMarshallingStrategyAcceptor.DEFAULT ) }); return env; }
@Override public org.drools.core.process.instance.WorkItem readWorkItem(MarshallerReaderContext context) { try { ExtensionRegistry registry = PersisterHelper.buildRegistry(context, null); Header _header = PersisterHelper.readFromStreamWithHeaderPreloaded(context, registry); JBPMMessages.WorkItem _workItem = JBPMMessages.WorkItem.parseFrom(_header.getPayload(), registry); return (org.drools.core.process.instance.WorkItem) readWorkItem(context, _workItem, persistWorkItemVars); } catch (IOException e) { throw new IllegalArgumentException( "IOException while fetching work item instance : " + e.getMessage(), e ); } catch (ClassNotFoundException e) { throw new IllegalArgumentException( "ClassNotFoundException while fetching work item instance : " + e.getMessage(), e ); } }
public Timer serialize(JobContext jobCtx, MarshallerWriteContext outputCtx) { // do not store StartProcess timers as they are registered whenever session starts if (jobCtx instanceof StartProcessJobContext) { return null; } ProcessJobContext pctx = (ProcessJobContext) jobCtx; return ProtobufMessages.Timers.Timer .newBuilder() .setType(ProtobufMessages.Timers.TimerType.PROCESS) .setExtension( JBPMMessages.procTimer, JBPMMessages.ProcessTimer.newBuilder() .setTimer(ProtobufProcessMarshaller.writeTimer(outputCtx, pctx.getTimer())) .setTrigger(ProtobufOutputMarshaller.writeTrigger(pctx.getTrigger(), outputCtx)).build()) .build(); } }
/** * <code>optional .org.drools.core.marshalling.Trigger trigger = 2;</code> */ public Builder mergeTrigger(org.drools.core.marshalling.impl.ProtobufMessages.Trigger value) { if (triggerBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002) && trigger_ != null && trigger_ != org.drools.core.marshalling.impl.ProtobufMessages.Trigger.getDefaultInstance()) { trigger_ = org.drools.core.marshalling.impl.ProtobufMessages.Trigger.newBuilder(trigger_).mergeFrom(value).buildPartial(); } else { trigger_ = value; } onChanged(); } else { triggerBuilder_.mergeFrom(value); } bitField0_ |= 0x00000002; return this; } /**
public SignalManagerSignalAction(MarshallerReaderContext context) throws IOException, ClassNotFoundException { type = context.readUTF(); if (context.readBoolean()) { event = context.readObject(); } }
@Override public void writeWorkItem(MarshallerWriteContext context, org.drools.core.process.instance.WorkItem workItem) { try { JBPMMessages.WorkItem _workItem = writeWorkItem(context, workItem, persistWorkItemVars); PersisterHelper.writeToStreamWithHeader( context, _workItem ); } catch (IOException e) { throw new IllegalArgumentException( "IOException while storing work item instance " + workItem.getId() + ": " + e.getMessage(), e ); } }
/** * <code>optional .org.drools.core.marshalling.Trigger trigger = 2;</code> */ public Builder setTrigger( org.drools.core.marshalling.impl.ProtobufMessages.Trigger.Builder builderForValue) { if (triggerBuilder_ == null) { trigger_ = builderForValue.build(); onChanged(); } else { triggerBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000002; return this; } /**
public byte[] marshal(Context context, ObjectOutputStream os, Object object) throws IOException { ProcessInstance processInstance = (ProcessInstance) object; connectProcessInstanceToRuntimeAndProcess( processInstance, os ); return PersisterHelper.longToByteArray( processInstance.getId() ); }
public void readWorkItems(MarshallerReaderContext context) throws IOException { ProtobufMessages.ProcessData _pdata = (ProtobufMessages.ProcessData) context.parameterObject; InternalWorkingMemory wm = context.wm; for ( JBPMMessages.WorkItem _workItem : _pdata.getExtension( JBPMMessages.workItem ) ) { WorkItem workItem = readWorkItem( context, _workItem ); ((WorkItemManager) wm.getWorkItemManager()).internalAddWorkItem( (org.drools.core.process.instance.WorkItem) workItem ); } }
public void writeProcessTimers(MarshallerWriteContext outCtx) throws IOException { outCtx.writersByClass.put( ProcessJobContext.class, new TimerManager.ProcessTimerOutputMarshaller() ); outCtx.writersByClass.put( StartProcessJobContext.class, new TimerManager.ProcessTimerOutputMarshaller() ); ProtobufMessages.ProcessData.Builder _pdata = (ProtobufMessages.ProcessData.Builder) outCtx.parameterObject; TimerManager timerManager = ((InternalProcessRuntime) ((InternalWorkingMemory) outCtx.wm).getProcessRuntime()).getTimerManager(); long timerId = timerManager.internalGetTimerId(); _pdata.setExtension( JBPMMessages.timerId, timerId ); }
public Object unmarshal(Context context, ObjectInputStream is, byte[] object, ClassLoader classloader) throws IOException, ClassNotFoundException { long processInstanceId = PersisterHelper.byteArrayToLong( object ); ProcessInstanceManager pim = retrieveProcessInstanceManager( is ); // load it as read only to avoid any updates to the data base ProcessInstance processInstance = pim.getProcessInstance( processInstanceId, true ); if (processInstance == null) { RuleFlowProcessInstance result = new RuleFlowProcessInstance(); result.setId( processInstanceId ); result.internalSetState(ProcessInstance.STATE_COMPLETED); return result; } else { connectProcessInstanceToRuntimeAndProcess( processInstance, is ); return processInstance; } }
public void write(MarshallerWriteContext context) throws IOException { context.writeInt( WorkingMemoryAction.SignalAction ); context.writeUTF(type); context.writeBoolean(event != null); if (event != null) { context.writeObject(event); } }
public SignalAction(MarshallerReaderContext context) throws IOException, ClassNotFoundException { type = context.readUTF(); if (context.readBoolean()) { event = context.readObject(); } }
/** * <code>optional .org.drools.core.marshalling.Trigger trigger = 2;</code> */ public org.drools.core.marshalling.impl.ProtobufMessages.TriggerOrBuilder getTriggerOrBuilder() { return trigger_ == null ? org.drools.core.marshalling.impl.ProtobufMessages.Trigger.getDefaultInstance() : trigger_; }
/** * <code>optional .org.drools.core.marshalling.Trigger trigger = 2;</code> */ public org.drools.core.marshalling.impl.ProtobufMessages.Trigger getTrigger() { if (triggerBuilder_ == null) { return trigger_ == null ? org.drools.core.marshalling.impl.ProtobufMessages.Trigger.getDefaultInstance() : trigger_; } else { return triggerBuilder_.getMessage(); } } /**
/** * <code>optional .org.drools.core.marshalling.Trigger trigger = 2;</code> */ public org.drools.core.marshalling.impl.ProtobufMessages.TriggerOrBuilder getTriggerOrBuilder() { if (triggerBuilder_ != null) { return triggerBuilder_.getMessageOrBuilder(); } else { return trigger_ == null ? org.drools.core.marshalling.impl.ProtobufMessages.Trigger.getDefaultInstance() : trigger_; } } /**