if (request == null) {
// Not set
throw new NullPointerException("request is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
if (request == null) {
// Not set
throw new NullPointerException("request is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
if (null == product) {
// Not set
throw new NullPointerException("product is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
} else if (request == null) {
// Not set
throw new NullPointerException("request is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
if (null == product) {
// Not set
throw new NullPointerException("product is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
if (request == null) {
// Not set
throw new NullPointerException("request is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
} else if (request == null) {
// Not set
throw new NullPointerException("request is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
this.getLogger().trace(MessageFormat.format("session={0},key={1} - CALLED", session, key)); //NOI18N
// Are both parameter not null?
- if (session == null) {
+ if (null == session) {
// Abort here
throw new NullPointerException("session is null"); //NOI18N
} else if (key == null) {
} else if (request == null) {
// Not set
throw new NullPointerException("request is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
} else if (request == null) {
// Not set
throw new NullPointerException("request is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
} else if (request == null) {
// Not set
throw new NullPointerException("request is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
if (null == product) {
// Not set
throw new NullPointerException("product is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
if (null == product) {
// Not set
throw new NullPointerException("product is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
if (null == product) {
// Not set
throw new NullPointerException("product is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
if (null == product) {
// Not set
throw new NullPointerException("product is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
} else if (request == null) {
// Not set
throw new NullPointerException("request is null"); //NOI18N
- } else if (session == null) {
+ } else if (null == session) {
// Not set
throw new NullPointerException("session is null"); //NOI18N
}
import java.text.MessageFormat;
import java.util.Iterator;
import java.util.Map;
+import org.mxchange.jcore.criteria.logical.and.AndLogicalMatcher;
import org.mxchange.jcore.criteria.searchable.SearchCriteria;
import org.mxchange.jcore.criteria.searchable.SearchableCriteria;
import org.mxchange.jcore.database.frontend.BaseDatabaseFrontend;
this.addToDataSet(BasketDatabaseConstants.COLUMN_ITEM_ID, item.getItemId());
this.addToDataSet(BasketDatabaseConstants.COLUMN_SESSION_ID, sessionId);
this.addToDataSet(BasketDatabaseConstants.COLUMN_AMOUNT, item.getAmount());
- this.addToDataSet(BasketDatabaseConstants.COLUMN_PRODUCT_TYPE, item.getItemType());
+ this.addToDataSet(BasketDatabaseConstants.COLUMN_ITEM_TYPE, item.getItemType());
// Handle this over to the backend
// @todo Nothing is done yet!
criteria.addCriteria(BasketDatabaseConstants.COLUMN_SESSION_ID, sessionId);
criteria.setLimit(1);
+ // Set AND logical matcher
+ criteria.setLogical(new AndLogicalMatcher());
+
// Now search for it
Result<? extends Storeable> result = this.getBackend().doSelectByCriteria(criteria);
// Now it is secure to cast
AddableBasketItem item = (AddableBasketItem) object;
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("item.id={0},item.itemId={1},item.itemType={2},item.amount={3}", item.getId(), item.getItemId(), item.getItemType(), item.getAmount()));
+
// Init instance
Basket<AddableBasketItem> basket;
try {
this.getLogger().debug(MessageFormat.format("session={0}", session)); //NOI18N
// Should not be null
- if (session == null) {
+ if (null == session) {
// session is null
throw new NullPointerException("session is null"); //NOI18N
}
basket = ItemBasket.getInstance(session);
// Is the item already added?
- if ((item.getAmount() == null) || (item.getAmount() == 0)) {
+ if (item.getItemId() == null) {
+ // Item id is not set
+ throw new NullPointerException(MessageFormat.format("item id of item={0} is null", item)); //NOI18N
+ } else if (item.getItemType() == null) {
+ // Item type is not set
+ throw new NullPointerException(MessageFormat.format("item type of item={0} is null", item)); //NOI18N
+ } else if ((item.getAmount() == null) || (item.getAmount() == 0)) {
// Debug message
- this.getLogger().debug("Amount for item " + item + " is null");
+ this.getLogger().debug(MessageFormat.format("Amount for item {0} is null", item)); //NOI18N
// Amount is not entered
return;
} else if (basket.isItemAdded(item)) {
// Yes, then throw exception here
- throw new ServletException(MessageFormat.format("item id={0} has already been added.", item.getItemId()));
+ throw new ServletException(MessageFormat.format("item id={0} has already been added.", item.getItemId())); //NOI18N
}
// Register item with it