Class ProductionRecord
- java.lang.Object
-
- ProductionRecord
-
public class ProductionRecord extends java.lang.ObjectProductionRecord 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
-
-
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 ItemTypefindType(java.lang.String code)Takes the code parameter and returns the corresponding ItemTypejava.util.DategetProdDate()Gets the dateProduced field and outputsintgetProductID()Gets the productID field and outputsintgetProductionNum()Gets the production number fieldjava.lang.StringgetProductName()Grabs the productName of the objectjava.lang.StringgetSerialNum()Gets the serialNumber field and outputsstatic intgetTypeTotal(ItemType type)Takes the ItemType parameter and returns the respective totalstatic voidresetAllTypeCounts()Sets all of the totals for the types to 0.voidsetProdDate(java.util.Date newDate)Sets the dateProduced to a new datevoidsetProductID(int number)Sets the productID field to numbervoidsetProductionNum(int number)Sets productionNumber field to numbervoidsetProductName(java.lang.String productName)Sets the productNamevoidsetSerialNum(java.lang.String number)Sets the serialNumber field to numberjava.lang.StringtoString()This method is primarily used as output onto the productionLog.static voidupdateTypeTotals(java.lang.String code)Takes the code parameter and updates the respective itemType total
-
-
-
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:
toStringin classjava.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.
-
-