Source Code Cross Referenced for OpenProject.java in  » Issue-Tracking » javafreedom-bugtracker » com » espada » bugtracker » servlets » 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 » Issue Tracking » javafreedom bugtracker » com.espada.bugtracker.servlets 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:        ====================================================================
003:        Project Name: bugtracker
004:        File Name: /src/com/espada/bugtracker/servlets/OpenProject.java
005:        Author: Kishan Peiris <kishan@espadanet.com>
006:        Description: Opening a project to view list of bugs available and other details such as Status, Severity, etc.
007:        CVS Repository: goliath:/projects/repository/cvsroot/
008:        CVS Module: bugtracker
009:        Version: CVS $Id: $
010:        ====================================================================
011:
012:         */
013:
014:        package com.espada.bugtracker.servlets;
015:
016:        import com.sr.espada.se.util.config.*;
017:        import com.sr.espada.se.util.logwriter.*;
018:        import java.util.*;
019:
020:        // webmacro resources
021:        import org.webmacro.*;
022:        import org.webmacro.broker.*;
023:        import org.webmacro.resource.*;
024:        import org.webmacro.servlet.WebContext;
025:
026:        // servlet libraries
027:        import javax.servlet.http.*;
028:        import javax.servlet.*;
029:
030:        // bugtracker java apps
031:        import com.espada.bugtracker.app.*;
032:
033:        public class OpenProject extends BTServlet {
034:
035:            protected void doAction(HttpServletRequest request,
036:                    HttpServletResponse response, WebContext c) {
037:                projectDetails(request, response, c);
038:            };
039:
040:            public String getInitialTemplate() {
041:                return ("openProject.wm");
042:            }
043:
044:            /**************************** Start Of Method projectDetails ********************************************/
045:            /** Opening a project for bugs...*/
046:
047:            private void projectDetails(HttpServletRequest request,
048:                    HttpServletResponse response, WebContext c) {
049:
050:                HttpSession session = request.getSession();
051:
052:                String SuccessLoggedIn = (String) session
053:                        .getAttribute("loggedIn");
054:
055:                String pageLocation = new String();
056:
057:                boolean loggedIn = false;
058:
059:                if (SuccessLoggedIn != null) {
060:                    if (SuccessLoggedIn.equals("true")) {
061:                        defaultTemplate = "openProject.wm";
062:
063:                        loggedIn = true;
064:
065:                        int UID = ((Integer) session.getAttribute("UID"))
066:                                .intValue();
067:
068:                        c.put("USER", session.getAttribute("USER"));
069:
070:                        /*******************************************************************************************/
071:                        /*******************
072:                         Required parameters from WebMacro file
073:                         *******************/
074:
075:                        String sortBy = (request.getParameter("sort") == null) ? "bid"
076:                                : request.getParameter("sort");
077:                        int pid = Integer.parseInt(request
078:                                .getParameter("projID"));
079:                        int trancheSize = Integer.parseInt(request
080:                                .getParameter("trancheSize"));
081:                        int pageNumber = Integer.parseInt(request
082:                                .getParameter("pageNumber"));
083:                        int limitStatus = (request.getParameter("limitStatus") == null) ? 0
084:                                : Integer.parseInt(request
085:                                        .getParameter("limitStatus"));
086:                        int limitSeverity = (request
087:                                .getParameter("limitSeverity") == null) ? 0
088:                                : Integer.parseInt(request
089:                                        .getParameter("limitSeverity"));
090:                        Project myProject = new Project(pid);
091:                        String myRole = myProject.getRoleID(UID);
092:                        session.setAttribute("PUR", (myRole == null) ? "0"
093:                                : myRole);
094:                        c.put("RoleID", (String) session.getAttribute("PUR"));
095:
096:                        /*Seeting up a session on current project*/
097:
098:                        session.setAttribute("currentProject", myProject);
099:
100:                        Vector bugs = new Vector();
101:
102:                        if (limitStatus == 0) {
103:                            if (limitSeverity == 0) {
104:
105:                                bugs = Bug.getAllBugs(myProject, sortBy,
106:                                        pageNumber, trancheSize);
107:
108:                            } else {
109:
110:                                bugs = Bug.getAllBugs(myProject, sortBy,
111:                                        new Severity(limitSeverity),
112:                                        pageNumber, trancheSize);
113:
114:                            }
115:                        } else {
116:                            if (limitSeverity == 0) {
117:
118:                                bugs = Bug.getAllBugs(myProject, sortBy,
119:                                        new Status(limitStatus), pageNumber,
120:                                        trancheSize);
121:
122:                            } else {
123:
124:                                bugs = Bug.getAllBugs(myProject, sortBy,
125:                                        new Status(limitStatus), new Severity(
126:                                                limitSeverity), pageNumber,
127:                                        trancheSize);
128:
129:                            }
130:                        }
131:
132:                        /*******************************************************************************************/
133:                        /*******************
134:                         Creating bug severity array of objects
135:                         ********************/
136:
137:                        Severity server = new Severity(); //object of severity
138:                        Vector sev = Severity.getSeverities(); //vector of severity
139:                        Vector s = new Vector(); //to copy as an array of object severity
140:                        int i;
141:
142:                        for (i = 0; i < sev.size(); i++) //number of selected items
143:                        {
144:                            server = ((Severity) sev.get(i)); //assigning lements
145:                            s.addElement(server); //adding all objects
146:                        }
147:
148:                        Severity pros[] = new Severity[s.size()];//severity type array
149:                        s.copyInto(pros); //cope all into new array object pros
150:
151:                        /*******************************************************************************************/
152:                        /*******************
153:                         Creating bug status array of objects
154:                         ********************/
155:
156:                        Vector stv = Status.getStatusList();
157:                        Vector ss = new Vector();
158:                        Status bstat = new Status();
159:
160:                        for (i = 0; i < stv.size(); i++) {
161:                            bstat = ((Status) stv.get(i));
162:                            ss.addElement(bstat);
163:                        }
164:
165:                        Status statObj[] = new Status[ss.size()];
166:                        ss.copyInto(statObj);
167:
168:                        /*******************************************************************************************/
169:                        /*******************
170:                         Selected bugs, array of objects
171:                         ********************/
172:
173:                        Vector bb = new Vector();
174:                        Bug b = new Bug();
175:
176:                        for (i = 0; i < bugs.size(); i++) {
177:                            b = (Bug) bugs.get(i);
178:                            bb.addElement(b);
179:                        }
180:
181:                        Bug bugObj[] = new Bug[bb.size()];
182:                        bb.copyInto(bugObj);
183:
184:                        /*******************************************************************************************/
185:                        /*******************
186:                         Passing parameter to WebMacro file
187:                         ********************/
188:
189:                        c.put("currentProject", myProject);
190:
191:                        c.put("trancheSize", String.valueOf(trancheSize));
192:
193:                        c.put("limitSeverity", String.valueOf(limitSeverity));
194:
195:                        c.put("limitStatus", String.valueOf(limitStatus));
196:
197:                        c.put("sortBy", sortBy);
198:
199:                        c.put("pros", pros);
200:
201:                        c.put("statObj", statObj);
202:
203:                        c.put("bugObjs", bugObj);
204:
205:                        /*******************************************************************************************/
206:                        /*******************
207:                         Page "next" or "previous"
208:                         ********************/
209:
210:                        boolean hasMore = (bugs.size() == trancheSize);
211:
212:                        int backPage = pageNumber;
213:                        session.setAttribute("page", new Integer(pageNumber));
214:
215:                        if (hasMore) {
216:                            pageNumber = pageNumber + 1;
217:                        }
218:
219:                        if (backPage > 0) {
220:                            c.put("back", "yes");
221:                            backPage = backPage - 1;
222:                        } else if ((!hasMore) && (backPage > 0)) {
223:                            backPage = backPage - 1;
224:                            c.put("back", "yes");
225:                        } else {
226:                            c.put("back", "no");
227:                        }
228:                        c.put("waite", String.valueOf(session
229:                                .getAttribute("page")));
230:
231:                        c.put("hasMore", String.valueOf(hasMore));
232:
233:                        c.put("pageNumber", String.valueOf(pageNumber));
234:
235:                        c.put("backPage", String.valueOf(backPage));
236:
237:                    } else {
238:
239:                        loggedIn = false;
240:
241:                        defaultTemplate = "errorMesg.wm";
242:
243:                        c.put("errorId", "9");
244:
245:                    }
246:                } else {
247:
248:                    loggedIn = false;
249:
250:                    defaultTemplate = "errorMesg.wm";
251:
252:                    c.put("errorId", "9");
253:
254:                }
255:
256:                c.put("loggedIn", String.valueOf(loggedIn));
257:                c.put("myRoleId", session.getAttribute("USERROLE"));
258:
259:            } //end of method
260:
261:            /**************************** End Of Method projectDetails ********************************************/
262:
263:        } //end of class
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.