KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > managementtool > actions > UpdateGroupAction


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.managementtool.actions;
25
26 import org.infoglue.cms.controllers.kernel.impl.simple.GroupControllerProxy;
27 import org.infoglue.cms.controllers.kernel.impl.simple.GroupPropertiesController;
28 import org.infoglue.cms.entities.management.GroupVO;
29 import org.infoglue.cms.util.ConstraintExceptionBuffer;
30
31 /**
32  * @author Mattias Bogeblad
33  */

34
35 public class UpdateGroupAction extends ViewGroupAction
36 {
37     private ConstraintExceptionBuffer ceb;
38     private GroupVO groupVO;
39     
40     public UpdateGroupAction()
41     {
42         this(new GroupVO());
43     }
44     
45     public UpdateGroupAction(GroupVO GroupVO)
46     {
47         this.groupVO = GroupVO;
48         this.ceb = new ConstraintExceptionBuffer();
49     }
50     
51     public String JavaDoc doExecute() throws Exception JavaDoc
52     {
53         super.initialize(getGroupName());
54         
55         ceb.add(this.groupVO.validate());
56         ceb.throwIfNotEmpty();
57
58         String JavaDoc[] values = getRequest().getParameterValues("userName");
59         String JavaDoc[] contentTypeDefinitionIds = getRequest().getParameterValues("contentTypeDefinitionId");
60
61         GroupControllerProxy.getController().updateGroup(this.groupVO, values);
62         
63         if(contentTypeDefinitionIds != null && contentTypeDefinitionIds.length > 0 && !contentTypeDefinitionIds[0].equals(""))
64             GroupPropertiesController.getController().updateContentTypeDefinitions(this.getGroupName(), contentTypeDefinitionIds);
65         
66         return "success";
67     }
68     
69     public String JavaDoc doSaveAndExit() throws Exception JavaDoc
70     {
71         doExecute();
72                         
73         return "saveAndExit";
74     }
75
76     public void setGroupName(String JavaDoc groupName)
77     {
78         this.groupVO.setGroupName(groupName);
79     }
80     
81     public String JavaDoc getGroupName()
82     {
83         return this.groupVO.getGroupName();
84     }
85     
86     public void setDescription(java.lang.String JavaDoc description)
87     {
88         this.groupVO.setDescription(description);
89     }
90
91     public String JavaDoc getDescription()
92     {
93         return this.groupVO.getDescription();
94     }
95     
96
97 }
98
Popular Tags