bookstoremgrimp.java

来自「《精通SOA:基于服务总线的Struts+EJB+Web Service整合应用」· Java 代码 · 共 105 行

JAVA
105
字号
package com.bkstore.model.service.imp;

import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.List;

import javax.xml.rpc.ServiceException;

import com.bkstore.ejb.sessionbean.ArrayOf_tns2_BookDTO;
import com.bkstore.ejb.sessionbean.ArrayOf_tns2_OrderItemDTO;
import com.bkstore.ejb.sessionbean.ArrayOf_tns2_UserAccountDTO;
import com.bkstore.ejb.sessionbean.BookMgr;
import com.bkstore.ejb.sessionbean.BookMgrServiceLocator;
import com.bkstore.ejb.sessionbean.OrderMgr;
import com.bkstore.ejb.sessionbean.OrderMgrServiceLocator;
import com.bkstore.ejb.sessionbean.UserAccountMgr;
import com.bkstore.ejb.sessionbean.UserAccountMgrServiceLocator;
import com.bkstore.exception.ApplicationException;
import com.bkstore.model.service.dto.BookDTO;
import com.bkstore.model.service.dto.OrderDTO;
import com.bkstore.model.service.dto.UserAccountDTO;
import com.bkstore.model.service.ifc.BookStoreMgrIfc;

public class BookStoreMgrImp implements  BookStoreMgrIfc {
	
    private BookMgr getBookMgr() throws ServiceException
    {
    	BookMgrServiceLocator bookMgrLocator = new BookMgrServiceLocator();
		return bookMgrLocator.getBookMgr();
    }
    
    private OrderMgr getOrderMgr() throws ServiceException
    {
    	OrderMgrServiceLocator orderMgrLocator = new OrderMgrServiceLocator();
		return orderMgrLocator.getOrderMgr();
    }
    
    private UserAccountMgr getUserAccountMgr() throws ServiceException
    {
    	UserAccountMgrServiceLocator userAccountMgrLocator = new UserAccountMgrServiceLocator();
		return userAccountMgrLocator.getUserAccountMgr();
    }
	
	public boolean checkUserLogin(String loginName, String password) throws ServiceException, RemoteException {
		
		return getUserAccountMgr().checkUserLogin(loginName,password);

	}
	
	public void saveUserInfo(UserAccountDTO userAccountDTO) throws ServiceException, RemoteException {
		getUserAccountMgr().saveUserInfo(userAccountDTO);
	}
	
    public List getUserList() throws ServiceException, RemoteException {
    	
    	ArrayList list = new ArrayList();

		ArrayOf_tns2_UserAccountDTO userAccountArrays = getUserAccountMgr().getUserList();
		UserAccountDTO[] userAccountDTOs = userAccountArrays.getUserAccountDTO();
		
		for (int i=0; i<userAccountDTOs.length; i++) {
			list.add(userAccountDTOs[i]);
			
		}
		
		return list;
    }

	public void updateAccountBalance(UserAccountDTO userAccountDTO) throws RemoteException, ServiceException {
		getUserAccountMgr().updateAccountBalance(userAccountDTO);
		
	}
	
	public UserAccountDTO getUserInfo(String loginName) throws ServiceException, RemoteException {
		
		return getUserAccountMgr().getUserInfo(loginName);
		
	}

	public void createBook(BookDTO bookDTO) throws RemoteException, ServiceException {
		getBookMgr().createBook(bookDTO);
		
	}

	public BookDTO getBook(int getBookBookID) throws RemoteException, ServiceException {
		return getBookMgr().getBook(getBookBookID);
	}

	public ArrayOf_tns2_BookDTO getBookList() throws RemoteException, ServiceException {
		return getBookMgr().getBookList();
	}

	public void createOrderItem(ArrayOf_tns2_OrderItemDTO orderItemDTOs) throws RemoteException, ServiceException {
		getOrderMgr().createOrderItem(orderItemDTOs);
		
	}

	public int createOrder(OrderDTO orderDTO) throws RemoteException, ApplicationException, ServiceException {
		return getOrderMgr().createOrder(orderDTO);
	}
	
	
	
}

⌨️ 快捷键说明

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