Package model
Class Inventory
- java.lang.Object
-
- model.Inventory
-
public class Inventory extends java.lang.Object
Inventory object, used to manage the list of parts and products, and operations that manage that inventory.
-
-
Constructor Summary
Constructors Constructor Description Inventory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addPart(Part newPart)
static void
addProduct(Product newProduct)
static boolean
deletePart(Part selectedPart)
Deletes part.static boolean
deleteProduct(Product selectedProduct)
Deletes Product.static javafx.collections.ObservableList<Part>
getAllParts()
Return all partsstatic javafx.collections.ObservableList<Product>
getAllProducts()
Return all productsstatic Part
lookupPart(int partID)
Looks for a part using it's part ID numberstatic javafx.collections.ObservableList<Part>
lookupPart(java.lang.String partName)
Searches for partial string matches on name of Part.static Product
lookupProduct(int product)
Look for a product using it's id numberstatic javafx.collections.ObservableList<Product>
lookupProduct(java.lang.String productName)
Searches for partial name matches on the name of a product.static void
updatePart(int index, Part selectedPart)
Updates the selected part, by adding tne new entry, and deleting the original.static void
updateProduct(int index, Product newProduct)
Replaces product with updated entry, by adding new entry and deleting the old.
-
-
-
Method Detail
-
addPart
public static void addPart(Part newPart)
-
addProduct
public static void addProduct(Product newProduct)
-
lookupProduct
public static Product lookupProduct(int product)
Look for a product using it's id number- Parameters:
product
- , the product id number- Returns:
- the product object if it is found. Null if not found
-
lookupPart
public static Part lookupPart(int partID)
Looks for a part using it's part ID number- Parameters:
partID
- , equals the part id number- Returns:
- the searched for part, if not found returns null
-
lookupProduct
public static javafx.collections.ObservableList<Product> lookupProduct(java.lang.String productName)
Searches for partial name matches on the name of a product. Search is case insensitive.- Parameters:
productName
-- Returns:
-
lookupPart
public static javafx.collections.ObservableList<Part> lookupPart(java.lang.String partName)
Searches for partial string matches on name of Part. Lookup is case insensitive.- Parameters:
partName
-- Returns:
-
updatePart
public static void updatePart(int index, Part selectedPart)
Updates the selected part, by adding tne new entry, and deleting the original. PartID is retained.- Parameters:
index
- is the PartIDselectedPart
- is the desired object
-
updateProduct
public static void updateProduct(int index, Product newProduct)
Replaces product with updated entry, by adding new entry and deleting the old. ProductID is retained.- Parameters:
index
- is Product IDnewProduct
- is object reference
-
deletePart
public static boolean deletePart(Part selectedPart)
Deletes part.- Parameters:
selectedPart
-- Returns:
- true if delete was successful, false if it was not.
-
deleteProduct
public static boolean deleteProduct(Product selectedProduct)
Deletes Product.- Parameters:
selectedProduct
-- Returns:
- true if successful, false if not.
-
getAllParts
public static javafx.collections.ObservableList<Part> getAllParts()
Return all parts- Returns:
- All parts
-
getAllProducts
public static javafx.collections.ObservableList<Product> getAllProducts()
Return all products- Returns:
- all Products
-
-