亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? customerejb.java

?? 一個(gè)關(guān)于學(xué)習(xí)EJB中sessinBean的小的例子程序源碼,提供給初學(xué)者參考.
?? JAVA
字號(hào):
/*
 * $Id: CustomerEJB.java,v 1.7.4.9 2001/03/14 10:03:07 vijaysr Exp $
 * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
 * Copyright 2001 Sun Microsystems, Inc. Tous droits r閟erv閟.
 */

package com.sun.j2ee.blueprints.customer.customer.ejb;

import java.util.Collection;
import java.util.Locale;
import java.rmi.RemoteException;
import javax.rmi.PortableRemoteObject;
import javax.naming.InitialContext;
import javax.ejb.DuplicateKeyException;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.RemoveException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.FinderException;

import com.sun.j2ee.blueprints.customer.account.model.AccountModel;
import com.sun.j2ee.blueprints.customer.util.ContactInformation;
import com.sun.j2ee.blueprints.customer.order.model.OrderModel;
import com.sun.j2ee.blueprints.customer.order.ejb.Order;
import com.sun.j2ee.blueprints.customer.order.ejb.OrderHome;
import com.sun.j2ee.blueprints.customer.account.ejb.Account;
import com.sun.j2ee.blueprints.customer.account.ejb.AccountHome;
import com.sun.j2ee.blueprints.customer.util.Address;
import com.sun.j2ee.blueprints.customer.util.CreditCard;
import com.sun.j2ee.blueprints.customer.util.JNDINames;

import com.sun.j2ee.blueprints.customer.account.exceptions.AccountAppException;
import com.sun.j2ee.blueprints.customer.account.exceptions.AccountAppLongIdException;
import com.sun.j2ee.blueprints.customer.account.exceptions.AccountAppInvalidCharException;
import com.sun.j2ee.blueprints.customer.order.exceptions.OrderAppException;

import com.sun.j2ee.blueprints.customer.customer.exceptions.CustomerAppLongIdException;
import com.sun.j2ee.blueprints.customer.customer.exceptions.CustomerAppInvalidCharException;
import com.sun.j2ee.blueprints.customer.customer.exceptions.CustomerAppException;

/** 
 * Session Bean implementation for CustomerEJB EJB.
 */
public class CustomerEJB implements SessionBean {

    AccountHome accountHomeRef = null;
    OrderHome orderHomeRef = null;
    SessionContext context = null;

    /**
     * Constructor - does nothing
     */

    public CustomerEJB() {}

    /**
     * Sets the session context
     * @param sc the <code>SessionContext</code> for this instance
     */
    public void setSessionContext(SessionContext sc) {
        this.context = sc;
    }

    private void getReferences() {
        try {
            Object objref;
            InitialContext initial = new InitialContext();
                if(accountHomeRef == null) {
                    objref = initial.lookup(JNDINames.ACCOUNT_EJBHOME);
                    accountHomeRef = (AccountHome)
                    PortableRemoteObject.narrow(objref, AccountHome.class);
                }
                if(orderHomeRef == null) {
                    objref = initial.lookup(JNDINames.ORDER_EJBHOME);
                    orderHomeRef = (OrderHome)
                    PortableRemoteObject.narrow(objref, OrderHome.class);
                }
        } catch (javax.naming.NamingException ne) {
            throw new EJBException ("Naming Ex while getting facade " +
                                    "references : " + ne);
        }
        return;
    }

    /**
     * the ejbCreate methods that just gets the references
     */
    public void ejbCreate() {
        getReferences();
    }

    /**
     * the ejbRemove methods that does nothing
     */
    public void ejbRemove() {
    }

    /**
     * the ejbActivate methods that just gets the references
     */
    public void ejbActivate() {
       getReferences();
    }

    /**
     * the ejbPassivate methods that resets the references
     */
    public void ejbPassivate() {
        accountHomeRef = null;
        orderHomeRef = null;
    }

    /**
     * Gets the account details give an user id
     * @param userId a string that represents the user Id
     * @return the <code>AccountModel</code> that has the account information
     *         corresponding to a customer's account.
     * @throws <code>RemoteException</code> for irrecoverable errors
     * @throws <code>FinderException</code> if the user details was not found
     */
    public AccountModel getAccountDetails(String userId) throws
                                   FinderException {
        try {
           if(accountHomeRef == null)
               getReferences();
           Account acct = accountHomeRef.findByPrimaryKey(userId);
           return(acct.getDetails());
        } catch (FinderException fe) {
             throw new FinderException(fe.getMessage());
        } catch (RemoteException re) {
             throw new EJBException(re);
        }
    }

    /**
     * updates the contact information  for the specified account
     * @param info the <code>ContactInformation</code> of the user
     * @param userId a string that represents the user Id
     * @throws <code>RemoteException</code> for irrecoverable errors
     * @throws <code>FinderException</code> if the user was not found
     */
    public void changeContactInformation(ContactInformation info,
                     String userId) throws
                     FinderException {
        try {
           Account acct = accountHomeRef.findByPrimaryKey(userId);
           acct.changeContactInformation(info);
     } catch (FinderException fe) {
             throw new FinderException(fe.getMessage());
        } catch (RemoteException re) {
             throw new EJBException(re);
        }
        return;
    }

