?? customermanager.java
字號:
package com.xc.hotelmanager.hotel.control.proxy;import java.util.*;import com.xc.hotelmanager.hotel.model.*;import com.xc.hotelmanager.hotel.control.*;import com.xc.hotelmanager.hotel.exception.*;import java.lang.NullPointerException;import java.rmi.*;import com.xc.hotelmanager.hotel.control.session.SB_CustomerManager;public class CustomerManager { static CustomerManager instance = null; private SB_CustomerManager manager = null; private CustomerManager() { try { manager =EjbGetter.getSB_CustomerManagerHome(). create(); } catch (Exception ex) { } } public static CustomerManager getInstance() { if (instance == null) { instance = new CustomerManager(); } return instance; } public Customer loadCustomer(String cid) throws HotelManagerException { Customer result = null; try { result = manager.loadCustomer(cid); } catch (Exception rex) { throw new HotelManagerException("CustomerManager.load Eorr:"+rex.getMessage()); } return result; } public Customer existCustomer(String cid) throws HotelManagerException { Customer result = null; try { result = manager.exitCustomer(cid); } catch(java.lang.NullPointerException ex){ System.out.println("該顧客不存在----可不寫??"+ex.getMessage()); result=null; } catch (Exception rex) { if (result == null) { result = null; } else { throw new HotelManagerException("CustomerManager.exist Eorr:" + rex.getMessage()); } } return result; } public Collection getAllCustomer() throws HotelManagerException { try { Collection result = manager.getAllCustomer(); return result; } catch (Exception rex) { throw new HotelManagerException(rex.getMessage()); } } public void removeCustomer(String cid) throws HotelManagerException { try { manager.removeCustomer(cid); } catch (Exception rex) { throw new HotelManagerException(rex.getMessage()); } } public Customer addCustomer(Customer cus) throws HotelManagerException { try { return manager.addCustomer(cus); } catch (Exception rex) { throw new HotelManagerException("CustomerManager.add Eorr:"+rex.getMessage()); } } public Customer saveCustomer(Customer cus) throws HotelManagerException { try { return manager.saveCustomer(cus); } catch (Exception rex) { throw new HotelManagerException("CustomerManager.save Eorr:"+rex.getMessage()); } } public static void main(String[] args) { try { CustomerManager m = CustomerManager.getInstance(); } catch (Exception ex) { System.out.println("CustomerManager.main Eorr:"+ex.getMessage()); } } }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -