* ================================================================================
* 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
package org.onap.so.bpmn.infrastructure.scripts
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor;
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-
-import groovy.json.JsonOutput
-import groovy.json.JsonSlurper
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleInfra.class);
+ private static final Logger logger = LoggerFactory.getLogger(UpdateVfModuleInfra.class)
ExceptionUtil exceptionUtil = new ExceptionUtil()
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
initProcessVariables(execution)
def incomingRequest = execution.getVariable('bpmnRequest')
- msoLogger.debug("Incoming Infra Request: " + incomingRequest)
+ logger.debug("Incoming Infra Request: {}", incomingRequest)
try {
def jsonSlurper = new JsonSlurper()
def jsonOutput = new JsonOutput()
Map reqMap = jsonSlurper.parseText(incomingRequest)
- msoLogger.debug(" Request is in JSON format.")
+ logger.debug(" Request is in JSON format.")
def serviceInstanceId = execution.getVariable('serviceInstanceId')
def vnfId = execution.getVariable('vnfId')
userParams.each { userParam ->
userParamsMap.put(userParam.name, userParam.value.toString())
}
- }
-
- msoLogger.debug('Processed user params: ' + userParamsMap)
+ }
+
+ logger.debug('Processed user params: {}', userParamsMap)
execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap)
//backoutOnFailure
- msoLogger.debug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo"))
-
- msoLogger.trace('Exited ' + method)
+ logger.debug('RequestInfo: {}', execution.getVariable(prefix + "requestInfo"))
+
+ logger.trace('Exited {}', method)
}
catch(groovy.json.JsonException je) {
- msoLogger.debug(" Request is not in JSON format.")
+ logger.debug(" Request is not in JSON format.")
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format")
}
catch(Exception e) {
String restFaultMessage = e.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, " Exception Encountered - " + "\n" + restFaultMessage, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Exception Encountered - \n{}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), restFaultMessage, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage)
}
}
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered {}', method)
try {
def requestInfo = execution.getVariable('UPDVfModI_requestInfo')
sendWorkflowResponse(execution, 200, synchResponse)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage())
}
}
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage())
}
}
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def requestId = execution.getVariable('UPDVfModI_requestId')
updateInfraRequest = utils.formatXml(updateInfraRequest)
execution.setVariable('UPDVfModI_updateInfraRequest', updateInfraRequest)
- msoLogger.debug('Request for Update Infra Request:\n' + updateInfraRequest)
+ logger.debug('Request for Update Infra Request:\n{}', updateInfraRequest)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage())
}
}
', resultVar=' + resultVar +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def requestInfo = getVariable(execution, 'UPDVfModI_requestInfo')
"""
content = utils.formatXml(content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug('{} = {}{}', resultVar, System.lineSeparator(), content)
execution.setVariable(resultVar, content)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error')
}
}
', resultVar=' + resultVar +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
try {
def prefix = execution.getVariable('prefix')
</sdncadapterworkflow:FalloutHandlerRequest>
"""
content = utils.formatXml(content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug('{} = {}{}', resultVar, System.lineSeparator(), content)
execution.setVariable(resultVar, content)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited {}', method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error')
}
}
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered {}', method)
String processKey = getProcessKey(execution);
def prefix = execution.getVariable("prefix")
utils.logContext(requestId, serviceInstanceId)
*/
- msoLogger.debug('Incoming message: ' + System.lineSeparator() + request)
- msoLogger.trace('Exited ' + method)
+ logger.debug('Incoming message: {}{}', System.lineSeparator(), request)
+ logger.trace('Exited {}', method)
return request
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ logger.error("{} {} {} Caught exception in {}\n ", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), method, e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
}
}