    /**
     * Create interface of AccountHome component
     * @param userId a string that represents the user
     * @param password a string that represents the password of the user
     * @param status a string the represents the user's status
     * @param info the <code>ContactInformation</code> of the user
     * @return <code>true</code> if create was OK; <code>false</code> ifnot
     * @throws <code>RemoteException</code> for irrecoverable errors
     * @throws <code>CreateException</code> if account could not be created
     * @throws <code>DuplicateKeyException</code> if an account with the same
     *         user id is already present
     * @throws <code>CustomerAppException</code> if there was an user error
    */
    public boolean createAccount(String userId, String password, String status,
        ContactInformation info) throws CreateException, DuplicateKeyException,
                                        CustomerAppException {
        Account acct = null;
        try {
           if(accountHomeRef == null)
               getReferences();
           acct = accountHomeRef.create(userId, password, status, info);
        } catch (DuplicateKeyException dup) {
            throw new DuplicateKeyException("User exits for " + userId);
        } catch (CreateException re) {
             throw new CreateException(re.getMessage());
    } catch (AccountAppLongIdException re) {
             throw new CustomerAppLongIdException(re.getMessage());
    } catch (AccountAppInvalidCharException re) {
             throw new CustomerAppInvalidCharException(re.getMessage());
    } catch (AccountAppException re) {
             throw new CustomerAppException(re.getMessage());
        } catch (RemoteException re) {
             throw new EJBException(re);
        }
        if(acct == null)
           return(false);
        return(true);
    }

    /**
     * Return the details of an order
     * @param orderId an integer the order Id
     * @return <code>OrderModel</code> that has the order details
     * @throws <code>RemoteException</code> for irrecoverable errors
     * @throws <code>FinderException</code> if the order details was not found
    */
    public OrderModel getOrderDetails(int orderId) throws FinderException {
        try {
           if(orderHomeRef == null)
               getReferences();
           Order ordr = orderHomeRef.findByPrimaryKey(new Integer(orderId));
           if(ordr == null)
               return(null);
           return(ordr.getDetails());
        } catch (FinderException re) {
             throw new FinderException(re.getMessage());
        } catch (RemoteException re) {
             throw new EJBException(re);
        }
    }

