Class BOMTree


  • public class BOMTree
    extends java.lang.Object
    It represents an (in-memory) bill of materials (in which each component is an BOMNode) Useful for tree traversal (breakdown, explosion, implosion).
    • Constructor Summary

      Constructors 
      Constructor Description
      BOMTree​(java.lang.String productId, java.lang.String bomTypeId, java.util.Date inDate, int type, Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin)
      Creates a new instance of BOMTree by reading the productId's bill of materials (upward or downward).
      BOMTree​(java.lang.String productId, java.lang.String bomTypeId, java.util.Date inDate, Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin)
      Creates a new instance of BOMTree by reading downward the productId's bill of materials (explosion).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String createManufacturingOrders​(java.lang.String facilityId, java.util.Date date, java.lang.String workEffortName, java.lang.String description, java.lang.String routingId, java.lang.String orderId, java.lang.String orderItemSeqId, java.lang.String shipGroupSeqId, java.lang.String shipmentId, GenericValue userLogin)
      It visits the in-memory tree that represents a bill of materials and it creates a manufacturing order for each of the nodes that needs to be manufactured.
      java.util.List<java.lang.String> getAllProductsId()
      It visits the in-memory tree that represents a bill of materials and it collects all the productId it contains.
      java.lang.String getBomTypeId()
      Getter for property bomTypeId.
      java.util.Date getInDate()
      Getter for property inDate.
      GenericValue getInputProduct()  
      void getProductsInPackages​(java.util.List<BOMNode> arr)  
      BOMNode getRoot()
      Getter for property root.
      java.math.BigDecimal getRootAmount()
      Getter for property rootAmount.
      java.math.BigDecimal getRootQuantity()
      Getter for property rootQuantity.
      boolean isConfigured()
      It tells if the current (in-memory) tree representing a product's bill of materials is completely configured or not.
      void print​(java.lang.StringBuffer sb)
      It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the StringBuffer.
      void print​(java.util.List<BOMNode> arr)
      It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the List.
      void print​(java.util.List<BOMNode> arr, boolean excludeWIPs)  
      void print​(java.util.List<BOMNode> arr, int initialDepth)
      It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the List.
      void print​(java.util.List<BOMNode> arr, int initialDepth, boolean excludeWIPs)  
      void setRootAmount​(java.math.BigDecimal rootAmount)
      Setter for property rootAmount.
      void setRootQuantity​(java.math.BigDecimal rootQuantity)
      Setter for property rootQuantity.
      void sumQuantities​(java.util.Map<java.lang.String,​BOMNode> quantityPerNode)
      It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the Map.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BOMTree

        public BOMTree​(java.lang.String productId,
                       java.lang.String bomTypeId,
                       java.util.Date inDate,
                       Delegator delegator,
                       LocalDispatcher dispatcher,
                       GenericValue userLogin)
                throws GenericEntityException
        Creates a new instance of BOMTree by reading downward the productId's bill of materials (explosion). If virtual products are found, it tries to configure them by running the Product Configurator.
        Parameters:
        productId - The product for which we want to get the bom.
        bomTypeId - The bill of materials type (e.g. manufacturing, engineering, ...)
        inDate - Validity date (if null, today is used).
        delegator - The delegator used.
        Throws:
        GenericEntityException - If a db problem occurs.
      • BOMTree

        public BOMTree​(java.lang.String productId,
                       java.lang.String bomTypeId,
                       java.util.Date inDate,
                       int type,
                       Delegator delegator,
                       LocalDispatcher dispatcher,
                       GenericValue userLogin)
                throws GenericEntityException
        Creates a new instance of BOMTree by reading the productId's bill of materials (upward or downward). If virtual products are found, it tries to configure them by running the Product Configurator.
        Parameters:
        productId - The product for which we want to get the bom.
        bomTypeId - The bill of materials type (e.g. manufacturing, engineering, ...)
        inDate - Validity date (if null, today is used).
        type - if equals to EXPLOSION, a downward visit is performed (explosion); if equals to EXPLOSION_SINGLE_LEVEL, a single level explosion is performed; if equals to EXPLOSION_MANUFACTURING, a downward visit is performed (explosion), including only the product that needs manufacturing; if equals to IMPLOSION an upward visit is done (implosion);
        delegator - The delegator used.
        Throws:
        GenericEntityException - If a db problem occurs.
    • Method Detail

      • isConfigured

        public boolean isConfigured()
        It tells if the current (in-memory) tree representing a product's bill of materials is completely configured or not.
        Returns:
        true if no virtual nodes (products) are present in the tree.
      • getRootQuantity

        public java.math.BigDecimal getRootQuantity()
        Getter for property rootQuantity.
        Returns:
        Value of property rootQuantity.
      • setRootQuantity

        public void setRootQuantity​(java.math.BigDecimal rootQuantity)
        Setter for property rootQuantity.
        Parameters:
        rootQuantity - New value of property rootQuantity.
      • getRootAmount

        public java.math.BigDecimal getRootAmount()
        Getter for property rootAmount.
        Returns:
        Value of property rootAmount.
      • setRootAmount

        public void setRootAmount​(java.math.BigDecimal rootAmount)
        Setter for property rootAmount.
        Parameters:
        rootAmount - New value of property rootAmount.
      • getRoot

        public BOMNode getRoot()
        Getter for property root.
        Returns:
        Value of property root.
      • getInDate

        public java.util.Date getInDate()
        Getter for property inDate.
        Returns:
        Value of property inDate.
      • getBomTypeId

        public java.lang.String getBomTypeId()
        Getter for property bomTypeId.
        Returns:
        Value of property bomTypeId.
      • print

        public void print​(java.lang.StringBuffer sb)
        It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the StringBuffer. Method used for debug purposes.
        Parameters:
        sb - The StringBuffer used to collect tree info.
      • print

        public void print​(java.util.List<BOMNode> arr,
                          int initialDepth)
        It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the List. Method used for bom breakdown (explosion/implosion).
        Parameters:
        arr - The List used to collect tree info.
        initialDepth - The depth of the root node.
      • print

        public void print​(java.util.List<BOMNode> arr,
                          int initialDepth,
                          boolean excludeWIPs)
      • print

        public void print​(java.util.List<BOMNode> arr)
        It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the List. Method used for bom breakdown (explosion/implosion).
        Parameters:
        arr - The List used to collect tree info.
      • print

        public void print​(java.util.List<BOMNode> arr,
                          boolean excludeWIPs)
      • sumQuantities

        public void sumQuantities​(java.util.Map<java.lang.String,​BOMNode> quantityPerNode)
        It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the Map. Method used for bom summarized explosion.
        Parameters:
        quantityPerNode - The Map that will contain the summarized quantities per productId.
      • getAllProductsId

        public java.util.List<java.lang.String> getAllProductsId()
        It visits the in-memory tree that represents a bill of materials and it collects all the productId it contains.
        Returns:
        List containing all the tree's productId.
      • createManufacturingOrders

        public java.lang.String createManufacturingOrders​(java.lang.String facilityId,
                                                          java.util.Date date,
                                                          java.lang.String workEffortName,
                                                          java.lang.String description,
                                                          java.lang.String routingId,
                                                          java.lang.String orderId,
                                                          java.lang.String orderItemSeqId,
                                                          java.lang.String shipGroupSeqId,
                                                          java.lang.String shipmentId,
                                                          GenericValue userLogin)
                                                   throws GenericEntityException
        It visits the in-memory tree that represents a bill of materials and it creates a manufacturing order for each of the nodes that needs to be manufactured.
        Parameters:
        facilityId - the facility id
        date - the context date
        workEffortName - the work effort name
        description - the description
        routingId - the routing id
        orderId - the order id
        orderItemSeqId - the order item id
        shipGroupSeqId - the shipment group item id
        shipmentId - the shipment id delegator used
        userLogin - the GenericValue object of userLogin
        Returns:
        returns the work effort id
        Throws:
        GenericEntityException - If a db problem occurs.
      • getProductsInPackages

        public void getProductsInPackages​(java.util.List<BOMNode> arr)