Class BOMHelper


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

      • module

        public static final java.lang.String module
    • Method Detail

      • getMaxDepth

        public static int getMaxDepth​(java.lang.String productId,
                                      java.lang.String bomType,
                                      java.util.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​(java.lang.String productId,
                                                            java.lang.String productIdKey,
                                                            java.lang.String bomType,
                                                            java.util.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