clientdelegate.java

来自「EJB+Struts+Webservice实现的开放式基金管理系统」· Java 代码 · 共 124 行

JAVA
124
字号
package com.fund.client;

import com.fund.ServiceLocator;
import com.fund.ServiceLocatorException;

/**
 *
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class ClientDelegate {
    /**
     *ClientSessionFacadeHome
     */
    private ClientSessionFacadeHome clientSessionFacadeHome;
    /**
     *ClientSessionFacade
     */
    private ClientSessionFacade clientSessionFacade;

    /**
     * constructor
     * @throws Exception e
     */
    public ClientDelegate() throws Exception {
        initializeClientSessionFacadeHome();
        clientSessionFacade = clientSessionFacadeHome.create();
    }

    /**
     *
     * @param clientDto ClientDto
     * @throws Exception e
     */
    public void createClient(ClientDto clientDto) throws Exception {
        clientSessionFacade.createClient(clientDto);
    }

    /**
     *
     * @param clientNo Integer
     * @throws Exception e
     */
    public void removeClient(Integer clientNo) throws Exception {
        clientSessionFacade.removeClient(clientNo);
    }

    /**
     *
     * @param clientDto ClientDto
     * @throws Exception e
     */
    public void removeClient(ClientDto clientDto) throws Exception {
        clientSessionFacade.removeClient(clientDto);
    }

    /**
     *
     * @param clientDto ClientDto
     * @throws Exception e
     */
    public void updateClient(ClientDto clientDto) throws Exception {
        clientSessionFacade.updateClient(clientDto);
    }

    /**
     *
     * @param clientDtos ClientDto[]
     * @throws Exception e
     */
    public void updateClients(ClientDto[] clientDtos) throws Exception {
        clientSessionFacade.updateClients(clientDtos);
    }

    /**
     *
     * @param clientNo Integer
     * @return ClientDto
     * @throws Exception e
     */
    public ClientDto clientFindByPrimaryKey(Integer clientNo) throws Exception {
        return clientSessionFacade.clientFindByPrimaryKey(clientNo);
    }

    /**
     *
     * @param idCardNo String
     * @return ClientDto
     * @throws Exception e
     */
    public ClientDto clientFindByIdCardNo(String idCardNo) throws Exception {
        return clientSessionFacade.clientFindByIdCardNo(idCardNo);
    }

    /**
     *
     * @throws Exception e
     */
    private void initializeClientSessionFacadeHome() throws Exception {
        String facadeName = "ClientSessionFacade";
        final Class facadClass = com.fund.client.ClientSessionFacadeHome.class;
        if (clientSessionFacadeHome == null) {
            try {
                ServiceLocator locator = ServiceLocator.getInstance();
                clientSessionFacadeHome = (ClientSessionFacadeHome) locator.
                                          getEjbHome(facadeName, facadClass);
                if (clientSessionFacadeHome == null) {
                    throw new Exception("Did not get home for " + facadeName);
                }
            } catch (ServiceLocatorException e) {
                throw new Exception(e.getMessage());
            }
        }
    }
}

⌨️ 快捷键说明

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