Search in sources :

Example 1 with Builder

use of com.google.protobuf.Struct.Builder in project so by onap.

the class AbstractCDSProcessingBBUtils method prepareExecutionServiceInput.

private ExecutionServiceInput prepareExecutionServiceInput(AbstractCDSPropertiesBean executionObject) {
    String payload = executionObject.getRequestObject();
    CommonHeader commonHeader = CommonHeader.newBuilder().setOriginatorId(executionObject.getOriginatorId()).setRequestId(executionObject.getRequestId()).setSubRequestId(executionObject.getSubRequestId()).build();
    ActionIdentifiers actionIdentifiers = ActionIdentifiers.newBuilder().setBlueprintName(executionObject.getBlueprintName()).setBlueprintVersion(executionObject.getBlueprintVersion()).setActionName(executionObject.getActionName()).setMode(executionObject.getMode()).build();
    Builder struct = Struct.newBuilder();
    try {
        JsonFormat.parser().merge(payload, struct);
    } catch (InvalidProtocolBufferException e) {
        logger.error("Failed to parse received message. blueprint({}:{}) for action({}). {}", executionObject.getBlueprintVersion(), executionObject.getBlueprintName(), executionObject.getActionName(), e);
    }
    return ExecutionServiceInput.newBuilder().setCommonHeader(commonHeader).setActionIdentifiers(actionIdentifiers).setPayload(struct.build()).build();
}
Also used : CommonHeader(org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader) ExceptionBuilder(org.onap.so.client.exception.ExceptionBuilder) Builder(com.google.protobuf.Struct.Builder) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) ActionIdentifiers(org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers)

Aggregations

InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 Builder (com.google.protobuf.Struct.Builder)1 ActionIdentifiers (org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers)1 CommonHeader (org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader)1 ExceptionBuilder (org.onap.so.client.exception.ExceptionBuilder)1