Refine search
continue; if (strategy.accept(variable.getValue())) { logger.debug("Strategy of type {} found to handle variable '{}'", strategy, variable.getKey()); try { context.setState(ProcessMarshallerWriteContext.STATE_COMPLETED); strategy.marshal(null, context, variable.getValue()); logger.debug("Variable '{}' successfully persisted by strategy {}", variable.getKey(), strategy); break;
strategy.write(stream, object);
value = strategy.read( stream );
public static Variable marshallVariablesMap(MarshallerWriteContext context, Map<String, Object> variables) throws IOException{ Map<String, Variable> marshalledVariables = new HashMap<String, Variable>(); for(String key : variables.keySet()){ JBPMMessages.Variable.Builder builder = JBPMMessages.Variable.newBuilder().setName( key ); if(variables.get(key) != null){ ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategyObject( variables.get(key) ); Integer index = context.getStrategyIndex( strategy ); builder.setStrategyIndex( index ) .setValue( ByteString.copyFrom( strategy.marshal( context.strategyContext.get( strategy ), context, variables.get(key) ) ) ); } marshalledVariables.put(key, builder.build()); } return marshallVariable(context, "variablesMap" ,marshalledVariables); }
public static Object unmarshallVariableValue(MarshallerReaderContext context, JBPMMessages.Variable _variable) throws IOException, ClassNotFoundException { if(_variable.getValue() == null || _variable.getValue().isEmpty()){ return null; } ObjectMarshallingStrategy strategy = context.usedStrategies.get( _variable.getStrategyIndex() ); Object value = strategy.unmarshal( context.strategyContexts.get( strategy ), context, _variable.getValue().toByteArray(), (context.kBase == null)?null:context.kBase.getRootClassLoader() ); return value; }
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 static VariableContainer marshallVariablesContainer(MarshallerWriteContext context, Map<String, Object> variables) throws IOException{ JBPMMessages.VariableContainer.Builder vcbuilder = JBPMMessages.VariableContainer.newBuilder(); for(String key : variables.keySet()){ JBPMMessages.Variable.Builder builder = JBPMMessages.Variable.newBuilder().setName( key ); if(variables.get(key) != null){ ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategyObject( variables.get(key) ); Integer index = context.getStrategyIndex( strategy ); builder.setStrategyIndex( index ) .setValue( ByteString.copyFrom( strategy.marshal( context.strategyContext.get( strategy ), context, variables.get(key) ) ) ); } vcbuilder.addVariable(builder.build()); } return vcbuilder.build(); }
public static Object unmarshallVariableValue(MarshallerReaderContext context, JBPMMessages.Variable _variable) throws IOException, ClassNotFoundException { if(_variable.getValue() == null || _variable.getValue().isEmpty()){ return null; } ObjectMarshallingStrategy strategy = context.usedStrategies.get( _variable.getStrategyIndex() ); Object value = strategy.unmarshal( context.strategyContexts.get( strategy ), context, _variable.getValue().toByteArray(), (context.kBase == null)?null:context.kBase.getRootClassLoader() ); return value; }
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 static Variable marshallVariable(MarshallerWriteContext context, String name, Object value) throws IOException { JBPMMessages.Variable.Builder builder = JBPMMessages.Variable.newBuilder().setName( name ); if(value != null){ ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategyObject( value ); Integer index = context.getStrategyIndex( strategy ); builder.setStrategyIndex( index ) .setValue( ByteString.copyFrom( strategy.marshal( context.strategyContext.get( strategy ), context, value ) ) ); } return builder.build(); }
strategy.write( stream, object ); } else {
continue; if (strategy.accept(variable.getValue())) { logger.debug("Strategy of type {} found to handle variable '{}'", strategy, variable.getKey()); try { context.setState(ProcessMarshallerWriteContext.STATE_COMPLETED); strategy.marshal(null, context, variable.getValue()); logger.debug("Variable '{}' successfully persisted by strategy {}", variable.getKey(), strategy); break;
value = strategy.read( stream );
public static Variable marshallVariablesMap(MarshallerWriteContext context, Map<String, Object> variables) throws IOException{ Map<String, Variable> marshalledVariables = new HashMap<String, Variable>(); for(String key : variables.keySet()){ JBPMMessages.Variable.Builder builder = JBPMMessages.Variable.newBuilder().setName( key ); if(variables.get(key) != null){ ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategyObject( variables.get(key) ); Integer index = context.getStrategyIndex( strategy ); builder.setStrategyIndex( index ) .setValue( ByteString.copyFrom( strategy.marshal( context.strategyContext.get( strategy ), context, variables.get(key) ) ) ); } marshalledVariables.put(key, builder.build()); } return marshallVariable(context, "variablesMap" ,marshalledVariables); }
strategy.write(stream, object);
public static VariableContainer marshallVariablesContainer(MarshallerWriteContext context, Map<String, Object> variables) throws IOException{ JBPMMessages.VariableContainer.Builder vcbuilder = JBPMMessages.VariableContainer.newBuilder(); for(String key : variables.keySet()){ JBPMMessages.Variable.Builder builder = JBPMMessages.Variable.newBuilder().setName( key ); if(variables.get(key) != null){ ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategyObject( variables.get(key) ); Integer index = context.getStrategyIndex( strategy ); builder.setStrategyIndex( index ) .setValue( ByteString.copyFrom( strategy.marshal( context.strategyContext.get( strategy ), context, variables.get(key) ) ) ); } vcbuilder.addVariable(builder.build()); } return vcbuilder.build(); }
strategy.write( stream, object ); } else {
public static Variable marshallVariable(MarshallerWriteContext context, String name, Object value) throws IOException { JBPMMessages.Variable.Builder builder = JBPMMessages.Variable.newBuilder().setName( name ); if(value != null){ ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategyObject( value ); Integer index = context.getStrategyIndex( strategy ); builder.setStrategyIndex( index ) .setValue( ByteString.copyFrom( strategy.marshal( context.strategyContext.get( strategy ), context, value ) ) ); } return builder.build(); }