*/
package org.mxchange.jshopcore.model.basket;
-import java.text.MessageFormat;
import java.util.Map;
-import javax.ejb.EJB;
-import org.mxchange.jcoreeelogger.beans.local.logger.Log;
-import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
/**
* A general basket class
*/
private static final long serialVersionUID = 782_396_762_230_845_717L;
- /**
- * Logger instance
- */
- @EJB
- @Log
- private LoggerBeanLocal logger;
-
/**
* Protected constructor with session instance
*/
protected BaseBasket () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
}
@Override
public void init () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
}
@Override
- @SuppressWarnings ("unchecked")
public void addItem (final T item) {
- // Trace call
- this.getLogger().logTrace(MessageFormat.format("item={0} - CALLED!", item)); //NOI18N
-
// item must not be null
if (null == item) {
// Then abort here
// Add item to database
// TODO: ((BasketFrontend) this.getFrontend()).addItem(item, this.getSessionId());
-
- // Trace call
- this.getLogger().logTrace("EXIT!"); //NOI18N
}
@Override
}
@Override
- @SuppressWarnings("unchecked")
public Map<Long, T> getAll () {
- // Trace message
- this.getLogger().logTrace("CALLED!"); //NOI18N
-
// Init map
// TODO: Map<Long, T> map = ((BasketFrontend) this.getFrontend()).getAll();
Map<Long, T> map = null;
- // Trace message
- this.getLogger().logTrace("map=" + map); //NOI18N
-
// Return it
return map;
}
@Override
public boolean isAdded (final T item) {
- // Trace call
- this.getLogger().logTrace(MessageFormat.format("item={0} - CALLED!", item)); //NOI18N
-
// item must not be null
if (null == item) {
// Then abort here
// TODO: boolean isAdded = ((BasketFrontend) this.getFrontend()).isAdded(item, this.getSessionId());
boolean isAdded = true;
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("isAdded={0} - EXIT!", isAdded)); //NOI18N
-
// Return it
return isAdded;
}
-
- /**
- * Getter for logger
- *
- * @return Logger instance
- */
- private LoggerBeanLocal getLogger () {
- return this.logger;
- }
}
*/
package org.mxchange.jshopcore.model.category;
-import java.text.MessageFormat;
import java.util.Objects;
-import javax.ejb.EJB;
-import org.mxchange.jcoreeelogger.beans.local.logger.Log;
-import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
/**
* A general product category class
*/
private String title;
- /**
- * Logger instance
- */
- @EJB
- @Log
- private LoggerBeanLocal logger;
-
/**
* Constructor which accepts all database fields
*
*/
@Override
public int compareTo (final Category category) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N
-
// category should not be null
if (null == category) {
throw new NullPointerException("category is null"); //NOI18N
}
- // Debug message
- this.getLogger().logDebug(MessageFormat.format("this.id={0},category.id={1}", this.getCategoryId(), category.getCategoryId())); //NOI18N
-
// Is the categoryId the same?
if (Objects.equals(this.getCategoryId(), category.getCategoryId())) {
// Same categoryId, means same category
public void setTitle (final String title) {
this.title = title;
}
-
- /**
- * Getter for logger
- *
- * @return Logger instance
- */
- private LoggerBeanLocal getLogger () {
- return this.logger;
- }
}
*/
package org.mxchange.jshopcore.model.item;
-import java.text.MessageFormat;
import java.util.Objects;
-import javax.ejb.EJB;
-import org.mxchange.jcoreeelogger.beans.local.logger.Log;
-import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
import org.mxchange.jshopcore.model.basket.AddableBasketItem;
import org.mxchange.jshopcore.model.product.Product;
* @author Roland Haeder
*/
public abstract class BaseItem implements AddableBasketItem, Comparable<AddableBasketItem> {
+
/**
* Serial number
*/
*/
private Product product;
- /**
- * Logger instance
- */
- @EJB
- @Log
- private LoggerBeanLocal logger;
-
@Override
public int compareTo (final AddableBasketItem item) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("item={0} - CALLED!", item)); //NOI18N
-
// item should not be null
if (null == item) {
throw new NullPointerException("item is null"); //NOI18N
}
- // Debug message
- this.getLogger().logDebug(MessageFormat.format("this.itemId={0},item.itemId={1}", this.getItemId(), item.getItemId())); //NOI18N
-
// Is the id the same?
if (Objects.equals(this.getItemId(), item.getItemId())) {
// Same id, means same item
}
@Override
- public void setItemId( final Long itemId) {
+ public void setItemId (final Long itemId) {
this.itemId = itemId;
}
public void setProduct (final Product product) {
this.product = product;
}
-
- /**
- * Getter for logger
- *
- * @return Logger instance
- */
- protected LoggerBeanLocal getLogger () {
- return this.logger;
- }
}
*/
package org.mxchange.jshopcore.model.item;
-import java.text.MessageFormat;
import org.mxchange.jshopcore.model.basket.AddableBasketItem;
import org.mxchange.jshopcore.model.product.Product;
// Call default constructor
this();
- // Trace message
- this.getLogger().logDebug(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
-
// product must not be null
if (null == product) {
// Abort here
*/
package org.mxchange.jshopcore.model.product;
-import java.text.MessageFormat;
import java.util.Objects;
-import javax.ejb.EJB;
-import org.mxchange.jcoreeelogger.beans.local.logger.Log;
-import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
/**
* A general product class
* @author Roland Haeder
*/
public abstract class BaseProduct implements Product, Comparable<Product> {
+
/**
* Serial number
*/
*/
private String title;
- /**
- * Logger instance
- */
- @EJB
- @Log
- private LoggerBeanLocal logger;
-
@Override
public int compareTo (final Product product) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
-
// category should not be null
if (null == product) {
throw new NullPointerException("product is null"); //NOI18N
}
-
- // Debug message
- this.getLogger().logDebug(MessageFormat.format("this.id={0},product.id={1}", this.getId(), product.getId())); //NOI18N
-
+
// Is the id the same?
if (Objects.equals(this.getId(), product.getId())) {
// Same id, means same category
// This id is larger than compared to
return 1;
}
-
+
// The other id is larger
return -1;
}
public void setTitle (final String title) {
this.title = title;
}
-
- /**
- * Getter for logger
- *
- * @return Logger instance
- */
- protected LoggerBeanLocal getLogger () {
- return this.logger;
- }
}
*/
package org.mxchange.jshopcore.model.product;
-import java.text.MessageFormat;
-
/**
* Generic product class
*
* @param available Availability (selectable by customer)
*/
public GenericProduct (final Long id, final String title, final Float price, final Long categoryId, final Boolean available) {
- // Trace message
- this.getLogger().logTrace(MessageFormat.format("id={0},title={1},price={2},categoryId={3},available={4} - CALLED!", id, title, price, categoryId, available)); //NOI18N
-
// Set all here
this.setId(id);
this.setTitle(title);