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