001: /**
002: * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
017: * USA
018: *
019: * Component of: Red Hat Application Server
020: *
021: * Initial Developers: Aizaz Ahmed
022: * Vivek Lakshmanan
023: * Andrew Overholt
024: * Matthew Wringe
025: *
026: */package olstore.entity;
027:
028: //import java.lang.Integer;
029: import javax.ejb.EntityBean;
030:
031: /**
032: * @ejb.bean name="Picture"
033: * description="This bean is used to store picture information."
034: * type="CMP"
035: * schema="olstore_picture"
036: * reentrant="false"
037: * cmp-version="2.x"
038: * view-type="local"
039: * local-jndi-name="PictureLocal_L"
040: *
041: * @ejb.relation
042: * name="Item-Picture"
043: * role-name="Pictures-belong-to-Items"
044: * cascade-delete="yes"
045: * target-ejb="Item"
046: * target-multiple="yes"
047: *
048: * @ejb.transaction
049: * type="Required"
050: *
051: * @ejb:pk
052: * class="java.lang.Object"
053: * generate="false"
054: *
055: *--
056: * This is needed for JOnAS.
057: * If you are not using JOnAS you can safely remove the tags below.
058: * @jonas.bean ejb-name="Picture"
059: * jndi-name="PictureLocal"
060: * @jonas.jdbc-mapping jndi-name="jdbc_1" jdbc-table-name="olstore_picture"
061: * --
062: *
063: * @ejb.persistence
064: *
065: * @ejb.finder
066: * query="SELECT OBJECT(a) FROM olstore_picture as a"
067: * signature="java.util.Collection findAll()"
068: *
069: *--
070: * This is needed for JOnAS.
071: * If you are not using JOnAS you can safely remove the tags below.
072: * @jonas.finder-method-jdbc-mapping method-name="findAll"
073: * jdbc-where-clause=""
074: * @jonas.jdbc-mapping jndi-name="jdbc_1"
075: * jdbc-table-name="olstore_picture"
076: *
077: *--
078: *
079: **/
080:
081: public abstract class PictureBean implements EntityBean {
082:
083: /**
084: * The ejbCreate method.
085: *
086: * @ejb.create-method
087: */
088:
089: public java.lang.String ejbCreate(String location, int priority)
090: throws javax.ejb.CreateException {
091:
092: // Init here the bean fields
093: ejbCreate(location, "", priority);
094: return null;
095: }
096:
097: /**
098: * The ejbCreate method when priority is empty (or null).
099: *
100: * @ejb.create-method
101: */
102: public java.lang.String ejbCreate(String location, String altText,
103: String priority) throws javax.ejb.CreateException {
104: int priorityInt = 100;
105: if (priority != null && !priority.equals("")) {
106: priorityInt = Integer.parseInt(priority);
107: }
108:
109: return ejbCreate(location, altText, priorityInt);
110: }
111:
112: /**
113: * The ejbCreate method.
114: *
115: * @ejb.create-method
116: */
117: public java.lang.String ejbCreate(String location, String altText,
118: int priority) throws javax.ejb.CreateException {
119: setLocation(location);
120: setText(altText);
121: setPriority(priority);
122: return null;
123: }
124:
125: /**
126: * The container invokes this method immediately after it calls ejbCreate.
127: *
128: */
129: public void ejbPostCreate(String location, int priority)
130: throws javax.ejb.CreateException {
131: }
132:
133: public void ejbPostCreate(String location, String altText,
134: String priority) throws javax.ejb.CreateException {
135: }
136:
137: public void ejbPostCreate(String location, String altText,
138: int priority) throws javax.ejb.CreateException {
139: }
140:
141: /**
142: * Returns the location
143: * @return the location
144: *
145: * @ejb.persistent-field
146: * @ejb.persistence
147: * column-name="location"
148: * sql-type="VARCHAR"
149: *
150: * @ejb.interface-method
151: *
152: */
153: public abstract java.lang.String getLocation();
154:
155: /**
156: * Sets the location
157: *
158: * @param java.lang.String the new location value
159: *
160: * @ejb.interface-method
161: */
162: public abstract void setLocation(java.lang.String location);
163:
164: /**
165: * Returns the text
166: * @return the text
167: *
168: * @ejb.persistent-field
169: * @ejb.persistence
170: * column-name="text"
171: * sql-type="VARCHAR"
172: *
173: * @ejb.interface-method
174: *
175: */
176: public abstract java.lang.String getText();
177:
178: /**
179: * Sets the text
180: *
181: * @param java.lang.String the new text value
182: *
183: * @ejb.interface-method
184: */
185: public abstract void setText(java.lang.String text);
186:
187: /**
188: * Returns the priority
189: * @return the priority
190: *
191: * @ejb.persistent-field
192: * @ejb.persistence
193: * column-name="priority"
194: * sql-type="INTEGER"
195: *
196: * @ejb.interface-method
197: *
198: */
199: public abstract int getPriority();
200:
201: /**
202: * Sets the priority
203: *
204: * @param int the new priority value
205: *
206: * @ejb.interface-method
207: */
208: public abstract void setPriority(int priority);
209:
210: }
|