コード例 #1
0
  public boolean evaluateCondition(
      YFSEnvironment arg0, String arg1, Map arg2, Document getOrderDetailsOutput) {

    boolean isOrderOnHold = false;

    YFCDocument yfcDoc = YFCDocument.getDocumentFor(getOrderDetailsOutput);
    if (log.isDebugEnabled()) {
      log.debug("XPXCheckIfOrderOnPendingAppHoldCondition-InXML: " + yfcDoc.getString());
    }

    YFCElement rootElem = yfcDoc.getDocumentElement();
    YFCElement orderHoldTypesElem = rootElem.getChildElement(XPXLiterals.E_ORDER_HOLD_TYPES);
    if (orderHoldTypesElem != null) {
      YFCIterable<YFCElement> orderHoldItr =
          orderHoldTypesElem.getChildren(XPXLiterals.E_ORDER_HOLD_TYPE);
      while (orderHoldItr.hasNext()) {
        YFCElement orderHoldTypeElem = orderHoldItr.next();
        String holdType = orderHoldTypeElem.getAttribute(XPXLiterals.A_HOLD_TYPE);
        String holdStatus = orderHoldTypeElem.getAttribute(XPXLiterals.A_STATUS);
        if (log.isDebugEnabled()) {
          log.debug("holdType: " + holdType);
          log.debug("holdStatus: " + holdStatus);
        }

        if (!YFCObject.isNull(holdType)
            && holdType.equalsIgnoreCase("ORDER_LIMIT_APPROVAL")
            && !YFCObject.isNull(holdStatus)
            && holdStatus.equalsIgnoreCase(XPXLiterals.HOLD_CREATED_STATUS_ID)) {
          isOrderOnHold = true;
          break;
        }
      }
    }

    if (log.isDebugEnabled()) {
      log.debug("Is Order On Hold: " + isOrderOnHold);
    }
    return isOrderOnHold;
  }