/** Change to dependent object... */ public void stateChanged(ChangeEvent e) { Object source = e.getSource(); while (source instanceof OrderCommodityDetailFrame) { // Some order commodity has changed. // Try to find it, then update order model // Sanity Check OrderValue ov = (OrderValue) getModel(); if (ov == null) { break; } // Which OC ID to find? OrderCommodityDetailFrame ocdf = (OrderCommodityDetailFrame) source; OrderCommodityValue changedOCV = (OrderCommodityValue) ocdf.getModel(); OrderCommodityPK ocpk = (OrderCommodityPK) changedOCV.getPK(); if (ocpk == null) { break; } Long changeOrderCommodityId = ocpk.getId(); if (changeOrderCommodityId == null || changeOrderCommodityId.longValue() == 0) { break; } // Check OrderValues, find it. Collection orderCommodities = ov.getOrderCommodities(); for (Iterator it = orderCommodities.iterator(); it.hasNext(); ) { OrderCommodityValue ocv = (OrderCommodityValue) it.next(); if (ocv.getId().equals(changeOrderCommodityId)) { ocv.setCommodity(changedOCV.getCommodity()); ocv.setHazardousDetails(changedOCV.getHazardousDetails()); orderPanel.stateChanged(new ChangeEvent(ocv)); break; } } break; } hasChanged(); }
/** * @param torder * @param order * @param limit * @return * @throws Exception */ public List getDepots(TransportOrderValue torder, OrderValue order, int limit) throws Exception { WaypointValue customerAddress = null; Address seaTerminalAddress = null; long carrierId; long container; boolean pickup; pickup = !order.getIsImportOrder(); container = order.getContainerType().longValue(); carrierId = order.getCarrierId(); // get the needed customer address List waypoints = null; if (pickup) { waypoints = torder.getExportWaypoints(); } else { waypoints = torder.getImportWaypoints(); } log.debug("the length of waypoints: " + waypoints.size()); if (order.getIsImportOrder()) { // last customer for import for (int i = waypoints.size() - 1; i >= 0; i--) { WaypointValue point = (WaypointValue) waypoints.get(i); if (point.getType().equalsIgnoreCase("Customer")) { customerAddress = point; } else if (point.getType().equalsIgnoreCase(Constants.WAYPOINT_TYPE_SEATERMINAL)) { seaTerminalAddress = point; } } } else { // fist customer for export for (int i = 0; i < waypoints.size(); i++) { WaypointValue point = (WaypointValue) waypoints.get(i); if (point.getType().equalsIgnoreCase("Customer")) { customerAddress = point; } else if (point.getType().equalsIgnoreCase(Constants.WAYPOINT_TYPE_SEATERMINAL)) { seaTerminalAddress = point; } } } Date fixedDate = customerAddress.getFixedDate(); boolean isExtended = false; // VERSION_TOGGLE FRR.ExtendedDepots Start ---------- if (ResourceUtil.getBoolean("FRR.ExtendedDepots")) { isExtended = true; } // VERSION_TOGGLE FRR.ExtendedDepots End ---------- log.debug( "customer:" + customerAddress + " carrierId: " + carrierId + " container " + container + " pickup " + pickup); return getFacilityManager() .getDepots( customerAddress, seaTerminalAddress, carrierId, container, pickup, fixedDate, limit, isExtended); }
/** * @param order * @param limit * @return * @throws Exception */ public List getDepots(OrderValue order, int limit) throws Exception { log.debug("getDepots, order: " + order); WaypointValue customerAddress = null; WaypointValue seaTerminalAddress = null; long carrierId; long container; // long containerType; boolean pickup; pickup = !order.getIsImportOrder(); container = order.getContainerType().longValue(); carrierId = order.getCarrierId(); // containerType = order.getContainerType().longValue(); // get the needed customer address List waypoints = order.getWaypoints(); log.info("Waypointcount: " + waypoints.size() + " limit: " + limit); // boolean isSpecial = false; // CarrierValue carrier = // (CarrierValue)CarrierService.getInstance().findByPrimaryKey(new // CarrierPK(new // Long(carrierId))); // long special = carrier.getHinterlandEquipmentChange(); // isSpecial = (special&containerType)!=0; // if (!isSpecial){ if (order.getIsImportOrder()) { // last customer for import for (int i = waypoints.size() - 1; i >= 0; i--) { WaypointValue point = (WaypointValue) waypoints.get(i); if (point.getType().equalsIgnoreCase(Constants.WAYPOINT_TYPE_CUSTOMER)) { customerAddress = point; } else if (point.getType().equalsIgnoreCase(Constants.WAYPOINT_TYPE_SEATERMINAL)) { seaTerminalAddress = point; } } } else { // fist customer for export for (int i = 0; i < waypoints.size(); i++) { WaypointValue point = (WaypointValue) waypoints.get(i); if (point.getType().equalsIgnoreCase(Constants.WAYPOINT_TYPE_CUSTOMER)) { customerAddress = point; } else if (point.getType().equalsIgnoreCase(Constants.WAYPOINT_TYPE_SEATERMINAL)) { seaTerminalAddress = point; } } } Date fixedDate = customerAddress.getFixedDate(); boolean isExtended = false; // VERSION_TOGGLE FRR.ExtendedDepots Start ---------- if (ResourceUtil.getBoolean("FRR.ExtendedDepots")) { isExtended = true; } // VERSION_TOGGLE FRR.ExtendedDepots End ---------- return getFacilityManager() .getDepots( customerAddress, seaTerminalAddress, carrierId, container, pickup, fixedDate, limit, isExtended); }