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