SequenceFlow_15qo8gh
SequenceFlow_15qo8gh
SequenceFlow_0znyzkt
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
execution.setVariable("continueLoop","true");
Date date = new Date();
//log.debug("Flow AONotification started "+ date.toString())
def result= S('{}');
try {
// Initialize the flowResult Object
result.prop("flowStatus", "FAILURE");
result.prop("flowStatusMessage", "Flow Failed for Unknown Reason");
result.prop("flowProcessId", execution.getProcessInstanceId());
result.prop("flowProcessName", "AoNotification");
execution.setVariable("result", result);
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope")
execution.setVariableLocal("processId",execution.getProcessInstanceId())
}
//log.debug(result.prop("flowProcessName").stringValue() + " started "+ date.toString())
execution.setVariable("result", result)
execution.setVariable("aoPushSuccessful", true)
//log.info(aoRequest.toString());
execution.setVariable("bigLoopCounter", 0)
SequenceFlow_0znyzkt
SequenceFlow_0r7y8k8
SequenceFlow_0r7y8k8
SequenceFlow_0h4vt2x
SequenceFlow_0h4vt2x
SequenceFlow_1yeb1ze
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Extract input values");
//log.debug(aoRequest.toString());
//log.debug(aoRequest.getClass().toString());
//def aoRequestJSON = S(aoRequest);
//log.info(aoRequestJSON.getClass().toString());
execution.setVariable("outageId", aoRequest.prop("outageId").stringValue())
execution.setVariable("outageNotice", aoRequest.prop("outageNotice").stringValue())
SequenceFlow_1kfwprt
SequenceFlow_17891p5
SequenceFlow_0vkqari
SequenceFlow_00tdozo
SequenceFlow_1pwc854
SequenceFlow_0b7wak4
SequenceFlow_0vkqari
SequenceFlow_05tjwwg
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Build get outage info request NEW");
Date date = new Date();
//log.debug("Flow started "+ date.toString());
def outageInfoRequest= S('{}');
def sqlParams = S("{}");
def firstRow = execution.getVariable("startingRow");
def lastRow = startingRow + maxSqlBans;
outageInfoRequest.prop("sqlRequestString","SELECT BPO_OUTAGE_INFO.OUTAGE_ID, BPO_OUTAGE_INFO.OUTAGE_STATUS, BPO_OUTAGE_BAN_INFO.BAN, BPO_OUTAGE_BAN_INFO.CBR, BPO_OUTAGE_INFO.OUTAGE_ETR, BPO_OUTAGE_INFO.OUTAGE_START_TIME, BPO_OUTAGE_INFO.OUTAGE_END_TIME, BAN_CBR_INFO.BAN_STATUS, BAN_CBR_INFO.CBR AS CURRENTCBR, BAN_CBR_INFO.SERVICE_STATE, BAN_CBR_INFO.TIME_ZONE FROM FASTMS.BPO_OUTAGE_INFO RIGHT JOIN BPO_OUTAGE_BAN_INFO ON BPO_OUTAGE_INFO.OUTAGE_ID = BPO_OUTAGE_BAN_INFO.OUTAGE_ID LEFT JOIN BAN_CBR_INFO ON BPO_OUTAGE_BAN_INFO.BAN=BAN_CBR_INFO.BAN WHERE BPO_OUTAGE_INFO.OUTAGE_ID = :outageId AND BPO_OUTAGE_BAN_INFO.INCIDENT_STATUS = \'IN OUTAGE\' AND BAN_CBR_INFO.CBR IS NOT NULL AND BPO_OUTAGE_BAN_INFO.RECORD_ID >= :firstRow AND BPO_OUTAGE_BAN_INFO.RECORD_ID < :lastRow");
sqlParams.prop("outageId", outageId);
sqlParams.prop("firstRow", firstRow);
sqlParams.prop("lastRow", lastRow);
outageInfoRequest.prop("sqlParams", sqlParams.toString());
execution.setVariable("utilBusinessDataRequest", outageInfoRequest);
execution.setVariable("expectedReturnVariable","getOutageDataResponse");
//log.debug("End: " + "Build get outage info request NEW");
//log.debug(outageInfoRequest.toString());
execution.setVariable("bigLoopCounter", bigLoopCounter + 1)
SequenceFlow_05tjwwg
SequenceFlow_1oi7a9o
SequenceFlow_1oi7a9o
SequenceFlow_1sysllx
SequenceFlow_1jtei1j
SequenceFlow_1n21cjx
SequenceFlow_1jdl4k1
SequenceFlow_1mrrwyv
SequenceFlow_1sysllx
SequenceFlow_00tdozo
SequenceFlow_1mrrwyv
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Build get outage info request CLOSE");
Date date = new Date();
//log.debug("Flow started "+ date.toString());
def outageInfoRequest= S('{}');
def sqlParams = S("{}");
outageInfoRequest.prop("sqlRequestString","SELECT BPO_OUTAGE_INFO.OUTAGE_ID, BPO_OUTAGE_INFO.OUTAGE_STATUS, BPO_OUTAGE_BAN_INFO.BAN, BPO_OUTAGE_BAN_INFO.CBR, BPO_OUTAGE_INFO.OUTAGE_ETR, BPO_OUTAGE_INFO.OUTAGE_START_TIME, BPO_OUTAGE_INFO.OUTAGE_END_TIME, BAN_CBR_INFO.BAN_STATUS, BAN_CBR_INFO.CBR AS CURRENTCBR, BAN_CBR_INFO.SERVICE_STATE, BAN_CBR_INFO.TIME_ZONE, BPO_OUTAGE_BAN_INFO.START_OUTAGE_SENT FROM FASTMS.BPO_OUTAGE_INFO RIGHT JOIN BPO_OUTAGE_BAN_INFO ON BPO_OUTAGE_INFO.OUTAGE_ID = BPO_OUTAGE_BAN_INFO.OUTAGE_ID LEFT JOIN BAN_CBR_INFO ON BPO_OUTAGE_BAN_INFO.BAN=BAN_CBR_INFO.BAN WHERE BPO_OUTAGE_INFO.OUTAGE_ID = :outageId AND BAN_CBR_INFO.BAN_STATUS = \'ACTIVE\' AND BAN_CBR_INFO.CBR IS NOT NULL AND BPO_OUTAGE_BAN_INFO.START_OUTAGE_SENT IN (\'Y\',\'S\')");
sqlParams.prop("outageId", outageId);
outageInfoRequest.prop("sqlParams", sqlParams.toString());
execution.setVariable("utilBusinessDataRequest", outageInfoRequest);
execution.setVariable("expectedReturnVariable","getOutageDataResponse");
SequenceFlow_1pwc854
SequenceFlow_04e5dcy
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Build get outage info request UPDATE");
Date date = new Date();
//log.debug("Flow started "+ date.toString());
def outageInfoRequest= S('{}');
def sqlParams = S("{}");
outageInfoRequest.prop("sqlRequestString","SELECT BPO_OUTAGE_INFO.OUTAGE_ID, BPO_OUTAGE_INFO.OUTAGE_STATUS, BPO_OUTAGE_BAN_INFO.BAN, BPO_OUTAGE_BAN_INFO.CBR, BPO_OUTAGE_INFO.OUTAGE_ETR, BPO_OUTAGE_INFO.OUTAGE_START_TIME, BPO_OUTAGE_INFO.OUTAGE_END_TIME, BAN_CBR_INFO.BAN_STATUS, BAN_CBR_INFO.CBR AS CURRENTCBR, BAN_CBR_INFO.SERVICE_STATE, BAN_CBR_INFO.TIME_ZONE FROM FASTMS.BPO_OUTAGE_INFO RIGHT JOIN BPO_OUTAGE_BAN_INFO ON BPO_OUTAGE_INFO.OUTAGE_ID = BPO_OUTAGE_BAN_INFO.OUTAGE_ID LEFT JOIN BAN_CBR_INFO ON BPO_OUTAGE_BAN_INFO.BAN=BAN_CBR_INFO.BAN WHERE BPO_OUTAGE_INFO.OUTAGE_ID = :outageId AND BPO_OUTAGE_BAN_INFO.CBR IS NOT NULL");
sqlParams.prop("outageId", outageId);
outageInfoRequest.prop("sqlParams", sqlParams.toString());
execution.setVariable("utilBusinessDataRequest", outageInfoRequest);
execution.setVariable("expectedReturnVariable","getOutageDataResponse");
SequenceFlow_04e5dcy
SequenceFlow_1jtei1j
SequenceFlow_0b7wak4
SequenceFlow_1n21cjx
execution.setVariable('getOutageDataResponse',null);
SequenceFlow_1jdl4k1
SequenceFlow_1pru4i4
import groovy.json.*
import static org.camunda.spin.Spin.*
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Count BANs");
if(getOutageDataResponse != null){
def jsonSlurper = new JsonSlurper();
def responseVal = jsonSlurper.parseText(getOutageDataResponse.toString());
//log.debug(responseVal.toString());
execution.setVariable("banCount", responseVal.sqlResponseData.size());
execution.setVariable("banIndex", 0);
execution.setVariable("aoPushCounter", 0);
} else {
execution.setVariable("banCount", 0);
}
//log.debug("Bans will be processed: " + banCount);
outageNotice=='NEW'
outageNotice=='CLOSE'
outageNotice=='UPDATE'
SequenceFlow_0jynswq
SequenceFlow_0o4xqul
SequenceFlow_05fskz3
SequenceFlow_0jynswq
SequenceFlow_0o4xqul
SequenceFlow_1w2x108
import groovy.json.*
import static org.camunda.spin.Spin.*
result.prop("flowStatus", "FlowFaulted");
result.prop("flowStatusMessage", execution.getVariable(errorMessage) + " " + execution.getVariable(errorMessage));
result.prop("flowProcessId", execution.getProcessInstanceId());
result.prop("flowProcessName", "AoNotification");
processLogObj= S(JsonOutput.toJson(result));
execution.setVariable("processLogObj", processLogObj);
//def result = JsonOutput.toJson(result);
//execution.setVariable("result",result);
result.prop("flowStatusMessage", errorCode + ": " + errorMessage)
execution.setVariable("status", "FAILURE");
execution.setVariable("errorMessage", "Unknown Fault Occurred");
SequenceFlow_1w2x108
SequenceFlow_05fskz3
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
import groovy.json.*
Date date = new Date();
Logger log = LoggerFactory.getLogger(ScriptLogging)
def errorCode = "ERROR";
def errorMessage = "Flow faulted for unknown reason";
log.debug("Setting process log write request");
//Initialize the processLog Object
def processLogObj= S('{}');
log.info("Setting process log pid");
processLogObj.prop("processId", execution.getProcessInstanceId());
log.info("Setting process log servicename");
processLogObj.prop("serviceName", "AoNotification");
log.info("Setting process log status");
processLogObj.prop("processStatus", "FlowFaulted");
log.info("Setting process log error message");
processLogObj.prop("errorMessage", result.prop("flowStatusMessage"));
log.info("Setting process log flow name");
processLogObj.prop("processInput3", result.prop("flowProcessName"));
execution.setVariableLocal("processLogObj", processLogObj);
SequenceFlow_1cat9lu
SequenceFlow_19aei3p
import groovy.json.*
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: Finalize response");
Date date = new Date();
log.info("AONotification ended at "+ date.toString());
execution.setVariable("result", result);
SequenceFlow_1pru4i4
SequenceFlow_12ozl08
SequenceFlow_0fuk8jr
SequenceFlow_0zwjzdr
SequenceFlow_19uegec
SequenceFlow_15cm5w0
SequenceFlow_0c6783u
SequenceFlow_143yqaa
SequenceFlow_0mwqro9
import groovy.json.*
import static org.camunda.spin.Spin.*
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Extract customer values");
//log.debug("banIndex: " + banIndex + "continueLoop: " + continueLoop);
//Date date = new Date();
//log.info("Extract customer values at "+ date.toString())
//These lines were used before
//def jsonSlurper = new JsonSlurper();
//def responseVal = jsonSlurper.parseText(getOutageDataResponse.toString());
//execution.setVariable("ban",responseVal.sqlResponseData[banIndex].BAN);
//execution.setVariable("state",responseVal.sqlResponseData[banIndex].SERVICE_STATE);
//execution.setVariable("cbr",responseVal.sqlResponseData[banIndex].CBR);
//execution.setVariable("timeZone",responseVal.sqlResponseData[banIndex].TIME_ZONE);
//execution.setVariable("banStatus",responseVal.sqlResponseData[banIndex].BAN_STATUS);
//These lines speed things up
def cbr = null;
if(getOutageDataResponse.prop("sqlResponseData").elements()[banIndex].hasProp("CBR")){
def tempCBR = getOutageDataResponse.prop("sqlResponseData").elements()[banIndex].prop("CBR").stringValue();
if(tempCBR.length() == 10){
execution.setVariable("cbr",tempCBR);
} else {
execution.setVariable("cbr",cbr);
}
} else {
execution.setVariable("cbr",cbr);
}
execution.setVariable("ban",getOutageDataResponse.prop("sqlResponseData").elements()[banIndex].prop("BAN").stringValue());
execution.setVariable("state",getOutageDataResponse.prop("sqlResponseData").elements()[banIndex].prop("SERVICE_STATE").stringValue());
execution.setVariable("timeZone",getOutageDataResponse.prop("sqlResponseData").elements()[banIndex].prop("TIME_ZONE").stringValue());
execution.setVariable("banStatus",getOutageDataResponse.prop("sqlResponseData").elements()[banIndex].prop("BAN_STATUS").stringValue());
//log.debug("End: " + "Extract customer values");
//log.debug("banIndex: " + banIndex + " banCount: " + banCount+ " continueLoop: " + continueLoop + " bigLoopCounter: " + bigLoopCounter)
SequenceFlow_00s85pc
SequenceFlow_1f2lh1m
SequenceFlow_075qjsi
SequenceFlow_0gp84fs
SequenceFlow_1pt60zf
SequenceFlow_1jz9b3i
SequenceFlow_0l9bqyl
SequenceFlow_0fjsc3u
SequenceFlow_038gq58
SequenceFlow_1jz9b3i
SequenceFlow_031g362
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
def errorCode = "NOVAR";
def errorMessage = "State, Timezone, or BAN Status not found";
log.debug("Exception Caught: " + errorCode + ": " + errorMessage)
//Set Failure Result
result.prop("flowStatusMessage", errorMessage);
//Initialize the processLog Object
def processLogObj= S('{}')
processLogObj.prop("processId", execution.getProcessInstanceId())
processLogObj.prop("serviceName", result.prop("flowProcessName"))
processLogObj.prop("processStatus", "Warning")
processLogObj.prop("errorMessage", result.prop("flowStatusMessage"))
processLogObj.prop("processInput1", outageId);
processLogObj.prop("processInput2", ban);
execution.setVariableLocal("processLogObj", processLogObj)
SequenceFlow_031g362
SequenceFlow_1bbv9fn
SequenceFlow_0ycjitf
SequenceFlow_0gp84fs
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Validate codes");
Date date = new Date();
//log.info("Validate codes at "+ date.toString())
def varsOk = false;
def stateOk = false;
def tzOk = false;
def banStatusOk = false;
def etrOk = false
//log.debug("BAN:" + ban);
//log.debug("State:" + state);
//log.debug("TZ:" + timeZone);
//log.debug("CBR:" + cbr);
//log.debug("BANStat:" + banStatus);
//log.debug("OutageStartTime:" + outageStartTime);
//log.debug("OutageEndTime:" + outageEndTime);
stateOk = (state != null);
tzOk = (timeZone != null);
banStatusOk = (banStatus != null);
etrOk = (outageETR != null);
if(outageNotice=='CLOSE'){
dateTimeOk = (outageEndTime != null);
//log.debug("I will set dateTimeOk to " + dateTimeOk);
}
if(outageNotice=='NEW'){
dateTimeOk = (outageStartTime != null);
//log.debug("I will set dateTimeOk to " + dateTimeOk);
}
if(outageNotice=='UPDATE'){
dateTimeOk = (outageStartTime != null);
//log.debug("I will set dateTimeOk to " + dateTimeOk);
}
varsOk = (stateOk && tzOk && banStatusOk && dateTimeOk && etrOk);
//log.debug(stateOk);
//log.debug(tzOk);
//log.debug(cbrOk);
//log.debug(banStatusOk);
//log.debug(dateTimeOk);
//log.debugvarsOk);
execution.setVariable("varsOk", varsOk);
//execution.setVariable("varsOk", false);
SequenceFlow_12ozl08
SequenceFlow_19uegec
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
def errorCode = "NOBAN";
def errorMessage = "No BANs found or max bans exceeded for outageId " + outageId;
log.error("Exception Caught: " + errorCode + ": " + errorMessage)
//Set Failure Result
result.prop("flowStatusMessage", errorMessage);
//Initialize the processLog Object
def processLogObj= S('{}')
processLogObj.prop("processId", execution.getProcessInstanceId())
processLogObj.prop("serviceName", result.prop("flowProcessName"))
processLogObj.prop("processStatus", "FlowCompleted")
processLogObj.prop("errorMessage", result.prop("flowStatusMessage"))
processLogObj.prop("processInput1", outageId);
execution.setVariableLocal("processLogObj", processLogObj)
SequenceFlow_0fuk8jr
SequenceFlow_0dpciyo
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Set AO Code");
switch(outageNotice){
case "NEW":
execution.setVariable("aoCode", newOutageCode);
//log.debug("set aoCode to " + newOutageCode);
break;
case "CLOSE":
execution.setVariable("aoCode", closeOutageCode);
//log.debug("set aoCode to " + closeOutageCode);
break;
case "UPDATE":
execution.setVariable("aoCode", updateOutageCode);
execution.setVariable("outageStartTime", "");
execution.setVariable("outageETR", "");
//log.debug("set aoCode to " + updateOutageCode);
break;
default:
execution.setVariable("aoCode", newOutageCode)
//log.debug("set aoCode to default" );
break;
}
SequenceFlow_0lpzwwg
SequenceFlow_1l0hdom
import groovy.json.*
import static org.camunda.spin.Spin.*
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Build AO request object");
Date date = new Date();
//log.info("Build AO request object at "+ date.toString())
//def jsonSlurper = new JsonSlurper();
def aoBatchRequest = S('{}')
updateBanList.prop("BANS",updateBanList.prop("BANS").stringValue() + ",'" + ban + "'");
execution.setVariable("updateBanList", updateBanList);
try{
aoBatchRequest.prop("MessageCode", aoResponseCode);
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("MessageCode" + err.toString());
}
try{
aoBatchRequest.prop("CorrId", outageId);
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("CorrId" + err.toString());
}
try{
aoBatchRequest.prop("ScriptCode", aoCode);
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("ScriptCode" + err.toString());
}
try{
aoBatchRequest.prop("VoiceDelivery", "0");
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("VoiceDelivery" + err.toString());
}
try{
aoBatchRequest.prop("SMSDelivery", "1");
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("SMSDelivery" + err.toString());
}
try{
aoBatchRequest.prop("PriCBR", cbr);
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("PriCBR" + err.toString());
}
try{
aoBatchRequest.prop("AltCBR", cbr);
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("AltCBR" + err.toString());
}
try{
aoBatchRequest.prop("BAN", ban);
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("BAN" + err.toString());
}
try{
aoBatchRequest.prop("State", state);
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("State" + err.toString());
}
try{
aoBatchRequest.prop("BusinessUnit", "R");
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("BusinessUnit" + err.toString());
}
try{
aoBatchRequest.prop("Data2", outageStartTime);
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("Data2" + err.toString());
}
try{
aoBatchRequest.prop("Data3", outageETR);
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("Data3" + err.toString());
}
try{
aoBatchRequest.prop("Data4", outageEndTime);
} catch(err) {
execution.setVariableLocal("faultScope","Initialize Variables Scope");
execution.setVariableLocal("processId",execution.getProcessInstanceId());
log.error("Data4" + err.toString());
}
AORecordArray.append(aoBatchRequest);
SequenceFlow_1gxtj6t
SequenceFlow_0fs3mkh
SequenceFlow_0ver1t7
SequenceFlow_1idvoze
SequenceFlow_1oxtccb
SequenceFlow_09pi3oc
SequenceFlow_0ver1t7
SequenceFlow_0gacddx
import groovy.json.*
import static org.camunda.spin.Spin.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
Date date = new Date();
//log.debug("Update CBR at "+ date.toString())
//def SimpleDateFormat
//def jsonSlurper = new JsonSlurper();
//def responseVal = jsonSlurper.parseText(getOutageDataResponse.toString());
//def currentCBR = responseVal.sqlResponseData[banIndex].CURRENTCBR;
def currentCBR = null;
def responseVal = getOutageDataResponse.prop("sqlResponseData").elements()[banIndex];
if(responseVal.hasProp("CURRENTCBR")){
execution.setVariable("cbr",responseVal.prop("CURRENTCBR").stringValue());
}
//execution.setVariable("cbr",responseVal.sqlResponseData[banIndex].CURRENTCBR);
SequenceFlow_0gacddx
SequenceFlow_1tyo873
SequenceFlow_1vmqvj6
SequenceFlow_13kfk6h
SequenceFlow_041jfeg
SequenceFlow_1idvoze
SequenceFlow_1bvo0lk
SequenceFlow_0m31j9p
import groovy.json.*
import static org.camunda.spin.Spin.*
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Build AOTS list for outage");
def aotsList;
if(getOutageAOTSResponse != null){
def jsonSlurper = new JsonSlurper();
def responseVal = jsonSlurper.parseText(getOutageAOTSResponse.toString());
aotsList = responseVal.sqlResponseData.AOTS.join('\',\'');
} else {
aotsList = 'NA';
}
if(aotsList.length()>2){
aotsList = "'" + aotsList + "'";
}else {
aotsList = 'NA';
}
execution.setVariable("aotsList",aotsList);
SequenceFlow_1pt60zf
SequenceFlow_1gxtj6t
SequenceFlow_0aue8h8
SequenceFlow_0aue8h8
SequenceFlow_0jxmvvi
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
def errorCode = "BANNOTACTIVE";
def errorMessage = "BAN " + ban + " not in active state";
//log.debug("Exception Caught: " + errorCode + ": " + errorMessage)
//Set Failure Result
result.prop("flowStatusMessage", errorMessage);
//Initialize the processLog Object
def processLogObj= S('{}')
processLogObj.prop("processId", execution.getProcessInstanceId())
processLogObj.prop("serviceName", result.prop("flowProcessName"))
processLogObj.prop("processStatus", "Warning")
processLogObj.prop("errorMessage", result.prop("flowStatusMessage"))
processLogObj.prop("processInput1", outageId);
processLogObj.prop("processInput2", ban);
execution.setVariableLocal("processLogObj", processLogObj)
SequenceFlow_1l0hdom
SequenceFlow_0ko54ak
SequenceFlow_0l9bqyl
SequenceFlow_15cm5w0
SequenceFlow_1t8vjqb
SequenceFlow_1lo23rj
SequenceFlow_1iy54kf
SequenceFlow_04s2ujl
SequenceFlow_1sfhyyf
SequenceFlow_0bf0xpx
SequenceFlow_1lo23rj
SequenceFlow_1tcfe4q
SequenceFlow_060mwid
SequenceFlow_1ewuq0p
SequenceFlow_01d9pmm
SequenceFlow_00e6uoi
SequenceFlow_0c9ejq5
SequenceFlow_1gjop7r
SequenceFlow_1r0v2ux
SequenceFlow_01d9pmm
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Update field in BPO_OUTAGE_INFO");
def updateMessageSentRequest = S('{}');
def sqlParams = S("{}");
if(zuluUpdateMsgTime != null){
updateMessageSentRequest.prop("sqlRequestString","UPDATE FASTMS.BPO_OUTAGE_INFO SET LAST_UPDATED_TIME = SYSDATE, NEW_MSG_SENT = 'Y', OUTAGE_STATUS = :outageStatus, NEW_MSG_SENT_TIME = SYSDATE, UPDATE_MSG_SEND_TIME = to_timestamp_tz(:zuluUpdateMsgTime, 'YYYY-MM-DD\"T\"HH24:MI:SSTZHTZM') WHERE OUTAGE_ID = :outageId");
sqlParams.prop("zuluUpdateMsgTime", zuluUpdateMsgTime);
} else {
updateMessageSentRequest.prop("sqlRequestString","UPDATE FASTMS.BPO_OUTAGE_INFO SET LAST_UPDATED_TIME = SYSDATE, NEW_MSG_SENT = 'Y', OUTAGE_STATUS = :outageStatus, NEW_MSG_SENT_TIME = SYSDATE WHERE OUTAGE_ID = :outageId");
}
updateMessageSentRequest.prop("overrideLimit","true");
sqlParams.prop("outageId", outageId);
sqlParams.prop("outageStatus", "ACTIVE");
updateMessageSentRequest.prop("sqlParams", sqlParams.toString());
//log.info(updateMessageSentRequest.toString());
execution.setVariable("utilBusinessDataRequest", updateMessageSentRequest);
execution.setVariable("expectedReturnVariable","updateMessageSentResponse");
SequenceFlow_060mwid
SequenceFlow_00e6uoi
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Update field in BPO_OUTAGE_INFO");
def updateMessageSentRequest = S('{}');
def sqlParams = S("{}");
updateMessageSentRequest.prop("sqlRequestString","UPDATE FASTMS.BPO_OUTAGE_INFO SET LAST_UPDATED_TIME = SYSDATE, CLOSE_MSG_SENT = 'Y', OUTAGE_STATUS = :outageStatus, CLOSE_MSG_SENT_TIME = SYSDATE WHERE OUTAGE_ID = :outageId");
updateMessageSentRequest.prop("overrideLimit","true");
sqlParams.prop("outageId", outageId);
sqlParams.prop("outageStatus", "CLOSED");
updateMessageSentRequest.prop("sqlParams", sqlParams.toString());
execution.setVariable("utilBusinessDataRequest", updateMessageSentRequest);
execution.setVariable("expectedReturnVariable","updateMessageSentResponse");
SequenceFlow_1ewuq0p
SequenceFlow_0c9ejq5
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Update field in BPM_OUTAGE_INFO");
def updateMessageSentRequest = S('{}');
def sqlParams = S("{}");
updateMessageSentRequest.prop("sqlRequestString","UPDATE FASTMS.BPO_OUTAGE_INFO SET LAST_UPDATED_TIME = SYSDATE, UPDATE_MSG_SENT = 'Y', UPDATE_MSG_SENT_TIME = SYSDATE WHERE OUTAGE_ID = :outageId");
updateMessageSentRequest.prop("overrideLimit","true");
sqlParams.prop("outageId", outageId);
updateMessageSentRequest.prop("sqlParams", sqlParams.toString());
execution.setVariable("utilBusinessDataRequest", updateMessageSentRequest);
execution.setVariable("expectedReturnVariable","updateMessageSentResponse");
SequenceFlow_06ugonj
SequenceFlow_1o4s9ei
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Set flow success");
result.prop("flowStatus", "SUCCESS");
result.prop("flowStatusMessage", "AO ran succesfully");
SequenceFlow_09pi3oc
SequenceFlow_0lpzwwg
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Increment counter");
//log.debug("banIndex: " + banIndex + "banCount: " + banCount + " continueLoop: " + continueLoop);
execution.setVariable("banIndex", banIndex + 1);
if(banIndex>=banCount){
execution.setVariable("continueLoop","false");
//log.debug("Setting continue loop to false");
}
execution.setVariable("aoPushCounter", aoPushCounter + 1);
//log.debug("End Increment counter banIndex: " + banIndex);
SequenceFlow_1bbv9fn
SequenceFlow_0fjsc3u
execution.setVariable("banIndex", banIndex + 1);
if(banIndex>=banCount){
execution.setVariable("continueLoop","false");
}
SequenceFlow_0jxmvvi
SequenceFlow_0ko54ak
execution.setVariable("banIndex", banIndex + 1);
if(banIndex>=banCount){
execution.setVariable("continueLoop","false");
}
SequenceFlow_1hwckdb
SequenceFlow_0jnbmok
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
Date date = new Date();
//log.debug("Start: Instantiating collections");
//log.info("Entering ban processing loop at "+ date.toString())
//List<String> aoCollection = new ArrayList<String>();
//execution.setVariable("aoCollection", aoCollection);
def updateBanList= S('{}');
def sendNoticeTimeTracker= S('{}');
def updateCBRList= S("[]");
updateBanList.prop("BANS","");
execution.setVariable("updateBanList", updateBanList);
sendNoticeTimeTracker.prop("StartTime", date.toString());
def AORecordArray = S("[]");
//execution.setVariable("aoCollection", aoCollection);
execution.setVariable("AORecordArray", AORecordArray);
execution.setVariable("updateCBRList", updateCBRList);
execution.setVariable("sendNoticeTimeTracker", sendNoticeTimeTracker);
SequenceFlow_1vmqvj6
SequenceFlow_13kfk6h
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Set update cbr flag to false");
execution.setVariable("needToUpdateCBR", "false");
SequenceFlow_1tyo873
SequenceFlow_041jfeg
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
Date date = new Date();
//log.debug("Adding BAN and CBR to JSON at "+ date.toString())
execution.setVariable("needToUpdateCBR", "true");
def updatedBan= S('{}');
updatedBan.prop("BAN",ban);
updatedBan.prop("CBR",cbr);
updateCBRList.append(updatedBan);
SequenceFlow_0fs3mkh
SequenceFlow_1oxtccb
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Set update cbr flag to false");
execution.setVariable("needToUpdateCBR", "false");
SequenceFlow_038gq58
SequenceFlow_0oqal01
SequenceFlow_06gr4vk
SequenceFlow_0oqal01
SequenceFlow_0olyi2t
SequenceFlow_19hazas
SequenceFlow_151opn2
SequenceFlow_0olyi2t
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Reset counter and collections");
Date date = new Date();
//log.info("Pushed batch BANs to AO at "+ date.toString())
execution.setVariable("aoPushCounter", 0);
//List<String> aoCollection = new ArrayList<String>();
//execution.setVariable("aoCollection", aoCollection);
def AORecordArray = S("[]");
def updateCBRList= S("[]");
updateBanList.prop("BANS","");
execution.setVariable("updateBanList", updateBanList);
execution.setVariable("AORecordArray", AORecordArray);
execution.setVariable("updateCBRList", updateCBRList);
//log.info("Completed iteration maxNotices: " + maxNotices + " banIndex: " + banIndex + " total BANs: " + banCount)
SequenceFlow_0ran4zt
SequenceFlow_1r1hn21
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: Convert final AO list");
Date date = new Date();
log.info("Sent final BAN batch at "+ date.toString());
sendNoticeTimeTracker = execution.getVariable("sendNoticeTimeTracker")
sendNoticeTimeTracker.prop("EndTime", date.toString());
execution.setVariable("sendNoticeTimeTracker", sendNoticeTimeTracker);
//execution.setVariable("aoCollection", S(aoCollection.toString()));
SequenceFlow_0mwqro9
SequenceFlow_0ycjitf
SequenceFlow_03kyxjn
SequenceFlow_19hazas
SequenceFlow_0jdnrhq
SequenceFlow_00s85pc
SequenceFlow_03kyxjn
SequenceFlow_0jdnrhq
execution.setVariable("banIndex", banIndex + 1);
if(banIndex>=banCount){
execution.setVariable("continueLoop","false");
}
execution.setVariable("aoPushCounter", aoPushCounter + 1);
SequenceFlow_0m31j9p
SequenceFlow_15d4ok4
SequenceFlow_0n9ybuy
SequenceFlow_0jq46bw
SequenceFlow_14vs5ua
SequenceFlow_1hwckdb
SequenceFlow_0n9ybuy
SequenceFlow_14vs5ua
execution.setVariable("getAOTSBANValuesResponse",null);
SequenceFlow_06gr4vk
SequenceFlow_0zkvug4
SequenceFlow_075qjsi
SequenceFlow_1ljf6fo
SequenceFlow_0jnbmok
SequenceFlow_0g66aqv
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
import groovy.json.*
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Convert ETR");
Date date = new Date();
try{
def jsonSlurper = new JsonSlurper();
def responseVal = jsonSlurper.parseText(getOutageDataResponse.toString());
//log.info(getOutageDataResponse.prop("sqlResponseData").elements()[0].toString());
execution.setVariable("outageETR",responseVal.sqlResponseData[banIndex].OUTAGE_ETR);
execution.setVariable("rawETR",responseVal.sqlResponseData[banIndex].OUTAGE_ETR);
//log.info(responseVal.sqlResponseData[banIndex].toString());
if(responseVal.sqlResponseData[banIndex].OUTAGE_END_TIME == null){
execution.setVariable("outageEndTime",null);
} else{
execution.setVariable("outageEndTime",responseVal.sqlResponseData[banIndex].OUTAGE_END_TIME);
}
execution.setVariable("outageStartTime",responseVal.sqlResponseData[banIndex].OUTAGE_START_TIME);
execution.setVariable("rawOutageStartTime",responseVal.sqlResponseData[banIndex].OUTAGE_START_TIME);
execution.setVariable("timeZone",responseVal.sqlResponseData[banIndex].TIME_ZONE);
if(outageETR != null){
def etrArray = outageETR.split(":")
def fixedETRStart = etrArray[0].toInteger()*24 + etrArray[1].toInteger();
def fixedETREnd = fixedETRStart + 1;
def newEtr = fixedETRStart + "-" + fixedETREnd;
execution.setVariable("outageETR", newEtr);
}
} catch(err) {
log.error(err.toString());
execution.setVariableLocal("faultScope","Set eTTR scope")
execution.setVariableLocal("processId",execution.getProcessInstanceId())
}
SequenceFlow_0g66aqv
SequenceFlow_04tbhdn
SequenceFlow_09am5rt
SequenceFlow_0kghf9m
SequenceFlow_0kghf9m
SequenceFlow_1e342v1
import java.util.Calendar;
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import java.time.format.DateTimeFormxkdser;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Convert StartTime to local time");
ZoneId zoneIdEastern = ZoneId.of("America/New_York");
ZoneId zoneIdCentral = ZoneId.of("America/Chicago");
ZoneId zoneIdMountain = ZoneId.of("America/Denver");
ZoneId zoneIdPacific = ZoneId.of("America/Los_Angeles");
def DateTimeFormxkdser formxkdser = DateTimeFormxkdser.ofPxkdsern("yyyy-MM-dd'T'HH:mm:ssZ");
def DateTimeFormxkdser localizedFormat = DateTimeFormxkdser.ofPxkdsern("hh:mm a");
ZonedDateTime startDateTime = ZonedDateTime.parse(outageStartTime, formxkdser);
def localizedStartTime;
ZonedDateTime localStartTime;
switch(timeZone){
case "EASTERN":
localStartTime = startDateTime.withZoneSameInstant(zoneIdEastern);
break;
case "CENTRAL":
localStartTime = startDateTime.withZoneSameInstant(zoneIdCentral);
break;
case "MOUNTAIN":
localStartTime = startDateTime.withZoneSameInstant(zoneIdMountain);
break;
case "PACIFIC":
localStartTime = startDateTime.withZoneSameInstant(zoneIdPacific);
break;
default:
localStartTime = startDateTime.withZoneSameInstant(zoneIdEastern);
break;
}
localizedStartTime = localStartTime.format(localizedFormat);
execution.setVariable("outageStartTime",localizedStartTime);
SequenceFlow_1e342v1
SequenceFlow_0k7oqhc
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Set EndTime value");
if(outageEndTime == null){
execution.setVariable("outageEndTime","");
} else {
execution.setVariable("outageEndTime","");
}
SequenceFlow_0k7oqhc
SequenceFlow_0umf28m
SequenceFlow_0j3zfv9
SequenceFlow_0c6783u
SequenceFlow_0rmovnu
SequenceFlow_0umf28m
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Set StartTime value");
if(outageStartTime == null){
execution.setVariable("outageStartTime","");
}
if(outageNotice=='CLOSE'){
execution.setVariable("outageStartTime","");
}
SequenceFlow_09am5rt
SequenceFlow_0rmovnu
import java.util.Calendar;
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import java.time.format.DateTimeFormxkdser;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Convert EndTime to local time");
ZoneId zoneIdEastern = ZoneId.of("America/New_York");
ZoneId zoneIdCentral = ZoneId.of("America/Chicago");
ZoneId zoneIdMountain = ZoneId.of("America/Denver");
ZoneId zoneIdPacific = ZoneId.of("America/Los_Angeles");
def DateTimeFormxkdser formxkdser = DateTimeFormxkdser.ofPxkdsern("yyyy-MM-dd'T'HH:mm:ssZ");
def DateTimeFormxkdser localizedFormat = DateTimeFormxkdser.ofPxkdsern("hh:mm a");
ZonedDateTime endDateTime = ZonedDateTime.parse(outageEndTime, formxkdser);
def localizedEndTime;
ZonedDateTime localEndTime;
switch(timeZone){
case "EASTERN":
localEndTime = endDateTime.withZoneSameInstant(zoneIdEastern);
break;
case "CENTRAL":
localEndTime = endDateTime.withZoneSameInstant(zoneIdCentral);
break;
case "MOUNTAIN":
localEndTime = endDateTime.withZoneSameInstant(zoneIdMountain);
break;
case "PACIFIC":
localEndTime = endDateTime.withZoneSameInstant(zoneIdPacific);
break;
default:
localEndTime = endDateTime.withZoneSameInstant(zoneIdEastern);
break;
}
localizedEndTime = localEndTime.format(localizedFormat);
execution.setVariable("outageEndTime",localizedEndTime);
SequenceFlow_04tbhdn
SequenceFlow_0j3zfv9
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Set values for update");
if(outageEndTime == null){
execution.setVariable("outageEndTime","");
} else {
execution.setVariable("outageEndTime","");
}
if(outageStartTime == null){
execution.setVariable("outageStartTime","");
} else {
execution.setVariable("outageStartTime","");
}
SequenceFlow_1r1hn21
SequenceFlow_19ok7et
SequenceFlow_0zkvug4
SequenceFlow_0rh81xb
SequenceFlow_1i5bvrm
SequenceFlow_155kp1m
SequenceFlow_0c6p20u
SequenceFlow_1om9id7
SequenceFlow_0rh81xb
SequenceFlow_01eevc2
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
def errorCode = "AOBATCHFAULT";
def errorMessage = "Error sending batch to AO";
//log.debug("Start: " + "Setup process log write request");
//log.debug("Exception Caught: " + errorCode + ": " + errorMessage)
//Set Failure Result
result.prop("flowStatusMessage", errorMessage);
//Initialize the processLog Object
def processLogObj= S('{}')
processLogObj.prop("processId", execution.getProcessInstanceId())
processLogObj.prop("serviceName", result.prop("flowProcessName"))
processLogObj.prop("processStatus", "Error")
processLogObj.prop("errorMessage", result.prop("flowStatusMessage"))
processLogObj.prop("processInput1", outageId);
execution.setVariableLocal("processLogObj", processLogObj)
SequenceFlow_1sd42dn
SequenceFlow_155kp1m
SequenceFlow_1ljf6fo
SequenceFlow_1d50f21
SequenceFlow_1smv7y8
SequenceFlow_1d50f21
SequenceFlow_0pywqtp
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
def errorCode = "AOBATCHFAULT";
def errorMessage = "Error sending batch to AO";
//log.debug("Start: Setup process log write request");
//log.debug("Exception Caught: " + errorCode + ": " + errorMessage)
//Set Failure Result
result.prop("flowStatusMessage", errorMessage);
//Initialize the processLog Object
def processLogObj= S('{}')
processLogObj.prop("processId", execution.getProcessInstanceId())
processLogObj.prop("serviceName", result.prop("flowProcessName"))
processLogObj.prop("processStatus", "Error")
processLogObj.prop("errorMessage", result.prop("flowStatusMessage"))
processLogObj.prop("processInput1", outageId);
execution.setVariableLocal("processLogObj", processLogObj)
SequenceFlow_0hkhbtd
SequenceFlow_1qzp5bg
SequenceFlow_1qzp5bg
SequenceFlow_0hxjrqz
SequenceFlow_0ran4zt
SequenceFlow_19ok7et
SequenceFlow_10wrlw3
SequenceFlow_1jxerzp
SequenceFlow_10wrlw3
SequenceFlow_17et77z
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
def errorCode = "CBRBATCHFAULT";
def errorMessage = "Error updating CBR data";
//log.debug("Exception Caught: " + errorCode + ": " + errorMessage)
//Set Failure Result
result.prop("flowStatusMessage", errorMessage);
//Initialize the processLog Object
def processLogObj= S('{}')
processLogObj.prop("processId", execution.getProcessInstanceId())
processLogObj.prop("serviceName", result.prop("flowProcessName"))
processLogObj.prop("processStatus", "Error")
processLogObj.prop("errorMessage", result.prop("flowStatusMessage"))
processLogObj.prop("processInput1", outageId);
execution.setVariableLocal("processLogObj", processLogObj)
SequenceFlow_17et77z
SequenceFlow_0wedwg4
SequenceFlow_1jxerzp
SequenceFlow_0wedwg4
SequenceFlow_02hyd2t
SequenceFlow_1om9id7
SequenceFlow_1cdx57s
SequenceFlow_1cdx57s
SequenceFlow_0litnag
SequenceFlow_1g4n3nb
SequenceFlow_0litnag
SequenceFlow_1inyy3n
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
def errorCode = "AOBATCHFAULT";
def errorMessage = "Error updating CBR data";
//log.debug("Start: " + "Setup process log write request");
//log.debug("Exception Caught: " + errorCode + ": " + errorMessage)
//Set Failure Result
result.prop("flowStatusMessage", errorMessage);
//Initialize the processLog Object
def processLogObj= S('{}')
processLogObj.prop("processId", execution.getProcessInstanceId())
processLogObj.prop("serviceName", result.prop("flowProcessName"))
processLogObj.prop("processStatus", "Error")
processLogObj.prop("errorMessage", result.prop("flowStatusMessage"))
processLogObj.prop("processInput1", outageId);
execution.setVariableLocal("processLogObj", processLogObj)
SequenceFlow_1inyy3n
SequenceFlow_1ycztnz
SequenceFlow_1ycztnz
SequenceFlow_1ugwoyu
SequenceFlow_151opn2
SequenceFlow_0dpciyo
SequenceFlow_1gmg5k5
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Build request to get AOTS in outage");
def requestString = '{"sqlRequestString": "SELECT DISTINCT AOTS FROM FASTMS.BPO_OUTAGE_AOTS_INFO WHERE OUTAGE_ID = \'' + outageId + '\'"}';
execution.setVariable("utilBusinessDataRequest", requestString);
execution.setVariable("expectedReturnVariable","getOutageAOTSResponse");
SequenceFlow_1gmg5k5
SequenceFlow_1bvo0lk
SequenceFlow_15d4ok4
SequenceFlow_0foi373
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Build request to get BANs with AOTS in outage");
def requestString = '{"sqlRequestString": "SELECT BAN FROM SDAF.SDAF_OUTAGE_ETR_DATA WHERE AOTS_NUM IN (' + aotsList + ')"}';
execution.setVariable("utilBusinessDataRequestProd", requestString);
execution.setVariable("expectedReturnVariable","getAOTSBANValuesResponse");
return requestString;
SequenceFlow_0foi373
SequenceFlow_0jq46bw
SequenceFlow_01eevc2
SequenceFlow_1sd42dn
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Set update status to false");
execution.setVariable("aoPushSuccessful", false)
SequenceFlow_1i5bvrm
SequenceFlow_0c6p20u
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Log success");
//log.info("Call to AO Batch Delegate successful")
SequenceFlow_0pywqtp
SequenceFlow_0hkhbtd
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Set update status to false");
execution.setVariable("aoPushSuccessful", false)
SequenceFlow_1smv7y8
SequenceFlow_0hxjrqz
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.info("Call to AO Batch Delegate successful")
execution.setVariable("aoPushSuccessful", true)
SequenceFlow_1pcq9rc
SequenceFlow_18s09vg
SequenceFlow_1u0nxqf
SequenceFlow_1puy3te
SequenceFlow_0b65qcp
SequenceFlow_1ie7sc5
SequenceFlow_0l2kfdh
SequenceFlow_0l2kfdh
SequenceFlow_02jjejk
SequenceFlow_1bw0f36
SequenceFlow_0vkg71e
SequenceFlow_0lplj0b
SequenceFlow_1corot9
SequenceFlow_02jjejk
SequenceFlow_07tdaqv
SequenceFlow_1bw0f36
SequenceFlow_0b65qcp
SequenceFlow_0vkg71e
SequenceFlow_02hyd2t
SequenceFlow_1pcq9rc
SequenceFlow_1vmaaku
SequenceFlow_0lplj0b
SequenceFlow_1vmaaku
SequenceFlow_0zwjzdr
//import groovy.time.*;
//import java.text.SimpleDateFormat;
//import java.time.*;
//import java.time.temporal.ChronoUnit;
//import java.time.Duration;
//import org.slf4j.Logger
//import org.slf4j.LoggerFactory
//import com.xkds.sunrise.logging.ScriptLogging
//Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Check if BANs were returned");
//log.debug("banCount: " + banCount.toString());
//log.debug("maxBans: " + maxBans.toString());
//log.debug("banCount>0 && banCount<=maxBans.toInteger(): " + (banCount>0 && banCount<=maxBans.toInteger()))
return (banCount>0 && banCount<=maxBans.toInteger())
continueLoop == "true";
varsOk != true;
import groovy.json.*
import static org.camunda.spin.Spin.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
def noAotsFound = true;
try{
if(getAOTSBANValuesResponse != null){
def jsonSlurper = new JsonSlurper();
def responseVal = jsonSlurper.parseText(getAOTSBANValuesResponse.toString());
def sqlResponse = responseVal.sqlResponseData.BAN;
noAotsFound = !(!sqlResponse.find()==ban);
}
}catch(e) {
log.info("Issue with AOTS/BAN assocation check "+ e.toString())
}
return noAotsFound;
banStatus == "ACTIVE"
cbr != null
cbr !=null
banCount>0 && banCount<=maxBans.toInteger()
outageNotice=='CLOSE'
outageNotice=='UPDATE'
//import groovy.time.*;
//import java.text.SimpleDateFormat;
//import java.time.*;
//import java.time.temporal.ChronoUnit;
//import java.time.Duration;
//import org.slf4j.Logger
//import org.slf4j.LoggerFactory
//import com.xkds.sunrise.logging.ScriptLogging
//Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Check if BANs were returned");
//log.debug("aoPushCounter: " + aoPushCounter.toString());
//log.debug("maxNotices: " + maxNotices);
//log.debug("aoPushCounter >=maxNotices.toInteger(): " + (aoPushCounter >=maxNotices.toInteger()))
return aoPushCounter >=maxNotices.toInteger()
aotsList != 'NA'
outageNotice=='UPDATE'
outageNotice=='CLOSE'
callAOBatchSuccess;
callAOBatchSuccess;
BulkUpdateOutageCBRBANsSuccess
BulkUpdateOutageCBRBANsSuccess == true;
aoPushSuccessful
outageNotice=='NEW'
outageNotice=='CLOSE'
outageNotice=='UPDATE'
SequenceFlow_18s09vg
SequenceFlow_1ie7sc5
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Build get outage info request NEW");
Date date = new Date();
//log.debug("Flow started "+ date.toString());
def updateMessageRequest= S('{}');
def sqlParams = S("{}");
updateMessageRequest.prop("sqlRequestString","UPDATE FASTMS.BPO_OUTAGE_BAN_INFO SET LAST_UPDATED_TIME = SYSDATE, START_OUTAGE_SENT = \'Y\' WHERE OUTAGE_ID = :outageId AND CBR IS NOT NULL");
updateMessageRequest.prop("overrideLimit","true");
sqlParams.prop("outageId", outageId);
updateMessageRequest.prop("sqlParams", sqlParams.toString());
execution.setVariable("utilBusinessDataRequest", updateMessageRequest);
execution.setVariable("expectedReturnVariable","updateMessageResponse");
SequenceFlow_1u0nxqf
SequenceFlow_1corot9
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Build get outage info request CLOSE");
Date date = new Date();
//log.debug("Flow started "+ date.toString());
def updateMessageRequest= S('{}');
def sqlParams = S("{}");
updateMessageRequest.prop("sqlRequestString","UPDATE FASTMS.BPO_OUTAGE_BAN_INFO SET LAST_UPDATED_TIME = SYSDATE, CLOSE_OUTAGE_SENT = \'Y\' WHERE OUTAGE_ID = :outageId AND CBR IS NOT NULL");
updateMessageRequest.prop("overrideLimit","true");
sqlParams.prop("outageId", outageId);
updateMessageRequest.prop("sqlParams", sqlParams.toString());
execution.setVariable("utilBusinessDataRequest", updateMessageRequest);
execution.setVariable("expectedReturnVariable","updateMessageResponse");
SequenceFlow_1puy3te
SequenceFlow_07tdaqv
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Build get outage info request UPDATE");
Date date = new Date();
//log.debug("Flow started "+ date.toString());
def updateMessageRequest= S('{}');
def sqlParams = S("{}");
updateMessageRequest.prop("sqlRequestString","UPDATE FASTMS.BPO_OUTAGE_BAN_INFO SET LAST_UPDATED_TIME = SYSDATE, UPDATE_OUTAGE_SENT = \'Y\' WHERE OUTAGE_ID = :outageId AND CBR IS NOT NULL");
updateMessageRequest.prop("overrideLimit","true");
sqlParams.prop("outageId", outageId);
updateMessageRequest.prop("sqlParams", sqlParams.toString());
execution.setVariable("utilBusinessDataRequest", updateMessageRequest);
execution.setVariable("expectedReturnVariable","updateMessageResponse");
import org.camunda.bpm.engine.delegate.BpmnError;
//Uncomment one of the following line to force a failure
//execution.setVariableLocal("timeStamp", "123456789");
throw new BpmnError("EndEvent", "ending event");
SequenceFlow_0ultwfa
SequenceFlow_0khed0g
import groovy.json.*
import static org.camunda.spin.Spin.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
import groovy.time.*;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import java.time.format.DateTimeFormxkdser;
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Build request for dialing hours service");
def DialingHoursCheckRequest = S('{}');
DialingHoursCheckRequest.prop("state", state);
DialingHoursCheckRequest.prop("time", zuluUpdMsgTimePreliminary);
execution.setVariable("DialingHoursCheckRequest",DialingHoursCheckRequest);
//log.info("DialingHoursCheckRequest: " + DialingHoursCheckRequest);
SequenceFlow_1joc1a2
SequenceFlow_0ugw61j
SequenceFlow_0gjo919
SequenceFlow_1tkk72l
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
try {
//if Status = SUCCESS or WARNING then assume it is a 'clean' exit
// and use the current status and the 'error' message for the status
def mystatus = result.prop("status").value()
def cleanExistStatus = ['SUCCESS', 'WARNING']
if (!cleanExistStatus.contains(mystatus)) {
result.prop("status", "FAILURE")
}
//Set errorMessage
if (errorCode && errorMessage) {
result.prop("statusMessage", errorCode + ": " + errorMessage.replaceAll("org.camunda.bpm.engine.delegate.BpmnError: ","").replaceAll(" "," "))
}
else {
result.prop("statusMessage", "Unknown Fault occurred")
}
execution.setVariable("result", result)
}catch(Exception e) {
log.error("Exception Caught: " + errorCode + ": " + errorMessage)
result.prop("status", "FAILURE")
result.prop("statusMessage", "Unknown Fault occurred: " + e.toString())
execution.setVariable("result", result)
throw new BpmnError("FlowFaulted", "Unknown Fault occurred:"+e.toString())
}
SequenceFlow_1tkk72l
SequenceFlow_0hfibnw
SequenceFlow_0hfibnw
SequenceFlow_0gjo919
SequenceFlow_1t8vjqb
SequenceFlow_1ug112r
SequenceFlow_1kggzu1
SequenceFlow_0qqqj2p
SequenceFlow_1ug112r
SequenceFlow_0150vt1
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Update field in BPO_OUTAGE_INFO");
def updateMessageSentRequest = S('{}');
def sqlParams = S("{}");
updateMessageSentRequest.prop("sqlRequestString","UPDATE FASTMS.BPO_OUTAGE_INFO SET LAST_UPDATED_TIME = SYSDATE, NEW_MSG_SENT = 'N', OUTAGE_STATUS = :outageStatus WHERE OUTAGE_ID = :outageId");
updateMessageSentRequest.prop("overrideLimit","true");
sqlParams.prop("outageId", outageId);
sqlParams.prop("outageStatus", "ACTIVE");
updateMessageSentRequest.prop("sqlParams", sqlParams.toString());
log.info(updateMessageSentRequest.toString());
execution.setVariable("utilBusinessDataRequest", updateMessageSentRequest);
execution.setVariable("expectedReturnVariable","updateMessageSentResponse");
SequenceFlow_1kggzu1
SequenceFlow_0znv90t
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Update field in BPO_OUTAGE_INFO");
def updateMessageSentRequest = S('{}');
def sqlParams = S("{}");
updateMessageSentRequest.prop("sqlRequestString","UPDATE FASTMS.BPO_OUTAGE_INFO SET LAST_UPDATED_TIME = SYSDATE, CLOSE_MSG_SENT = 'N', OUTAGE_STATUS = :outageStatus WHERE OUTAGE_ID = :outageId");
updateMessageSentRequest.prop("overrideLimit","true");
sqlParams.prop("outageId", outageId);
sqlParams.prop("outageStatus", "CLOSED");
updateMessageSentRequest.prop("sqlParams", sqlParams.toString());
execution.setVariable("utilBusinessDataRequest", updateMessageSentRequest);
execution.setVariable("expectedReturnVariable","updateMessageSentResponse");
SequenceFlow_0qqqj2p
SequenceFlow_0llhh00
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Update field in BPM_OUTAGE_INFO");
def updateMessageSentRequest = S('{}');
def sqlParams = S("{}");
updateMessageSentRequest.prop("sqlRequestString","UPDATE FASTMS.BPO_OUTAGE_INFO SET LAST_UPDATED_TIME = SYSDATE, UPDATE_MSG_SENT = 'N' WHERE OUTAGE_ID = :outageId");
updateMessageSentRequest.prop("overrideLimit","true");
sqlParams.prop("outageId", outageId);
updateMessageSentRequest.prop("sqlParams", sqlParams.toString());
execution.setVariable("utilBusinessDataRequest", updateMessageSentRequest);
execution.setVariable("expectedReturnVariable","updateMessageSentResponse");
SequenceFlow_0znv90t
SequenceFlow_0150vt1
SequenceFlow_0llhh00
SequenceFlow_1y2x7cf
outageNotice=='CLOSE'
outageNotice=='UPDATE'
SequenceFlow_1y2x7cf
SequenceFlow_1iy54kf
SequenceFlow_1gjop7r
SequenceFlow_04s2ujl
SequenceFlow_1tcfe4q
SequenceFlow_0ultwfa
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import java.time.format.DateTimeFormxkdser;
import java.time.ZoneId;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Setting update notice time");
def rawETR = getOutageDataResponse.prop("sqlResponseData").elements()[0].prop("OUTAGE_ETR").stringValue();
def rawOutageStartTime = getOutageDataResponse.prop("sqlResponseData").elements()[0].prop("OUTAGE_START_TIME").stringValue();
//log.debug(rawETR);
def SimpleDateFormat;
def zuluUpdateMsgTime;
def utcTimeZone = "Etc/UTC"
ZoneId zoneIdUTC = ZoneId.of(utcTimeZone);
try{
//log.debug("rawETR: " + rawETR);
def etrArray = rawETR.split(":")
def etrMinutes = (etrArray[0].toInteger()*24*60) + (etrArray[1].toInteger()*60) + etrArray[2].toInteger() - incidentUpdateMinutesOffset;
//log.debug("etrMinutes: " + etrMinutes);
if(etrMinutes<0){
etrMinutes = 0;
}
def DateTimeFormxkdser formxkdser = DateTimeFormxkdser.ofPxkdsern("yyyy-MM-dd'T'HH:mm:ss");
def ZonedDateTime zdtOutageStart;
def ZonedDateTime ETRFromStart;
def ZonedDateTime currentTimeWithOffset=ZonedDateTime.now(ZoneId.of(utcTimeZone)).plusMinutes(outageNoticeOffset);
//log.debug("currentTimeWithOffset: " + currentTimeWithOffset.toString());
def parsedOutageStartTime = parsedOutageStartTime = rawOutageStartTime.split("\\+")[0] + "Z[" + utcTimeZone + "]";
//log.debug("parsedOutageStartTime: " + parsedOutageStartTime);
zdtOutageStart = ZonedDateTime.parse(parsedOutageStartTime);
//log.debug("zdtOutageStart: " + zdtOutageStart.toString());
ETRFromStart = zdtOutageStart.plusMinutes(etrMinutes);
//log.debug("ETR From Start: " + ETRFromStart);
//log.debug("Current time plus " + outageNoticeOffset + " minutes: " + currentTimeWithOffset);
if(ETRFromStart>=currentTimeWithOffset){
ETRZulu = ETRFromStart.withZoneSameInstant(ZoneId.of(utcTimeZone));
//log.debug("ETRFromStart greater than currentTimeWithOffset");
} else {
ETRZulu = currentTimeWithOffset.withZoneSameInstant(ZoneId.of(utcTimeZone));
//log.debug("currentTimeWithOffset greater than ETRFromStart");
}
//zuluUpdateMsgTime = ETRZulu.format(formxkdser);
zuluUpdateMsgTime = ETRZulu.toString();
} catch(err) {
execution.setVariableLocal("faultScope","Set update send time")
execution.setVariableLocal("processId",execution.getProcessInstanceId())
log.error(err.toString());
}
execution.setVariable("zuluUpdMsgTimePreliminary", zuluUpdateMsgTime);
SequenceFlow_0ugw61j
SequenceFlow_1r0v2ux
import groovy.json.*
import static org.camunda.spin.Spin.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
import groovy.time.*;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import java.time.format.DateTimeFormxkdser;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
def zuluUpdateMsgTime;
def utcTimeZone = "Etc/UTC";
ZoneId zoneIdUTC = ZoneId.of(utcTimeZone);
try{
def minutesBeforeDialingOk = dialingHoursCheckResponse.prop("payload").prop("minutesBeforeDialingOk").numberValue();
//log.info("minutesBeforeDialingOk: "+ minutesBeforeDialingOk);
def ZonedDateTime zdtOutageUpdateTime;
def ZonedDateTime ETRZulu;
//log.info("zuluUpdMsgTimePreliminary: "+ zuluUpdMsgTimePreliminary);
zdtOutageUpdateTime = ZonedDateTime.parse(zuluUpdMsgTimePreliminary).plusMinutes(minutesBeforeDialingOk);
//log.info("zdtOutageUpdateTime: "+ zdtOutageUpdateTime);
def DateTimeFormxkdser formxkdser = DateTimeFormxkdser.ofPxkdsern("yyyy-MM-dd'T'HH:mm:ssZ");
ETRZulu = zdtOutageUpdateTime.withZoneSameInstant(ZoneId.of(utcTimeZone));
zuluUpdateMsgTime = ETRZulu.format(formxkdser);
} catch(err) {
execution.setVariableLocal("faultScope","Set update send time")
execution.setVariableLocal("processId",execution.getProcessInstanceId())
log.error(err.toString());
}
execution.setVariable("zuluUpdateMsgTime", zuluUpdateMsgTime);
import org.camunda.bpm.engine.delegate.BpmnError;
//Uncomment one of the following line to force a failure
//execution.setVariableLocal("timeStamp", "123456789");
throw new BpmnError("EndEvent", "ending event");
SequenceFlow_1g4n3nb
SequenceFlow_1ugwoyu
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Log success");
//log.info("Update BAN CBR Delegate successful")
SequenceFlow_1f2lh1m
SequenceFlow_143yqaa
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.info("Completed iteration maxNotices: " + maxNotices + " banIndex: " + banIndex + " total BANs: " + banCount + " continuing loop")
SequenceFlow_1o4s9ei
SequenceFlow_1vgysp3
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Reset counter and collections");
Date date = new Date();
//log.info("Pushed batch BANs to AO at "+ date.toString())
execution.setVariable("aoPushCounter", 0);
//List<String> aoCollection = new ArrayList<String>();
//execution.setVariable("aoCollection", aoCollection);
def AORecordArray = S("[]");
def updateCBRList= S("[]");
updateBanList.prop("BANS","");
execution.setVariable("updateBanList", updateBanList);
execution.setVariable("AORecordArray", AORecordArray);
execution.setVariable("updateCBRList", updateCBRList);
//log.info("Completed iteration maxNotices: " + maxNotices + " banIndex: " + banIndex + " total BANs: " + banCount)
SequenceFlow_1yeb1ze
SequenceFlow_1rm93l6
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start build request to get count of BANs in outage");
Date date = new Date();
def outageRowsRequest= S('{}');
def sqlParams = S("{}");
outageRowsRequest.prop("sqlRequestString","SELECT MIN(RECORD_ID) AS FIRST, MAX(RECORD_ID) AS LAST FROM FASTMS.BPO_OUTAGE_BAN_INFO WHERE OUTAGE_ID = :outageId");
sqlParams.prop("outageId", outageId);
outageRowsRequest.prop("sqlParams", sqlParams.toString());
execution.setVariable("utilBusinessDataRequest", outageRowsRequest);
execution.setVariable("expectedReturnVariable","outageRowsResponse");
//log.debug("End build request to get count of BANs in outage");
SequenceFlow_1rm93l6
SequenceFlow_0mjm1yy
SequenceFlow_0mjm1yy
SequenceFlow_0v8m0p8
import groovy.json.*
import static org.camunda.spin.Spin.*
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start extract start and end of outage BANs");
def startingRow = 0
def endingRow = 0
def totalRowCount = 0
if(outageRowsResponse != null){
sqlResponseData = outageRowsResponse.prop("sqlResponseData");
startingRow = sqlResponseData.elements()[0].prop("FIRST").numberValue();
endingRow = sqlResponseData.elements()[0].prop("LAST").numberValue();
totalRowCount = endingRow - startingRow;
}
//log.debug("startingRow: " + startingRow);
//log.debug("endingRow: " + endingRow);
//log.debug("totalRowCount: " + totalRowCount);
execution.setVariable("startingRow", startingRow);
execution.setVariable("endingRow", endingRow);
execution.setVariable("totalRowCount", totalRowCount);
if(startingRow<endingRow){
execution.setVariable("continueSQLLoop", true);
} else {
execution.setVariable("continueSQLLoop", false);
}
SequenceFlow_10uubpq
SequenceFlow_06ugonj
SequenceFlow_0inzwnt
continueSQLLoop == false
SequenceFlow_0v8m0p8
SequenceFlow_0nmtcww
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Update field in BPO_OUTAGE_INFO");
def updateOutageStateRequest = S('{}');
def sqlParams = S("{}");
updateOutageStateRequest.prop("sqlRequestString","UPDATE FASTMS.BPO_OUTAGE_INFO SET LAST_UPDATED_TIME = SYSDATE, OUTAGE_STATUS = :outageStatus WHERE OUTAGE_ID = :outageId");
outageNotice=='CLOSE'
if(outageNotice=='NEW'){
sqlParams.prop("outageStatus", "SENDING NEW");
} else if(outageNotice=='CLOSE'){
sqlParams.prop("outageStatus", "SENDING CLOSE");
} else{
sqlParams.prop("outageStatus", "SENDING UPDATE");
}
updateOutageStateRequest.prop("overrideLimit","true");
sqlParams.prop("outageId", outageId);
updateOutageStateRequest.prop("sqlParams", sqlParams.toString());
execution.setVariable("utilBusinessDataRequest", updateOutageStateRequest);
execution.setVariable("expectedReturnVariable","updateOutageStateResponse");
SequenceFlow_0nmtcww
SequenceFlow_1wb4mzl
SequenceFlow_11kakw4
SequenceFlow_10uubpq
import groovy.time.*;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.time.Duration;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("startingRow: " + startingRow)
//log.debug("maxSqlBans: " + maxSqlBans)
//log.debug("continueSQLLoop: " + continueSQLLoop);
//startingRow = startingRow + maxSqlBans;
//log.debug("startingRow: " + startingRow)
//if(startingRow>endingRow){
//execution.setVariable("continueSQLLoop",false)
//}
//execution.setVariable("startingRow", startingRow)
//log.debug("continueSQLLoop: " + continueSQLLoop);
//log.debug("initial value of startingRow: " + startingRow);
//log.debug("BANs to process: " + ((startingRow+maxSqlBans)-startingRow));
//log.debug("bans to parse: " + (endingRow - startingRow));
if(totalRowCount>=0){
if(totalRowCount>=maxSqlBans){
startingRow = startingRow + maxSqlBans;
totalRowCount = totalRowCount - maxSqlBans
}else{
startingRow = startingRow + totalRowCount
totalRowCount = totalRowCount - maxSqlBans
//continueSQLLoop = false
}
}else{
continueSQLLoop = false
}
//log.debug("updated value of startingRow: " + startingRow);
execution.setVariable("startingRow", startingRow)
execution.setVariable("totalRowCount", totalRowCount)
execution.setVariable("continueSQLLoop",continueSQLLoop)
execution.setVariable("aoPushCounter",0);
execution.setVariable("continueLoop","true");
SequenceFlow_0inzwnt
SequenceFlow_17891p5
SequenceFlow_1wb4mzl
SequenceFlow_1kfwprt
SequenceFlow_0bf0xpx
SequenceFlow_11kakw4
import groovy.json.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.xkds.sunrise.logging.ScriptLogging
Logger log = LoggerFactory.getLogger(ScriptLogging)
//log.debug("Start: " + "Reset counter and collections");
Date date = new Date();
//log.info("Pushed batch BANs to AO at "+ date.toString())
execution.setVariable("aoPushCounter", 0);
//List<String> aoCollection = new ArrayList<String>();
//execution.setVariable("aoCollection", aoCollection);
def AORecordArray = S("[]");
def updateCBRList= S("[]");
updateBanList.prop("BANS","");
execution.setVariable("updateBanList", updateBanList);
execution.setVariable("AORecordArray", AORecordArray);
execution.setVariable("updateCBRList", updateCBRList);
//log.info("Completed iteration maxNotices: " + maxNotices + " banIndex: " + banIndex + " total BANs: " + banCount)
execution.setVariable("continueLoop","true");
SequenceFlow_0khed0g
SequenceFlow_1joc1a2
SequenceFlow_1sfhyyf
bigLoopCounter>1
SequenceFlow_1vgysp3
SequenceFlow_1cat9lu
execution.removeVariable("aafBasicAuth");
execution.removeVariable("applicationDetails");
execution.removeVariable("aoRequest");
execution.removeVariable("updateBanList");
execution.removeVariable("AORecordArray");
execution.removeVariable("updateCBRList");
execution.removeVariable("getOutageDataResponse");
execution.removeVariable("outageRowsResponse");
execution.removeVariable("ban");
execution.removeVariable("state");
execution.removeVariable("timeZone");
execution.removeVariable("banStatus");
execution.removeVariable("getOutageAOTSResponse");
execution.removeVariable("updateOutageStateResponse");
execution.removeVariable("utilBusinessDataRequest");
execution.removeVariable("expectedReturnVariable");
execution.removeVariable("updateCBRList");
SequenceFlow_19aei3p