Source Code Cross Referenced for Department.java in  » Database-ORM » Speedo_1.4.5 » org » objectweb » speedo » j2eedo » database » 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 » Speedo_1.4.5 » org.objectweb.speedo.j2eedo.database 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Speedo: an implementation of JDO compliant personality on top of JORM
003:         * generic I/O sub-system. Copyright (C) 2001-2004 France Telecom R&D
004:         * 
005:         * This library is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU Lesser General Public License as published by the
007:         * Free Software Foundation; either version 2 of the License, or (at your
008:         * option) any later version.
009:         * 
010:         * This library is distributed in the hope that it will be useful, but WITHOUT
011:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012:         * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
013:         * for more details.
014:         * 
015:         * You should have received a copy of the GNU Lesser General Public License
016:         * along with this library; if not, write to the Free Software Foundation,
017:         * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:         * 
019:         * Release: 1.0
020:         * 
021:         * Created on 27 feb. 2004 @author fmillevi@yahoo.com
022:         *  
023:         */
024:        package org.objectweb.speedo.j2eedo.database;
025:
026:        import java.util.ArrayList;
027:        import java.util.Collection;
028:        import java.util.Iterator;
029:
030:        /**
031:         * This class define the Java class to access to the department's data
032:         * @author fmillevi@yahoo.com
033:         *  
034:         */
035:        public class Department implements  DatabaseObjectInterface {
036:            private long deptid;
037:            private String name;
038:            private Collection employees; //element:Employee
039:            private Collection projects; //element:Project
040:
041:            /**
042:             * Empty constructor
043:             */
044:            public Department() {
045:                super ();
046:            }
047:
048:            public String getAsString() {
049:                StringBuffer sb = new StringBuffer();
050:                sb.append("\nDepartment (deptid:").append(this .deptid);
051:                sb.append(")\n\tName:").append(this .name);
052:                if (null != this .employees) {
053:                    sb.append("\n\tEmployees:");
054:                    Iterator employeeIterator = employees.iterator();
055:                    Employee e = null;
056:                    while (employeeIterator.hasNext()) {
057:                        e = (Employee) employeeIterator.next();
058:                        sb.append("\n\t\t").append(e.getFirstname())
059:                                .append(" ");
060:                        sb.append(e.getLastname());
061:                    }
062:                }
063:                if (projects != null) {
064:                    Iterator projectIterator = projects.iterator();
065:                    if (projectIterator.hasNext()) {
066:                        sb.append("\n\tProjects:");
067:                    }
068:                    while (projectIterator.hasNext()) {
069:                        sb.append("\n\t\t");
070:                        sb.append(((Project) projectIterator.next()).getName());
071:                    }
072:                }
073:                return sb.toString();
074:            }
075:
076:            /**
077:             * @see org.objectweb.speedo.j2eedo.database.DatabaseObjectInterface#getId()
078:             */
079:            public long getId() {
080:                return this .deptid;
081:            }
082:
083:            public Department(String itsName) {
084:                this .name = itsName;
085:                employees = new ArrayList();
086:                projects = new ArrayList();
087:            }
088:
089:            /**
090:             * @return Returns the deptid.
091:             */
092:            public long getDeptid() {
093:                return deptid;
094:            }
095:
096:            /**
097:             * @return Returns the employees.
098:             */
099:            public Collection getEmployees() {
100:                return employees;
101:            }
102:
103:            /**
104:             * @param employees
105:             *            The employees to set.
106:             */
107:            public void setEmployees(Collection employees) {
108:                this .employees = employees;
109:            }
110:
111:            /**
112:             * @param newEmployee
113:             */
114:            public void addEmployee(Employee newEmployee) {
115:                employees.add(newEmployee);
116:            }
117:
118:            /**
119:             * @param newEmployee
120:             */
121:            public void removeEmployee(Employee newEmployee) {
122:                employees.remove(newEmployee);
123:            }
124:
125:            /**
126:             * @return Returns the name.
127:             */
128:            public String getName() {
129:                return name;
130:            }
131:
132:            /**
133:             * @param name
134:             *            The name to set.
135:             */
136:            public void setName(String name) {
137:                this .name = name;
138:            }
139:
140:            /**
141:             * @return Returns the projects.
142:             */
143:            public Collection getProjects() {
144:                return projects;
145:            }
146:
147:            /**
148:             * @param projects
149:             *            The projects to set.
150:             */
151:            public void setProjects(Collection projects) {
152:                this .projects.addAll(projects);
153:            }
154:
155:            /**
156:             * @param newProject
157:             */
158:            public void addProject(Project newProject) {
159:                projects.add(newProject);
160:            }
161:
162:            /**
163:             * @param newProject
164:             */
165:            public void removeProject(Project newProject) {
166:                projects.remove(newProject);
167:            }
168:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.