📄 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 + -