public int compare(Element elem, Element elem1) { double fromQuantity = 0; double fromQuantity1 = 0; if (!YFCUtils.isVoid(elem.getAttribute("Conversion"))) { fromQuantity = Double.valueOf(elem.getAttribute("Conversion")); } if (!YFCUtils.isVoid(elem1.getAttribute("Conversion"))) { fromQuantity1 = Double.valueOf(elem1.getAttribute("Conversion")); } if (fromQuantity > fromQuantity1) { return 1; } else if (fromQuantity < fromQuantity1) { return -1; } else return 0; }
@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"; }