Package models.data

Examples of models.data.StrStrMap


     */
    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 {
View Full Code Here


          .entrySet()) {

        String fqdn = entry.getKey();
        AggregationNodeMetadata nodeMetadata = entry.getValue();

        StrStrMap strStrMap = new StrStrMap();
        if (nodeMetadata.isError()) {
          // not to fire requests for this node; sinc even the last
          // step does not have the value extracted. (e.g. fail to get
          // response back)
          // therefore; this step will not really to fire requests.
          strStrMap.getMap().put(VarUtils.NA, VarUtils.NA);
        } else {

          // for requests to a single server
          if (willReplaceTargetServer) {
            strStrMap
                .getMap()
                .put(VarUtils.VAR_NAME_APIVARREPLACE_SUPERMANSPECIAL_TARGET_NODE_VAR_WHEN_INSERT,
                    targetServerNew);
          }

          // get from the aggregation from last step and push it into
          // the nodemap
          String valueFromLastAggregationForThisFqdn = nodeMetadata
              .getValue();
          strStrMap.getMap().put(varName,
              valueFromLastAggregationForThisFqdn);
        }
        replacementVarMapNodeSpecific.put(fqdn, strStrMap);

      }// end for
View Full Code Here

TOP

Related Classes of models.data.StrStrMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.