diff options
Diffstat (limited to 'bpmn')
4 files changed, 15 insertions, 29 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index 296ab64df3..251464a34d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -22,16 +22,8 @@ package org.onap.so.bpmn.core.plugins; -import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Properties; -import java.util.concurrent.ConcurrentHashMap; import org.camunda.bpm.engine.RepositoryService; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.ExecutionListener; @@ -39,26 +31,15 @@ import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.camunda.bpm.engine.impl.context.Context; -import org.camunda.bpm.engine.impl.interceptor.Command; -import org.camunda.bpm.engine.impl.interceptor.CommandContext; import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity; import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl; import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl; import org.camunda.bpm.engine.impl.util.xml.Element; import org.camunda.bpm.engine.impl.variable.VariableDeclaration; -import org.camunda.bpm.model.bpmn.impl.instance.FlowNodeImpl; -import org.camunda.bpm.model.bpmn.instance.EndEvent; -import org.camunda.bpm.model.bpmn.instance.FlowNode; -import org.camunda.bpm.model.bpmn.instance.StartEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.AbstractEnvironment; -import org.springframework.core.env.Environment; -import org.springframework.core.env.MapPropertySource; -import org.springframework.core.env.PropertySource; import org.springframework.stereotype.Component; diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java index ab21c0807e..42c6ef059f 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java @@ -32,7 +32,6 @@ import org.camunda.bpm.engine.delegate.JavaDelegate; import org.camunda.bpm.engine.impl.bpmn.behavior.ClassDelegateActivityBehavior; import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; -import org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration; import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity; @@ -58,6 +57,8 @@ import org.slf4j.LoggerFactory; public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { private static final Logger logger = LoggerFactory.getLogger(WorkflowExceptionPlugin.class); + private static final String WORKFLOW_EXCEPTION = "WorkflowException"; + @Override public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners(); @@ -131,7 +132,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { */ public static class WorkflowExceptionResetListener implements ExecutionListener { public void notify(DelegateExecution execution) throws Exception { - Object workflowException = execution.getVariable("WorkflowException"); + Object workflowException = execution.getVariable(WORKFLOW_EXCEPTION); if (workflowException instanceof WorkflowException) { int index = 1; @@ -140,10 +141,10 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { saveName = "SavedWorkflowException" + (++index); } - logger.debug("WorkflowExceptionResetTask is moving WorkflowException to " + saveName); + logger.debug("WorkflowExceptionResetTask is moving WorkflowException to {}", saveName); execution.setVariable(saveName, workflowException); - execution.setVariable("WorkflowException", null); + execution.setVariable(WORKFLOW_EXCEPTION, null); } } } @@ -153,7 +154,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin { */ public static class WorkflowExceptionTriggerTask implements JavaDelegate { public void execute(DelegateExecution execution) throws Exception { - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + if (execution.getVariable(WORKFLOW_EXCEPTION) instanceof WorkflowException) { logger.debug("WorkflowExceptionTriggerTask is generating a MSOWorkflowException event"); throw new BpmnError("MSOWorkflowException"); } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index 9497ab970e..093fba089d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -124,7 +124,7 @@ public class MSOInfrastructureApplication { logger.debug("Attempting to deploy custom workflows"); try { List<Workflow> workflows = catalogDbClient.findWorkflowBySource(SDC_SOURCE); - if (workflows != null && workflows.size() != 0) { + if (workflows != null && !workflows.isEmpty()) { for (Workflow workflow : workflows) { String workflowName = workflow.getName(); String workflowBody = workflow.getBody(); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java index 7cb78a10e5..8010ce62ab 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java @@ -5,6 +5,7 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2018 Nokia. + * 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. @@ -35,15 +36,18 @@ public final class JsonUtilForPnfCorrelationId { private static final String JSON_PNF_CORRELATION_ID_FIELD_NAME = "correlationId"; + private JsonUtilForPnfCorrelationId() { + throw new IllegalStateException("Utility class"); + } + 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 -> getPnfCorrelationId(jsonObject) - .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId))); - }); + spliterator.forEachRemaining(jsonElement -> handleEscapedCharacters(jsonElement) + .ifPresent(jsonObject -> getPnfCorrelationId(jsonObject) + .ifPresent(pnfCorrelationId -> list.add(pnfCorrelationId)))); return list; } |