📄 answerchoicebean.java
字号:
/* * 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;import javax.ejb.*;import com.cyberdemia.ejb.BaseEntityBean;/** * AnswerChoiceBean represents one of the choices in a * multiple-choice question. * * @ejb.bean name="AnswerChoiceBean" * type="CMP" * view-type="local" * schema="AnswerChoice" * cmp-version="2.x" * primkey-field="id" * local-jndi-name="ejb/LocalAnswerChoice" * * @ejb.util generate="physical" * @ejb.interface local-class="com.cyberdemia.school.LocalAnswerChoice" local-extends="javax.ejb.EJBLocalObject" * @ejb.home local-class="com.cyberdemia.school.LocalAnswerChoiceHome" local-extends="javax.ejb.EJBLocalHome" * @ejb.pk class="java.lang.Integer" * @ejb.persistence table-name="AnswerChoice" * * @jboss.method-attributes pattern="get*" read-only="true" * * @jboss.unknown-pk class="java.lang.Integer" auto-increment="true" jdbc-type="INTEGER" sql-type="INTEGER" * @jboss.entity-command name="mysql-get-generated-keys" * @jboss.container-configuration name="CyberDemia Optimized Standalone CMP" * * @author Alexander Yap * @version $Revision: 1.5 $ at $Date: 2004/06/20 10:17:44 $ by $Author: alexycyap $ */public abstract class AnswerChoiceBean extends BaseEntityBean{ /** * Gets the ID (primary key) of this answer choice. * * @ejb.persistence * @ejb.pk-field * @ejb.interface-method * @jboss.persistence auto-increment="true" * * @return ID of this answer choice. */ public abstract Integer getId(); /** * Sets the ID (primary key) of this answer choice. * @param id ID of this answer choice. */ public abstract void setId(Integer id); /** * Gets index of this answer choice within the owner Question. * * @ejb.interface-method * @ejb.persistence * * @return Index of this answer choice. */ public abstract int getAnswerIndex(); /** * Sets index of this answer choice within the owner Question. * * @ejb.interface-method * * @param index Index of this answer choice. */ public abstract void setAnswerIndex(int index); /** * Gets the text of this answer choice. * * @ejb.interface-method * @ejb.persistence * * @return Text of this answer choice. */ public abstract String getAnswerText(); /** * Sets the text of this answer choice. * * @ejb.interface-method * * @param text Text of this answer choice. */ public abstract void setAnswerText(String text); /** * Gets the question that this answer choice belongs to. * * @ejb.interface-method * @ejb.relation name="question-answerChoices" role-name="answerChoice-belongs-to-question" target-ejb="QuestionBean" target-role-name="question-has-answerChoices" target-multiple="yes" cascade-delete="yes" * @jboss.relation fk-constraint="yes" related-pk-field="id" fk-column="questionId" * * @return The question unique Id. */ public abstract LocalQuestion getQuestion(); /** * Sets the Question that this answer choice belongs to. * * @param quesId The question unique Id. */ public abstract void setQuestion(LocalQuestion quesId); //----------------------------- // Create methods. //----------------------------- /** * Creates an AnswerChoice. * * @ejb.create-method view-type="local" */ public Integer ejbCreate( int index, String text ) throws CreateException { // Note : Unique ID is assigned by database auto-increment setAnswerIndex(index); setAnswerText(text); return null; } public void ejbPostCreate( int index, String text ) { // Nothing here }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -