diff options
author | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2019-02-25 09:11:16 +0100 |
---|---|---|
committer | Michal Kabaj <michal.kabaj@nokia.com> | 2019-02-28 11:22:04 +0100 |
commit | fee6611fa805b6bb5f06f07b45396a71ad72c564 (patch) | |
tree | d55aea0fd3cdfc53d96fe11489828c015fdb8dfc /bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap | |
parent | ade5e9910524146f2257183909842263136698cc (diff) |
CorrelationId cleanup
Remove old correlationId field and references from ServiceInstancesRequest and rename correlationId to pnfCorrelationId
Change-Id: I5d8861aebe14c68574b6c54bc8d4eadf2967478b
Issue-ID: SO-1274
Signed-off-by: Michal Kabaj <michal.kabaj@nokia.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap')
12 files changed, 56 insertions, 56 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java index 05109abc84..439591a295 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java @@ -33,8 +33,8 @@ public class CancelDmaapSubscription implements JavaDelegate { @Override public void execute(DelegateExecution execution) { - String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); - dmaapClient.unregister(correlationId); + String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID); + dmaapClient.unregister(pnfCorrelationId); } @Autowired diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java index a8fb21540a..e0fa41b7a1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegate.java @@ -21,7 +21,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import java.io.IOException; @@ -35,16 +35,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** - * Implementation of "Check AAI for correlation_id" task in CreateAndActivatePnfResource.bpmn + * Implementation of "Check AAI for pnf_correlation_id" task in CreateAndActivatePnfResource.bpmn * - * Inputs: - correlationId - String + * Inputs: - pnfCorrelationId - String * * Outputs: - aaiContainsInfoAboutPnf - local Boolean */ @Component -public class CheckAaiForCorrelationIdDelegate implements JavaDelegate { +public class CheckAaiForPnfCorrelationIdDelegate implements JavaDelegate { - private static final Logger logger = LoggerFactory.getLogger(CheckAaiForCorrelationIdDelegate.class); + private static final Logger logger = LoggerFactory.getLogger(CheckAaiForPnfCorrelationIdDelegate.class); private PnfManagement pnfManagement; @@ -55,13 +55,13 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate { @Override public void execute(DelegateExecution execution) { - String correlationId = (String) execution.getVariable(CORRELATION_ID); - if (correlationId == null) { - new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set"); + String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID); + if (pnfCorrelationId == null) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, PNF_CORRELATION_ID + " is not set"); } try { - boolean isEntry = pnfManagement.getEntryFor(correlationId).isPresent(); - logger.debug("AAI entry is found for pnf correlation id {}: {}", CORRELATION_ID, isEntry); + boolean isEntry = pnfManagement.getEntryFor(pnfCorrelationId).isPresent(); + logger.debug("AAI entry is found for pnf correlation id {}: {}", PNF_CORRELATION_ID, isEntry); execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, isEntry); } catch (IOException e) { new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage()); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java index c31041fbf7..e56cb83119 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -38,7 +38,7 @@ import org.springframework.stereotype.Component; * Implementation of "Create Pnf entry in AAI" task in CreateAndActivatePnfResource.bpmn * * Inputs: - * - correlationId - String + * - pnfCorrelationId - String * - pnfUuid - String */ @Component @@ -54,12 +54,12 @@ public class CreatePnfEntryInAaiDelegate implements JavaDelegate { @Override public void execute(DelegateExecution execution) throws Exception { - String correlationId = (String) execution.getVariable(CORRELATION_ID); + String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID); String pnfUuid = (String) execution.getVariable(PNF_UUID); Pnf pnf = new Pnf(); pnf.setPnfId(pnfUuid); - pnf.setPnfName(correlationId); - pnfManagement.createEntry(correlationId, pnf); - logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", correlationId, pnfUuid); + pnf.setPnfName(pnfCorrelationId); + pnfManagement.createEntry(pnfCorrelationId, pnf); + logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", pnfCorrelationId, pnfUuid); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java index 7b6706f820..a367bada02 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java @@ -44,7 +44,7 @@ public class CreateRelation implements JavaDelegate { @Override public void execute(DelegateExecution delegateExecution) { String serviceInstanceId = (String) delegateExecution.getVariable("serviceInstanceId"); - String pnfName = (String) delegateExecution.getVariable("correlationId"); + String pnfName = (String) delegateExecution.getVariable("pnfCorrelationId"); try { pnfManagementImpl.createRelation(serviceInstanceId, pnfName); } catch (Exception e) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java index c5caea5f2f..7d449e72a8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java @@ -27,7 +27,7 @@ public class ExecutionVariableNames { private ExecutionVariableNames() {} - public final static String CORRELATION_ID = "correlationId"; + public final static String PNF_CORRELATION_ID = "pnfCorrelationId"; public final static String AAI_CONTAINS_INFO_ABOUT_PNF = "aaiContainsInfoAboutPnf"; public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp"; public final static String DMAAP_MESSAGE = "dmaapMessage"; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java index 1a75b0998c..96455acb84 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java @@ -34,9 +34,9 @@ public class InformDmaapClient implements JavaDelegate { @Override public void execute(DelegateExecution execution) { - String correlationId = (String) execution.getVariable(ExecutionVariableNames.CORRELATION_ID); + String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID); RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService(); - dmaapClient.registerForUpdate(correlationId, () -> + dmaapClient.registerForUpdate(pnfCorrelationId, () -> runtimeService .createMessageCorrelation("WorkflowMessage") .processInstanceBusinessKey(execution.getProcessBusinessKey()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java index 1b185f7c03..1caadea0de 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION; @@ -49,16 +49,16 @@ public class PnfCheckInputs implements JavaDelegate { @Override public void execute(DelegateExecution execution) { - validateCorrelationId(execution); + validatePnfCorrelationId(execution); validatePnfUuid(execution); validateTimeout(execution); validateServiceInstanceId(execution); } - private void validateCorrelationId(DelegateExecution execution) { - String correlationId = (String) execution.getVariable(CORRELATION_ID); - if (Strings.isNullOrEmpty(correlationId)) { - new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined"); + private void validatePnfCorrelationId(DelegateExecution execution) { + String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID); + if (Strings.isNullOrEmpty(pnfCorrelationId)) { + new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfCorrelationId variable not defined"); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java index c7e7c7848c..fbf86cc411 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java @@ -22,7 +22,7 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; public interface DmaapClient { - void registerForUpdate(String correlationId, Runnable informConsumer); + void registerForUpdate(String pnfCorrelationId, Runnable informConsumer); - Runnable unregister(String correlationId); + Runnable unregister(String pnfCorrelationId); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java index 159298b4ad..53f6b78d69 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationId.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java @@ -31,19 +31,19 @@ import java.util.List; import java.util.Optional; import java.util.Spliterator; -public final class JsonUtilForCorrelationId { +public final class JsonUtilForPnfCorrelationId { - private static final String JSON_CORRELATION_ID_FIELD_NAME = "correlationId"; + private static final String JSON_PNF_CORRELATION_ID_FIELD_NAME = "pnfCorrelationId"; - static List<String> parseJsonToGelAllCorrelationId(String json) { + static List<String> parseJsonToGelAllPnfCorrelationId(String json) { JsonElement je = new JsonParser().parse(json); JsonArray array = je.getAsJsonArray(); List<String> list = new ArrayList<>(); Spliterator<JsonElement> spliterator = array.spliterator(); spliterator.forEachRemaining(jsonElement -> { handleEscapedCharacters(jsonElement) - .ifPresent(jsonObject -> getCorrelationId(jsonObject) - .ifPresent(correlationId -> list.add(correlationId))); + .ifPresent(jsonObject -> getPnfCorrelationId(jsonObject) + .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId))); }); return list; } @@ -55,9 +55,9 @@ public final class JsonUtilForCorrelationId { return Optional.ofNullable(new JsonParser().parse(jsonElement.getAsString()).getAsJsonObject()); } - private static Optional<String> getCorrelationId(JsonObject jsonObject) { - if (jsonObject.has(JSON_CORRELATION_ID_FIELD_NAME)) { - return Optional.ofNullable(jsonObject.get(JSON_CORRELATION_ID_FIELD_NAME).getAsString()); + private static Optional<String> getPnfCorrelationId(JsonObject jsonObject) { + if (jsonObject.has(JSON_PNF_CORRELATION_ID_FIELD_NAME)) { + return Optional.ofNullable(jsonObject.get(JSON_PNF_CORRELATION_ID_FIELD_NAME).getAsString()); } return Optional.empty(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java index 52f879b0ad..1b7a69eec8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java @@ -69,18 +69,18 @@ public class PnfEventReadyDmaapClient implements DmaapClient { } @Override - public synchronized void registerForUpdate(String correlationId, Runnable informConsumer) { - logger.debug("registering for pnf ready dmaap event for correlation id: {}", correlationId); - pnfCorrelationIdToThreadMap.put(correlationId, informConsumer); + public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) { + logger.debug("registering for pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId); + pnfCorrelationIdToThreadMap.put(pnfCorrelationId, informConsumer); if (!dmaapThreadListenerIsRunning) { startDmaapThreadListener(); } } @Override - public synchronized Runnable unregister(String correlationId) { - logger.debug("unregistering from pnf ready dmaap event for correlation id: {}", correlationId); - Runnable runnable = pnfCorrelationIdToThreadMap.remove(correlationId); + public synchronized Runnable unregister(String pnfCorrelationId) { + logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId); + Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId); if (pnfCorrelationIdToThreadMap.isEmpty()) { stopDmaapThreadListener(); } @@ -113,7 +113,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient { try { logger.debug("dmaap listener starts listening pnf ready dmaap topic"); HttpResponse response = httpClient.execute(getRequest); - getCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfCorrelationIdFound); + getPnfCorrelationIdListFromResponse(response).forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound); } catch (IOException e) { logger.error("Exception caught during sending rest request to dmaap for listening event topic", e); } @@ -122,20 +122,20 @@ public class PnfEventReadyDmaapClient implements DmaapClient { } } - private List<String> getCorrelationIdListFromResponse(HttpResponse response) throws IOException { + private List<String> getPnfCorrelationIdListFromResponse(HttpResponse response) throws IOException { if (response.getStatusLine().getStatusCode() == 200) { String responseString = EntityUtils.toString(response.getEntity(), "UTF-8"); if (responseString != null) { - return JsonUtilForCorrelationId.parseJsonToGelAllCorrelationId(responseString); + return JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(responseString); } } return Collections.emptyList(); } - private void informAboutPnfReadyIfCorrelationIdFound(String correlationId) { - Runnable runnable = unregister(correlationId); + private void informAboutPnfReadyIfPnfCorrelationIdFound(String pnfCorrelationId) { + Runnable runnable = unregister(pnfCorrelationId); if (runnable != null) { - logger.debug("dmaap listener gets pnf ready event for correlationId: {}", correlationId); + logger.debug("dmaap listener gets pnf ready event for pnfCorrelationId: {}", pnfCorrelationId); runnable.run(); } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java index b66bb5f61b..9e720fe0a4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java @@ -26,9 +26,9 @@ import org.onap.aai.domain.yang.Pnf; public interface PnfManagement { - Optional<Pnf> getEntryFor(String correlationId) throws IOException; + Optional<Pnf> getEntryFor(String pnfCorrelationId) throws IOException; - void createEntry(String correlationId, Pnf entry) throws IOException; + void createEntry(String pnfCorrelationId, Pnf entry) throws IOException; void createRelation(String serviceInstanceId, String pnfName) throws IOException; } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java index 3d8da2a106..32ea357817 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java @@ -33,15 +33,15 @@ import org.springframework.stereotype.Component; public class PnfManagementImpl implements PnfManagement { @Override - public Optional<Pnf> getEntryFor(String correlationId) { + public Optional<Pnf> getEntryFor(String pnfCorrelationId) { AAIRestClientImpl restClient = new AAIRestClientImpl(); - return restClient.getPnfByName(correlationId); + return restClient.getPnfByName(pnfCorrelationId); } @Override - public void createEntry(String correlationId, Pnf entry) { + public void createEntry(String pnfCorrelationId, Pnf entry) { AAIRestClientImpl restClient = new AAIRestClientImpl(); - restClient.createPnf(correlationId, entry); + restClient.createPnf(pnfCorrelationId, entry); } @Override |