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) {