Search in sources :

Example 1 with UnassignNetworkException

use of org.onap.so.bpmn.infrastructure.flowspecific.exceptions.UnassignNetworkException in project so by onap.

the class UnassignNetworkBB method checkRelationshipRelatedTo.

/**
 * BPMN access method to prepare overall error messages.
 *
 * @param execution - BuildingBlockExecution
 * @param relatedToValue - String, ex: vf-module
 * @return void - nothing
 */
public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) {
    try {
        L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
        AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
        Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
        if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) {
            String msg = messageCannotPerformUnassign + relatedToValue;
            execution.setVariable("ErrorUnassignNetworkBB", msg);
            logger.error("ErrorUnassignNetworkBB: {}", msg);
            throw new UnassignNetworkException(msg);
        }
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) UnassignNetworkException(org.onap.so.bpmn.infrastructure.flowspecific.exceptions.UnassignNetworkException) UnassignNetworkException(org.onap.so.bpmn.infrastructure.flowspecific.exceptions.UnassignNetworkException) AAIResultWrapper(org.onap.aaiclient.client.aai.entities.AAIResultWrapper)

Aggregations

AAIResultWrapper (org.onap.aaiclient.client.aai.entities.AAIResultWrapper)1 UnassignNetworkException (org.onap.so.bpmn.infrastructure.flowspecific.exceptions.UnassignNetworkException)1 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)1