Source Code Cross Referenced for LoginAction.java in  » Workflow-Engines » bonita-v3.1 » hero » struts » actions » 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 » bonita v3.1 » hero.struts.actions 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package hero.struts.actions;
002:
003:        import java.io.IOException;
004:        import javax.servlet.ServletException;
005:        import javax.servlet.http.HttpServletRequest;
006:        import javax.servlet.http.HttpSession;
007:        import javax.servlet.http.HttpServletResponse;
008:        import org.apache.struts.action.ActionError;
009:        import org.apache.struts.action.ActionErrors;
010:        import org.apache.struts.action.ActionForm;
011:        import org.apache.struts.action.ActionMapping;
012:        import org.apache.struts.action.ActionForward;
013:        import hero.interfaces.*;
014:
015:        /**
016:         * <strong>LoginAction</strong>
017:         * Action that performs users authentication and forward activity or project
018:         * information
019:         * 
020:         *@author Miguel Valdes Faura
021:         */
022:        public class LoginAction extends AbstStrutsActionBase {
023:            /**
024:             *@param String containing username
025:             *@param String containing password
026:             *@return boolean - true authenticated, false not authenticated.
027:             */
028:            public boolean authenticate(String username, String password) {
029:                return (true);
030:            }
031:
032:            /**
033:             * @param mapping The ActionMapping used to select this instance
034:             * @param actionForm The optional AbstActionFormBase bean for this request (if any)
035:             * @param request The HTTP request we are processing
036:             * @param response The HTTP response we are creating
037:             * @exception IOException if an input/output error occurs
038:             * @exception ServletException if a servlet exception occurs
039:             */
040:
041:            public ActionForward perform(ActionMapping mapping,
042:                    ActionForm form, HttpServletRequest request,
043:                    HttpServletResponse response) throws IOException,
044:                    ServletException {
045:                // Assume that the login fails, so that the login page is redisplayed
046:                // if the user isn't authenticated
047:                ActionForward actionForward = mapping.findForward(LOGIN);
048:                // Create the container for any errors that occur
049:                ActionErrors errors = new ActionErrors();
050:
051:                // Extract attributes and parameters we will need from the incoming
052:                // form.
053:
054:                HttpSession session = request.getSession();
055:                String action = (String) session.getAttribute("action");
056:
057:                try {
058:
059:                    hero.interfaces.UserSessionLocalHome userh = (UserSessionLocalHome) hero.interfaces.UserSessionUtil
060:                            .getLocalHome();
061:                    hero.interfaces.UserSessionLocal usersession = userh
062:                            .create();
063:
064:                    request.getSession(true).setAttribute("username",
065:                            usersession.getUser());
066:                    request.getSession(true).setAttribute("password",
067:                            usersession.getUserPassword());
068:                    request.getSession(true)
069:                            .setAttribute("workElement", "null");
070:
071:                    if (action.equals("user")) {
072:                        request.getSession(true).setAttribute("user",
073:                                usersession);
074:
075:                        String project = (String) session
076:                                .getAttribute("project");
077:
078:                        if (project.equals("clone")) {
079:                            // Forward control to the specified 'success' URI specified in the structs-config.xml
080:                            actionForward = mapping.findForward(CLONEPROJECT);
081:                        }
082:                        if (project.equals("details")) {
083:                            // Forward control to the specified 'success' URI specified in the structs-config.xml
084:                            actionForward = mapping.findForward(PROJECTDETAILS);
085:                        }
086:                    } else {
087:                        try {
088:                            String project = (String) session
089:                                    .getAttribute("projectname");
090:
091:                            hero.interfaces.ProjectSessionLocalHome projecth = (ProjectSessionLocalHome) hero.interfaces.ProjectSessionUtil
092:                                    .getLocalHome();
093:                            hero.interfaces.ProjectSessionLocal projectsession = projecth
094:                                    .create();
095:                            projectsession.initProject(project);
096:
097:                            if (action.equals("node")) {
098:                                String name = (String) session
099:                                        .getAttribute("nodename");
100:                                String username = (String) session
101:                                        .getAttribute("username");
102:                                hero.util.StrutsNodeValue node = projectsession
103:                                        .getStrutsNode(name);
104:                                request.getSession(true).setAttribute("node",
105:                                        node);
106:
107:                                if (!node.getDeadline().equals(
108:                                        "Deadline needed")) {
109:                                    java.sql.Timestamp deadline = java.sql.Timestamp
110:                                            .valueOf(node.getDeadline()
111:                                                    + " 00:00:00");
112:                                    if (deadline.getTime() <= (new java.util.Date())
113:                                            .getTime()
114:                                            && !node.getState().equals(
115:                                                    "TERMINATED"))
116:                                        ;
117:                                    errors.add("deadline_error",
118:                                            new ActionError("error.deadline"));
119:                                }
120:
121:                                request.getSession(true).setAttribute(
122:                                        "project", projectsession);
123:                                request.getSession(true).setAttribute("proAct",
124:                                        "false");
125:                                request.getSession(true).setAttribute("edit",
126:                                        "false");
127:
128:                                // Forward control to the specified 'success' URI specified in the structs-config.xml
129:                                actionForward = mapping.findForward(ACTIVITY);
130:                            }
131:                            if (action.equals("project")) {
132:                                request.getSession(true).setAttribute(
133:                                        "project", projectsession);
134:                                request.getSession(true).setAttribute("proAct",
135:                                        "true");
136:                                request.getSession(true).setAttribute("edit",
137:                                        "false");
138:
139:                                request.getSession(true).setAttribute("nodes",
140:                                        projectsession.getStrutsNodes());
141:                                request.getSession(true).setAttribute("edges",
142:                                        projectsession.getStrutsEdges());
143:
144:                                // Forward control to the specified 'success' URI specified in the structs-config.xml
145:                                actionForward = mapping.findForward(PROJECT);
146:                            }
147:                        } catch (Exception pe) {
148:                            actionForward = mapping.findForward(INITIAL);
149:                            errors.add("project_error", new ActionError(
150:                                    "error.project.mismatch"));
151:                        }
152:                    }
153:                } catch (Exception e) {
154:                    errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(
155:                            "error.password.mismatch"));
156:                }
157:
158:                // If any messages is required, save the specified error messages keys
159:                // into the HTTP request for use by the <struts:errors> tag.
160:                if (!errors.empty()) {
161:                    saveErrors(request, errors);
162:                }
163:
164:                // Forward control to the appropriate URI as determined by the action.
165:                return (actionForward);
166:            }
167:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.