Class ProductionRecord


  • public class ProductionRecord
    extends java.lang.Object
    ProductionRecord keeps track of the types of Products that have been produced. It keeps track of their time, the total amount of each type produced, the product name, and it's ID.
    Author:
    Jairo Garciga
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int totalAM  
      static int totalAU  
      static int totalVI  
      static int totalVM  
    • Constructor Summary

      Constructors 
      Constructor Description
      ProductionRecord​(int productID)
      This default constructor takes care of the quick instantiation of productionRecords The type count has to be updated when this is called since it does not update the itemType totals.
      ProductionRecord​(Product product)
      This constructor takes care of several things, it sets all the main variables, updates the totals for the types, and finally sets the serial number.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ItemType findType​(java.lang.String code)
      Takes the code parameter and returns the corresponding ItemType
      java.util.Date getProdDate()
      Gets the dateProduced field and outputs
      int getProductID()
      Gets the productID field and outputs
      int getProductionNum()
      Gets the production number field
      java.lang.String getProductName()
      Grabs the productName of the object
      java.lang.String getSerialNum()
      Gets the serialNumber field and outputs
      static int getTypeTotal​(ItemType type)
      Takes the ItemType parameter and returns the respective total
      static void resetAllTypeCounts()
      Sets all of the totals for the types to 0.
      void setProdDate​(java.util.Date newDate)
      Sets the dateProduced to a new date
      void setProductID​(int number)
      Sets the productID field to number
      void setProductionNum​(int number)
      Sets productionNumber field to number
      void setProductName​(java.lang.String productName)
      Sets the productName
      void setSerialNum​(java.lang.String number)
      Sets the serialNumber field to number
      java.lang.String toString()
      This method is primarily used as output onto the productionLog.
      static void updateTypeTotals​(java.lang.String code)
      Takes the code parameter and updates the respective itemType total
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • totalAU

        public static int totalAU
      • totalAM

        public static int totalAM
      • totalVI

        public static int totalVI
      • totalVM

        public static int totalVM
    • Constructor Detail

      • ProductionRecord

        public ProductionRecord​(int productID)
        This default constructor takes care of the quick instantiation of productionRecords The type count has to be updated when this is called since it does not update the itemType totals.
        Parameters:
        productID - The id of the product
      • ProductionRecord

        public ProductionRecord​(Product product)
        This constructor takes care of several things, it sets all the main variables, updates the totals for the types, and finally sets the serial number.
        Parameters:
        product - The product which a production record will be made of
    • Method Detail

      • toString

        public java.lang.String toString()
        This method is primarily used as output onto the productionLog. It sets a string for the productionNum, productName, serialNum, and prodDate.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string format of a productionRecord object
      • getProductName

        public java.lang.String getProductName()
        Grabs the productName of the object
        Returns:
        The productName
      • setProductName

        public void setProductName​(java.lang.String productName)
        Sets the productName
        Parameters:
        productName - The new productName
      • getProductionNum

        public int getProductionNum()
        Gets the production number field
        Returns:
        productionNumber
      • getProductID

        public int getProductID()
        Gets the productID field and outputs
        Returns:
        productID
      • getSerialNum

        public java.lang.String getSerialNum()
        Gets the serialNumber field and outputs
        Returns:
        serialNumber
      • getProdDate

        public java.util.Date getProdDate()
        Gets the dateProduced field and outputs
        Returns:
        dateProduced
      • setProductionNum

        public void setProductionNum​(int number)
        Sets productionNumber field to number
        Parameters:
        number - The new product number
      • setProductID

        public void setProductID​(int number)
        Sets the productID field to number
        Parameters:
        number - The new productID
      • setSerialNum

        public void setSerialNum​(java.lang.String number)
        Sets the serialNumber field to number
        Parameters:
        number - The new serialNumber
      • setProdDate

        public void setProdDate​(java.util.Date newDate)
        Sets the dateProduced to a new date
        Parameters:
        newDate - The new date
      • updateTypeTotals

        public static void updateTypeTotals​(java.lang.String code)
        Takes the code parameter and updates the respective itemType total
        Parameters:
        code - The ItemType to have it's total updated
      • getTypeTotal

        public static int getTypeTotal​(ItemType type)
        Takes the ItemType parameter and returns the respective total
        Parameters:
        type - The ItemType input
        Returns:
        The respective ItemType amount
      • findType

        public static ItemType findType​(java.lang.String code)
        Takes the code parameter and returns the corresponding ItemType
        Parameters:
        code - The String representation of an ItemType
        Returns:
        The corresponding ItemType to the code
      • resetAllTypeCounts

        public static void resetAllTypeCounts()
        Sets all of the totals for the types to 0. This prevents issues where the typeTotals spiral out of control when continuously making new productionRecord objects from the database. Ex: Each time that ProductionRecord database is updated it remakes every ProductionRecord Object in the productLog tab.