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