diff options
7 files changed, 36 insertions, 40 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java index 74cf7c38c9..c106591b25 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java @@ -3,6 +3,8 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * + * Copyright (C) 2019 IBM * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +41,8 @@ public class CreateInventoryTask { private static final Logger logger = LoggerFactory.getLogger(CreateInventoryTask.class); + private static final String AAI_INVENTORY_FAILURE = "AAIInventoryFailure"; + @Autowired CreateAAIInventory createInventory; @@ -75,7 +79,7 @@ public class CreateInventoryTask { logger.debug("The External Task Id: {} Successful", externalTask.getId()); } else if (inventoryException) { logger.debug("The External Task Id: {} Failed, Retry not needed", externalTask.getId()); - externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure"); + externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); } else { if (externalTask.getRetries() == null) { logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}", @@ -84,7 +88,7 @@ public class CreateInventoryTask { UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000); } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) { logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId()); - externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure"); + externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); } else { logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ", externalTask.getId(), externalTask.getRetries() - 1, @@ -97,13 +101,13 @@ public class CreateInventoryTask { } } else { logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTask.getId()); - externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure"); + externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE); } } private void setupMDC(ExternalTask externalTask) { try { - String msoRequestId = (String) externalTask.getVariable("mso-request-id"); + String msoRequestId = externalTask.getVariable("mso-request-id"); if (msoRequestId != null && !msoRequestId.isEmpty()) MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId); } catch (Exception e) { diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java index f4cfb1361f..93e4aee3d7 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/ArtifactInfoImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -59,7 +61,7 @@ public class ArtifactInfoImpl implements IArtifactInfo { } public static List<ArtifactInfoImpl> convertToArtifactInfoImpl(List<IArtifactInfo> list) { - List<ArtifactInfoImpl> ret = new ArrayList<ArtifactInfoImpl>(); + List<ArtifactInfoImpl> ret = new ArrayList<>(); if (list != null) { for (IArtifactInfo artifactInfo : list) { ret.add(new ArtifactInfoImpl(artifactInfo)); @@ -159,7 +161,7 @@ public class ArtifactInfoImpl implements IArtifactInfo { @Override public List<IArtifactInfo> getRelatedArtifacts() { - List<IArtifactInfo> temp = new ArrayList<IArtifactInfo>(); + List<IArtifactInfo> temp = new ArrayList<>(); if (relatedArtifactsInfo != null) { temp.addAll(relatedArtifactsImpl); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java index 113baf96e6..b9b7fcc0d4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java @@ -50,8 +50,6 @@ import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference; import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest; import org.onap.so.apihandlerinfra.tasksbeans.Value; import org.onap.so.apihandlerinfra.tasksbeans.Variables; -import org.onap.so.constants.Status; -import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; @@ -94,7 +92,6 @@ public class ManualTasks { String requestId = requestContext.getProperty("requestId").toString(); logger.info(LoggingAnchor.TWO, MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId); - long startTime = System.currentTimeMillis(); logger.debug("requestId is: {}", requestId); TasksRequest taskRequest = null; String apiVersion = version.substring(1); @@ -141,9 +138,6 @@ public class ManualTasks { throw validateException; } - // Create Request Record - InfraActiveRequests currentActiveReq = - msoRequest.createRequestObject(taskRequest, Action.completeTask, requestId, Status.PENDING, request); // Transform the request to Camunda-style Complete request Variables variablesForComplete = new Variables(); @@ -157,7 +151,7 @@ public class ManualTasks { variablesForComplete.setResponseValue(responseValue); variablesForComplete.setRequestorId(requestorIdValue); - String camundaJsonReq = null; + String camundaJsonReq; try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); @@ -176,9 +170,8 @@ public class ManualTasks { throw validateException; } - RequestClient requestClient = null; - HttpResponse response = null; - long subStartTime = System.currentTimeMillis(); + RequestClient requestClient; + HttpResponse response; String requestUrl = taskUri + "/" + taskId + "/complete"; try { requestClient = reqClientFactory.getRequestClient(requestUrl); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java index ba69355d5e..9e92c293bf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java @@ -165,13 +165,11 @@ public class OrchestrationRequests { @QueryParam("includeCloudRequest") boolean includeCloudRequest, @QueryParam(value = "format") String format) throws ApiException { - long startTime = System.currentTimeMillis(); - MultivaluedMap<String, String> queryParams = ui.getQueryParameters(); - List<InfraActiveRequests> activeRequests = null; + List<InfraActiveRequests> activeRequests; - GetOrchestrationListResponse orchestrationList = null; + GetOrchestrationListResponse orchestrationList; Map<String, List<String>> orchestrationMap; String apiVersion = version.substring(1); @@ -222,12 +220,10 @@ public class OrchestrationRequests { public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId, @PathParam("version") String version) throws ApiException { - long startTime = System.currentTimeMillis(); logger.debug("requestId is: {}", requestId); - ServiceInstancesRequest sir = null; + ServiceInstancesRequest sir; - InfraActiveRequests infraActiveRequest = null; - Request request = null; + InfraActiveRequests infraActiveRequest; try { ObjectMapper mapper = new ObjectMapper(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java index bba8064f7c..b57bb5d1d8 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -91,13 +93,13 @@ public class WorkflowSpecificationsHandler { List<Workflow> workflows = catalogDbClient.findWorkflowByModelUUID(vnfModelVersionId); List<Workflow> nativeWorkflows = catalogDbClient.findWorkflowBySource(NATIVE_WORKFLOW); - if (nativeWorkflows != null && nativeWorkflows.size() != 0) { + if (nativeWorkflows != null && !nativeWorkflows.isEmpty()) { workflows.addAll(nativeWorkflows); } WorkflowSpecifications workflowSpecifications = mapWorkflowsToWorkflowSpecifications(workflows); - String jsonResponse = null; + String jsonResponse; try { ObjectMapper mapper = new ObjectMapper(); jsonResponse = mapper.writeValueAsString(workflowSpecifications); @@ -116,11 +118,11 @@ public class WorkflowSpecificationsHandler { } protected WorkflowSpecifications mapWorkflowsToWorkflowSpecifications(List<Workflow> workflows) { - if (workflows == null || workflows.size() == 0) { + if (workflows == null || workflows.isEmpty()) { return null; } WorkflowSpecifications workflowSpecifications = new WorkflowSpecifications(); - List<WorkflowSpecificationList> workflowSpecificationList = new ArrayList<WorkflowSpecificationList>(); + List<WorkflowSpecificationList> workflowSpecificationList = new ArrayList<>(); for (Workflow workflow : workflows) { WorkflowSpecificationList workflowSpecificationListItem = new WorkflowSpecificationList(); @@ -153,10 +155,10 @@ public class WorkflowSpecificationsHandler { private List<ActivitySequence> buildActivitySequence(Workflow workflow) { List<WorkflowActivitySpecSequence> workflowActivitySpecSequences = workflow.getWorkflowActivitySpecSequence(); - if (workflowActivitySpecSequences == null || workflowActivitySpecSequences.size() == 0) { + if (workflowActivitySpecSequences == null || workflowActivitySpecSequences.isEmpty()) { return null; } - List<ActivitySequence> activitySequences = new ArrayList<ActivitySequence>(); + List<ActivitySequence> activitySequences = new ArrayList<>(); for (WorkflowActivitySpecSequence workflowActivitySpecSequence : workflowActivitySpecSequences) { if (workflowActivitySpecSequence != null) { ActivitySpec activitySpec = workflowActivitySpecSequence.getActivitySpec(); @@ -174,17 +176,17 @@ public class WorkflowSpecificationsHandler { private List<WorkflowInputParameter> buildWorkflowInputParameters(Workflow workflow) { List<WorkflowActivitySpecSequence> workflowActivitySpecSequences = workflow.getWorkflowActivitySpecSequence(); - if (workflowActivitySpecSequences == null || workflowActivitySpecSequences.size() == 0) { - return new ArrayList<WorkflowInputParameter>(); + if (workflowActivitySpecSequences == null || workflowActivitySpecSequences.isEmpty()) { + return new ArrayList<>(); } - Map<String, WorkflowInputParameter> workflowInputParameterMap = new HashMap<String, WorkflowInputParameter>(); + Map<String, WorkflowInputParameter> workflowInputParameterMap = new HashMap<>(); for (WorkflowActivitySpecSequence workflowActivitySpecSequence : workflowActivitySpecSequences) { if (workflowActivitySpecSequence != null) { ActivitySpec activitySpec = workflowActivitySpecSequence.getActivitySpec(); if (activitySpec != null) { List<ActivitySpecUserParameters> activitySpecUserParameters = activitySpec.getActivitySpecUserParameters(); - if (activitySpecUserParameters != null && activitySpecUserParameters.size() != 0) { + if (activitySpecUserParameters != null && !activitySpecUserParameters.isEmpty()) { for (ActivitySpecUserParameters activitySpecUserParameter : activitySpecUserParameters) { UserParameters userParameter = activitySpecUserParameter.getUserParameters(); if (userParameter != null) { @@ -199,7 +201,7 @@ public class WorkflowSpecificationsHandler { } if (workflowInputParameterMap.size() == 0) { - return new ArrayList<WorkflowInputParameter>(); + return new ArrayList<>(); } List<WorkflowInputParameter> workflowInputParameterList = workflowInputParameterMap.values().stream().collect(Collectors.toList()); @@ -220,7 +222,7 @@ public class WorkflowSpecificationsHandler { private List<Validation> buildValidationList(UserParameters userParameter) { List<Validation> validationList = null; if (userParameter.getMaxLength() != null || userParameter.getAllowableChars() != null) { - validationList = new ArrayList<Validation>(); + validationList = new ArrayList<>(); Validation validation = new Validation(); if (userParameter.getMaxLength() != null) { validation.setMaxLength(userParameter.getMaxLength().toString()); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java index b2933df030..216588432b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java @@ -75,8 +75,7 @@ public class ModelDistributionRequest { @Transactional public Response updateModelDistributionStatus(String requestJSON, @PathParam("version") String version, @PathParam("distributionId") String distributionId) throws ApiException { - long startTime = System.currentTimeMillis(); - Distribution distributionRequest = null; + Distribution distributionRequest; try { ObjectMapper mapper = new ObjectMapper(); @@ -146,7 +145,7 @@ public class ModelDistributionRequest { } re.setServiceException(se); - String requestErrorStr = null; + String requestErrorStr; try { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(Include.NON_DEFAULT); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java index fe81a07212..5eb4a67fa6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java @@ -145,7 +145,7 @@ public class CreateVnfOperationalEnvironment { throws TenantIsolationException { List<ServiceEndPoint> endpointList = serviceEndPointList.getServiceEndPointList(); logger.debug("Number of service endpoints from GRM: {}", endpointList.size()); - List<ServiceEndPointRequest> serviceEndPointRequestList = new ArrayList<ServiceEndPointRequest>(); + List<ServiceEndPointRequest> serviceEndPointRequestList = new ArrayList<>(); for (ServiceEndPoint serviceEndpoint : endpointList) { serviceEndPointRequestList.add(buildServiceEndpoint(serviceEndpoint)); } |