use of org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException in project so by onap.
the class RequestHandlerUtils method getServiceInstanceOrchestrationURI.
public RecipeLookupResult getServiceInstanceOrchestrationURI(ServiceInstancesRequest sir, Actions action, boolean alaCarteFlag, InfraActiveRequests currentActiveReq) throws ApiException {
RecipeLookupResult recipeLookupResult = null;
// if the aLaCarte flag is set to TRUE, the API-H should choose the VID_DEFAULT recipe for the requested action
ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) {
recipeLookupResult = getDefaultVnfUri(sir, action);
} else if (action == Action.addMembers || action == Action.removeMembers) {
recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
} else if (modelInfo.getModelType().equals(ModelType.service)) {
try {
recipeLookupResult = getServiceURI(sir, action, alaCarteFlag);
} catch (IOException e) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
throw validateException;
}
} else if (modelInfo.getModelType().equals(ModelType.vfModule) || modelInfo.getModelType().equals(ModelType.volumeGroup) || modelInfo.getModelType().equals(ModelType.vnf)) {
try {
recipeLookupResult = getVnfOrVfModuleUri(sir, action);
} catch (ValidationException e) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
throw validateException;
}
} else if (modelInfo.getModelType().equals(ModelType.network)) {
try {
recipeLookupResult = getNetworkUri(sir, action);
} catch (ValidationException e) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
throw validateException;
}
} else if (modelInfo.getModelType().equals(ModelType.instanceGroup)) {
recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
}
if (recipeLookupResult == null) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
RecipeNotFoundException recipeNotFoundExceptionException = new RecipeNotFoundException.Builder("Recipe could not be retrieved from catalog DB.", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, recipeNotFoundExceptionException.getMessage());
throw recipeNotFoundExceptionException;
}
return recipeLookupResult;
}
use of org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException in project so by onap.
the class InstanceManagement method getInstanceManagementWorkflowRecipe.
private RecipeLookupResult getInstanceManagementWorkflowRecipe(InfraActiveRequests currentActiveReq, String workflowUuid) throws ApiException {
RecipeLookupResult recipeLookupResult;
try {
recipeLookupResult = getCustomWorkflowUri(workflowUuid);
} catch (Exception e) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
throw validateException;
}
if (recipeLookupResult == null) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
RecipeNotFoundException recipeNotFoundExceptionException = new RecipeNotFoundException.Builder("Recipe could not be retrieved from catalog DB.", HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, recipeNotFoundExceptionException.getMessage());
throw recipeNotFoundExceptionException;
}
return recipeLookupResult;
}
Aggregations