Source Code Cross Referenced for UserBean.java in  » J2EE » JOnAS-4.8.6 » olstore » entity » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » JOnAS 4.8.6 » olstore.entity 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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 javax.ejb.EntityBean;
029:
030:        import olstore.entity.AddressLocal;
031:
032:        import java.util.Collection;
033:
034:        /**
035:         * @ejb.bean name="User"
036:         *  description="This bean is used to store information about the user."
037:         *	type="CMP"
038:         *  schema="olstore_user"
039:         *  primkey-field="username"
040:         *  reentrant="false"
041:         *  cmp-version="2.x"
042:         *  view-type="local"
043:         *  local-jndi-name="UserLocal_L"
044:         * 
045:         * @ejb.relation
046:         *  name="Friend-User"
047:         *  role-name"User-can-be-a-friend"
048:         *  target-ejb="Friend"
049:         * 
050:         *  
051:         * @ejb.transaction
052:         *  type="Required"
053:         * 
054:         *--
055:         * This is needed for JOnAS.
056:         * If you are not using JOnAS you can safely remove the tags below.
057:         * @jonas.bean ejb-name="User"
058:         * jndi-name="UserLocal"
059:         * @jonas.jdbc-mapping  jndi-name="jdbc_1" jdbc-table-name="olstore_user" 
060:         * --
061:         * 
062:         *  @ejb.persistence 
063:         * 
064:         * @ejb.finder 
065:         *    query="SELECT OBJECT(a) FROM olstore_user as a"  
066:         *    signature="java.util.Collection findAll()"  
067:         * 
068:         * @ejb.finder 
069:         *    query="SELECT OBJECT(a) FROM olstore_user as a WHERE a.username = ?1"  
070:         *    signature="olstore.entity.UserLocal findByUsername(java.lang.String username)"
071:         * 
072:         * @ejb.finder 
073:         *    query="SELECT f.user FROM olstore_user u, IN (u.friends) f WHERE u.username = ?1 AND ?2 MEMBER OF f.user.purchased"  
074:         *    signature="java.util.Collection findByFriendsOfPurchased(java.lang.String username, olstore.entity.ItemLocal purchasedItem)"
075:         * 
076:         * 
077:         * 
078:         *--
079:         * This is needed for JOnAS.
080:         * If you are not using JOnAS you can safely remove the tags below.
081:         * @jonas.bean ejb-name="User"
082:         * @jonas.finder-method-jdbc-mapping  method-name="findAll"
083:         *	jdbc-where-clause=""
084:         * @jonas.jdbc-mapping  jndi-name="jdbc_1"
085:         *	jdbc-table-name="olstore_user"
086:         * 
087:         *--
088:         *  
089:         **/
090:
091:        public abstract class UserBean implements  EntityBean {
092:
093:            /**
094:             * The  ejbCreate method.
095:             * 
096:             * @ejb.create-method 
097:             */
098:            public java.lang.String ejbCreate(String username, String role,
099:                    String lname, String fname, String emailAdd,
100:                    String phoneNum, String passwd)
101:                    throws javax.ejb.CreateException {
102:                setUsername(username);
103:                setLname(lname);
104:                setFname(fname);
105:                setEmailAdd(emailAdd);
106:                setPhoneNum(phoneNum);
107:                setPasswd(passwd);
108:                setRole(role);
109:                return null;
110:            }
111:
112:            /**
113:             * The container invokes this method immediately after it calls ejbCreate.
114:             * 
115:             */
116:            public void ejbPostCreate(String username, String role,
117:                    String lname, String fname, String emailAdd,
118:                    String phoneNum, String passwd)
119:                    throws javax.ejb.CreateException {
120:            }
121:
122:            /**
123:             * Returns the username
124:             * @return the username
125:             * 
126:             * @ejb.persistent-field 
127:             * @ejb.persistence
128:             *    column-name="username"
129:             *     sql-type="VARCHAR"
130:             * @ejb.pk-field 
131:             * @ejb.interface-method
132:             * 
133:             */
134:            public abstract java.lang.String getUsername();
135:
136:            /**
137:             * Sets the username
138:             * 
139:             * @param java.lang.String the new username value
140:             * 
141:             * @ejb.interface-method
142:             */
143:            public abstract void setUsername(java.lang.String username);
144:
145:            /**
146:             * Returns the fname
147:             * @return the fname
148:             * 
149:             * @ejb.persistent-field 
150:             * @ejb.persistence
151:             *    column-name="fname"
152:             *     sql-type="VARCHAR"
153:             *  
154:             * @ejb.interface-method
155:             * 
156:             */
157:            public abstract java.lang.String getFname();
158:
159:            /**
160:             * Sets the fname
161:             * 
162:             * @param java.lang.String the new fname value
163:             * 
164:             * @ejb.interface-method
165:             */
166:            public abstract void setFname(java.lang.String fname);
167:
168:            /**
169:             * Returns the lname
170:             * @return the lname
171:             * 
172:             * @ejb.persistent-field 
173:             * @ejb.persistence
174:             *    column-name="lname"
175:             *     sql-type="VARCHAR"
176:             *  
177:             * @ejb.interface-method
178:             * 
179:             */
180:            public abstract java.lang.String getLname();
181:
182:            /**
183:             * Sets the lname
184:             * 
185:             * @param java.lang.String the new lname value
186:             * 
187:             * @ejb.interface-method
188:             */
189:            public abstract void setLname(java.lang.String lname);
190:
191:            /**
192:             * Returns the emailAdd
193:             * @return the emailAdd
194:             * 
195:             * @ejb.persistent-field 
196:             * @ejb.persistence
197:             *    column-name="emailAdd"
198:             *     sql-type="VARCHAR"
199:             *  
200:             * @ejb.interface-method
201:             * 
202:             */
203:            public abstract java.lang.String getEmailAdd();
204:
205:            /**
206:             * Sets the emailAdd
207:             * 
208:             * @param java.lang.String the new emailAdd value
209:             * 
210:             * @ejb.interface-method
211:             */
212:            public abstract void setEmailAdd(java.lang.String emailAdd);
213:
214:            /**
215:             * Returns the phoneNum
216:             * @return the phoneNum
217:             * 
218:             * @ejb.persistent-field 
219:             * @ejb.persistence
220:             *    column-name="phoneNum"
221:             *     sql-type="VARCHAR"
222:             *  
223:             * @ejb.interface-method
224:             * 
225:             */
226:            public abstract java.lang.String getPhoneNum();
227:
228:            /**
229:             * Sets the phoneNum
230:             * 
231:             * @param java.lang.String the new phoneNum value
232:             * 
233:             * @ejb.interface-method
234:             */
235:            public abstract void setPhoneNum(java.lang.String phoneNum);
236:
237:            /**
238:             * Returns the passwd
239:             * @return the passwd
240:             * 
241:             * @ejb.persistent-field 
242:             * @ejb.persistence
243:             *    column-name="passwd"
244:             *     sql-type="VARCHAR"
245:             *  
246:             * @ejb.interface-method
247:             * 
248:             */
249:            public abstract java.lang.String getPasswd();
250:
251:            /**
252:             * Sets the passwd
253:             * 
254:             * @param java.lang.String the new passwd value
255:             * 
256:             * @ejb.interface-method
257:             */
258:            public abstract void setPasswd(java.lang.String passwd);
259:
260:            /**
261:             * Returns the role
262:             * @return the role
263:             * 
264:             * @ejb.persistent-field 
265:             * @ejb.persistence
266:             *    column-name="role"
267:             *     sql-type="VARCHAR"
268:             *  
269:             * @ejb.interface-method
270:             * 
271:             */
272:            public abstract java.lang.String getRole();
273:
274:            /**
275:             * Sets the role
276:             * 
277:             * @param java.lang.String the new role value
278:             * 
279:             * @ejb.interface-method
280:             */
281:            public abstract void setRole(java.lang.String role);
282:
283:            /**
284:             * Returns the User's Address
285:             * 
286:             * @return the User's Address 
287:             *  
288:             * @ejb.interface-method
289:             * 
290:             * @ejb.relation
291:             *  name="User-Address"
292:             *  role-name="User-has-an-Address"
293:             *  target-ejb="Address"
294:             * 
295:             */
296:
297:            public abstract AddressLocal getAddress();
298:
299:            /**
300:             * 
301:             * @param userAddress
302:             * 
303:             * @ejb.interface-method
304:             * 
305:             */
306:
307:            public abstract void setAddress(AddressLocal userAddress);
308:
309:            /**
310:             * Returns the User's Orders
311:             * 
312:             * @return the User's Orders 
313:             *  
314:             * @ejb.interface-method
315:             * 
316:             * @ejb.relation
317:             *  name="User-Order"
318:             *  role-name="User-has-many-Orders"
319:             *  target-ejb="Order"
320:             * 
321:             */
322:
323:            public abstract Collection getOrders();
324:
325:            public abstract void setOrders(Collection orders);
326:
327:            /**
328:             * Returns the User's Friends
329:             * 
330:             * @return the User's Friends 
331:             *  
332:             * @ejb.interface-method
333:             * 
334:             * @ejb.relation
335:             *  name="User-Friend"
336:             *  role-name="User-has-many-Friends"
337:             *  target-ejb="Friend"
338:             *  target-multiple="yes"
339:             *
340:             */
341:
342:            public abstract Collection getFriends();
343:
344:            /**
345:             * Sets the User's friends
346:             * 
347:             * @param java.util.Collection friends
348:             * 
349:             * @ejb.interface-method
350:             *
351:             *  @ejb.transaction
352:             *  type="Required"
353:             *
354:             */
355:
356:            public abstract void setFriends(Collection friends);
357:
358:            /**
359:             * Returns the User's purchased Items
360:             * 
361:             * @return the User's purchased Items
362:             *  
363:             * @ejb.interface-method
364:             * 
365:             * @ejb.relation
366:             *  name="User-Item"
367:             *  role-name="User-has-many-Items"
368:             *  target-ejb="Item"
369:             *  target-multiple="yes"
370:             *
371:             */
372:
373:            public abstract Collection getPurchased();
374:
375:            /**
376:             * Sets the purchased items
377:             * 
378:             * @param java.util.Collection the User's purchased items
379:             * 
380:             * @ejb.interface-method
381:             */
382:
383:            public abstract void setPurchased(Collection purchased);
384:
385:            /**
386:             * 
387:             * @return
388:             * 
389:             * @ejb.interface-method
390:             * 
391:             */
392:
393:            public boolean isAdmin() {
394:                String role = getRole();
395:                if (role != null && !role.equals("") && role.equals("admin")) {
396:                    return true;
397:                } else {
398:                    return false;
399:                }
400:            }
401:
402:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.