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


001:        package com.espada.bugtracker.app;
002:
003:        // Java core API
004:        import java.io.*;
005:
006:        import java.sql.*;
007:        import java.util.*;
008:
009:        // Espada API
010:        import com.espada.*;
011:
012:        // Espada API
013:        import org.webmacro.*;
014:        import javax.servlet.*;
015:
016:        // DB Connection Pool API
017:        import com.sr.espada.se.util.db.pool.*;
018:        import com.sr.espada.se.util.logwriter.LogWriter;
019:        import com.sr.espada.se.util.config.ConfigFactory;
020:
021:        /**
022:
023:         * This is the User class.
024:
025:         *
026:
027:         * When an instance of User is created, the class searches the database for an<BR>
028:
029:         * existing user with the corresponding user id, and fills up the object properties.<BR>
030:
031:         *
032:
033:         * <b>Currently not implemented! I add users manually for now ... </B><BR>
034:
035:         * To create a new user in the database, the static method User.createUser() must be used.<BR>
036:
037:         *
038:
039:         *
040:
041:         * @version: $Id: Roles.java,v 1.7 2001/04/16 06:45:47 manik Exp $<BR>
042:
043:         * @author: Manik Surtani<BR>
044:
045:         **/
046:
047:        public class Roles {
048:
049:            public int rid = 0;
050:
051:            public Project roleProject;
052:
053:            public User roleUser;
054:
055:            public String roleDescription;
056:
057:            public boolean found = true;
058:
059:            public Roles() {
060:
061:                //Default values
062:
063:            }
064:
065:            public Roles(int roleId) {
066:
067:                try {
068:
069:                    Connection d = DatabaseConnectionPool.getConnection();
070:                    Statement st = d.createStatement();
071:                    ResultSet rs = st
072:                            .executeQuery("select * from roles where rid='"
073:                                    + roleId + "'");
074:
075:                    while (rs.next()) {
076:
077:                        rid = rs.getInt(1);
078:                        roleDescription = rs.getString(2);
079:                        found = true;
080:
081:                    }
082:
083:                    st.close();
084:                    DatabaseConnectionPool.freeConnection(d);
085:
086:                }
087:
088:                catch (Exception E) {
089:
090:                    found = false;
091:
092:                }
093:
094:                LogWriter.write("User Role:" + String.valueOf(found));
095:
096:            } //end of method Roles
097:
098:            public static Vector getAllRoles() {
099:                return getRoles("select rid from roles");
100:            }
101:
102:            public static Vector getAllRoles(int rid) {
103:
104:                Vector r = new Vector();
105:
106:                if (rid == 1) {
107:                    r = getRoles("select rid from roles");
108:                } else if (rid == 2) {
109:                    r = getRoles("select rid from roles where rid > 2");
110:                }
111:                return r;
112:
113:            }
114:
115:            public static Vector getRoles(String SQL) {
116:
117:                Vector v = new Vector();
118:
119:                try {
120:
121:                    Connection d = DatabaseConnectionPool.getConnection();
122:                    Statement st = d.createStatement();
123:                    ResultSet rs = st.executeQuery(SQL);
124:
125:                    while (rs.next()) {
126:
127:                        v.add(new Roles(rs.getInt(1)));
128:
129:                    }
130:
131:                    st.close();
132:                    DatabaseConnectionPool.freeConnection(d);
133:                    return v;
134:
135:                }
136:
137:                catch (Exception E) {
138:
139:                    LogWriter.write("User Roles " + E.getMessage());
140:                    return v;
141:
142:                }
143:
144:            } //end of method getRoles
145:
146:            public boolean update(int uid, int pid, int rid) {
147:
148:                try {
149:
150:                    Connection d = DatabaseConnectionPool.getConnection();
151:                    Statement st = d.createStatement();
152:                    String SQL = "update projectuser set rid=" + rid
153:                            + " where uid=" + uid + " and pid=" + pid;
154:                    LogWriter.write(SQL);
155:                    int rs = st.executeUpdate(SQL);
156:                    st.close();
157:                    DatabaseConnectionPool.freeConnection(d);
158:                    return (rs != 0);
159:
160:                }
161:
162:                catch (Exception E) {
163:
164:                    return false;
165:
166:                }
167:
168:            } //end of method update
169:
170:        } //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.