*/
for (Entry<String, NodeData> entry : ngdm.getNodeDataMapValid()
.entrySet()) {
String fqdn = entry.getKey();
StrStrMap replacementVarMapForThisNode = replacementVarMapNodeSpecific
.get(fqdn);
//20140105: fix NPE.
if (replacementVarMapForThisNode == null
|| replacementVarMapForThisNode.getMap() == null) {
LogUtils.printLogError("replacementVarMapForThisNode is null in "
+ "genericUpdateRequestByAddingReplaceVarKeyValuePairHelperNodeSpecific for fqnd "
+ fqdn + " at " + DateUtils.getNowDateTimeStrSdsm());
continue;
}
for (Entry<String, String> entryReplaceMap : replacementVarMapForThisNode
.getMap().entrySet()) {
String replaceVarKey = entryReplaceMap.getKey();
String replaceVarValue = entryReplaceMap.getValue();
NodeData nodeData = entry.getValue();
if (nodeData.getDataMap().containsKey(agentCommand)) {
NodeReqResponse nodeReqResponse = nodeData.getDataMap()
.get(agentCommand);
if (nodeReqResponse == null) {
nodeReqResponse = new NodeReqResponse();
nodeReqResponse.setDefaultEmptyReqestContent();
nodeData.getDataMap()
.put(agentCommand, nodeReqResponse);
}
// Safeguard!! When the wisbVarValue is "NA" (e.g. fail to
// get
// the wisb) should alert that
// Safeguard: if NA, then dont run it!
if (replaceVarKey.equalsIgnoreCase(VarUtils.NA)) {
if (varReplacementType == VarUtils.VAR_REPLACEMENT_TYPE.WISB_SREPO) {
models.utils.LogUtils
.printLogNormal("Wisb fail to get wisbVarValue"
+ DateUtils.getNowDateTimeStrSdsm());
// 20130731: add error msg
nodeReqResponse
.getRequestParameters()
.put(VarUtils.NODE_REQUEST_EXECUTE_MSG,
VarUtils.NODE_REQUEST_EXECUTE_MSG_DETAIL_TYPE_WISB_NOT_EXIST);
} else if (varReplacementType == VarUtils.VAR_REPLACEMENT_TYPE.ADHOC_FROM_API) {
models.utils.LogUtils
.printLogNormal("Get an invalid var value as NA."
+ DateUtils.getNowDateTimeStrSdsm());
// 20130731: add error msg
nodeReqResponse
.getRequestParameters()
.put(VarUtils.NODE_REQUEST_EXECUTE_MSG,
VarUtils.NODE_REQUEST_EXECUTE_MSG_DETAIL_REPLACEMENT_VAR_VALUE_NA);
}
nodeReqResponse.getRequestParameters().put(
VarUtils.NODE_REQUEST_WILL_EXECUTE,
new Boolean(false).toString());
/**
* 20130828: make it generic to check NULL KEY/VALUE
*/
} else if (replaceVarKey == null || replaceVarValue == null) {
models.utils.LogUtils
.printLogNormal("Get NULL repalceVarKey or value.."
+ DateUtils.getNowDateTimeStrSdsm());
// 20130731: add error msg
nodeReqResponse
.getRequestParameters()
.put(VarUtils.NODE_REQUEST_EXECUTE_MSG,
VarUtils.NODE_REQUEST_EXECUTE_MSG_DETAIL_REPLACEMENT_VAR_KEY_OR_VALUE_NULL);
nodeReqResponse.getRequestParameters().put(
VarUtils.NODE_REQUEST_WILL_EXECUTE,
new Boolean(false).toString());
} else {
nodeReqResponse.getRequestParameters().put(
VarUtils.NODE_REQUEST_PREFIX_REPLACE_VAR
+ replaceVarKey, replaceVarValue);
// CAREFUL! This is added to prevent a last time run
// "NOT EXECUTE" to continue to be effective this time.
// Since the whole nodeReqResponse will not replaced
// everytime
/*
* 20131205: to prevent this overwrite when there is a
* NA field passed in. This will check
*/
if (replacementVarMapForThisNode.getMap().keySet()
.contains(VarUtils.NA)) {
nodeReqResponse.getRequestParameters().put(
VarUtils.NODE_REQUEST_WILL_EXECUTE,
new Boolean(false).toString());
} else {