Source Code Cross Referenced for Session2Bean.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » jtests » beans » relation » lcp » 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 » org.objectweb.jonas.jtests.beans.relation.lcp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.objectweb.jonas.jtests.beans.relation.lcp;
002:
003:        import javax.naming.Context;
004:        import javax.naming.InitialContext;
005:
006:        public class Session2Bean implements  javax.ejb.SessionBean {
007:
008:            // Variables
009:            public javax.ejb.SessionContext ejbctx;
010:
011:            // Methods
012:
013:            /*****************************************************************************
014:             *
015:             * No args constructor
016:             *
017:             *****************************************************************************/
018:            public Session2Bean() {
019:            }
020:
021:            /*****************************************************************************
022:             *
023:             * No args creator
024:             *
025:             *****************************************************************************/
026:            public void ejbCreate() {
027:            }
028:
029:            /*****************************************************************************
030:             *
031:             * Remove bean
032:             *
033:             *****************************************************************************/
034:            public void ejbRemove() {
035:            }
036:
037:            /*****************************************************************************
038:             *
039:             * Passivate bean
040:             *
041:             *****************************************************************************/
042:            public void ejbPassivate() {
043:
044:            }
045:
046:            /*****************************************************************************
047:             *
048:             * Activate bean
049:             *
050:             *****************************************************************************/
051:            public void ejbActivate() {
052:
053:            }
054:
055:            /*****************************************************************************
056:             *
057:             * Sets the bean session context
058:             *
059:             *****************************************************************************/
060:            public void setSessionContext(javax.ejb.SessionContext ctx) {
061:                ejbctx = ctx;
062:
063:            }
064:
065:            public String getSimpleChildren(String id) {
066:                try {
067:                    Context ic = new InitialContext();
068:                    SIMPLEPARENTLocalHome home = (SIMPLEPARENTLocalHome) ic
069:                            .lookup("java:comp/env/ejb/SIMPLEPARENT-local");
070:                    SIMPLEPARENTPK pk = new SIMPLEPARENTPK();
071:                    pk.spPkId = id;
072:                    SIMPLEPARENTLocal bean = home.findByPrimaryKey(pk);
073:                    if (bean != null) {
074:                        java.util.Collection childs = bean
075:                                .getSimpleparentSimplechild();
076:                        if (childs != null) {
077:                            StringBuffer ret = new StringBuffer();
078:                            //ret.append("Parent desc:" + bean.getSpDesc() + "<br>");
079:                            int ct = 1;
080:                            SIMPLECHILDLocal bean2 = null;
081:                            java.util.Iterator i = childs.iterator();
082:                            while (i.hasNext()) {
083:                                bean2 = (SIMPLECHILDLocal) i.next();
084:                                //ret.append("Child" + ct + ":" + bean2.getScDesc() + "<br>");
085:                                if (ct != 1) {
086:                                    ret.append(",");
087:                                }
088:                                ret.append(bean2.getScDesc());
089:                                ct++;
090:                            }
091:                            return ret.toString();
092:                        } else {
093:                            return "Unable to find parent & child details (null childs bean)";
094:                        }
095:                    } else {
096:                        return "Unable to find parent & child details (null parent bean)";
097:                    }
098:                } catch (Exception ne) {
099:                    return "Error: Unable to find parent & child ("
100:                            + ne.getClass().getName() + ") - "
101:                            + ne.getMessage();
102:                }
103:
104:            }
105:
106:            public String getChildParent(String id) {
107:                try {
108:                    Context ic = new InitialContext();
109:                    SIMPLECHILDLocalHome home = (SIMPLECHILDLocalHome) ic
110:                            .lookup("java:comp/env/ejb/SIMPLECHILD-local");
111:                    SIMPLECHILDPK pk = new SIMPLECHILDPK();
112:                    pk.scPkId = id;
113:                    SIMPLECHILDLocal bean = home.findByPrimaryKey(pk);
114:                    if (bean != null) {
115:                        SIMPLEPARENTLocal par = bean
116:                                .getSimplechildSimpleparent();
117:                        StringBuffer ret = new StringBuffer();
118:                        if (par != null) {
119:                            //ret.append("Child desc:" + bean.getScDesc() + "<br>");
120:                            //ret.append("Parent desc:" + par.getSpDesc() + "<br>");
121:                            ret.append(par.getSpDesc());
122:                        }
123:                        return ret.toString();
124:                    } else {
125:                        return "Unable to find parent of child details (null child bean)";
126:                    }
127:                } catch (Exception ne) {
128:                    return "Error: Unable to find parent & child ("
129:                            + ne.getClass().getName() + ") - "
130:                            + ne.getMessage();
131:                }
132:
133:            }
134:
135:        }
w___w_w.__j_a_v_a_2s__.___c_o___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.