]> git.mxchange.org Git - jproduct-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 31 Mar 2018 15:57:14 +0000 (17:57 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 31 Mar 2018 15:57:14 +0000 (17:57 +0200)
- moved "added" event to own package
- added "created" (LOL) event

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jproduct/events/product/AddedProductEvent.java [deleted file]
src/org/mxchange/jproduct/events/product/ProductAddedEvent.java [deleted file]
src/org/mxchange/jproduct/events/product/added/AddedProductEvent.java [new file with mode: 0644]
src/org/mxchange/jproduct/events/product/added/ProductAddedEvent.java [new file with mode: 0644]
src/org/mxchange/jproduct/events/product/created/CreatedProductEvent.java [new file with mode: 0644]
src/org/mxchange/jproduct/events/product/created/ObservableCreatedProductEvent.java [new file with mode: 0644]
src/org/mxchange/jproduct/model/product/agegroup/AgeGroup.java

diff --git a/src/org/mxchange/jproduct/events/product/AddedProductEvent.java b/src/org/mxchange/jproduct/events/product/AddedProductEvent.java
deleted file mode 100644 (file)
index 7a96cf2..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2016 - 2018 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jproduct.events.product;
-
-import java.io.Serializable;
-import org.mxchange.jproduct.model.product.Product;
-
-/**
- * An interface for added product events
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface AddedProductEvent extends Serializable {
-
-       /**
-        * Getter for added product instance
-        * <p>
-        * @return Added product instance
-        */
-       public Product getAddedProduct ();
-
-}
diff --git a/src/org/mxchange/jproduct/events/product/ProductAddedEvent.java b/src/org/mxchange/jproduct/events/product/ProductAddedEvent.java
deleted file mode 100644 (file)
index 66f43ac..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2016 - 2018 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jproduct.events.product;
-
-import java.text.MessageFormat;
-import org.mxchange.jproduct.model.product.Product;
-
-/**
- * An event fired when a new shop category has been added.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class ProductAddedEvent implements AddedProductEvent {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 18_567_817_669_107L;
-
-       /**
-        * Product instance that has been added
-        */
-       private final Product addedProduct;
-
-       /**
-        * Constructor with added product instance
-        * <p>
-        * @param addedProduct Added product
-        */
-       public ProductAddedEvent (final Product addedProduct) {
-               // The category should be valid
-               if (null == addedProduct) {
-                       // Is NULL, throw NPE
-                       throw new NullPointerException("addedProduct is null"); //NOI18N
-               } else if (addedProduct.getProductI18nKey().isEmpty()) {
-                       // Empty title
-                       throw new IllegalArgumentException("addedProduct.productI18nKey is empty"); //NOI18N
-               } else if (addedProduct.getProductId() == null) {
-                       // Id is NULL
-                       throw new NullPointerException("addedProduct.productId is null"); //NOI18N
-               } else if (addedProduct.getProductId() <= 0) {
-                       // Not valid id
-                       throw new IllegalArgumentException(MessageFormat.format("addedProduct.productId={0} is not valid.", addedProduct.getProductId())); //NOI18N
-               } else if (addedProduct.getProductCategory() == null) {
-                       // Id is NULL
-                       throw new NullPointerException("addedProduct.productCategory is null"); //NOI18N
-               } else if (addedProduct.getProductCategory().getCategoryId() == null) {
-                       // Id is NULL
-                       throw new NullPointerException("addedProduct.productCategory.categoryId is null"); //NOI18N
-               } else if (addedProduct.getProductCategory().getCategoryId() <= 0) {
-                       // Not valid id
-                       throw new IllegalArgumentException(MessageFormat.format("addedProduct.productCategory.categoryId={0} is not valid.", addedProduct.getProductId())); //NOI18N
-               }
-
-               // Set it here
-               this.addedProduct = addedProduct;
-       }
-
-       @Override
-       public Product getAddedProduct () {
-               return this.addedProduct;
-       }
-
-}
diff --git a/src/org/mxchange/jproduct/events/product/added/AddedProductEvent.java b/src/org/mxchange/jproduct/events/product/added/AddedProductEvent.java
new file mode 100644 (file)
index 0000000..899aece
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016 - 2018 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jproduct.events.product.added;
+
+import java.io.Serializable;
+import org.mxchange.jproduct.model.product.Product;
+
+/**
+ * An interface for added product events
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface AddedProductEvent extends Serializable {
+
+       /**
+        * Getter for added product instance
+        * <p>
+        * @return Added product instance
+        */
+       public Product getAddedProduct ();
+
+}
diff --git a/src/org/mxchange/jproduct/events/product/added/ProductAddedEvent.java b/src/org/mxchange/jproduct/events/product/added/ProductAddedEvent.java
new file mode 100644 (file)
index 0000000..8421850
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2016 - 2018 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jproduct.events.product.added;
+
+import java.text.MessageFormat;
+import org.mxchange.jproduct.model.product.Product;
+
+/**
+ * An event fired when a new shop category has been added.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class ProductAddedEvent implements AddedProductEvent {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 18_567_817_669_107L;
+
+       /**
+        * Product instance that has been added
+        */
+       private final Product addedProduct;
+
+       /**
+        * Constructor with added product instance
+        * <p>
+        * @param addedProduct Added product
+        */
+       public ProductAddedEvent (final Product addedProduct) {
+               // The category should be valid
+               if (null == addedProduct) {
+                       // Is NULL, throw NPE
+                       throw new NullPointerException("addedProduct is null"); //NOI18N
+               } else if (addedProduct.getProductI18nKey().isEmpty()) {
+                       // Empty title
+                       throw new IllegalArgumentException("addedProduct.productI18nKey is empty"); //NOI18N
+               } else if (addedProduct.getProductId() == null) {
+                       // Id is NULL
+                       throw new NullPointerException("addedProduct.productId is null"); //NOI18N
+               } else if (addedProduct.getProductId() <= 0) {
+                       // Not valid id
+                       throw new IllegalArgumentException(MessageFormat.format("addedProduct.productId={0} is not valid.", addedProduct.getProductId())); //NOI18N
+               } else if (addedProduct.getProductCategory() == null) {
+                       // Id is NULL
+                       throw new NullPointerException("addedProduct.productCategory is null"); //NOI18N
+               } else if (addedProduct.getProductCategory().getCategoryId() == null) {
+                       // Id is NULL
+                       throw new NullPointerException("addedProduct.productCategory.categoryId is null"); //NOI18N
+               } else if (addedProduct.getProductCategory().getCategoryId() <= 0) {
+                       // Not valid id
+                       throw new IllegalArgumentException(MessageFormat.format("addedProduct.productCategory.categoryId={0} is not valid.", addedProduct.getProductId())); //NOI18N
+               }
+
+               // Set it here
+               this.addedProduct = addedProduct;
+       }
+
+       @Override
+       public Product getAddedProduct () {
+               return this.addedProduct;
+       }
+
+}
diff --git a/src/org/mxchange/jproduct/events/product/created/CreatedProductEvent.java b/src/org/mxchange/jproduct/events/product/created/CreatedProductEvent.java
new file mode 100644 (file)
index 0000000..34de314
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2017, 2018 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jproduct.events.product.created;
+
+import org.mxchange.jproduct.model.product.Product;
+
+/**
+ * An interface for observable events being fired when a product instance has
+ * been successfully created. This may happen when a product profile was called.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class CreatedProductEvent implements ObservableCreatedProductEvent {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 24_138_056_876_716_551L;
+
+       /**
+        * Product instance being created
+        */
+       private final Product createdProduct;
+
+       /**
+        * Constructor with product instance
+        * <p>
+        * @param createdProduct Product instance being created by helper
+        */
+       public CreatedProductEvent (final Product createdProduct) {
+               // Set product instance
+               this.createdProduct = createdProduct;
+       }
+
+       @Override
+       public Product getCreatedProduct () {
+               return this.createdProduct;
+       }
+
+}
diff --git a/src/org/mxchange/jproduct/events/product/created/ObservableCreatedProductEvent.java b/src/org/mxchange/jproduct/events/product/created/ObservableCreatedProductEvent.java
new file mode 100644 (file)
index 0000000..69ee9ab
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2017, 2018 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jproduct.events.product.created;
+
+import java.io.Serializable;
+import org.mxchange.jproduct.model.product.Product;
+
+/**
+ * An interface for observable events being fired when a product instance has
+ * been successfully created. This may happen when a product profile was called.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface ObservableCreatedProductEvent extends Serializable {
+
+       /**
+        * Getter for created product instance
+        * <p>
+        * @return Created product instance
+        */
+       Product getCreatedProduct ();
+
+}
index 673e94560fa8776aeb812a6da3a423e586bf4ea2..5aed39fd5bb8077060cc4b5b17af05af323a7b40 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Roland Haeder<roland@mxchange.org>
+ * Copyright (C) 2017, 2018 Free Software Foundation
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by