⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customerwebimpl.java~

📁 J2EE & Tomcat books published by hope
💻 JAVA~
字号:
/* * $Id: CustomerWebImpl.java~,v 1.1 2002/01/04 21:03:58 jc123804 Exp $ * Copyright 2001 Sun Microsystems, Inc. All rights reserved. * Copyright 2001 Sun Microsystems, Inc. Tous droits r?erv?. */package com.sun.j2ee.blueprints.petstore.control.web;import java.rmi.RemoteException;import javax.ejb.FinderException;import com.sun.j2ee.blueprints.petstore.util.JNDINames;import com.sun.j2ee.blueprints.customer.account.model.AccountModel;import com.sun.j2ee.blueprints.customer.util.ContactInformation;import com.sun.j2ee.blueprints.customer.customer.ejb.Customer;import com.sun.j2ee.blueprints.petstore.control.web.ModelManager;import com.sun.j2ee.blueprints.petstore.control.web.ModelUpdateListener;import com.sun.j2ee.blueprints.petstore.control.ejb.ShoppingClientController;import com.sun.j2ee.blueprints.petstore.control.exceptions.GeneralFailureException;import com.sun.j2ee.blueprints.petstore.control.exceptions.EStoreAppException;import com.sun.j2ee.blueprints.util.tracer.Debug;/** * This class is the web-tier representation of the Account. */public class CustomerWebImpl implements ModelUpdateListener, java.io.Serializable {    private ModelManager mm;    private Customer custEjb;    private String userId;    private boolean loggedIn = false;    private AccountModel account = null;    public CustomerWebImpl() {}    public CustomerWebImpl(ModelManager mm) {        this.mm = mm;        mm.addListener(JNDINames.CUSTOMER_EJBHOME, this);    }    public void setUserId(String userId) {        this.userId = userId;    }    public String getUserId() {        return userId;    }    public ContactInformation getContactInformation() {        if (account == null) return null;        else return account.getContactInformation();    }    public AccountModel getAccount() {        return account;    }    /**     *  Set by the SigninHandler.doAfter() method     */    public void setLoggedIn(boolean loggedIn) {        this.loggedIn = loggedIn;    }    public boolean isLoggedIn() {        return loggedIn;    }    public void performUpdate()  throws EStoreAppException {        // Get data from the EJB        if (custEjb == null) {            custEjb = mm.getCustomerEJB();        }        if (custEjb != null) {            try {               // check if the user account was ok               account = custEjb.getAccountDetails(getUserId());               if (account != null) loggedIn = true;            } catch (FinderException fe) {                //            } catch(RemoteException e) {                Debug.println("*** CustomerWebImpl: preformUpdate caught " + e);            }        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -