예제 #1
0
 public String execute() {
   String retVal = "";
   try {
     prepareAndInvokeMashups();
     retVal = SUCCESS;
     if (retVal.equals(SUCCESS)
         && getSingleOrderHeaderKey()
             .equals(CommerceContextHelper.getCartInContextOrderHeaderKey(getWCContext()))) {
       CommerceContextHelper.flushCartInContextCache(getWCContext());
       XPEDXWCUtils.removeObectFromCache("OrderHeaderInContext");
       // Remove itemMap from Session, when cart change in context,  For Minicart Jira 3481
       XPEDXWCUtils.removeObectFromCache("itemMap");
       XPEDXOrderUtils.refreshMiniCart(
           getWCContext(), null, true, false, XPEDXConstants.MAX_ELEMENTS_IN_MINICART);
     }
   } catch (XMLExceptionWrapper e) {
     YFCElement errorXML = e.getXML();
     YFCElement errorElement = (YFCElement) errorXML.getElementsByTagName("Error").item(0);
     String errorDeasc = errorElement.getAttribute("ErrorDescription");
     if (errorDeasc.contains("YFS: Order cannot be modified in current status")) {
       retVal = "failure";
     }
   } catch (Exception e) {
     retVal = "error";
   }
   return retVal;
 }
  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;
  }