KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > publishingtool > actions > DenyPublicationRequestAction


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.publishingtool.actions;
25
26 import java.util.ArrayList JavaDoc;
27 import java.util.List JavaDoc;
28
29 import javax.servlet.http.HttpServletRequest JavaDoc;
30
31 import org.apache.log4j.Logger;
32 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
33 import org.infoglue.cms.applications.mydesktoptool.actions.ViewMyDesktopToolToolBarAction;
34 import org.infoglue.cms.controllers.kernel.impl.simple.EventController;
35 import org.infoglue.cms.controllers.kernel.impl.simple.PublicationController;
36 import org.infoglue.cms.entities.workflow.EventVO;
37 import org.infoglue.cms.exception.SystemException;
38
39 /**
40  * @author Mattias Bogeblad
41  *
42  * This action denies a requested publishing of an entity or whatever is in the que.
43  * It deletes the old event and creates a new one with a reply to the requester.
44  */

45
46 public class DenyPublicationRequestAction extends InfoGlueAbstractAction
47 {
48     private final static Logger logger = Logger.getLogger(DenyPublicationRequestAction.class.getName());
49
50     private Integer JavaDoc eventId;
51     private Integer JavaDoc repositoryId;
52     private List JavaDoc events;
53     private String JavaDoc comment;
54     
55     public Integer JavaDoc getEventId()
56     {
57         return eventId;
58     }
59     
60     public void setEventId(Integer JavaDoc eventId)
61     {
62         this.eventId = eventId;
63     }
64         
65     public Integer JavaDoc getRepositoryId()
66     {
67         return repositoryId;
68     }
69
70     public void setRepositoryId(Integer JavaDoc repositoryId)
71     {
72         this.repositoryId = repositoryId;
73     }
74     
75     public String JavaDoc[] getSelList()
76     {
77         return getRequest().getParameterValues("sel");
78     }
79     
80     protected String JavaDoc doExecute() throws Exception JavaDoc
81     {
82         setEvents(getRequest().getParameterValues("sel"));
83         
84         PublicationController.denyPublicationRequest(this.events, this.getInfoGluePrincipal().getName(), this.comment, getApplicationBaseUrl(getRequest()));
85         return "success";
86     }
87
88     public String JavaDoc doComment() throws Exception JavaDoc
89     {
90         return "comment";
91     }
92
93     private String JavaDoc getApplicationBaseUrl(HttpServletRequest JavaDoc request)
94     {
95         return request.getRequestURL().toString().substring(0, request.getRequestURL().lastIndexOf("/") + 1) + "ViewCMSTool.action";
96     }
97     
98     private void setEvents(String JavaDoc[] eventArguments) throws SystemException, Exception JavaDoc
99     {
100         List JavaDoc events = new ArrayList JavaDoc();
101     
102         for(int i=0; i < eventArguments.length; i++)
103         {
104             logger.info("EventId:" + eventArguments[i]);
105             EventVO eventVO = EventController.getEventVOWithId(new Integer JavaDoc(eventArguments[i]));
106             events.add(eventVO);
107         }
108     
109         this.events = events;
110     }
111
112     public String JavaDoc getComment()
113     {
114         return comment;
115     }
116
117     public void setComment(String JavaDoc comment)
118     {
119         this.comment = comment;
120     }
121
122 }
123
Popular Tags