Class BOMHelper

java.lang.Object
org.apache.ofbiz.manufacturing.bom.BOMHelper

public final class BOMHelper extends Object
Helper class containing static method useful when dealing with product's bills of materials. These methods are also available as services (see BOMServices).
  • Method Details

    • getMaxDepth

      public static int getMaxDepth(String productId, String bomType, Date inDate, Delegator delegator) throws GenericEntityException
      Returns the product's low level code (llc) i.e. the maximum depth in which the productId can be found in any of the bills of materials of bomType type.
      Parameters:
      productId - The product id
      bomType - The bill of materials type (e.g. manufacturing, engineering,...)
      delegator - Validity date (if null, today is used).
      inDate - The delegator
      Returns:
      The low level code for the productId. (0 = root, 1 = first level, etc...)
      Throws:
      GenericEntityException - If a db problem occurs.
    • searchDuplicatedAncestor

      public static GenericValue searchDuplicatedAncestor(String productId, String productIdKey, String bomType, Date inDate, Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) throws GenericEntityException
      Returns the ProductAssoc generic value for a duplicate productIdKey ancestor if present, null otherwise. Useful to avoid loops when adding new assocs (components) to a bill of materials.
      Parameters:
      productId - The product to which we want to add a new child.
      productIdKey - The new component we want to add to the existing bom.
      bomType - The bill of materials type (e.g. manufacturing, engineering).
      inDate - Validity date (if null, today is used).
      delegator - The delegator used
      Returns:
      the ProductAssoc generic value for a duplicate productIdKey ancestor if present, null otherwise.
      Throws:
      GenericEntityException - If a db problem occurs
    • createProductionRunsForShipment

      public static String createProductionRunsForShipment(HttpServletRequest request, HttpServletResponse response)