    /**
     * Create interface of Order component
     * @return an integer that represents the order ID
     * @throws <code>RemoteException</code> for irrecoverable errors
     * @throws <code>CreateException</code> if account could not be created
     * @throws <code>CustomerAppException</code> if there was an user error
    */
    public int createOrder(String userId, Collection lineItems,
               Address shipToAddr,
        Address billToAddr,  String shipToFirstName,
        String shipToLastName, String billToFirstName,
        String billToLastName, CreditCard chargeCard,
        String carrier, double totalPrice,
        Locale locale
) throws CreateException, CustomerAppException {

        try {
           if(orderHomeRef == null)
               getReferences();

           Order ordr = orderHomeRef.create(lineItems, shipToAddr, billToAddr,
                           shipToFirstName, shipToLastName, billToFirstName,
                           billToLastName, chargeCard, carrier, userId,
                           totalPrice, locale);
           if(ordr == null)
               return(-1);
           return(ordr.getDetails().getOrderId());
        } catch (CreateException re) {
             throw new CreateException(re.getMessage());
    } catch (OrderAppException re) {
        throw new CustomerAppException(re.getMessage());
        } catch (RemoteException re) {
             throw new EJBException(re);
        }
    }
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美福利电影网| 91精品国产高清一区二区三区| 一二三四社区欧美黄| 欧美一级高清片| 99精品欧美一区| 国产综合久久久久影院| 一级精品视频在线观看宜春院| 久久这里都是精品| 7777精品伊人久久久大香线蕉| 成人性生交大合| 久久国产精品99精品国产 | 日韩精品电影在线| 中文字幕不卡在线观看| 欧美一区二区在线观看| 欧洲激情一区二区| 成人性生交大片免费看视频在线 | 亚洲色图在线看| 精品国产凹凸成av人导航| 欧美日韩一区二区不卡| 99免费精品视频| 懂色av一区二区在线播放| 久久国产精品一区二区| 日欧美一区二区| 亚洲一区二区三区精品在线| 国产精品久久久久婷婷| 国产欧美一区视频| 久久午夜色播影院免费高清| 日韩免费一区二区| 91精品国产综合久久精品| 色激情天天射综合网| 99久久久免费精品国产一区二区| 国产在线精品免费av| 久久se精品一区二区| 久久成人久久爱| 精品在线一区二区三区| 精品一区二区日韩| 精东粉嫩av免费一区二区三区| 日韩电影在线一区| 三级久久三级久久| 琪琪久久久久日韩精品| 日韩中文欧美在线| 美国精品在线观看| 久久国产乱子精品免费女| 久久成人av少妇免费| 麻豆精品视频在线观看视频| 美国欧美日韩国产在线播放| 久久精品国产99国产精品| 国产一区二区三区香蕉| 国产毛片精品国产一区二区三区| 国产一区二区在线影院| 岛国av在线一区| 99re视频精品| 91福利视频网站| 欧美日韩亚洲高清一区二区| 91精品国产一区二区人妖| 日韩精品一区二区三区在线观看 | 无码av免费一区二区三区试看| 亚洲第一主播视频| 日本伊人色综合网| 国产一区福利在线| 99久久99久久精品国产片果冻| 日本高清不卡一区| 555夜色666亚洲国产免| 久久五月婷婷丁香社区| 国产精品传媒入口麻豆| 亚洲综合在线视频| 另类小说视频一区二区| 国产**成人网毛片九色 | 欧美三区在线视频| 日韩精品一区二区三区swag| 国产午夜亚洲精品羞羞网站| 亚洲视频网在线直播| 亚洲sss视频在线视频| 极品少妇xxxx精品少妇| 91首页免费视频| 在线播放日韩导航| 国产午夜亚洲精品羞羞网站| 亚洲天堂久久久久久久| 日韩成人免费电影| 成人一级视频在线观看| 欧美色视频在线| 久久久久久久久蜜桃| 亚洲美女淫视频| 久久精品国产久精国产爱| 91性感美女视频| 日韩免费成人网| 亚洲欧美日韩国产一区二区三区| 日本午夜精品视频在线观看| 99久久综合国产精品| 日韩一区二区视频在线观看| 综合久久久久久久| 久久99国产精品尤物| 91香蕉视频mp4| 26uuu国产在线精品一区二区| 一区二区三区中文字幕在线观看| 狠狠色丁香婷婷综合| 91成人免费网站| 国产女人水真多18毛片18精品视频| 亚洲va韩国va欧美va| 99久久综合色| 国产欧美日韩在线视频| 天堂午夜影视日韩欧美一区二区| 懂色av一区二区夜夜嗨| 日韩免费一区二区三区在线播放| 亚洲精品视频在线| 国产成人在线观看| 欧美一区二区三区在线电影| 亚洲人精品午夜| 国产精品夜夜爽| 日韩精品一区二区三区在线播放 | 久久精品一区二区三区四区| 天堂va蜜桃一区二区三区漫画版| av影院午夜一区| 国产欧美一区二区三区网站| 免费成人深夜小野草| 欧美日韩日日骚| 一区二区三区四区在线免费观看 | 99r精品视频| 国产精品免费视频观看| 国产一区 二区 三区一级| 欧美一区二区三级| 日韩激情一区二区| 欧美麻豆精品久久久久久| 亚洲综合一二三区| 欧美在线播放高清精品| 亚洲欧美视频在线观看视频| 成人av网址在线| 日本一区二区成人| 国产一区二区三区不卡在线观看| 欧美成人精品福利| 美女视频黄频大全不卡视频在线播放| 欧美日韩的一区二区| 午夜婷婷国产麻豆精品| 欧美日韩国产一级片| 午夜电影久久久| 欧美二区三区的天堂| 三级影片在线观看欧美日韩一区二区 | 亚洲福利视频一区| 欧美中文字幕一区| 午夜亚洲福利老司机| 欧美精品1区2区3区| 日本亚洲三级在线| 欧美mv日韩mv国产网站| 狠狠色综合日日| 国产亚洲精品bt天堂精选| 国产91高潮流白浆在线麻豆 | 亚洲国产人成综合网站| 欧美午夜精品免费| 波多野结衣中文字幕一区二区三区| 国产日韩欧美麻豆| av在线不卡免费看| 夜色激情一区二区| 5858s免费视频成人| 韩国视频一区二区| 国产精品国产精品国产专区不蜜| 成人av在线观| 亚洲图片欧美一区| 日韩精品影音先锋| 国产成人午夜高潮毛片| 中文字幕日本不卡| 欧美日韩电影在线| 国产精品一区一区三区| 亚洲欧洲日韩在线| 欧美日韩一区在线观看| 激情另类小说区图片区视频区| 国产三级精品三级| 在线看不卡av| 麻豆91免费观看| 国产精品看片你懂得| 欧美日韩一区二区三区四区五区| 青椒成人免费视频| 国产精品福利一区二区| 欧美日韩一级片在线观看| 久久99在线观看| 亚洲视频免费观看| 日韩亚洲欧美高清| 不卡电影免费在线播放一区| 亚洲国产成人tv| 久久蜜桃av一区二区天堂 | 99国产欧美久久久精品| 午夜精品福利在线| 国产欧美日韩另类一区| 欧美日韩一区在线| 成人激情午夜影院| 日本不卡一区二区三区| 国产精品三级在线观看| 制服丝袜亚洲网站| 99视频精品免费视频| 奇米色一区二区三区四区| 亚洲欧美在线视频观看| 日韩精品专区在线| 欧美揉bbbbb揉bbbbb| 国产91色综合久久免费分享| 亚洲午夜免费福利视频| 日本一区二区三区视频视频| 在线电影欧美成精品| 99视频一区二区| 国产一区二区伦理片| 爽爽淫人综合网网站| 亚洲欧洲综合另类|