*/
private final BasketSessionBeanRemote basketBean;
- /////////////////////// Properties /////////////////////
- /**
- * Ordered orderedAmount
- */
- private Long orderedAmount;
/**
* Current item
*/
private AddableBasketItem currentItem;
+ /////////////////////// Properties /////////////////////
+ /**
+ * Ordered orderedAmount
+ */
+ private Long orderedAmount;
+
/**
* Default constructor
*/
this.basket.clear();
}
- @Override
- public Long getOrderedAmount () {
- return this.orderedAmount;
- }
-
- @Override
- public void setOrderedAmount (final Long orderedAmount) {
- this.orderedAmount = orderedAmount;
- }
-
@Override
public AddableBasketItem getCurrentItem () {
return this.currentItem;
return this.basket.getLastNumRows();
}
+ @Override
+ public Long getOrderedAmount () {
+ return this.orderedAmount;
+ }
+
+ @Override
+ public void setOrderedAmount (final Long orderedAmount) {
+ this.orderedAmount = orderedAmount;
+ }
+
@Override
public boolean hasItems () {
// Call above and invert it
* <p>
* @return Redirect target or null
*/
- public String addItem (final Product product);
+ String addItem (final Product product);
/**
* Gets for all added items
* <p>
* @return A list of all added items
*/
- public List<AddableBasketItem> allItems ();
+ List<AddableBasketItem> allItems ();
/**
* Calculates total price (no tax added) of current item. If no current item
* <p>
* @return Current item's total price
*/
- public Float calculateCurrentItemPrice ();
+ Float calculateCurrentItemPrice ();
/**
* Calculates total price (no tax added) for given item.
* <p>
* @return Total price
*/
- public Float calculateItemPrice (final AddableBasketItem item);
+ Float calculateItemPrice (final AddableBasketItem item);
/**
* Calculates total sum (no tax added) for all items
* <p>
* @return Total price of all items
*/
- public Float calculateTotalPrice ();
+ Float calculateTotalPrice ();
/**
* Changes given item instance's amount in basket and redirects to proper
* <p>
* @return Page redirection
*/
- public String changeItem (final AddableBasketItem item);
+ String changeItem (final AddableBasketItem item);
/**
* Clears this basket instance
*/
- public void clear ();
+ void clear ();
/**
* Getter for item amount property
* <p>
* @return Item amount property
*/
- public Long getOrderedAmount ();
+ Long getOrderedAmount ();
/**
* Setter for item amount property
* <p>
* @param amount Item amount property
*/
- public void setOrderedAmount (final Long amount);
+ void setOrderedAmount (final Long amount);
/**
* Getter for current item
* <p>
* @return Current item
*/
- public AddableBasketItem getCurrentItem ();
+ AddableBasketItem getCurrentItem ();
/**
* Setter for current item
* <p>
* @param currentItem Current item
*/
- public void setCurrentItem (final AddableBasketItem currentItem);
+ void setCurrentItem (final AddableBasketItem currentItem);
/**
* Some getter for item amount of given product. This method requires a full
* <p>
* @return Item amount of given product
*/
- public Long getItemAmount (final Product product);
+ Long getItemAmount (final Product product);
/**
* Getter for last entry
* <p>
* @return Last added item in basket
*/
- public AddableBasketItem getLast ();
+ AddableBasketItem getLast ();
/**
* Getter for last num rows
* <p>
* @return Last num rows
*/
- public int getLastNumRows ();
+ int getLastNumRows ();
/**
* Checks whether the basket has items in it. This method is wrapper to
* <p>
* @return Whether the basket is empty
*/
- public boolean hasItems ();
+ boolean hasItems ();
/**
* Checks whether the basket is empty
* <p>
* @return Whether the basket is empty
*/
- public boolean isEmpty ();
+ boolean isEmpty ();
/**
* Checks whether the currently set product is added in basked
* <p>
* @return Whether the product is added
*/
- public boolean isProductAdded (final Product product);
+ boolean isProductAdded (final Product product);
/**
* Outputs last added item in the basket.
* <p>
* @return Last added item
*/
- public String outputLastAddedItem ();
+ String outputLastAddedItem ();
}
* @throws javax.faces.view.facelets.FaceletException If something
* unexpected happened
*/
- public void addCategory () throws FaceletException;
+ void addCategory () throws FaceletException;
/**
* Getter for parent id
* <p>
* @return Parent id
*/
- public Category getParentCategory ();
+ Category getParentCategory ();
/**
* Setter for parent category
* <p>
* @param parentCategory Parent category to set
*/
- public void setParentCategory (final Category parentCategory);
+ void setParentCategory (final Category parentCategory);
/**
* Getter for category title
* <p>
* @return the title
*/
- public String getCategoryTitle ();
+ String getCategoryTitle ();
/**
* Setter for category title
* <p>
* @param categoryTitle the title to set
*/
- public void setCategoryTitle (final String categoryTitle);
+ void setCategoryTitle (final String categoryTitle);
}
*/
private static final long serialVersionUID = 51_987_348_347_183L;
+ ////////////////////// Bean injections ///////////////////////
/**
- * Connection
+ * Basket bean
*/
- private Connection connection;
+ @Inject
+ private BasketWebController basketController;
/**
- * Message producer
+ * Connection
*/
- private MessageProducer messageProducer;
+ private Connection connection;
/**
- * Queue instance
+ * Customer instance
*/
- private Queue queue;
+ private Customer customer;
/**
- * Session instance
+ * Customer bean
*/
- private Session session;
+ @Inject
+ private CustomerWebController customerController;
+
/**
* Object message
private ObjectMessage message;
/**
- * Customer instance
+ * Message producer
*/
- private Customer customer;
+ private MessageProducer messageProducer;
- ////////////////////// Bean injections ///////////////////////
/**
- * Basket bean
+ * Queue instance
*/
- @Inject
- private BasketWebController basketController;
+ private Queue queue;
- /**
- * Customer bean
- */
- @Inject
- private CustomerWebController customerController;
/**
* Receipt bean
@Inject
private ReceiptWebController receiptController;
+ /**
+ * Session instance
+ */
+ private Session session;
+
+ /**
+ * Destructor
+ */
+ @PreDestroy
+ public void destroy () {
+ try {
+ // Try to close all
+ this.messageProducer.close();
+ this.session.close();
+ this.connection.close();
+ } catch (final JMSException ex) {
+ // TODO: Continue to throw is fine?
+ throw new FacesException(ex);
+ }
+ }
+
@Override
public String doCheckout () {
// Trace message
try {
// Get initial context
Context context = new InitialContext();
-
// Get factory from JMS resource
QueueConnectionFactory connectionFactory = (QueueConnectionFactory) context.lookup("jms/shopConnectionFactory"); //NOI18N
-
// Lookup queue
this.queue = (Queue) context.lookup("jms/shopCheckoutQueue"); //NOI18N
// Create connection
this.connection = connectionFactory.createConnection();
-
// Init session instance
this.session = this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
// And message producer
- this.messageProducer = session.createProducer(queue);
-
+ this.messageProducer = this.session.createProducer(this.queue);
// Finally the message instance itself
this.message = this.session.createObjectMessage();
- } catch (final NamingException | JMSException e) {
+ }catch (final NamingException | JMSException e) {
// Continued to throw
throw new FacesException(e);
}
}
-
- /**
- * Destructor
- */
- @PreDestroy
- public void destroy () {
- try {
- // Try to close all
- this.messageProducer.close();
- this.session.close();
- this.connection.close();
- } catch (final JMSException ex) {
- // TODO: Continue to throw is fine?
- throw new FacesException(ex);
- }
- }
}
* <p>
* @return Page redirection target
*/
- public String doCheckout ();
+ String doCheckout ();
/**
* Getter for customer instance
* <p>
* @return Customer instance
*/
- public Customer getCustomer ();
+ Customer getCustomer ();
/**
* Setter for customer instance
* <p>
* @param customer Customer instance
*/
- public void setCustomer (final Customer customer);
+ void setCustomer (final Customer customer);
}
* <p>
* @return All countries
*/
- public List<Country> allCountries ();
+ List<Country> allCountries ();
}
* <p>
* @return A Customer instance
*/
- public Customer createCustomerInstance ();
+ Customer createCustomerInstance ();
/**
* Cellphone number
* <p>
* @return the cellphoneNumber
*/
- public DialableCellphoneNumber getCellphoneNumber ();
+ DialableCellphoneNumber getCellphoneNumber ();
/**
* Cellphone number
* <p>
* @param cellphoneNumber the cellphoneNumber to set
*/
- public void setCellphoneNumber (final DialableCellphoneNumber cellphoneNumber);
+ void setCellphoneNumber (final DialableCellphoneNumber cellphoneNumber);
/**
* City
* <p>
* @return the city
*/
- public String getCity ();
+ String getCity ();
/**
* City
* <p>
* @param city the city to set
*/
- public void setCity (final String city);
+ void setCity (final String city);
/**
* Getter for country instance
* <p>
* @return Country instance
*/
- public Country getCountry ();
+ Country getCountry ();
/**
* Setter for country instance
* <p>
* @param country Country instance
*/
- public void setCountry (final Country country);
+ void setCountry (final Country country);
/**
* Email address
* <p>
* @return the emailAddress
*/
- public String getEmailAddress ();
+ String getEmailAddress ();
/**
* Email address
* <p>
* @param emailAddress the emailAddress to set
*/
- public void setEmailAddress (final String emailAddress);
+ void setEmailAddress (final String emailAddress);
/**
* Family name
* <p>
* @return the familyName
*/
- public String getFamilyName ();
+ String getFamilyName ();
/**
* Family name
* <p>
* @param familyName the familyName to set
*/
- public void setFamilyName (final String familyName);
+ void setFamilyName (final String familyName);
/**
* Fax number
* <p>
* @return the faxNumber
*/
- public DialableFaxNumber getFaxNumber ();
+ DialableFaxNumber getFaxNumber ();
/**
* Fax number
* <p>
* @param faxNumber the faxNumber to set
*/
- public void setFaxNumber (final DialableFaxNumber faxNumber);
+ void setFaxNumber (final DialableFaxNumber faxNumber);
/**
* First name
* <p>
* @return the first name
*/
- public String getFirstName ();
+ String getFirstName ();
/**
* First name
* <p>
* @param firstName the first name to set
*/
- public void setFirstName (final String firstName);
+ void setFirstName (final String firstName);
/**
* Gender of the contact
* <p>
* @return the gender
*/
- public Gender getGender ();
+ Gender getGender ();
/**
* Gender of the contact
* <p>
* @param gender the gender to set
*/
- public void setGender (final Gender gender);
+ void setGender (final Gender gender);
/**
* House number
* <p>
* @return the houseNumber
*/
- public Short getHouseNumber ();
+ Short getHouseNumber ();
/**
* House number
* <p>
* @param houseNumber the houseNumber to set
*/
- public void setHouseNumber (final Short houseNumber);
+ void setHouseNumber (final Short houseNumber);
/**
* Phone number
* <p>
* @return the phoneNumber
*/
- public DialableLandLineNumber getPhoneNumber ();
+ DialableLandLineNumber getPhoneNumber ();
/**
* Phone number
* <p>
* @param phoneNumber the phoneNumber to set
*/
- public void setPhoneNumber (final DialableLandLineNumber phoneNumber);
+ void setPhoneNumber (final DialableLandLineNumber phoneNumber);
/**
* Street
* <p>
* @return the street
*/
- public String getStreet ();
+ String getStreet ();
/**
* Street
* <p>
* @param street the street to set
*/
- public void setStreet (final String street);
+ void setStreet (final String street);
/**
* ZIP code
* <p>
* @return the zipCode
*/
- public Integer getZipCode ();
+ Integer getZipCode ();
/**
* ZIP code
* <p>
* @param zipCode the zipCode to set
*/
- public void setZipCode (final Integer zipCode);
+ void setZipCode (final Integer zipCode);
/**
* Checks whether all required personal data is set
* <p>
* @return Whether the required personal data is set
*/
- public boolean isRequiredPersonalDataSet ();
+ boolean isRequiredPersonalDataSet ();
}
* <p>
* @return All genders as array
*/
- public Gender[] getAllGenders ();
+ Gender[] getAllGenders ();
/**
* Getter for only selectable genders as array, UNKNOWN is not selectable
* <p>
* @return All genders as array
*/
- public List<Gender> getSelectableGenders ();
+ List<Gender> getSelectableGenders ();
}
@Override
public Category getProductCategory () {
- return productCategory;
+ return this.productCategory;
}
@Override
* @throws javax.faces.view.facelets.FaceletException If something
* unexpected happened
*/
- public void addProduct () throws FaceletException;
+ void addProduct () throws FaceletException;
/**
* Some "getter" for a linked list of all products
* <p>
* @throws javax.faces.view.facelets.FaceletException If anything went wrong
*/
- public List<Product> getAllProducts () throws FaceletException;
+ List<Product> getAllProducts () throws FaceletException;
/**
* Getter for product's available property
* <p>
* @return Product's available property
*/
- public Boolean getProductAvailability ();
+ Boolean getProductAvailability ();
/**
* Setter for product's available property
* <p>
* @param available Product's available property
*/
- public void setProductAvailability (final Boolean available);
+ void setProductAvailability (final Boolean available);
/**
* Getter for product's category
* <p>
* @return Product's category
*/
- public Category getProductCategory ();
+ Category getProductCategory ();
/**
* Setter for product's category instance
* <p>
* @param productCategory Product's category instance
*/
- public void setProductCategory (final Category productCategory);
+ void setProductCategory (final Category productCategory);
/**
* Getter for product's price property
* <p>
* @return Product's price property
*/
- public Float getProductPrice ();
+ Float getProductPrice ();
/**
* Setter for product's price property
* <p>
* @param price Product's price property
*/
- public void setProductPrice (final Float price);
+ void setProductPrice (final Float price);
/**
* Getter for product's title property
* <p>
* @return Product's title
*/
- public String getProductTitle ();
+ String getProductTitle ();
/**
* Setter for product's title property
* <p>
* @param title Product's title
*/
- public void setProductTitle (final String title);
+ void setProductTitle (final String title);
}
* <p>
* @return Access key to receipt
*/
- public String fetchAccessKey ();
+ String fetchAccessKey ();
/**
* Getter for customer instamce
* <p>
* @return Customer instance
*/
- public Customer getCustomer ();
+ Customer getCustomer ();
/**
* Setter for customer instamce
* <p>
* @param customer Customer instance
*/
- public void setCustomer (final Customer customer);
+ void setCustomer (final Customer customer);
}
* <p>
* @param category Category instance
*/
- public void addCategory (final Category category);
+ void addCategory (final Category category);
/**
* Adds given product to the "cached" instance
* <p>
* @param product Product instance
*/
- public void addProduct (final Product product);
+ void addProduct (final Product product);
/**
* Some "getter" for a linked list of all categories
* <p>
* @throws javax.faces.view.facelets.FaceletException If anything went wrong
*/
- public List<Category> getAllCategories () throws FaceletException;
+ List<Category> getAllCategories () throws FaceletException;
/**
* Some "getter" for a linked list of all categories including "Has no
* <p>
* @throws javax.faces.view.facelets.FaceletException If anything went wrong
*/
- public List<Category> getAllCategoriesParent () throws FaceletException;
+ List<Category> getAllCategoriesParent () throws FaceletException;
/**
* Some "getter" for a linked list of only available products
* <p>
* @throws javax.faces.view.facelets.FaceletException If anything went wrong
*/
- public List<Product> getAvailableProducts () throws FaceletException;
+ List<Product> getAvailableProducts () throws FaceletException;
}