Source Code Cross Referenced for AuditQueryServlet.java in  » Workflow-Engines » JFolder » org » jfolder » console » web » admin » audit » 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 » Workflow Engines » JFolder » org.jfolder.console.web.admin.audit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JFolder, Copyright 2001-2006 Gary Steinmetz
003:         *
004:         * Distributable under LGPL license.
005:         * See terms of license at gnu.org.
006:         */
007:
008:        package org.jfolder.console.web.admin.audit;
009:
010:        //base classes
011:        import java.io.IOException;
012:        import java.math.BigDecimal;
013:        import java.util.ArrayList;
014:        import java.util.Calendar;
015:        import java.util.GregorianCalendar;
016:        import java.util.StringTokenizer;
017:        import javax.servlet.ServletException;
018:
019:        //project specific classes
020:        import org.jfolder.common.utils.misc.MiscHelper;
021:        import org.jfolder.common.utils.web.ParameterSet;
022:        import org.jfolder.common.web.template.ConsoleParameterContext;
023:        import org.jfolder.common.web.template.CreationResultParameterContext;
024:        import org.jfolder.common.web.template.SubmitActionContext;
025:        import org.jfolder.common.web.template.SubmitActionParameters;
026:        import org.jfolder.console.base.BaseConsoleServlet;
027:        import org.jfolder.console.base.ConsolePageContext;
028:        import org.jfolder.console.base.ConsolePageSession;
029:        import org.jfolder.security.audit.SecurityAudit;
030:        import org.jfolder.security.audit.SecurityAuditSet;
031:        import org.jfolder.security.model.UserHolder;
032:        import org.jfolder.services.console.ConsoleService;
033:        import org.jfolder.services.console.ConsoleServiceCallerFactory;
034:
035:        //other classes
036:
037:        public class AuditQueryServlet extends BaseConsoleServlet {
038:
039:            public AuditQueryServlet() {
040:            }
041:
042:            protected boolean checkAccess(ConsolePageSession inCps)
043:                    throws IOException, ServletException {
044:
045:                boolean outValue = false;
046:
047:                outValue = (inCps.isAdministrator());
048:
049:                return outValue;
050:            }
051:
052:            public ConsolePageContext process(ConsolePageSession inCps,
053:                    UserHolder inUser, ParameterSet inPs,
054:                    SubmitActionContext inSac) throws IOException,
055:                    ServletException {
056:
057:                //
058:                ConsolePageContext outValue = null;
059:
060:                if (inSac.isAction(SubmitActionParameters.OPEN)) {
061:                    //
062:                    //
063:                    //
064:                }
065:                //else if (inSac.isAction(SubmitActionParameters.DO_NOTHING)) {
066:                //}
067:                else if (inSac.isAction(SubmitActionParameters.UPDATE)) {
068:                    //
069:                    CreationResultParameterContext crpc = inSac
070:                            .getCreationResultParameterContext();
071:                    //
072:                    String firstCrpc = crpc
073:                            .getParameter(ConsoleParameterContext.FIRST_INPUT);
074:                    String secondCrpc = crpc
075:                            .getParameter(ConsoleParameterContext.SECOND_INPUT);
076:                    String thirdCrpc = crpc
077:                            .getParameter(ConsoleParameterContext.THIRD_INPUT);
078:                    //
079:                    MiscHelper.println("AuQuServ Crpc01 = " + firstCrpc);
080:                    MiscHelper.println("AuQuServ Crpc02 = " + secondCrpc);
081:                    MiscHelper.println("AuQuServ Crpc03 = " + thirdCrpc);
082:                    //
083:                    //
084:                    Boolean status = null;
085:                    if (firstCrpc != null) {
086:                        status = new Boolean(firstCrpc);
087:                    }
088:                    String annotation = secondCrpc;
089:                    BigDecimal auditId = new BigDecimal(thirdCrpc);
090:                    //
091:                    ConsoleService cs = ConsoleServiceCallerFactory
092:                            .getConsoleService();
093:                    //
094:                    cs.updateAudit(auditId, inUser.getUserIdentity(),
095:                            MiscHelper.currentUTC(), annotation, status);
096:                    //
097:                    SecurityAuditSet sas = inCps.getSecurityAuditSet();
098:                    if (status != null) {
099:                        for (int i = 0; i < sas.getSecurityAuditCount(); i++) {
100:                            SecurityAudit nextSa = sas.getSecurityAudit(i);
101:                            BigDecimal nextId = sas.getId(i);
102:                            if (nextId.compareTo(auditId) == 0) {
103:                                nextSa.setAuditOpened(status.booleanValue());
104:                            }
105:                        }
106:                    }
107:                } else if (inSac.isAction(SubmitActionParameters.EXECUTE)) {
108:                    //
109:                    //
110:                    //
111:                    String firstParam = inSac
112:                            .getParameter(ConsoleParameterContext.FIRST_INPUT);
113:                    MiscHelper.println("AuQuServ Param01 = " + firstParam);
114:                    //
115:                    String secondParam = inSac
116:                            .getParameter(ConsoleParameterContext.SECOND_INPUT);
117:                    MiscHelper.println("AuQuServ Param02 = " + secondParam);
118:                    //
119:                    String thirdParam = inSac
120:                            .getParameter(ConsoleParameterContext.THIRD_INPUT);
121:                    MiscHelper.println("AuQuServ Param03 = " + thirdParam);
122:                    //
123:                    String fourthParam = inSac
124:                            .getParameter(ConsoleParameterContext.FOURTH_INPUT);
125:                    MiscHelper.println("AuQuServ Param04 = " + fourthParam);
126:                    //
127:                    String fifthParam = inSac
128:                            .getParameter(ConsoleParameterContext.FIFTH_INPUT);
129:                    MiscHelper.println("AuQuServ Param05 = " + fifthParam);
130:                    //
131:                    String sixthParam = inSac
132:                            .getParameter(ConsoleParameterContext.SIXTH_INPUT);
133:                    MiscHelper.println("AuQuServ Param06 = " + sixthParam);
134:                    //
135:                    String seventhParam = inSac
136:                            .getParameter(ConsoleParameterContext.SEVENTH_INPUT);
137:                    MiscHelper.println("AuQuServ Param07 = " + seventhParam);
138:                    //
139:                    String eighthParam = inSac
140:                            .getParameter(ConsoleParameterContext.EIGHTH_INPUT);
141:                    MiscHelper.println("AuQuServ Param08 = " + eighthParam);
142:                    //
143:                    String ninthParam = inSac
144:                            .getParameter(ConsoleParameterContext.NINTH_INPUT);
145:                    MiscHelper.println("AuQuServ Param09 = " + ninthParam);
146:                    //
147:                    String tenthParam = inSac
148:                            .getParameter(ConsoleParameterContext.TENTH_INPUT);
149:                    MiscHelper.println("AuQuServ Param10 = " + tenthParam);
150:                    //
151:                    //
152:                    //
153:                    //
154:                    //
155:                    //
156:                    //
157:                    //
158:                    long startDate = 0;
159:                    long endDate = 0;
160:                    Boolean status = null;
161:                    BigDecimal severityLevels[] = null;
162:                    String categoryTypes[] = null;
163:                    String sourceTypes[] = null;
164:                    BigDecimal customCodes[] = null;
165:                    String customCategoryTypes[] = null;
166:                    String customSourceTypes[] = null;
167:                    //
168:                    //
169:                    if (inPs.getParameter(firstParam).length() > 0) {
170:                        startDate = Long.parseLong(inPs
171:                                .getParameter(firstParam));
172:                        long locEndDate = (new GregorianCalendar())
173:                                .getTimeInMillis();
174:                        endDate = MiscHelper
175:                                .fromLocalizedTimeToUTCTime(locEndDate);
176:                    } else {
177:                        startDate = MiscHelper.fromStringToTime(inPs
178:                                .getParameter(secondParam));
179:                        startDate = MiscHelper
180:                                .fromLocalizedTimeToUTCTime(startDate);
181:                        endDate = MiscHelper.fromStringToTime(inPs
182:                                .getParameter(thirdParam));
183:                        endDate = MiscHelper
184:                                .fromLocalizedTimeToUTCTime(endDate);
185:                    }
186:                    //
187:                    if (inPs.getParameter(fourthParam).length() > 0) {
188:                        status = new Boolean(inPs.getParameter(fourthParam));
189:                    }
190:                    //
191:                    severityLevels = parseParamsToBigDecimals(inPs, fifthParam);
192:                    //
193:                    categoryTypes = parseParamsToStrings(inPs, sixthParam);
194:                    //
195:                    sourceTypes = parseParamsToStrings(inPs, seventhParam);
196:                    //
197:                    customCodes = parseParamsToBigDecimals(inPs, eighthParam);
198:                    //
199:                    customCategoryTypes = parseParamsToStrings(inPs, ninthParam);
200:                    //
201:                    customSourceTypes = parseParamsToStrings(inPs, tenthParam);
202:                    //
203:                    //
204:                    ConsoleService cs = ConsoleServiceCallerFactory
205:                            .getConsoleService();
206:
207:                    SecurityAuditSet sas = cs.getSecurityAudits(startDate,
208:                            endDate, severityLevels, categoryTypes,
209:                            sourceTypes, customCodes, customCategoryTypes,
210:                            customSourceTypes, status);
211:                    //
212:                    inCps.setSecurityAuditSet(sas);
213:                } else {
214:                    inSac.unknownAction();
215:                }
216:
217:                outValue = AuditQueryContext.newInstance(inCps);
218:
219:                return outValue;
220:
221:            }
222:
223:            //
224:            //
225:            //
226:            private final static BigDecimal[] parseParamsToBigDecimals(
227:                    ParameterSet inPs, String inParamList) {
228:                //
229:                BigDecimal outValue[] = null;
230:
231:                String initValues[] = parseParamsToStrings(inPs, inParamList);
232:
233:                ArrayList values = new ArrayList();
234:                for (int i = 0; i < initValues.length; i++) {
235:                    String nextInitValue = initValues[i];
236:                    if (MiscHelper.isStringNonNegativeNumber(nextInitValue)) {
237:                        values.add(nextInitValue);
238:                    }
239:                }
240:
241:                outValue = new BigDecimal[values.size()];
242:                for (int i = 0; i < values.size(); i++) {
243:                    outValue[i] = new BigDecimal(values.get(i).toString());
244:                }
245:
246:                return outValue;
247:            }
248:
249:            private final static String[] parseParamsToStrings(
250:                    ParameterSet inPs, String inParamList) {
251:                //
252:                String outValue[] = null;
253:
254:                ArrayList values = new ArrayList();
255:                StringTokenizer st = new StringTokenizer(inParamList,
256:                        ConsolePageContext.HANDLE_SEPARATOR);
257:                //
258:                while (st.hasMoreTokens()) {
259:                    String nextParam = st.nextToken();
260:                    int icount = inPs.getParameterValuesLength(nextParam);
261:                    for (int i = 0; i < icount; i++) {
262:                        String nextParamValue = inPs.getParameter(nextParam, i);
263:                        if (nextParamValue.trim().length() > 0) {
264:                            values.add(nextParamValue);
265:                        }
266:                    }
267:                }
268:
269:                outValue = new String[values.size()];
270:                for (int i = 0; i < values.size(); i++) {
271:                    outValue[i] = values.get(i).toString();
272:                }
273:
274:                return outValue;
275:            }
276:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.