KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > workflowtool > actions > examples > CreateUser


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

23
24 package org.infoglue.cms.applications.workflowtool.actions.examples;
25
26 import java.util.Iterator JavaDoc;
27 import java.util.Map JavaDoc;
28
29 import javax.servlet.http.HttpServletRequest JavaDoc;
30
31 import org.infoglue.cms.controllers.kernel.impl.simple.UserControllerProxy;
32 import org.infoglue.cms.entities.management.SystemUserVO;
33 import org.infoglue.cms.util.workflow.CustomWorkflowAction;
34
35 import com.opensymphony.module.propertyset.PropertySet;
36 import com.opensymphony.workflow.WorkflowException;
37
38 public class CreateUser implements CustomWorkflowAction
39 {
40     public CreateUser()
41     {
42     }
43     
44     
45     public void invokeAction(String JavaDoc callerUserName, HttpServletRequest JavaDoc request, Map JavaDoc args, PropertySet ps) throws WorkflowException
46     {
47         Iterator JavaDoc paramsIterator = request.getParameterMap().keySet().iterator();
48         while(paramsIterator.hasNext())
49         {
50             String JavaDoc key = (String JavaDoc)paramsIterator.next();
51             System.out.println("key:" + key);
52             Object JavaDoc value = request.getParameterMap().get(key);
53             System.out.println("value:" + value);
54         }
55         
56         Iterator JavaDoc psIterator = ps.getKeys().iterator();
57         while(psIterator.hasNext())
58         {
59             String JavaDoc key = (String JavaDoc)psIterator.next();
60             System.out.println("key:" + key);
61             Object JavaDoc value = ps.getObject(key);
62             System.out.println("value:" + value);
63         }
64         
65         String JavaDoc firstName = (String JavaDoc)request.getParameter("firstName");
66         String JavaDoc lastName = (String JavaDoc)request.getParameter("lastName");
67         String JavaDoc userName = (String JavaDoc)request.getParameter("userName");
68         String JavaDoc password = (String JavaDoc)request.getParameter("password");
69         String JavaDoc email = (String JavaDoc)request.getParameter("email");
70         
71         System.out.println("firstName:" + firstName);
72         System.out.println("lastName:" + lastName);
73         System.out.println("userName:" + userName);
74         System.out.println("password:" + password);
75         System.out.println("email:" + email);
76         
77         SystemUserVO systemUserVO = new SystemUserVO();
78         systemUserVO.setFirstName(firstName);
79         systemUserVO.setLastName(lastName);
80         systemUserVO.setUserName(userName);
81         systemUserVO.setPassword(password);
82         systemUserVO.setEmail(email);
83         
84         try
85         {
86             System.out.println("firstName:" + systemUserVO.getFirstName());
87             System.out.println("lastName:" + systemUserVO.getLastName());
88             System.out.println("userName:" + systemUserVO.getUserName());
89             System.out.println("password:" + systemUserVO.getPassword());
90             System.out.println("email:" + systemUserVO.getEmail());
91             UserControllerProxy.getController().createUser(systemUserVO);
92         }
93         catch (Exception JavaDoc e)
94         {
95             e.printStackTrace();
96             throw new WorkflowException(e);
97         }
98     }
99
100 }
101
Popular Tags