package oracle.fodemo.storefront.store.service;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import oracle.adf.share.ADFContext;
import oracle.adf.share.logging.ADFLogger;
import oracle.adf.share.security.SecurityContext;
import oracle.fodemo.storefront.store.queries.AddressesAndUsagesVOImpl;
import oracle.fodemo.storefront.store.queries.OrderItemsVOImpl;
import oracle.fodemo.storefront.store.queries.OrdersVOImpl;
import oracle.fodemo.storefront.store.queries.PersonsVOImpl;
import oracle.fodemo.storefront.store.queries.ShoppingCartTransientVOImpl;
import oracle.fodemo.storefront.store.service.common.StoreServiceAM;
import oracle.jbo.ApplicationModule;
import oracle.jbo.JboException;
import oracle.jbo.Key;
import oracle.jbo.Row;
import oracle.jbo.RowIterator;
import oracle.jbo.RowSetIterator;
import oracle.jbo.ViewCriteria;
import oracle.jbo.ViewCriteriaRow;
import oracle.jbo.ViewObject;
import oracle.jbo.client.Configuration;
import oracle.jbo.domain.DBSequence;
import oracle.jbo.domain.Number;
import oracle.jbo.server.ApplicationModuleImpl;
import oracle.jbo.server.AttributeListImpl;
import oracle.jbo.server.ViewLinkImpl;
import oracle.jbo.server.ViewObjectImpl;
// ---------------------------------------------------------------------
// --- File generated by Oracle ADF Business Components Design Time.
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class StoreServiceAMImpl extends ApplicationModuleImpl implements StoreServiceAM {
private static ADFLogger LOGGER = ADFLogger.createADFLogger(StoreServiceAMImpl.class);
// Order status code for user shopping carts
private static String CART_STATUS_CODE = "CART";
// Persistent shopping cart vo constants
private static String PERSISTENT_CART_VO = "pShoppingCart";
private static String ORDER_ITEMS_VO_DEF = "oracle.fodemo.storefront.store.queries.OrderItemsVO";
/**This is the default constructor (do not remove).
*/
public StoreServiceAMImpl() {}
/**
* Updates the quantity of an existing item in the
* shopping cart. If the item does not exist a new
* entry will be created.
*
* @param productId
* @param quantity
* @param isSet
*/
public void updateItemInCart(Integer productId, Integer quantity, Boolean isSet){
// 1. update transient vo
updateTransientCartItem(productId, quantity, isSet);
SecurityContext securityContext = ADFContext.getCurrent().getSecurityContext();
// 2. authentication check
if(securityContext.isAuthenticated()){
String username = securityContext.getUserName();
// 3. find shopping cart id for user
long orderId = this.findCartIdForUser(username);
if(orderId >= 0){
// 4. update cart item
updatePersitentCartItem(orderId, productId, quantity, isSet);
}
}
}
/**
* Add new item to cart.
*
* @param productId
* @param quantity
*/
public void addItemToCart(Integer productId, Integer quantity){
// 1. update transient vo
addItemToTransientCart(productId, quantity);
SecurityContext securityContext = ADFContext.getCurrent().getSecurityContext();
// 2. authentication check
if(securityContext.isAuthenticated()){
String username = securityContext.getUserName();
// 3. find shopping cart id for user
long orderId = this.findCartIdForUser(username);
addItemToPersistentCart(orderId, productId, quantity);
}
}
/**
* Remove an item from the cart.
*
* @param productId
*/
public void removeItemFromCart(Integer productId){
// 1. update transient vo
removeItemFromTransientCart(productId);
SecurityContext securityContext = ADFContext.getCurrent().getSecurityContext();
// 2. authentication check
if(securityContext.isAuthenticated()){
String username = securityContext.getUserName();
// 3. find shopping cart id for user
long orderId = this.findCartIdForUser(username);
if(orderId >= 0){
// 4. add cart item
removeItemFromPersistentCart(orderId, productId);
}
}
}
/**
* Remove all items from cart.
*/
public void removeAllItemsFromCart(){
// 1. update transient vo
removeAllItemsFromTransientCart();
SecurityContext securityContext = ADFContext.getCurrent().getSecurityContext();
// 2. authentication check
if(securityContext.isAuthenticated()){
String username = securityContext.getUserName();
// 3. find shopping cart id for user
long orderId = this.findCartIdForUser(username);
// 4. add cart item
if(orderId >= 0){
removeAllItemsFromPersistentCart(orderId);
}
}
}
/**
* Updates the quantity of an existing item in the
* shopping cart. If the item does not exist a new
* entry will be created.
*
* @param productId
* @param quantity
*/
public void updateTransientCartItem(Integer productId, Integer quantity, Boolean isSet){
// 1. check for existence of product in cart
ViewObjectImpl shoppingCartVO = getMyShoppingCart();
Row[] rows = shoppingCartVO.findByKey( new Key(new Object[]{productId}) ,1);
if(rows.length > 0){
// 2. update quantity of existing item
if(!isSet){
Integer currQuantity = (Integer)rows[0].getAttribute("Quantity");
quantity = currQuantity.intValue() + quantity;
}
rows[0].setAttribute("Quantity", quantity);
return;
}
// 3. The product has not been add to the cart.
addItemToTransientCart(productId, quantity);
}
/**
* Updates the quantity of an existing item in the
* shopping cart. If the item does not exist a new
* entry will be created.
*
* @param orderId
* @param productId
* @param quantity
*/
public void updatePersitentCartItem(Long orderId, Integer productId, Integer quantity, Boolean isSet){
// 1. create instance of persitent shopping cart.
OrderItemsVOImpl shoppingCartVO = createPersistentShoppingCartVO();
// 2. limit view to order of interest.
shoppingCartVO.showOrderItemForOrderIdAndProductId(orderId ,productId);
// 3. find view item in view.
Row shoppingCartRow = shoppingCartVO.first();
if(shoppingCartRow != null){
// 4. update quantity of existing item
if(!isSet){
Integer currQuantity = (Integer)shoppingCartRow.getAttribute("Quantity");
quantity = currQuantity.intValue() + quantity;
}
shoppingCartRow.setAttribute("Quantity", quantity);
getDBTransaction().commit();
return;
}
// 5. The product has not been add to the cart.
addItemToPersistentCart(orderId, productId, quantity);
}
/**
* Adds item to peristent shopping cart.
*
* @param orderId
* @param productId
* @param quantity
*/
public void addItemToPersistentCart(Long orderId, Integer prod
没有合适的资源?快使用搜索试试~ 我知道了~
oracle JDeveloper Studio 11.1.1.0.2初学者入门,带demo。
共1936个文件
class:598个
xml:505个
java:158个
4星 · 超过85%的资源 需积分: 12 86 下载量 87 浏览量
2009-06-16
18:33:41
上传
评论 1
收藏 13.17MB RAR 举报
温馨提示
oracle JDeveloper Studio 11.1.1.0.2初学者入门。
资源详情
资源评论
资源推荐
收起资源包目录
oracle JDeveloper Studio 11.1.1.0.2初学者入门,带demo。 (1936个子文件)
View Objects Diagram.adfbc_diagram 50KB
Business Domain Compact.adfbc_diagram 30KB
customer-registration-task-flow.adfc_diagram 21KB
customer-registration-task-flow.adfc_diagram 12KB
adfc-config.adfc_diagram 7KB
employee-registration-task-flow.adfc_diagram 7KB
checkout-task-flow.adfc_diagram 6KB
user-registration-task-flow.adfc_diagram 4KB
adfc-config.adfc_diagram 2KB
StoreFrontServicezyxr.cdi 93KB
StoreFrontService.cdi 65KB
StoreFrontServicezyxm.cdi 59KB
StoreFrontUIzyxm.cdi 23KB
ApplicationModuleszyxr.cdi 18KB
StoreFrontUIzyxr.cdi 16KB
StoreFrontUI.cdi 16KB
ApplicationModuleszyxm.cdi 14KB
ApplicationModules.cdi 14KB
ControllingPostingOrderzyxm.cdi 6KB
ControllingPostingOrderzyxr.cdi 6KB
QueryingDataWithViewObjects.cdi 4KB
ControllingPostingOrder.cdi 3KB
QueryingDataWithViewObjectszyxm.cdi 3KB
QueryingDataWithViewObjectszyxr.cdi 3KB
MasterBuildScript.cdi_javac 2KB
__home_jspx.class 293KB
__order_jspx.class 259KB
__myorders_jspx.class 239KB
__updateuserinfo_jspx.class 196KB
__ordersummary_jspx.class 115KB
__reviewcustomerinfo_jsff.class 82KB
__paymentoptions_jsff.class 53KB
__basicinformation_jsff.class 50KB
__reviewemployeeinfo_jsff.class 50KB
__storefronttemplate_jspx.class 47KB
__paymentoptiondetails_jsff.class 46KB
__basicemployeeinfo_jsff.class 46KB
__defineaddresses_jsff.class 45KB
__addressdetails_jsff.class 33KB
StoreServiceAMImpl.class 32KB
__welcomeuserregistration_jsff.class 30KB
__login_jspx.class 29KB
__registeruser_jspx.class 22KB
__login_error_jspx.class 22KB
__errorpage_jsff.class 19KB
__unexpectederrorhandler_jspx.class 19KB
OrderEOImpl.class 15KB
PersonEOImpl.class 14KB
PersonsVORowImpl$AttributesEnum.class 13KB
PersonsVORowImpl.class 13KB
OrdersVORowImpl.class 12KB
PersonEOImpl$AttributesEnum.class 12KB
OrdersVORowImpl$AttributesEnum.class 12KB
ProductBaseEOImpl.class 12KB
ProductBaseEOImpl$AttributesEnum.class 12KB
ProductsBaseImpl.class 12KB
CustomerRegistrationVORowImpl.class 11KB
OrderEOImpl$AttributesEnum.class 11KB
UpdateUserInfoBean.class 11KB
CustomerRegistrationVORowImpl$AttributesEnum.class 11KB
AddressesAndUsagesVORowImpl.class 10KB
CustomerAddressVORowImpl.class 10KB
ProductsBaseEOImpl.class 10KB
ADFUtils.class 10KB
AddressesAndUsagesVORowImpl$AttributesEnum.class 10KB
AddressDetailsPageLifeCycle.class 10KB
ProductsBaseEOImpl$AttributesEnum.class 10KB
PersonsEOImpl.class 9KB
JSFUtils.class 9KB
CustomerAddressVORowImpl$AttributesEnum.class 9KB
PersonsEOImpl$AttributesEnum.class 9KB
AddressUsageEOImpl.class 8KB
OrdersEOImpl.class 8KB
PaymentOptionEOImpl.class 8KB
CustomerPaymentOptionVORowImpl.class 8KB
AddressEOImpl.class 8KB
CustomerPaymentOptionVORowImpl$AttributesEnum.class 8KB
OrderItemEOImpl.class 7KB
OrdersEOImpl$AttributesEnum.class 7KB
PaymentOptionEOImpl$AttributesEnum.class 7KB
HomeBean.class 7KB
AddressEOImpl$AttributesEnum.class 7KB
SuppliersImpl.class 6KB
AddressUsageEOImpl$AttributesEnum.class 6KB
ShoppingCartBean.class 6KB
OrderItemEOImpl$AttributesEnum.class 6KB
OrderBean.class 5KB
StoreFrontService2Impl.class 5KB
ImageLoaderServiceAMImpl.class 5KB
ShoppingCartTransientVORowImpl.class 5KB
WarehouseEOImpl.class 5KB
ShoppingCartTransientVORowImpl$AttributesEnum.class 5KB
MyOrdersBean.class 4KB
CustRegBasicInformationBean.class 4KB
OrdersVOImpl.class 4KB
StoreServiceAMClient.class 4KB
CustomerAddressVOImpl.class 4KB
CustRegDefineAddressesBean.class 4KB
ImageServlet.class 4KB
StoreFrontServiceImpl.class 4KB
共 1936 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
postfxj
- 粉丝: 83
- 资源: 19
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论3