abstractentitybean.java

来自「老外的在线考试」· Java 代码 · 共 106 行

JAVA
106
字号
/* * SchoolEJB - CyberDemia's library of EJBs for educational related services. * Copyright (C) 2003 CyberDemia Research and Services * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Library General Public License for more details. *  * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA  02111-1307, USA. * * See the COPYING file located in the top-level-directory of * the archive of this library for complete text of license. */package com.cyberdemia.school.impl;import javax.ejb.*;import java.util.logging.*;/*** AbstractEntityBean is an abstract base class for entity beans.* It cannot be specified as an entity bean itself because* it does not define the create methods.* Subclasses must define appropriate create methods to be used* as EntityBeans.** @author Alexander Yap*/public abstract class AbstractEntityBean implements EntityBean{		/**	 * Gets the unique ID of this object.	 * @return Unique ID	 */	public abstract String getId();	/**	 * Sets the unique ID of this object.	 * @param id Unique ID	 */	public abstract void setId(String id);	/**	* Gets the name intended for display in user interface.	* It is a persistent attribute.	* @return Name of this object.	*/	public abstract String getName();		/**	* Sets the name intended for display in user interface.	* It is a persistent attribute.	* @param  nm  Name of this object.	*/	public abstract void setName(String nm);	//-----------------------------	// Container methods. Override in subclasses if appropriate.	//-----------------------------		public void setEntityContext(EntityContext ctx)	{ 		m_ctx = ctx;	}	public EntityContext getEntityContext()	{		return m_ctx;	}	public void ejbActivate() 	{ 		s_logger.log( Level.FINEST, "Activating "+getClass().getName());	}	public void ejbPassivate() 	{ 		s_logger.log( Level.FINEST, "Passivating "+getClass().getName());	}	public void ejbLoad() 	{ 		s_logger.log( Level.FINEST, "Loading "+getClass().getName());	}	public void ejbStore()	{ 		s_logger.log( Level.FINEST, "Storing "+getClass().getName());	}	public void ejbRemove() 	{ 		s_logger.log( Level.FINEST, "Removing "+getClass().getName());	}		private EntityContext m_ctx;	private static Logger s_logger = Logger.getLogger(AbstractEntityBean.class.getName());}

⌨️ 快捷键说明

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