use of io.automatiko.engine.workflow.marshalling.impl.AutomatikoMessages.VariableContainer in project automatiko-engine by automatiko-io.
the class ProtobufProcessMarshaller method marshallVariablesContainer.
public static VariableContainer marshallVariablesContainer(MarshallerWriteContext context, Map<String, Object> variables) throws IOException {
AutomatikoMessages.VariableContainer.Builder vcbuilder = AutomatikoMessages.VariableContainer.newBuilder();
for (String key : variables.keySet()) {
AutomatikoMessages.Variable.Builder builder = AutomatikoMessages.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();
}
Aggregations