From 4fba75b0e11a2e8b93d964f9f87295eb97a13567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Musil?= Date: Sun, 27 Dec 2020 19:11:07 +0100 Subject: [PATCH] Added setStateToInRequirement that I forgot earlier --- .../fel/sit/omo/foodchain/product/Product.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/cz/cvut/fel/sit/omo/foodchain/product/Product.java b/src/main/java/cz/cvut/fel/sit/omo/foodchain/product/Product.java index 9feee01..b556cb1 100644 --- a/src/main/java/cz/cvut/fel/sit/omo/foodchain/product/Product.java +++ b/src/main/java/cz/cvut/fel/sit/omo/foodchain/product/Product.java @@ -84,14 +84,14 @@ public class Product } /** - * Set current product state to READY_FOR_DISPATCH. Throws IllegalStateException if the product is not AVAILABLE. + * Set current product state to READY_FOR_DISPATCH. Throws IllegalStateException if the product is not IN_REQUIREMENT. */ public void setStateToReadyForDispatch() { - if(this.productState.equals(ProductState.AVAILABLE)) + if(this.productState.equals(ProductState.IN_REQUIREMENT)) this.productState = ProductState.READY_FOR_DISPATCH; else - throw new IllegalStateException("Cannot set state READY_FOR_DISPATCH. Product is not AVAILABLE!"); + throw new IllegalStateException("Cannot set state READY_FOR_DISPATCH. Product is not IN_REQUIREMENT!"); } /** @@ -127,6 +127,17 @@ public class Product throw new IllegalStateException("Cannot set state IN_ACTION. Product is not AVAILABLE!"); } + /** + * Set current product state to IN_REQUIREMENT. Throws IllegalStateException if the product is not AVAILABLE. + */ + public void setStateToInRequirement() + { + if(this.productState.equals(ProductState.AVAILABLE)) + this.productState = ProductState.IN_REQUIREMENT; + else + throw new IllegalStateException("Cannot set state IN_REQUIREMENT. Product is not AVAILABLE!"); + } + /* public void setProductState(ProductState productState) {