Source Code Cross Referenced for ProjectManagerImpl.java in  » J2EE » Enhydra-Demos » projectmanagement » business » project » 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 » projectmanagement.business.project 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package projectmanagement.business.project;
002:
003:        import projectmanagement.business.ProjectManagementBusinessException;
004:        import projectmanagement.data.project.*;
005:
006:        import projectmanagement.business.customer.*;
007:
008:        import com.lutris.appserver.server.sql.DatabaseManagerException;
009:        import com.lutris.appserver.server.sql.ObjectId;
010:        import com.lutris.appserver.server.sql.ObjectIdException;
011:        import com.lutris.dods.builder.generator.query.*;
012:        import com.lutris.appserver.server.Enhydra;
013:        import com.lutris.logging.*;
014:
015:        import projectmanagement.spec.customer.*;
016:        import projectmanagement.spec.project.*;
017:
018:        /**
019:         * Used to find the instance of Project.
020:         *
021:         * @author Sasa Bojanic
022:         * @version 1.0
023:         */
024:        public class ProjectManagerImpl implements  ProjectManager {
025:
026:            /**
027:             * The getAllProjects method performs a database query to
028:             * return all <CODE>Project</CODE> objects representing the
029:             * row in the <CODE>Projects</CODE> table.
030:             * @return all the projects, or null if there are no any.
031:             * @exception ProjectManagementBusinessException
032:             *    if there is a problem retrieving project information.
033:             */
034:            public Project[] getAllProjects()
035:                    throws ProjectManagementBusinessException {
036:                try {
037:                    ProjectQuery query = new ProjectQuery();
038:
039:                    ProjectDO[] foundProjects = query.getDOArray();
040:                    if (foundProjects.length != 0) {
041:                        ProjectImpl[] cs = new ProjectImpl[foundProjects.length];
042:                        for (int i = 0; i < foundProjects.length; i++) {
043:                            cs[i] = new ProjectImpl(foundProjects[i]);
044:                        }
045:                        return cs;
046:                    } else {
047:                        return null;
048:                    }
049:                } catch (NonUniqueQueryException ex) {
050:                    Enhydra.getLogChannel().write(
051:                            Logger.DEBUG,
052:                            "Non-unique project found in database: "
053:                                    + ex.getMessage());
054:                    throw new ProjectManagementBusinessException(
055:                            "Non unique project found");
056:                } catch (DataObjectException ex) {
057:                    throw new ProjectManagementBusinessException(
058:                            "Database error retrieving projects: ", ex);
059:                } /*catch(QueryException ex) {
060:                        throw new ProjectManagementBusinessException("Query exception retrieving projects: ", ex);
061:                     }*/
062:            }
063:
064:            /**
065:             * The findProjectByID method performs a database query to
066:             * return a <CODE>Project</CODE> object
067:             * representing the row in the <CODE>project</CODE> table
068:             * that matches the object id.
069:             *
070:             * @param id, the object id of the project table.
071:             * @return
072:             *    the project. null if there isn't a project associated
073:             *    the id
074:             * @exception ProjectManagementBusinessException
075:             *    if there is a problem retrieving project information.
076:             */
077:            public Project findProjectByID(String id)
078:                    throws ProjectManagementBusinessException {
079:                ProjectImpl theProject = null;
080:
081:                try {
082:                    ProjectQuery query = new ProjectQuery();
083:                    //set query
084:                    query.setQueryOId(new ObjectId(id));
085:                    // Throw an exception if more than one user by this name is found
086:                    query.requireUniqueInstance();
087:                    ProjectDO theProjectDO = query.getNextDO();
088:                    theProject = new ProjectImpl(theProjectDO);
089:                    return theProject;
090:                } catch (Exception ex) {
091:                    throw new ProjectManagementBusinessException(
092:                            "Exception in findProjectByID()", ex);
093:                }
094:            }
095:
096:            /**
097:             * The getAllProjectsForCustomer method performs a database query to
098:             * return a <CODE>Project</CODE> objects representing the row in the 
099:             * <CODE>project</CODE> table that matches the customer given by 
100:             * customerID.
101:             *
102:             * @param customerID the object id of Customer for which we need projects.
103:             * @return
104:             *    array of projects for given customer. null if there isn't a project 
105:             *    associated the customerID
106:             * @exception ProjectManagementBusinessException
107:             *    if there is a problem retrieving project information.
108:             */
109:            public Project[] getAllProjectsForCustomer(String customerID)
110:                    throws ProjectManagementBusinessException {
111:
112:                if (customerID == null)
113:                    return getAllProjects();
114:                try {
115:                    ProjectQuery query = new ProjectQuery();
116:
117:                    CustomerManagerImpl customerManager = new CustomerManagerImpl();
118:                    CustomerImpl customer = (CustomerImpl) customerManager
119:                            .findCustomerByID(customerID);
120:
121:                    query
122:                            .setQueryCustomer(customer.getDO(),
123:                                    QueryBuilder.EQUAL);
124:
125:                    ProjectDO[] foundProjects = query.getDOArray();
126:                    if (foundProjects.length != 0) {
127:                        ProjectImpl[] projs = new ProjectImpl[foundProjects.length];
128:                        for (int i = 0; i < foundProjects.length; i++) {
129:                            projs[i] = new ProjectImpl(foundProjects[i]);
130:                        }
131:                        return projs;
132:                    } else {
133:                        return null;
134:                    }
135:                } catch (NonUniqueQueryException ex) {
136:                    Enhydra.getLogChannel().write(
137:                            Logger.DEBUG,
138:                            "Non-unique worksheet found in database: "
139:                                    + ex.getMessage());
140:                    throw new ProjectManagementBusinessException(
141:                            "Non unique worksheet found");
142:                } catch (DataObjectException ex) {
143:                    throw new ProjectManagementBusinessException(
144:                            "Database error retrieving projects: ", ex);
145:                } catch (QueryException ex) {
146:                    throw new ProjectManagementBusinessException(
147:                            "Query exception retrieving projects: ", ex);
148:                }
149:            }
150:
151:            /**
152:             * The getAllProjectsForCustomer method performs a database query to
153:             * return a <CODE>Project</CODE> objects representing the row in the 
154:             * <CODE>project</CODE> table that matches the customer 
155:             *
156:             * @param customer the customer for which we need projects.
157:             * @return
158:             *    array of projects for given customer. null if there isn't a project 
159:             *    associated the customer
160:             * @exception ProjectManagementBusinessException
161:             *    if there is a problem retrieving project information.
162:             */
163:            public Project[] getAllProjectsForCustomer(Customer customer)
164:                    throws ProjectManagementBusinessException {
165:
166:                if (customer == null)
167:                    return getAllProjects();
168:                try {
169:                    ProjectQuery query = new ProjectQuery();
170:                    query.setQueryCustomer(((CustomerImpl) customer).getDO(),
171:                            QueryBuilder.EQUAL);
172:
173:                    ProjectDO[] foundProjects = query.getDOArray();
174:                    if (foundProjects.length != 0) {
175:                        ProjectImpl[] projs = new ProjectImpl[foundProjects.length];
176:                        for (int i = 0; i < foundProjects.length; i++) {
177:                            projs[i] = new ProjectImpl(foundProjects[i]);
178:                        }
179:                        return projs;
180:                    } else {
181:                        return null;
182:                    }
183:                } catch (NonUniqueQueryException ex) {
184:                    Enhydra.getLogChannel().write(
185:                            Logger.DEBUG,
186:                            "Non-unique worksheet found in database: "
187:                                    + ex.getMessage());
188:                    throw new ProjectManagementBusinessException(
189:                            "Non unique worksheet found");
190:                } catch (DataObjectException ex) {
191:                    throw new ProjectManagementBusinessException(
192:                            "Database error retrieving projects: ", ex);
193:                } catch (QueryException ex) {
194:                    throw new ProjectManagementBusinessException(
195:                            "Query exception retrieving projects: ", ex);
196:                }
197:            }
198:
199:            public Project getProject()
200:                    throws ProjectManagementBusinessException {
201:                return new ProjectImpl();
202:            }
203:
204:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.