private ProcessInstanceMarshaller getMarshallerFromContext(MarshallerReaderContext context) throws IOException { ObjectInputStream stream = context.stream; String processInstanceType = stream.readUTF(); return ProcessMarshallerRegistry.INSTANCE.getMarshaller( processInstanceType ); }
private ProcessMarshallerRegistry() { this.registry = new HashMap<String, ProcessInstanceMarshaller>(); register(RuleFlowProcess.RULEFLOW_TYPE, ProtobufRuleFlowProcessInstanceMarshaller.INSTANCE); }
public List<ProcessInstance> readProcessInstances(MarshallerReaderContext context) throws IOException { ProtobufMessages.ProcessData _pdata = (ProtobufMessages.ProcessData) context.parameterObject; List<ProcessInstance> processInstanceList = new ArrayList<ProcessInstance>(); for ( JBPMMessages.ProcessInstance _instance : _pdata.getExtension( JBPMMessages.processInstance ) ) { context.parameterObject = _instance; ProcessInstance processInstance = ProcessMarshallerRegistry.INSTANCE.getMarshaller( _instance.getProcessType() ).readProcessInstance( context ); processInstanceList.add( processInstance ); } return processInstanceList; }
private ProcessMarshallerRegistry() { this.registry = new HashMap<String, ProcessInstanceMarshaller>(); register(RuleFlowProcess.RULEFLOW_TYPE, ProtobufRuleFlowProcessInstanceMarshaller.INSTANCE); }
public void writeProcessInstances(MarshallerWriteContext context) throws IOException { ProtobufMessages.ProcessData.Builder _pdata = (ProtobufMessages.ProcessData.Builder) context.parameterObject; List<org.kie.api.runtime.process.ProcessInstance> processInstances = new ArrayList<org.kie.api.runtime.process.ProcessInstance>( context.wm.getProcessInstances() ); Collections.sort( processInstances, new Comparator<org.kie.api.runtime.process.ProcessInstance>() { public int compare(org.kie.api.runtime.process.ProcessInstance o1, org.kie.api.runtime.process.ProcessInstance o2) { return (int) (o1.getId() - o2.getId()); } } ); for ( org.kie.api.runtime.process.ProcessInstance processInstance : processInstances ) { String processType = processInstance.getProcess().getType(); JBPMMessages.ProcessInstance _instance = (JBPMMessages.ProcessInstance) ProcessMarshallerRegistry.INSTANCE.getMarshaller( processType ) .writeProcessInstance( context, processInstance ); _pdata.addExtension( JBPMMessages.processInstance, _instance ); } }
processInstance, processType ); ProcessInstanceMarshaller marshaller = ProcessMarshallerRegistry.INSTANCE.getMarshaller( processType );
public List<ProcessInstance> readProcessInstances(MarshallerReaderContext context) throws IOException { ProtobufMessages.ProcessData _pdata = (ProtobufMessages.ProcessData) context.parameterObject; List<ProcessInstance> processInstanceList = new ArrayList<ProcessInstance>(); for ( JBPMMessages.ProcessInstance _instance : _pdata.getExtension( JBPMMessages.processInstance ) ) { context.parameterObject = _instance; ProcessInstance processInstance = ProcessMarshallerRegistry.INSTANCE.getMarshaller( _instance.getProcessType() ).readProcessInstance( context ); processInstanceList.add( processInstance ); } return processInstanceList; }
public void writeProcessInstances(MarshallerWriteContext context) throws IOException { ProtobufMessages.ProcessData.Builder _pdata = (ProtobufMessages.ProcessData.Builder) context.parameterObject; List<org.kie.api.runtime.process.ProcessInstance> processInstances = new ArrayList<org.kie.api.runtime.process.ProcessInstance>( context.wm.getProcessInstances() ); Collections.sort( processInstances, new Comparator<org.kie.api.runtime.process.ProcessInstance>() { public int compare(org.kie.api.runtime.process.ProcessInstance o1, org.kie.api.runtime.process.ProcessInstance o2) { return (int) (o1.getId() - o2.getId()); } } ); for ( org.kie.api.runtime.process.ProcessInstance processInstance : processInstances ) { String processType = processInstance.getProcess().getType(); JBPMMessages.ProcessInstance _instance = (JBPMMessages.ProcessInstance) ProcessMarshallerRegistry.INSTANCE.getMarshaller( processType ) .writeProcessInstance( context, processInstance ); _pdata.addExtension( JBPMMessages.processInstance, _instance ); } }