import org.mxchange.jshopcore.model.basket.Basket;
import org.mxchange.jshopcore.model.basket.BasketSessionBeanRemote;
import org.mxchange.jshopcore.model.basket.ShopBasket;
-import org.mxchange.jshopcore.model.item.BasketItem;
+import org.mxchange.jshopcore.model.basket.items.BasketItem;
import org.mxchange.jshopcore.model.product.Product;
/**
*/
package org.mxchange.pizzaapplication.beans.controller;
-import java.util.Deque;
+import java.util.Collections;
import java.util.LinkedList;
-import java.util.Queue;
+import java.util.List;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.faces.FacesException;
/**
* "Cache" for all available products
*/
- private Deque<Product> availableProducts;
+ private List<Product> availableProducts;
/**
* All categories
*/
- private Deque<Category> categories;
+ private List<Category> categories;
@Override
public void addCategory (final Category category) {
}
@Override
- public Deque<Category> getAllCategories () throws FacesException {
+ public List<Category> getAllCategories () throws FacesException {
// Return it
// TODO Find something better here to prevent warning
- return this.categories;
+ return Collections.unmodifiableList(this.categories);
}
@Override
- public Deque<Category> getAllCategoriesParent () throws FaceletException {
+ public List<Category> getAllCategoriesParent () throws FaceletException {
// Get regular list
- Deque<Category> deque = new LinkedList<>(this.getAllCategories());
+ List<Category> deque = new LinkedList<>();
// Create fake entry
Category fake = new ProductCategory(0L, this.getMessage("ADMIN_CATEGORY_HAS_NO_PARENT"), 0L); //NOI18N
// Add it
- deque.addFirst(fake);
+ deque.add(fake);
+
+ // Add all
+ deque.addAll(this.getAllCategories());
// Return it
return deque;
}
@Override
- public Queue<Product> getAvailableProducts () throws FacesException {
+ public List<Product> getAvailableProducts () throws FacesException {
// Return it
// TODO Find something better here to prevent warning
- return this.availableProducts;
+ return Collections.unmodifiableList(this.availableProducts);
}
}
package org.mxchange.pizzaapplication.beans.controller;
import java.io.Serializable;
-import java.util.Deque;
-import java.util.Queue;
+import java.util.List;
import javax.faces.view.facelets.FaceletException;
import org.mxchange.jshopcore.model.category.Category;
import org.mxchange.jshopcore.model.product.Product;
* @return Only available products
* @throws javax.faces.view.facelets.FaceletException If anything went wrong
*/
- public Queue<Product> getAvailableProducts () throws FaceletException;
+ public List<Product> getAvailableProducts () throws FaceletException;
/**
* Some "getter" for a linked list of all categories
* @return All categories
* @throws javax.faces.view.facelets.FaceletException If anything went wrong
*/
- public Deque<Category> getAllCategories () throws FaceletException;
+ public List<Category> getAllCategories () throws FaceletException;
/**
* Some "getter" for a linked list of all categories including "Has no
* @return All categories
* @throws javax.faces.view.facelets.FaceletException If anything went wrong
*/
- public Deque<Category> getAllCategoriesParent () throws FaceletException;
+ public List<Category> getAllCategoriesParent () throws FaceletException;
}
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.mxchange.jcore.model.contact.Contact;
+import org.mxchange.jcore.model.contact.CustomerContact;
import org.mxchange.jcore.model.contact.gender.Gender;
import org.mxchange.jcoreee.beans.BaseFrameworkBean;
import org.mxchange.jshopcore.model.customer.Customer;
// Create new customer instance
Customer customer = new ShopCustomer();
- customer.setGender(this.getGender());
- customer.setFirstName(this.getFirstName());
- customer.setFamilyName(this.getFamilyName());
- customer.setCompanyName(this.getCompanyName());
- customer.setStreet(this.getStreet());
- customer.setHouseNumber(this.getHouseNumber());
- customer.setZipCode(this.getZipCode());
- customer.setCity(this.getCity());
- customer.setPhoneNumber(this.getPhoneNumber());
- customer.setFaxNumber(this.getFaxNumber());
- customer.setCellphoneNumber(this.getCellphoneNumber());
+
+ // Create new contact
+ Contact contact = new CustomerContact();
+ contact.setGender(this.getGender());
+ contact.setFirstName(this.getFirstName());
+ contact.setFamilyName(this.getFamilyName());
+ contact.setCompanyName(this.getCompanyName());
+ contact.setStreet(this.getStreet());
+ contact.setHouseNumber(this.getHouseNumber());
+ contact.setZipCode(this.getZipCode());
+ contact.setCity(this.getCity());
+ contact.setPhoneNumber(this.getPhoneNumber());
+ contact.setFaxNumber(this.getFaxNumber());
+ contact.setCellphoneNumber(this.getCellphoneNumber());
+
+ // Set contact in customer
+ customer.setContact(contact);
// Trace message
this.getLogger().logTrace(MessageFormat.format("createInstance: customer={0} - EXIT!", customer));
*/
package org.mxchange.pizzaapplication.beans.product;
-import java.util.Deque;
+import java.util.List;
import javax.enterprise.context.RequestScoped;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
}
@Override
- public Deque<Product> getAllProducts () throws FaceletException {
+ public List<Product> getAllProducts () throws FaceletException {
// Call bean
return this.productBean.getAllProducts();
}
*/
package org.mxchange.pizzaapplication.beans.product;
-import java.util.Deque;
+import java.util.List;
import javax.faces.view.facelets.FaceletException;
import org.mxchange.jshopcore.model.product.Product;
* @return All products
* @throws javax.faces.view.facelets.FaceletException If anything went wrong
*/
- public Deque<Product> getAllProducts () throws FaceletException;
+ public List<Product> getAllProducts () throws FaceletException;
/**
* Getter for product's title property