Source Code Cross Referenced for PersonImpl.java in  » J2EE » Enhydra-Demos » transactionsDiscRack » 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 » J2EE » Enhydra Demos » transactionsDiscRack.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: PersonImpl.java,v 1.1 2006-09-11 12:44:39 sinisa Exp $
022:         */
023:
024:        package transactionsDiscRack.business.person;
025:
026:        import transactionsDiscRack.data.person.*;
027:        import transactionsDiscRack.spec.Person;
028:        import transactionsDiscRack.business.TransactionsDiscRackBusinessException;
029:
030:        import com.lutris.appserver.server.sql.DBTransaction;
031:        import com.lutris.appserver.server.sql.DatabaseManagerException;
032:        import com.lutris.dods.builder.generator.query.DataObjectException;
033:        import org.enhydra.dods.exceptions.AssertionDataObjectException;
034:
035:        /**
036:         * Represents a person.
037:         */
038:        public class PersonImpl implements  Person {
039:            /**
040:             * The DO of the Person.
041:             */
042:            protected String handle = null;
043:
044:            protected String login = null;
045:
046:            protected String password = null;
047:
048:            protected String firstName = null;
049:
050:            protected String lastName = null;
051:
052:            /**
053:             * The public constructor.
054:             */
055:            public PersonImpl() {
056:            }
057:
058:            /**
059:             * The public constructor
060:             * 
061:             * @param thePerson
062:             *            The data object of the person.
063:             */
064:            public PersonImpl(PersonDO thePerson)
065:                    throws TransactionsDiscRackBusinessException {
066:                try {
067:                    handle = thePerson.get_Handle();
068:                    login = thePerson.getLogin();
069:                    password = thePerson.getPassword();
070:                    firstName = thePerson.getFirstname();
071:                    lastName = thePerson.getLastname();
072:                } catch (DatabaseManagerException ex) {
073:                    throw new TransactionsDiscRackBusinessException(
074:                            "Error creating Person", ex);
075:                } catch (DataObjectException ex) {
076:                    throw new TransactionsDiscRackBusinessException(
077:                            "Error creating Person", ex);
078:                }
079:            }
080:
081:            /**
082:             * Gets the object id for the person
083:             * 
084:             * @return the object id.
085:             * @exception DiscRackBusinessException
086:             *                if an error occurs retrieving data (usually due to an
087:             *                underlying data layer error).
088:             */
089:            public String getHandle() {
090:                return handle;
091:            }
092:
093:            /**
094:             * Gets the login name for the person
095:             * 
096:             * @return the login name.
097:             * @exception DiscRackBusinessException
098:             *                if an error occurs retrieving data (usually due to an
099:             *                underlying data layer error).
100:             */
101:            public String getLogin() {
102:                return login;
103:            }
104:
105:            /**
106:             * Gets the password for the person
107:             * 
108:             * @return the password.
109:             * @exception DiscRackBusinessException
110:             *                if an error occurs retrieving data (usually due to an
111:             *                underlying data layer error).
112:             */
113:            public String getPassword() {
114:                return password;
115:            }
116:
117:            /**
118:             * Gets the firstname for the person
119:             * 
120:             * @return the firstname.
121:             * @exception DiscRackBusinessException
122:             *                if an error occurs retrieving data (usually due to an
123:             *                underlying data layer error).
124:             */
125:            public String getFirstname() {
126:                return firstName;
127:            }
128:
129:            /**
130:             * Gets the lastname for the person
131:             * 
132:             * @return the lastname.
133:             * @exception DiscRackBusinessException
134:             *                if an error occurs retrieving data (usually due to an
135:             *                underlying data layer error).
136:             */
137:            public String getLastname() {
138:                return lastName;
139:            }
140:
141:            /**
142:             * Sets the login name for the person.
143:             * 
144:             * @param login
145:             *            login name.
146:             * @exception DiscRackBusinessException
147:             *                if an error occurs setting the data (usually due to an
148:             *                underlying data layer error).
149:             */
150:            public void setLogin(String login) {
151:                this .login = login;
152:            }
153:
154:            /**
155:             * Sets the password for the person.
156:             * 
157:             * @param password
158:             * @exception DiscRackBusinessException
159:             *                if an error occurs setting the data (usually due to an
160:             *                underlying data layer error).
161:             */
162:            public void setPassword(String password) {
163:                this .password = password;
164:            }
165:
166:            /**
167:             * Sets the firstname for the person.
168:             * 
169:             * @param firstname
170:             * @exception DiscRackBusinessException
171:             *                if an error occurs setting the data (usually due to an
172:             *                underlying data layer error).
173:             */
174:            public void setFirstname(String firstname) {
175:                this .firstName = firstname;
176:            }
177:
178:            /**
179:             * Sets the lastname for the person.
180:             * 
181:             * @param lastname
182:             * @exception DiscRackBusinessException
183:             *                if an error occurs setting the data (usually due to an
184:             *                underlying data layer error).
185:             */
186:            public void setLastname(String lastname) {
187:                this .lastName = lastname;
188:            }
189:
190:            /**
191:             * Commits all changes to the database.
192:             * 
193:             * @exception DiscRackBusinessException
194:             *                if an error occurs retrieving data (usually due to an
195:             *                underlying data layer error).
196:             */
197:            public void save(DBTransaction transaction)
198:                    throws TransactionsDiscRackBusinessException,
199:                    AssertionDataObjectException {
200:                try {
201:                    PersonDO myDO = PersonDO.createExisting(this .handle,
202:                            transaction);
203:                    if (myDO == null) {
204:                        // person creation
205:                        myDO = PersonDO.createVirgin(transaction);
206:                    }
207:
208:                    myDO.setLogin(this .login);
209:                    myDO.setPassword(this .password);
210:                    myDO.setFirstname(this .firstName);
211:                    myDO.setLastname(this .lastName);
212:
213:                    myDO.save(transaction);
214:                } catch (AssertionDataObjectException ex) {
215:                    throw new AssertionDataObjectException(
216:                            "Read-only table: DML operations not allowed", ex);
217:                } catch (Exception ex) {
218:                    throw new TransactionsDiscRackBusinessException(
219:                            "Error saving person", ex);
220:                }
221:            }
222:
223:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.