From: Roland Haeder Date: Thu, 15 Oct 2015 07:45:21 +0000 (+0200) Subject: Cleanup through inspection + updated jar(s) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0d0ea908adc6bf06fb5d31da958594050d107c25;p=jshop-core.git Cleanup through inspection + updated jar(s) Signed-off-by:Roland Häder --- diff --git a/lib/jcontacts-core.jar b/lib/jcontacts-core.jar index 4bf2b79..588f0e3 100644 Binary files a/lib/jcontacts-core.jar and b/lib/jcontacts-core.jar differ diff --git a/lib/jcore.jar b/lib/jcore.jar index a6eb677..1c2e570 100644 Binary files a/lib/jcore.jar and b/lib/jcore.jar differ diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar index db108dd..176cc9d 100644 Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ diff --git a/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java b/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java index a732413..c85178a 100644 --- a/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java +++ b/src/org/mxchange/jshopcore/model/basket/AddableBasketItem.java @@ -32,74 +32,74 @@ public interface AddableBasketItem extends Serializable { * @param object Other object to check */ @Override - public boolean equals (final Object object); + boolean equals (final Object object); /** * Getter for item amount *

* @return the amount */ - public Long getOrderedAmount (); + Long getOrderedAmount (); /** * Setter for item amount *

* @param amount the amount to set */ - public void setOrderedAmount (final Long amount); + void setOrderedAmount (final Long amount); /** * Getter for entry id (from database backend) *

* @return the id */ - public Long getItemId (); + Long getItemId (); /** * Setter for entry id (from database backend) *

* @param id the id to set */ - public void setItemId (final Long id); + void setItemId (final Long id); /** * Getter for item type *

* @return the type */ - public String getItemType (); + String getItemType (); /** * Setter for item type *

* @param type the type to set */ - public void setItemType (final String type); + void setItemType (final String type); /** * Getter for product instance *

* @return the product */ - public Product getItemProduct (); + Product getItemProduct (); /** * Setter fo product instance *

* @param product the product to set */ - public void setItemProduct (final Product product); + void setItemProduct (final Product product); /** * Hash-code calculattion */ @Override - public int hashCode (); + int hashCode (); /** * Determines whether the item has a Product instance set *

* @return Whether a Product instance is set */ - public boolean isProductType (); + boolean isProductType (); } diff --git a/src/org/mxchange/jshopcore/model/basket/Basket.java b/src/org/mxchange/jshopcore/model/basket/Basket.java index d2e9883..d2e9c08 100644 --- a/src/org/mxchange/jshopcore/model/basket/Basket.java +++ b/src/org/mxchange/jshopcore/model/basket/Basket.java @@ -36,33 +36,33 @@ public interface Basket extends Serializable { * @throws org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException * If the item instance has already been added */ - public void addItem (final T item) throws BasketItemAlreadyAddedException; + void addItem (final T item) throws BasketItemAlreadyAddedException; /** * Clears the basket instance */ - public void clear (); + void clear (); /** * Some "getter" for all entries in this basket *

* @return Map on all basket items */ - public List getAll (); + List getAll (); /** * Getter for last entry *

* @return Last added item in basket */ - public T getLast (); + T getLast (); /** * Getter for last num rows *

* @return Last num rows */ - public int getLastNumRows (); + int getLastNumRows (); /** * Checks whether the given item has already been added by checking the @@ -72,12 +72,12 @@ public interface Basket extends Serializable { *

* @return Whether the given item has been found */ - public boolean isAdded (final T item); + boolean isAdded (final T item); /** * Checks if the basket is empty *

* @return Whether the basket is empty */ - public boolean isEmpty (); + boolean isEmpty (); } diff --git a/src/org/mxchange/jshopcore/model/category/Category.java b/src/org/mxchange/jshopcore/model/category/Category.java index 43b2d26..d5b56be 100644 --- a/src/org/mxchange/jshopcore/model/category/Category.java +++ b/src/org/mxchange/jshopcore/model/category/Category.java @@ -30,47 +30,47 @@ public interface Category extends Serializable { *

* @param category Source category instance */ - public void copyAll (final Category category); + void copyAll (final Category category); /** * Id number of category *

* @return the id */ - public Long getCategoryId (); + Long getCategoryId (); /** * Id number of category *

* @param id the id to set */ - public void setCategoryId (final Long id); + void setCategoryId (final Long id); /** * Parent category *

* @return the parent category */ - public Category getParentCategory (); + Category getParentCategory (); /** * Parent category *

* @param parentCategory the parent category to set */ - public void setParentCategory (final Category parentCategory); + void setParentCategory (final Category parentCategory); /** * Title of category *

* @return the title */ - public String getCategoryTitle (); + String getCategoryTitle (); /** * Title of category *

* @param title the title to set */ - public void setCategoryTitle (final String title); + void setCategoryTitle (final String title); } diff --git a/src/org/mxchange/jshopcore/model/customer/Customer.java b/src/org/mxchange/jshopcore/model/customer/Customer.java index a86b71b..a44a196 100644 --- a/src/org/mxchange/jshopcore/model/customer/Customer.java +++ b/src/org/mxchange/jshopcore/model/customer/Customer.java @@ -33,117 +33,117 @@ public interface Customer extends Serializable { *

* @param customer Source instance */ - public void copyAll (final Customer customer); + void copyAll (final Customer customer); /** * Getter for contact instance *

* @return Contact id number */ - public Contact getContact (); + Contact getContact (); /** * Setter for contact instance *

* @param contact Contact instance */ - public void setContact (final Contact contact); + void setContact (final Contact contact); /** * Getter for confirmation key *

* @return Confirmation key */ - public String getCustomerConfirmKey (); + String getCustomerConfirmKey (); /** * Setter for confirmation key *

* @param customerConfirmKey Confirmation key */ - public void setCustomerConfirmKey (final String customerConfirmKey); + void setCustomerConfirmKey (final String customerConfirmKey); /** * Getter for "created" timestamp *

* @return "created" timestamp */ - public Calendar getCustomerCreated (); + Calendar getCustomerCreated (); /** * Setter for "created" timestamp *

* @param customerCreated "created" timestamp */ - public void setCustomerCreated (final Calendar customerCreated); + void setCustomerCreated (final Calendar customerCreated); /** * Getter for customer id number *

* @return Customer id number */ - public Long getCustomerId (); + Long getCustomerId (); /** * Settte for customer id number *

* @param customerId Customer id number */ - public void setCustomerId (final Long customerId); + void setCustomerId (final Long customerId); /** * Getter for "locked" timestamp *

* @return "locked" timestamp */ - public Calendar getCustomerLocked (); + Calendar getCustomerLocked (); /** * Getter for "locked" timestamp *

* @param customerLocked "locked" timestamp */ - public void setCustomerLocked (final Calendar customerLocked); + void setCustomerLocked (final Calendar customerLocked); /** * Getter for customer number *

* @return Customer number */ - public String getCustomerNumber (); + String getCustomerNumber (); /** * Setter for customer number *

* @param customerNumber Customer number */ - public void setCustomerNumber (final String customerNumber); + void setCustomerNumber (final String customerNumber); /** * Getter for password hash *

* @return Password hash */ - public String getCustomerPasswordHash (); + String getCustomerPasswordHash (); /** * Setter for password hash *

* @param customerPasswordHash Password hash */ - public void setCustomerPasswordHash (final String customerPasswordHash); + void setCustomerPasswordHash (final String customerPasswordHash); /** * Getter for account status *

* @return Account status */ - public CustomerAccountStatus getCustomerAccountStatus (); + CustomerAccountStatus getCustomerAccountStatus (); /** * Setter for account status *

* @param customerStatus Account status */ - public void setCustomerAccountStatus (final CustomerAccountStatus customerStatus); + void setCustomerAccountStatus (final CustomerAccountStatus customerStatus); } diff --git a/src/org/mxchange/jshopcore/model/customer/CustomerUtils.java b/src/org/mxchange/jshopcore/model/customer/CustomerUtils.java index 1ef7cfb..3b06d44 100644 --- a/src/org/mxchange/jshopcore/model/customer/CustomerUtils.java +++ b/src/org/mxchange/jshopcore/model/customer/CustomerUtils.java @@ -33,23 +33,16 @@ import org.mxchange.jshopcore.model.order.ShopOrder; public class CustomerUtils extends BaseFrameworkSystem { /** - * No instance from this class - */ - private CustomerUtils () { - } - - /** - * Generates an unique customer number by checking is existence + * Generates an unique access key. *

* @param em Entity manager instance + * @param customer Customer instance *

- * @return Generated customer number (not used before) - *

- * @throws java.sql.SQLException If any SQL error occured + * @return An unique access key */ - public static String generateCustomerNumber (final EntityManager em) throws SQLException { + public static String generateAccessKey (final EntityManager em, final Customer customer) { // Trace message - // TODO: utils.getLogger().logTrace(MessageFormat.format("generateCustomerNumber: connection={0} - CALLED!", connection)); + // TODO: utils.getLogger().logTrace(MessageFormat.format("generateAccessKey: connection={0} - CALLED!", connection)); // em cannot be null if (null == em) { @@ -59,49 +52,52 @@ public class CustomerUtils extends BaseFrameworkSystem { // Not open throw new IllegalStateException("Entity manager is closed."); } - - // Generate number - String customerNumber = null; - + + // Generate fake order instance + Orderable orderable = null; + + // Generate access keyy + String accessKey = null; + // Default is found boolean isFound = true; // Is the number used? while (isFound) { // Both number parts - long part1 = Math.round(Math.random() * 100_000); - long part2 = Math.round(Math.random() * 1_000); - - // Generate new number - customerNumber = String.format("%s-%s", part1, part2); //NOI18N - - // Try it + String randString = String.format("%s:%s:%s", Long.toHexString(Math.round(Math.random() * 1_000_000)), em, customer.getCustomerNumber()); + + // Generate access key, use SHA512 hashing and BASE64-encoding for strong key generation + accessKey = Base64.encodeBase64String(Sha2Crypt.sha512Crypt(randString.getBytes()).getBytes()).substring(0, 100); + + // Try this try { - // Get instance - Customer customer = em.getReference(ShopCustomer.class, customerNumber); + // Get reference + orderable = em.getReference(ShopOrder.class, accessKey); } catch (final EntityNotFoundException ex) { - // Not found + // Not found, so abort loop here isFound = false; } } // Trace message - // TODO: utils.getLogger().logTrace(MessageFormat.format("generateCustomerNumber: customerNumber={0} - EXIT!", customerNumber)); + // TODO: utils.getLogger().logTrace(MessageFormat.format("generateAccessKey: accessKey={0} - EXIT!", accessKey)); // Found one - return customerNumber; + return accessKey; } /** - * Generates an unique access key. + * Generates an unique customer number by checking is existence *

* @param em Entity manager instance - * @param customer Customer instance *

- * @return An unique access key + * @return Generated customer number (not used before) + *

+ * @throws java.sql.SQLException If any SQL error occured */ - public static String generateAccessKey (final EntityManager em, final Customer customer) { + public static String generateCustomerNumber (final EntityManager em) throws SQLException { // Trace message - // TODO: utils.getLogger().logTrace(MessageFormat.format("generateAccessKey: connection={0} - CALLED!", connection)); + // TODO: utils.getLogger().logTrace(MessageFormat.format("generateCustomerNumber: connection={0} - CALLED!", connection)); // em cannot be null if (null == em) { @@ -112,11 +108,8 @@ public class CustomerUtils extends BaseFrameworkSystem { throw new IllegalStateException("Entity manager is closed."); } - // Generate fake order instance - Orderable orderable = null; - - // Generate access keyy - String accessKey = null; + // Generate number + String customerNumber = null; // Default is found boolean isFound = true; @@ -124,24 +117,31 @@ public class CustomerUtils extends BaseFrameworkSystem { // Is the number used? while (isFound) { // Both number parts - String randString = String.format("%s:%s:%s", Long.toHexString(Math.round(Math.random() * 1_000_000)), em, customer.getCustomerNumber()); + long part1 = Math.round(Math.random() * 100_000); + long part2 = Math.round(Math.random() * 1_000); - // Generate access key, use SHA512 hashing and BASE64-encoding for strong key generation - accessKey = Base64.encodeBase64String(Sha2Crypt.sha512Crypt(randString.getBytes()).getBytes()).substring(0, 100); + // Generate new number + customerNumber = String.format("%s-%s", part1, part2); //NOI18N - // Try this + // Try it try { - // Get reference - orderable = em.getReference(ShopOrder.class, accessKey); + // Get instance + Customer customer = em.getReference(ShopCustomer.class, customerNumber); } catch (final EntityNotFoundException ex) { - // Not found, so abort loop here + // Not found isFound = false; } } // Trace message - // TODO: utils.getLogger().logTrace(MessageFormat.format("generateAccessKey: accessKey={0} - EXIT!", accessKey)); + // TODO: utils.getLogger().logTrace(MessageFormat.format("generateCustomerNumber: customerNumber={0} - EXIT!", customerNumber)); // Found one - return accessKey; + return customerNumber; + } + + /** + * No instance from this class + */ + private CustomerUtils () { } } diff --git a/src/org/mxchange/jshopcore/model/order/Orderable.java b/src/org/mxchange/jshopcore/model/order/Orderable.java index 4517cda..66cf7aa 100644 --- a/src/org/mxchange/jshopcore/model/order/Orderable.java +++ b/src/org/mxchange/jshopcore/model/order/Orderable.java @@ -34,68 +34,68 @@ public interface Orderable extends Serializable { *

* @return Access key */ - public String getAccessKey (); + String getAccessKey (); /** * Setter for access key *

* @param accessKey Access key */ - public void setAccessKey (final String accessKey); + void setAccessKey (final String accessKey); /** * Getter for created timestamp *

* @return Created timestamp */ - public Calendar getOrderCreated (); + Calendar getOrderCreated (); /** * Setter for created timestamp *

* @param created Created timestamp */ - public void setOrderCreated (final Calendar created); + void setOrderCreated (final Calendar created); /** * Getter for customer instance *

* @return Customer instance */ - public Customer getCustomer (); + Customer getCustomer (); /** * Setter for customer instance *

* @param customer Customer instance */ - public void setCustomer (final Customer customer); + void setCustomer (final Customer customer); /** * Getter for order id *

* @return Order id */ - public Long getOrderId (); + Long getOrderId (); /** * Setter for order id *

* @param id Order id */ - public void setOrderId (final Long id); + void setOrderId (final Long id); /** * Getter for list of ordered basket items *

* @return List of items */ - public List getOrderedItems (); + List getOrderedItems (); /** * Setter for list of ordered basket items *

* @param orderedItems List of ordered items */ - public void setOrderedItems (final List orderedItems); + void setOrderedItems (final List orderedItems); } diff --git a/src/org/mxchange/jshopcore/model/product/Product.java b/src/org/mxchange/jshopcore/model/product/Product.java index 365e38c..4598d0f 100644 --- a/src/org/mxchange/jshopcore/model/product/Product.java +++ b/src/org/mxchange/jshopcore/model/product/Product.java @@ -31,75 +31,75 @@ public interface Product extends Serializable { *

* @param product Source product */ - public void copyAll (final Product product); + void copyAll (final Product product); /** * Getter for product availability *

* @return Product availability */ - public Boolean getProductAvailability (); + Boolean getProductAvailability (); /** * Setter for product availability *

* @param productAvailability Product availability */ - public void setProductAvailability (final Boolean productAvailability); + void setProductAvailability (final Boolean productAvailability); /** * Getter for product category id *

* @return Product category id */ - public Category getProductCategory (); + Category getProductCategory (); /** * Setter for product category *

* @param productCategory Product category */ - public void setProductCategory (final Category productCategory); + void setProductCategory (final Category productCategory); /** * Getter for id number, suitable for form fields. *

* @return Id number of product */ - public Long getProductId (); + Long getProductId (); /** * Id number of product *

* @param productId the id number to set */ - public void setProductId (final Long productId); + void setProductId (final Long productId); /** * Getter for raw price. *

* @return Single price of product */ - public Float getProductPrice (); + Float getProductPrice (); /** * Price of product *

* @param productPrice the price to set */ - public void setProductPrice (final Float productPrice); + void setProductPrice (final Float productPrice); /** * Getter for title. *

* @return Title of product */ - public String getProductTitle (); + String getProductTitle (); /** * Title of product *

* @param productTitle the title to set */ - public void setProductTitle (final String productTitle); + void setProductTitle (final String productTitle); } diff --git a/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java b/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java index a23f691..78dde40 100644 --- a/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java +++ b/src/org/mxchange/jshopcore/wrapper/WrapableCheckout.java @@ -33,26 +33,26 @@ public interface WrapableCheckout extends Serializable { *

* @return Customer indstance */ - public Customer getCustomer (); + Customer getCustomer (); /** * Setter for customer instance *

* @param customer Customer instance */ - public void setCustomer (final Customer customer); + void setCustomer (final Customer customer); /** * Getter for a List of AddableBasktem instances *

* @return List with AddableBasketItem instances */ - public List getList (); + List getList (); /** * Setter for a List of AddableBasktem instances *

* @param list List with AddableBasketItem instances */ - public void setList (final List list); + void setList (final List list); }