KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > olstore > entity > PictureBean


1 /**
2  * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17  * USA
18  *
19  * Component of: Red Hat Application Server
20  *
21  * Initial Developers: Aizaz Ahmed
22  * Vivek Lakshmanan
23  * Andrew Overholt
24  * Matthew Wringe
25  *
26  */

27
28 /*
29  * PictureBean.java
30  *
31  * Created on Aug 16, 2004
32  *
33  */

34 package olstore.entity;
35
36 //import java.lang.Integer;
37
import javax.ejb.EntityBean;
38
39 /**
40  * @ejb.bean name="Picture"
41  * description="This bean is used to store picture information."
42  * type="CMP"
43  * schema="olstore_picture"
44  * reentrant="false"
45  * cmp-version="2.x"
46  * view-type="local"
47  * local-jndi-name="PictureLocal_L"
48  *
49  * @ejb.relation
50  * name="Item-Picture"
51  * role-name="Pictures-belong-to-Items"
52  * cascade-delete="yes"
53  * target-ejb="Item"
54  * target-multiple="yes"
55  *
56  * @ejb.transaction
57  * type="Required"
58  *
59  * @ejb:pk
60  * class="java.lang.Object"
61  * generate="false"
62  *
63  *--
64  * This is needed for JOnAS.
65  * If you are not using JOnAS you can safely remove the tags below.
66  * @jonas.bean ejb-name="Picture"
67  * jndi-name="PictureLocal"
68  * @jonas.jdbc-mapping jndi-name="jdbc_1" jdbc-table-name="olstore_picture"
69  * --
70  *
71  * @ejb.persistence
72  *
73  * @ejb.finder
74  * query="SELECT OBJECT(a) FROM olstore_picture as a"
75  * signature="java.util.Collection findAll()"
76  *
77  *--
78  * This is needed for JOnAS.
79  * If you are not using JOnAS you can safely remove the tags below.
80  * @jonas.finder-method-jdbc-mapping method-name="findAll"
81  * jdbc-where-clause=""
82  * @jonas.jdbc-mapping jndi-name="jdbc_1"
83  * jdbc-table-name="olstore_picture"
84  *
85  *--
86  *
87  **/

88
89 public abstract class PictureBean implements EntityBean {
90     
91     /**
92      * The ejbCreate method.
93      *
94      * @ejb.create-method
95      */

96     
97     public java.lang.String ejbCreate(String location, int priority) throws javax.ejb.CreateException{
98         
99         // Init here the bean fields
100
ejbCreate( location, "", priority );
101         return null;
102     }
103     
104     /**
105      * The ejbCreate method when priority is empty (or null).
106      *
107      * @ejb.create-method
108      */

109     public java.lang.String ejbCreate(String location, String altText, String priority)
110     throws javax.ejb.CreateException {
111         int priorityInt = 100;
112         if ( priority != null && ! priority.equals("") ) {
113             priorityInt = Integer.parseInt ( priority );
114         }
115         
116         return ejbCreate (location, altText, priorityInt);
117     }
118     
119     /**
120      * The ejbCreate method.
121      *
122      * @ejb.create-method
123      */

124     public java.lang.String ejbCreate(String location, String altText, int priority)
125     throws javax.ejb.CreateException {
126         setLocation (location);
127         setText (altText);
128         setPriority(priority);
129         return null;
130     }
131     
132     /**
133      * The container invokes this method immediately after it calls ejbCreate.
134      *
135      */

136     public void ejbPostCreate(String location, int priority) throws javax.ejb.CreateException {
137     }
138     
139     public void ejbPostCreate(String location, String altText, String priority) throws javax.ejb.CreateException {
140     }
141     
142     public void ejbPostCreate(String location, String altText, int priority) throws javax.ejb.CreateException {
143     }
144     
145     /**
146      * Returns the location
147      * @return the location
148      *
149      * @ejb.persistent-field
150      * @ejb.persistence
151      * column-name="location"
152      * sql-type="VARCHAR"
153      *
154      * @ejb.interface-method
155      *
156      */

157     public abstract java.lang.String getLocation();
158     
159     /**
160      * Sets the location
161      *
162      * @param java.lang.String the new location value
163      *
164      * @ejb.interface-method
165      */

166     public abstract void setLocation(java.lang.String location);
167     
168     /**
169      * Returns the text
170      * @return the text
171      *
172      * @ejb.persistent-field
173      * @ejb.persistence
174      * column-name="text"
175      * sql-type="VARCHAR"
176      *
177      * @ejb.interface-method
178      *
179      */

180     public abstract java.lang.String getText();
181     
182     /**
183      * Sets the text
184      *
185      * @param java.lang.String the new text value
186      *
187      * @ejb.interface-method
188      */

189     public abstract void setText(java.lang.String text);
190     
191     /**
192      * Returns the priority
193      * @return the priority
194      *
195      * @ejb.persistent-field
196      * @ejb.persistence
197      * column-name="priority"
198      * sql-type="INTEGER"
199      *
200      * @ejb.interface-method
201      *
202      */

203     public abstract int getPriority();
204     
205     /**
206      * Sets the priority
207      *
208      * @param int the new priority value
209      *
210      * @ejb.interface-method
211      */

212     public abstract void setPriority(int priority);
213     
214 }
215
Popular Tags