strategy = context.resolverStrategyFactory.getStrategy( index ); String strategyClassName = context.stream.readUTF(); if ( ! StringUtils.isEmpty(strategyClassName) ) { strategy = context.resolverStrategyFactory.getStrategyObject(strategyClassName); if( strategy == null ) { throw new IllegalStateException( "No strategy of type " + strategyClassName + " available." );
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 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); }
int index = objectMarshallingStrategyStore.getStrategy( object ); ObjectMarshallingStrategy strategy = objectMarshallingStrategyStore.getStrategy( index );
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 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 ); } } } }
strategy = context.resolverStrategyFactory.getStrategy( index ); String strategyClassName = context.stream.readUTF(); if ( ! StringUtils.isEmpty(strategyClassName) ) { strategy = context.resolverStrategyFactory.getStrategyObject(strategyClassName); if( strategy == null ) { throw new IllegalStateException( "No strategy of type " + strategyClassName + " available." );
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(); }
int index = objectMarshallingStrategyStore.getStrategy( object ); ObjectMarshallingStrategy strategy = objectMarshallingStrategyStore.getStrategy( index );
stream.writeInt(useNewMarshallingStrategyAlgorithm); ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategyObject(object); stream.writeUTF(strategy.getClass().getName()); strategy.write(stream, object);
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 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 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(); }
stream.writeInt(useNewMarshallingStrategyAlgorithm); ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategyObject(object); stream.writeUTF(strategy.getClass().getName()); strategy.write(stream, object);