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

📄 usersdelegate.java

📁 JAVA 经典案例 源代码 Part2.
💻 JAVA
字号:
/*
 * 
 * 开发时间:2004-08-20 at 05:40:07
 * 
 * 作者:曹广鑫
 * 
 * 网站:www.helpsoft.org  电子邮件:support@helpsoft.org
 */

package org.helpsoft.blog.j2ee.delegate;

import org.helpsoft.blog.dao.*;
import org.helpsoft.blog.dto.*;
import org.helpsoft.blog.exceptions.*;
import org.helpsoft.blog.j2ee.session.*;
import java.rmi.RemoteException;
import java.math.*;
import java.util.Date;
import javax.ejb.*;

public class UsersDelegate implements UsersDao
{
	private UsersSession session;

	/**
	 * Method 'UsersDelegate'
	 * 
	 * @param session
	 */
	public UsersDelegate(final UsersSession session)
	{
		this.session = session;
	}

	/** 
	 * Inserts a new row in the users table.
	 */
	public UsersPk insert(Users dto) throws UsersDaoException
	{
		try {
			return session.insert(dto);
		}
		catch (UsersDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new UsersDaoException( ex.getMessage() );
		}
		
	}

	/** 
	 * Updates a single row in the users table.
	 */
	public void update(UsersPk pk, Users dto) throws UsersDaoException
	{
		try {
			session.update(pk, dto);
		}
		catch (UsersDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new UsersDaoException( ex.getMessage() );
		}
		
	}

	/** 
	 * Deletes a single row in the users table.
	 */
	public void delete(UsersPk pk) throws UsersDaoException
	{
		try {
			session.delete(pk);
		}
		catch (UsersDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new UsersDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findAll'
	 * 
	 * @throws UsersDaoException
	 * @return Users[]
	 */
	public Users[] findAll() throws UsersDaoException
	{
		try {
			return session.findAll();
		}
		catch (UsersDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new UsersDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findWhereUseridEquals'
	 * 
	 * @param userid
	 * @throws UsersDaoException
	 * @return Users[]
	 */
	public Users[] findWhereUseridEquals(String userid) throws UsersDaoException
	{
		try {
			return session.findWhereUseridEquals(userid);
		}
		catch (UsersDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new UsersDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findWhereNameEquals'
	 * 
	 * @param name
	 * @throws UsersDaoException
	 * @return Users[]
	 */
	public Users[] findWhereNameEquals(String name) throws UsersDaoException
	{
		try {
			return session.findWhereNameEquals(name);
		}
		catch (UsersDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new UsersDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findByPrimaryKey'
	 * 
	 * @param pk
	 * @throws UsersDaoException
	 * @return Users
	 */
	public Users findByPrimaryKey(UsersPk pk) throws UsersDaoException
	{
		try {
			return session.findByPrimaryKey(pk);
		}
		catch (UsersDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new UsersDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findByPrimaryKey'
	 * 
	 * @param userid
	 * @throws UsersDaoException
	 * @return Users
	 */
	public Users findByPrimaryKey(String userid) throws UsersDaoException
	{
		try {
			return session.findByPrimaryKey(userid);
		}
		catch (UsersDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new UsersDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findByDynamicSelect'
	 * 
	 * @param sql
	 * @param sqlParams
	 * @throws UsersDaoException
	 * @return Users[]
	 */
	public Users[] findByDynamicSelect(String sql, Object[] sqlParams) throws UsersDaoException
	{
		try {
			return session.findByDynamicSelect(sql, sqlParams);
		}
		catch (UsersDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new UsersDaoException( ex.getMessage() );
		}
		
	}

	/**
	 * Method 'findByDynamicWhere'
	 * 
	 * @param sql
	 * @param sqlParams
	 * @throws UsersDaoException
	 * @return Users[]
	 */
	public Users[] findByDynamicWhere(String sql, Object[] sqlParams) throws UsersDaoException
	{
		try {
			return session.findByDynamicWhere(sql, sqlParams);
		}
		catch (UsersDaoException daoException) {
			throw daoException;
		}
		catch (Exception ex) {
			ex.printStackTrace();
			throw new UsersDaoException( ex.getMessage() );
		}
		
	}

}

⌨️ 快捷键说明

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