diff options
author | Witold Ficio Kopel <w.kopel@samsung.com> | 2019-03-15 11:29:54 +0100 |
---|---|---|
committer | Witold Ficio Kopel <w.kopel@samsung.com> | 2019-03-20 15:58:00 +0100 |
commit | 26c6548520475894fa23231987f5e3fa69fed6d9 (patch) | |
tree | a84eb4bbd07076a8384ce1c253a31153f7625d0c /bpmn/MSOCoreBPMN | |
parent | 353782a4d50f3764f71916385dc062401aa7456d (diff) |
Removed BPMNLogger class
The BPMNLogger class has overlapping use to preferred solution based on
slf4j and logback - thus has been replaced by it.
Change-Id: I9889d4b9ab06f28941f0d827df889e3c081155da
Issue-ID: LOG-631
Signed-off-by: Witold Ficio Kopel <w.kopel@samsung.com>
Diffstat (limited to 'bpmn/MSOCoreBPMN')
-rw-r--r-- | bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java | 37 | ||||
-rw-r--r-- | bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java | 61 |
2 files changed, 28 insertions, 70 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java deleted file mode 100644 index ede515650e..0000000000 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.core; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class BPMNLogger { - private static Logger logger = LoggerFactory.getLogger(BPMNLogger.class); - - public static void debug (String isDebugLogEnabled, String LogText) { - logger.debug(LogText); - } - - -} - diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java index 6166071437..fb794e251d 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.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 @@ -21,6 +23,8 @@ package org.onap.so.bpmn.core; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Used in the output variable mapping configuration of subflow call activity @@ -36,6 +40,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; */ public class ResponseBuilder implements java.io.Serializable { private static final long serialVersionUID = 1L; + private static final Logger logger = LoggerFactory.getLogger(ResponseBuilder.class); /** * Creates a WorkflowException using data from the execution variables. @@ -48,28 +53,28 @@ public class ResponseBuilder implements java.io.Serializable { String method = getClass().getSimpleName() + ".buildWorkflowException(" + "execution=" + execution.getId() + ")"; - String isDebugLogEnabled = (String) execution.getVariable("isDebugLogEnabled"); - logDebug("Entered " + method, isDebugLogEnabled); - + + logger.debug("Entered " + method); + String prefix = (String) execution.getVariable("prefix"); String processKey = getProcessKey(execution); - logDebug("processKey=" + processKey, isDebugLogEnabled); + logger.debug("processKey=" + processKey); // See if there"s already a WorkflowException object in the execution. WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException"); if (theException != null) { - logDebug("Exited " + method + " - propagated " + theException, isDebugLogEnabled); + logger.debug("Exited " + method + " - propagated " + theException); return theException; } - + // Look in the legacy variables: ErrorResponse and ResponseCode String errorResponse = trimString(execution.getVariable(prefix + "ErrorResponse"), null); String responseCode = trimString(execution.getVariable(prefix + "ResponseCode"), null); - logDebug("errorResponse=" + errorResponse, isDebugLogEnabled); - logDebug("responseCode=" + responseCode, isDebugLogEnabled); + logger.debug("errorResponse=" + errorResponse); + logger.debug("responseCode=" + responseCode); if (errorResponse != null || !isOneOf(responseCode, null, "0", "200", "201", "202", "204")) { // This is an error condition. We need to return a WorkflowExcpetion @@ -93,8 +98,8 @@ public class ResponseBuilder implements java.io.Serializable { String xmlErrorCode = trimString(getXMLTextElement(maybeXML, "ErrorCode"), null); if (xmlErrorMessage != null || xmlErrorCode != null) { - logDebug("xmlErrorMessage=" + xmlErrorMessage, isDebugLogEnabled); - logDebug("xmlErrorCode=" + xmlErrorCode, isDebugLogEnabled); + logger.debug("xmlErrorMessage=" + xmlErrorMessage); + logger.debug("xmlErrorCode=" + xmlErrorCode); if (xmlErrorMessage == null) { errorResponse = "Received error code " + xmlErrorCode + " from " + processKey; @@ -135,27 +140,26 @@ public class ResponseBuilder implements java.io.Serializable { theException = new WorkflowException(processKey, intResponseCode, errorResponse); execution.setVariable("WorkflowException", theException); - logDebug("Exited " + method + " - created " + theException, isDebugLogEnabled); + logger.debug("Exited " + method + " - created " + theException); return theException; } - logDebug("Exited " + method + " - no WorkflowException", isDebugLogEnabled); + logger.debug("Exited " + method + " - no WorkflowException"); return null; } - + /** * Returns the "Response" variable, unless the execution variables * indicate there was an error. In that case, null is returned. * @param execution the execution */ public Object buildWorkflowResponse(DelegateExecution execution) { - + String method = getClass().getSimpleName() + ".buildWorkflowResponse(" + "execution=" + execution.getId() + ")"; - String isDebugLogEnabled = (String) execution.getVariable("isDebugLogEnabled"); - logDebug("Entered " + method, isDebugLogEnabled); - + logger.debug("Entered " + method); + String prefix = (String) execution.getVariable("prefix"); String processKey = getProcessKey(execution); @@ -169,16 +173,16 @@ public class ResponseBuilder implements java.io.Serializable { isOneOf(responseCode, null, "0", "200", "201", "202", "204")) { theResponse = execution.getVariable("WorkflowResponse"); - + if (theResponse == null) { theResponse = execution.getVariable(processKey + "Response"); } } - logDebug("Exited " + method, isDebugLogEnabled); + logger.debug("Exited " + method); return theResponse; } - + /** * Checks if the specified item is one of the specified values. * @param item the item @@ -201,10 +205,10 @@ public class ResponseBuilder implements java.io.Serializable { } } } - + return false; } - + /** * Creates a string value of the specified object, trimming whitespace in * the process. If the result is null or empty, the specified empty string @@ -221,7 +225,7 @@ public class ResponseBuilder implements java.io.Serializable { String s = String.valueOf(object).trim(); return s.equals("") ? emptyStringValue : s; } - + /** * Returns the process definition key (i.e. the process name) from the * execution. @@ -237,16 +241,7 @@ public class ResponseBuilder implements java.io.Serializable { return execution.getProcessEngineServices().getRepositoryService() .getProcessDefinition(execution.getProcessDefinitionId()).getKey(); } - - /** - * Logs a message at the DEBUG level. - * @param message the message - * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled - */ - private void logDebug(String message, String isDebugLogEnabled) { - BPMNLogger.debug(isDebugLogEnabled, message); - } - + /** * Removes namespace definitions and prefixes from XML, if any. */ |