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; }
@Override @SuppressWarnings("unchecked") public String execute() throws Exception { if (!YFCUtils.isVoid(searchString)) { ArrayList<DivisionBean> divisionBeanTempList = (ArrayList<DivisionBean>) XPEDXWCUtils.getObjectFromCache("divisionBeanList"); if (divisionBeanTempList != null && divisionBeanTempList.size() > 0) { Map<String, DivisionBean> searchDivisionBeanMap = new HashMap<String, DivisionBean>(); for (Iterator<DivisionBean> it = divisionBeanTempList.iterator(); it.hasNext(); ) { DivisionBean divisionBean = it.next(); DivisionBean searchDivisionBean; ArrayList<ShipToCustomerBean> shipToCustomerBeanList = divisionBean.getShipToCustomrs(); if (shipToCustomerBeanList != null && shipToCustomerBeanList.size() > 0) { ArrayList<ShipToCustomerBean> searchShipToCustomerBeanList = null; for (Iterator<ShipToCustomerBean> it1 = shipToCustomerBeanList.iterator(); it1.hasNext(); ) { ShipToCustomerBean shipToCustomerBean = it1.next(); String shipToDisplayString = shipToCustomerBean.getShipToDisplayString(); if (containsIgnoreCase(shipToDisplayString, searchString)) { if (searchShipToCustomerBeanList == null) { searchShipToCustomerBeanList = new ArrayList<ShipToCustomerBean>(); } searchShipToCustomerBeanList.add(shipToCustomerBean); } } if (searchShipToCustomerBeanList != null) { searchDivisionBean = searchDivisionBeanMap.get(divisionBean.getDivisionId()); if (searchDivisionBean == null) { searchDivisionBean = new DivisionBean(); searchDivisionBean.setDivisionId(divisionBean.getDivisionId()); searchDivisionBean.setDivisionName(divisionBean.getDivisionName()); } Collections.sort(searchShipToCustomerBeanList); searchDivisionBean.setShipToCustomrs(searchShipToCustomerBeanList); searchDivisionBeanMap.put(divisionBean.getDivisionId(), searchDivisionBean); } } } if (searchDivisionBeanMap != null) { divisionBeanList = new ArrayList<DivisionBean>(searchDivisionBeanMap.values()); Collections.sort(divisionBeanList); } } } else { divisionBeanList = (ArrayList<DivisionBean>) XPEDXWCUtils.getObjectFromCache("divisionBeanList"); } setPunchoutMessage(XPEDXWCUtils.getCustomerPunchoutMessage(wcContext)); return "punchout"; }