Source Code Cross Referenced for Person.java in  » Database-ORM » tro-community-7.2-1 » jtaDiscRack » business » person » 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 » Database ORM » tro community 7.2 1 » jtaDiscRack.business.person 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Enhydra Java Application Server Project
003:         *
004:         * The contents of this file are subject to the Enhydra Public License
005:         * Version 1.1 (the "License"); you may not use this file except in
006:         * compliance with the License. You may obtain a copy of the License on
007:         * the Enhydra web site ( http://www.enhydra.org/ ).
008:         *
009:         * Software distributed under the License is distributed on an "AS IS"
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011:         * the License for the specific terms governing rights and limitations
012:         * under the License.
013:         *
014:         * The Initial Developer of the Enhydra Application Server is Lutris
015:         * Technologies, Inc. The Enhydra Application Server and portions created
016:         * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017:         * All Rights Reserved.
018:         *
019:         * Contributor(s):
020:         *
021:         * $Id: Person.java,v 1.1 2006/02/23 08:47:29 slobodan Exp $
022:         */
023:
024:        package jtaDiscRack.business.person;
025:
026:        import jtaDiscRack.business.JtaDiscRackBusinessException;
027:        import jtaDiscRack.business.XaTransactionSupport;
028:        import jtaDiscRack.data.person.*;
029:        import com.lutris.appserver.server.sql.DatabaseManagerException;
030:        import com.lutris.dods.builder.generator.query.DataObjectException;
031:        import org.enhydra.dods.exceptions.AssertionDataObjectException;
032:
033:        /**
034:         * Represents a person.
035:         */
036:        public class Person extends XaTransactionSupport {
037:
038:            /*
039:             * Person attributes
040:             */
041:            private String handle = null;
042:
043:            private String firstname = null;
044:
045:            private String lastname = null;
046:
047:            private String login = null;
048:
049:            private String password = null;
050:
051:            /**
052:             * The public constructor.
053:             */
054:            public Person() throws JtaDiscRackBusinessException {
055:
056:            }
057:
058:            /** The public constructor
059:             *
060:             * @param thePerson. The data object of the person.
061:             */
062:            public Person(PersonDO thePerson)
063:                    throws JtaDiscRackBusinessException {
064:                try {
065:                    handle = thePerson.get_Handle();
066:                    firstname = thePerson.getFirstname();
067:                    lastname = thePerson.getLastname();
068:                    login = thePerson.getLogin();
069:                    password = thePerson.getPassword();
070:                } catch (DatabaseManagerException dbme) {
071:                    dbme.printStackTrace();
072:                    throw new JtaDiscRackBusinessException(
073:                            "Error creating Person", dbme);
074:                } catch (DataObjectException doe) {
075:                    doe.printStackTrace();
076:                    throw new JtaDiscRackBusinessException(
077:                            "Error creating Person", doe);
078:                }
079:            }
080:
081:            /**
082:             * Gets the object id for the person
083:             *
084:             * @return the object id.
085:             * @exception DiscRackBusinessException if an error occurs
086:             *   retrieving data (usually due to an underlying data layer
087:             *   error).
088:             */
089:            public String getHandle() throws JtaDiscRackBusinessException {
090:                return handle;
091:            }
092:
093:            /**
094:             * Gets the login name for the person
095:             *
096:             * @return the login name.
097:             * @exception DiscRackBusinessException if an error occurs
098:             *   retrieving data (usually due to an underlying data layer
099:             *   error).
100:             */
101:            public String getLogin() throws JtaDiscRackBusinessException {
102:                return login;
103:            }
104:
105:            /**
106:             * Gets the password for the person
107:             *
108:             * @return the password.
109:             * @exception DiscRackBusinessException if an error occurs
110:             *   retrieving data (usually due to an underlying data layer
111:             *   error).
112:             */
113:            public String getPassword() throws JtaDiscRackBusinessException {
114:                return password;
115:            }
116:
117:            /**
118:             * Gets the firstname for the person
119:             *
120:             * @return the firstname.
121:             * @exception DiscRackBusinessException if an error occurs
122:             *   retrieving data (usually due to an underlying data layer
123:             *   error).
124:             */
125:            public String getFirstname() throws JtaDiscRackBusinessException {
126:                return firstname;
127:            }
128:
129:            /**
130:             * Gets the lastname for the person
131:             *
132:             * @return the lastname.
133:             * @exception DiscRackBusinessException if an error occurs
134:             *   retrieving data (usually due to an underlying data layer
135:             *   error).
136:             */
137:            public String getLastname() throws JtaDiscRackBusinessException {
138:                return lastname;
139:            }
140:
141:            /**
142:             * Sets the login name for the person.
143:             *
144:             * @param the login name.
145:             * @exception DiscRackBusinessException if an error occurs
146:             *   setting the data (usually due to an underlying data layer
147:             *   error).
148:             */
149:            public void setLogin(String login)
150:                    throws JtaDiscRackBusinessException {
151:                this .login = login;
152:            }
153:
154:            /**
155:             * Sets the password for the person.
156:             *
157:             * @param the password.
158:             * @exception DiscRackBusinessException if an error occurs
159:             *   setting the data (usually due to an underlying data layer
160:             *   error).
161:             */
162:            public void setPassword(String password)
163:                    throws JtaDiscRackBusinessException {
164:                this .password = password;
165:            }
166:
167:            /**
168:             * Sets the firstname for the person.
169:             *
170:             * @param the firstname.
171:             * @exception DiscRackBusinessException if an error occurs
172:             *   setting the data (usually due to an underlying data layer
173:             *   error).
174:             */
175:            public void setFirstname(String firstname)
176:                    throws JtaDiscRackBusinessException {
177:                this .firstname = firstname;
178:            }
179:
180:            /**
181:             * Sets the lastname for the person.
182:             *
183:             * @param the lastname.
184:             * @exception DiscRackBusinessException if an error occurs
185:             *   setting the data (usually due to an underlying data layer
186:             *   error).
187:             */
188:            public void setLastname(String lastname)
189:                    throws JtaDiscRackBusinessException {
190:                this .lastname = lastname;
191:            }
192:
193:            /**
194:             * Commits all changes to the database.
195:             *
196:             * @exception DiscRackBusinessException if an error occurs
197:             *   retrieving data (usually due to an underlying data layer
198:             *   error).
199:             */
200:            public void save() throws JtaDiscRackBusinessException,
201:                    AssertionDataObjectException {
202:
203:                initTransaction();
204:
205:                boolean doCommit = true;
206:
207:                try {
208:                    PersonDO myDO = PersonDO.createExisting(this .handle);
209:                    if (myDO == null) {
210:                        // person creation
211:                        myDO = PersonDO.createVirgin();
212:                    }
213:
214:                    myDO.setLogin(this .login);
215:                    myDO.setPassword(this .password);
216:                    myDO.setFirstname(this .firstname);
217:                    myDO.setLastname(this .lastname);
218:
219:                    myDO.save();
220:                } catch (AssertionDataObjectException ex) {
221:                    doCommit = false;
222:                    ex.printStackTrace();
223:                    throw new AssertionDataObjectException(
224:                            "DML opertions not allowed.", ex);
225:                } catch (Exception ex) {
226:                    doCommit = false;
227:                    ex.printStackTrace();
228:                    throw new JtaDiscRackBusinessException(
229:                            "Error saving person", ex);
230:                } finally {
231:                    if (doCommit) {
232:                        commitTransaction();
233:                    } else {
234:                        rollbackTransaction();
235:                    }
236:                }
237:            }
238:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.