]> git.mxchange.org Git - jproduct-core.git/commitdiff
Categories may not be shown in statistics
authorRoland Häder <roland@mxchange.org>
Sat, 15 Apr 2017 20:11:21 +0000 (22:11 +0200)
committerRoland Häder <roland@mxchange.org>
Sat, 15 Apr 2017 20:11:21 +0000 (22:11 +0200)
src/org/mxchange/jproduct/model/category/Category.java
src/org/mxchange/jproduct/model/category/ProductCategory.java

index 7606fc617edbb41ad1f1258fc3f6316439b085d7..37f12937ca849e403e51b5c634233ce0b0a04b2b 100644 (file)
@@ -46,6 +46,21 @@ public interface Category extends Serializable {
         */
        void setCategoryId (final Long id);
 
+       /**
+        * Getter for if category is shown in any statistics
+        * <p>
+        * @return Whether this category is shown in any statistics
+        */
+       Boolean getCategoryShownInStatistics ();
+
+       /**
+        * Setter for if category is shown in any statistics
+        * <p>
+        * @param categoryShownInStatistics Whether this category is shown in any
+        *                                  statistics
+        */
+       void setCategoryShownInStatistics (final Boolean categoryShownInStatistics);
+
        /**
         * Parent category
         * <p>
index 90f17d09f4a0c0bc0181d51f85f892255291db0c..acb1f8e2b68b859c05f660bcbbe8b06a4323668b 100644 (file)
@@ -53,6 +53,13 @@ public class ProductCategory implements Category {
        @Column (name = "category_id", nullable = false)
        private Long categoryId;
 
+       /**
+        * Whether this category is shown in any statistics
+        */
+       @Basic (optional = false)
+       @Column (name = "category_in_statistics", nullable = false)
+       private Boolean categoryShownInStatistics;
+
        /**
         * Title of category
         */
@@ -70,15 +77,18 @@ public class ProductCategory implements Category {
        /**
         * Constructor which accepts all database fields
         * <p>
-        * @param categoryId     Id number of database record
-        * @param categoryTitle  Category categoryTitle
-        * @param parentCategory Parent category
+        * @param categoryId                Id number of database record
+        * @param categoryTitle             Category categoryTitle
+        * @param parentCategory            Parent category
+        * @param categoryShownInStatistics Whether this category is shown in any
+        *                                  statistics
         */
-       public ProductCategory (final Long categoryId, final String categoryTitle, final Category parentCategory) {
+       public ProductCategory (final Long categoryId, final String categoryTitle, final Category parentCategory, final Boolean categoryShownInStatistics) {
                // Set all here
                this.categoryId = categoryId;
                this.categoryTitle = categoryTitle;
                this.parentCategory = parentCategory;
+               this.categoryShownInStatistics = categoryShownInStatistics;
        }
 
        /**
@@ -92,6 +102,7 @@ public class ProductCategory implements Category {
                // Copy all data
                this.setParentCategory(category.getParentCategory());
                this.setCategoryTitle(category.getCategoryTitle());
+               this.setCategoryShownInStatistics(category.getCategoryShownInStatistics());
        }
 
        @Override
@@ -110,19 +121,13 @@ public class ProductCategory implements Category {
                        return false;
                } else if (!Objects.equals(this.getCategoryId(), other.getCategoryId())) {
                        return false;
+               } else if (!Objects.equals(this.getCategoryShownInStatistics(), other.getCategoryShownInStatistics())) {
+                       return false;
                }
 
                return true;
        }
 
-       @Override
-       public int hashCode () {
-               int hash = 7;
-               hash = 13 * hash + Objects.hashCode(this.getCategoryId());
-               hash = 13 * hash + Objects.hashCode(this.getCategoryTitle());
-               return hash;
-       }
-
        @Override
        public Long getCategoryId () {
                return this.categoryId;
@@ -133,6 +138,16 @@ public class ProductCategory implements Category {
                this.categoryId = categoryId;
        }
 
+       @Override
+       public Boolean getCategoryShownInStatistics () {
+               return this.categoryShownInStatistics;
+       }
+
+       @Override
+       public void setCategoryShownInStatistics (final Boolean categoryShownInStatistics) {
+               this.categoryShownInStatistics = categoryShownInStatistics;
+       }
+
        @Override
        public String getCategoryTitle () {
                return this.categoryTitle;
@@ -153,4 +168,12 @@ public class ProductCategory implements Category {
                this.parentCategory = parentCategory;
        }
 
+       @Override
+       public int hashCode () {
+               int hash = 7;
+               hash = 13 * hash + Objects.hashCode(this.getCategoryId());
+               hash = 13 * hash + Objects.hashCode(this.getCategoryTitle());
+               return hash;
+       }
+
 }