Source Code Cross Referenced for DiscImpl.java in  » J2EE » Enhydra-Demos » transactionsDiscRack » business » disc » 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.disc 
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: DiscImpl.java,v 1.1 2006-09-11 12:44:38 sinisa Exp $
022:         */
023:
024:        package transactionsDiscRack.business.disc;
025:
026:        import transactionsDiscRack.spec.*;
027:        import transactionsDiscRack.data.person.PersonDO;
028:        import transactionsDiscRack.data.disc.*;
029:
030:        import transactionsDiscRack.business.TransactionsDiscRackBusinessException;
031:
032:        import com.lutris.appserver.server.sql.DBTransaction;
033:        import com.lutris.appserver.server.sql.DatabaseManagerException;
034:        import com.lutris.dods.builder.generator.query.DataObjectException;
035:        import org.enhydra.dods.exceptions.AssertionDataObjectException;
036:
037:        /**
038:         * Represents a disc.
039:         */
040:        public class DiscImpl implements  Disc {
041:            /**
042:             * The attributes of the disc.
043:             */
044:
045:            protected String handle = null;
046:
047:            protected String title = null;
048:
049:            protected String artist = null;
050:
051:            protected String genre = null;
052:
053:            protected boolean isLiked = false;
054:
055:            protected String owner = null;
056:
057:            /**
058:             * The public constructor.
059:             */
060:            public DiscImpl() {
061:            }
062:
063:            /**
064:             * The protected constructor
065:             * 
066:             * @param theDisc
067:             *            The data object of the disc.
068:             */
069:            protected DiscImpl(DiscDO theDisc)
070:                    throws TransactionsDiscRackBusinessException {
071:                try {
072:                    handle = theDisc.get_Handle();
073:                    title = theDisc.getTitle();
074:                    artist = theDisc.getArtist();
075:                    genre = theDisc.getGenre();
076:                    isLiked = theDisc.getIsLiked();
077:                    owner = theDisc.getOwner().get_Handle();
078:                } catch (DataObjectException ex) {
079:                    throw new TransactionsDiscRackBusinessException(
080:                            "Error creating Disc", ex);
081:                } catch (DatabaseManagerException ex) {
082:                    throw new TransactionsDiscRackBusinessException(
083:                            "Error creating Disc", ex);
084:                }
085:            }
086:
087:            /**
088:             * Gets the object id for the disc
089:             * 
090:             * @return the object id.
091:             * @exception DiscRackBusinessException
092:             *                if an error occurs retrieving data (usually due to an
093:             *                underlying data layer error).
094:             */
095:            public String getHandle() {
096:                return handle;
097:            }
098:
099:            /**
100:             * Gets the title for the disc
101:             * 
102:             * @return the title.
103:             * @exception DiscRackBusinessException
104:             *                if an error occurs retrieving data (usually due to an
105:             *                underlying data layer error).
106:             */
107:            public String getTitle() {
108:                return title;
109:            }
110:
111:            /**
112:             * Gets the artist for the disc
113:             * 
114:             * @return the artist.
115:             * @exception DiscRackBusinessException
116:             *                if an error occurs retrieving data (usually due to an
117:             *                underlying data layer error).
118:             */
119:            public String getArtist() {
120:                return artist;
121:            }
122:
123:            /**
124:             * Gets the genre for the disc
125:             * 
126:             * @return the genre.
127:             * @exception DiscRackBusinessException
128:             *                if an error occurs retrieving data (usually due to an
129:             *                underlying data layer error).
130:             */
131:            public String getGenre() {
132:                return genre;
133:            }
134:
135:            /**
136:             * Gets the preference for the disc
137:             * 
138:             * @return true if like the disc, false if not
139:             * @exception DiscRackBusinessException
140:             *                if an error occurs retrieving data (usually due to an
141:             *                underlying data layer error).
142:             */
143:            public boolean isLiked() {
144:                return isLiked;
145:            }
146:
147:            /**
148:             * Sets the title for the disc.
149:             * 
150:             * @param title
151:             * @exception DiscRackBusinessException
152:             *                if an error occurs setting the data (usually due to an
153:             *                underlying data layer error).
154:             */
155:            public void setTitle(String title) {
156:                this .title = title;
157:            }
158:
159:            /**
160:             * Sets the artist for the disc.
161:             * 
162:             * @param artist
163:             * @exception DiscRackBusinessException
164:             *                if an error occurs setting the data (usually due to an
165:             *                underlying data layer error).
166:             */
167:            public void setArtist(String artist) {
168:                this .artist = artist;
169:            }
170:
171:            /**
172:             * Sets the genre for the disc.
173:             * 
174:             * @param genre
175:             * @exception DiscRackBusinessException
176:             *                if an error occurs setting the data (usually due to an
177:             *                underlying data layer error).
178:             */
179:            public void setGenre(String genre) {
180:                this .genre = genre;
181:            }
182:
183:            /**
184:             * Sets the owner for the disc.
185:             * 
186:             * @param owner
187:             * @exception DiscRackBusinessException
188:             *                if an error occurs setting the data (usually due to an
189:             *                underlying data layer error).
190:             */
191:            public void setOwner(String ownerHandle) {
192:                this .owner = ownerHandle;
193:            }
194:
195:            /**
196:             * Sets the preference for the disc.
197:             * 
198:             * @param isLiked
199:             * @exception DiscRackBusinessException
200:             *                if an error occurs setting the data (usually due to an
201:             *                underlying data layer error).
202:             */
203:            public void setLiked(boolean isLiked) {
204:                this .isLiked = isLiked;
205:            }
206:
207:            /**
208:             * Commits all changes to the database.
209:             * 
210:             * @exception DiscRackBusinessException
211:             *                if an error occurs retrieving data (usually due to an
212:             *                underlying data layer error).
213:             */
214:            public void save(DBTransaction transaction)
215:                    throws TransactionsDiscRackBusinessException,
216:                    AssertionDataObjectException {
217:                try {
218:                    PersonDO personDO = PersonDO.createExisting(this .owner,
219:                            transaction);
220:                    DiscDO myDO = DiscDO.createExisting(this .handle,
221:                            transaction);
222:
223:                    if (myDO == null) {
224:                        // disc creation
225:                        myDO = DiscDO.createVirgin(transaction);
226:                    }
227:                    myDO.setTitle(this .title);
228:                    myDO.setArtist(this .artist);
229:                    myDO.setGenre(this .genre);
230:                    myDO.setIsLiked(this .isLiked);
231:                    myDO.setOwner(personDO);
232:
233:                    myDO.save(transaction);
234:                } catch (AssertionDataObjectException ex) {
235:                    throw new AssertionDataObjectException(
236:                            "Read-only table: DML operations not allowed", ex);
237:                } catch (Exception ex) {
238:                    throw new TransactionsDiscRackBusinessException(
239:                            "Error saving disc", ex);
240:                }
241:            }
242:
243:            /**
244:             * Deletes the disc from the database.
245:             * 
246:             * @exception DiscRackBusinessException
247:             *                if an error occurs deleting data (usually due to an
248:             *                underlying data layer error).
249:             */
250:            public void delete(DBTransaction transaction)
251:                    throws TransactionsDiscRackBusinessException,
252:                    AssertionDataObjectException {
253:                try {
254:                    DiscDO myDO = DiscDO.createExisting(this .handle,
255:                            transaction);
256:                    myDO.delete(transaction);
257:                } catch (AssertionDataObjectException ex) {
258:                    throw new AssertionDataObjectException(
259:                            "Read-only table: DML operations not allowed", ex);
260:                } catch (Exception ex) {
261:                    throw new TransactionsDiscRackBusinessException(
262:                            "Error deleting disc", ex);
263:                }
264:            }
265:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.