/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import java.util.*; import org.ofbiz.entity.*; import org.ofbiz.base.util.*; delegator = request.getAttribute("delegator"); shipmentId = request.getParameter("shipmentId"); if (UtilValidate.isEmpty(shipmentId)) { shipmentId = context.get("shipmentId"); } shipment = null; if (UtilValidate.isNotEmpty(shipmentId)) { shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId)); } if (shipment != null) { shipmentPackages = shipment.getRelated("ShipmentPackage", null, UtilMisc.toList("shipmentPackageSeqId")); shipmentPackageDatas = new LinkedList(); if (shipmentPackages != null && shipmentPackages.size() > 0) { shipmentPackageIter = shipmentPackages.iterator(); while (shipmentPackageIter.hasNext()) { shipmentPackage = shipmentPackageIter.next(); shipmentPackageData = new HashMap(); shipmentPackageData.put("shipmentPackage", shipmentPackage); shipmentPackageData.put("shipmentPackageContents", shipmentPackage.getRelated("ShipmentPackageContent")); shipmentPackageData.put("shipmentPackageRouteSegs", shipmentPackage.getRelated("ShipmentPackageRouteSeg")); shipmentPackageData.put("weightUom", shipmentPackage.getRelatedOne("WeightUom")); shipmentPackageDatas.add(shipmentPackageData); } } shipmentItems = shipment.getRelated("ShipmentItem", null, UtilMisc.toList("shipmentItemSeqId")); shipmentRouteSegments = shipment.getRelated("ShipmentRouteSegment", null, UtilMisc.toList("shipmentRouteSegmentId")); weightUoms = delegator.findByAnd("Uom", UtilMisc.toMap("uomTypeId", "WEIGHT_MEASURE"), UtilMisc.toList("description")); boxTypes = delegator.findAll("ShipmentBoxType"); context.put("shipment", shipment); context.put("shipmentPackageDatas", shipmentPackageDatas); context.put("shipmentItems", shipmentItems); context.put("shipmentRouteSegments", shipmentRouteSegments); context.put("weightUoms", weightUoms); context.put("boxTypes", boxTypes); } context.put("shipmentId", shipmentId);