/*-\r
* ============LICENSE_START=======================================================\r
- * OPENECOMP - MSO\r
+ * ONAP - SO\r
* ================================================================================\r
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
* ================================================================================\r
\r
import java.time.chrono.AbstractChronology\r
import java.util.List\r
+import java.text.SimpleDateFormat\r
+import java.util.Date\r
\r
import org.apache.commons.lang3.*\r
import org.camunda.bpm.engine.TaskService\r
import org.camunda.bpm.engine.delegate.BpmnError\r
import org.camunda.bpm.engine.delegate.DelegateTask\r
import org.camunda.bpm.engine.delegate.DelegateExecution\r
-import org.camunda.bpm.engine.runtime.Execution\r
+import org.camunda.bpm.engine.delegate.DelegateExecution\r
import org.json.JSONObject;\r
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor\r
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil\r
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition\r
import org.openecomp.mso.bpmn.core.json.JsonUtils\r
+import org.openecomp.mso.client.ruby.*\r
\r
\r
\r
* @param - errorCode\r
* @param - errorText\r
* @param - validResponses\r
+ * @param - vnfName\r
*\r
* Outputs:\r
* @param - WorkflowException\r
\r
JsonUtils jsonUtils = new JsonUtils()\r
\r
- public void preProcessRequest (Execution execution) {\r
+ public void preProcessRequest (DelegateExecution execution) {\r
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")\r
String msg = ""\r
utils.log("DEBUG"," ***** preProcessRequest of ManualHandling *****", isDebugLogEnabled)\r
\r
try {\r
execution.setVariable("prefix", Prefix)\r
+ setBasicDBAuthHeader(execution, isDebugLogEnabled)\r
// check for required input\r
String requestId = execution.getVariable("msoRequestId")\r
utils.log("DEBUG", "msoRequestId is: " + requestId, isDebugLogEnabled) \r
utils.log("DEBUG"," ***** Exit preProcessRequest of RainyDayHandler *****", isDebugLogEnabled)\r
}\r
\r
- public void createManualTask (Execution execution) {\r
+ public void createManualTask (DelegateExecution execution) {\r
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")\r
String msg = ""\r
utils.log("DEBUG"," ***** createManualTask of ManualHandling *****", isDebugLogEnabled)\r
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)\r
}\r
utils.log("DEBUG"," ***** Exit completeTask of ManualHandling *****", isDebugLogEnabled)\r
- } \r
+ }\r
+ \r
+ public void prepareRequestsDBStatusUpdate (DelegateExecution execution, String requestStatus){\r
+ \r
+ def method = getClass().getSimpleName() + '.prepareRequestsDBStatusUpdate(' +'execution=' + execution.getId() +')'\r
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
+ utils.log("DEBUG"," ***** prepareRequestsDBStatusUpdate of ManualHandling *****", isDebugLogEnabled)\r
+ try {\r
+ def requestId = execution.getVariable("msoRequestId")\r
+ String payload = """\r
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">\r
+ <soapenv:Header/>\r
+ <soapenv:Body>\r
+ <req:updateInfraRequest>\r
+ <requestId>${requestId}</requestId>\r
+ <lastModifiedBy>ManualHandling</lastModifiedBy> \r
+ <requestStatus>${requestStatus}</requestStatus> \r
+ </req:updateInfraRequest>\r
+ </soapenv:Body>\r
+ </soapenv:Envelope>\r
+ """\r
+ \r
+ execution.setVariable("setUpdateDBstatusPayload", payload)\r
+ utils.log("DEBUG", "Outgoing Update Mso Request Payload is: " + payload, isDebugLogEnabled)\r
+ utils.logAudit("setUpdateDBstatusPayload: " + payload)\r
+ \r
+ } catch (BpmnError e) {\r
+ throw e;\r
+ } catch (Exception e) {\r
+ logError('Caught exception in ' + method, e)\r
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)\r
+ }\r
+ \r
+ utils.log("DEBUG"," ***** Exit prepareRequestsDBStatusUpdate of ManualHandling *****", isDebugLogEnabled)\r
+ }\r
+ \r
+ public void createAOTSTicket (DelegateExecution execution) {\r
+ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")\r
+ String msg = ""\r
+ utils.log("DEBUG"," ***** createAOTSTicket of ManualHandling *****", isDebugLogEnabled)\r
+ \r
+ // This method will not be throwing an exception, but rather log the error\r
+\r
+ try {\r
+ execution.setVariable("prefix", Prefix)\r
+ setBasicDBAuthHeader(execution, isDebugLogEnabled)\r
+ // check for required input\r
+ String requestId = execution.getVariable("msoRequestId")\r
+ utils.log("DEBUG", "requestId is: " + requestId, isDebugLogEnabled) \r
+ def currentActivity = execution.getVariable("currentActivity")\r
+ utils.log("DEBUG", "currentActivity is: " + currentActivity, isDebugLogEnabled)\r
+ def workStep = execution.getVariable("workStep")\r
+ utils.log("DEBUG", "workStep is: " + workStep, isDebugLogEnabled)\r
+ def failedActivity = execution.getVariable("failedActivity")\r
+ utils.log("DEBUG", "failedActivity is: " + failedActivity, isDebugLogEnabled)\r
+ def errorCode = execution.getVariable("errorCode")\r
+ utils.log("DEBUG", "errorCode is: " + errorCode, isDebugLogEnabled)\r
+ def errorText = execution.getVariable("errorText")\r
+ utils.log("DEBUG", "errorText is: " + errorText, isDebugLogEnabled)\r
+ def vnfName = execution.getVariable("vnfName")\r
+ utils.log("DEBUG", "vnfName is: " + vnfName, isDebugLogEnabled) \r
+ \r
+ String rubyRequestId = UUID.randomUUID()\r
+ utils.log("DEBUG", "rubyRequestId: " + rubyRequestId, isDebugLogEnabled)\r
+ String sourceName = vnfName\r
+ utils.log("DEBUG", "sourceName: " + sourceName, isDebugLogEnabled)\r
+ String reason = "VID Workflow failed at " + failedActivity + " " + workStep + " call with error " + errorCode\r
+ utils.log("DEBUG", "reason: " + reason, isDebugLogEnabled)\r
+ String workflowId = requestId\r
+ utils.log("DEBUG", "workflowId: " + workflowId, isDebugLogEnabled)\r
+ String notification = "Request originated from VID | Workflow fallout on " + vnfName + " | Workflow step failure: " + workStep + " failed | VID workflow ID: " + workflowId\r
+ utils.log("DEBUG", "notification: " + notification, isDebugLogEnabled) \r
+ \r
+ utils.log("DEBUG", "Creating AOTS Ticket request") \r
+ \r
+ RubyClient rubyClient = new RubyClient()\r
+ rubyClient.rubyCreateTicketCheckRequest(rubyRequestId, sourceName, reason, workflowId, notification) \r
+ \r
+ } catch (BpmnError e) {\r
+ msg = "BPMN error in createAOTSTicket " + ex.getMessage()\r
+ utils.log("ERROR", msg, isDebugLogEnabled) \r
+ } catch (Exception ex){\r
+ msg = "Exception in createAOTSTicket " + ex.getMessage()\r
+ utils.log("ERROR", msg, isDebugLogEnabled) \r
+ }\r
+ utils.log("DEBUG"," ***** Exit createAOTSTicket of ManualHandling *****", isDebugLogEnabled)\r
+ }\r
+\r
\r
\r
}\r