1 23 24 package org.infoglue.cms.applications.publishingtool.actions; 25 26 import java.util.ArrayList ; 27 import java.util.List ; 28 29 import javax.servlet.http.HttpServletRequest ; 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 45 46 public class DenyPublicationRequestAction extends InfoGlueAbstractAction 47 { 48 private final static Logger logger = Logger.getLogger(DenyPublicationRequestAction.class.getName()); 49 50 private Integer eventId; 51 private Integer repositoryId; 52 private List events; 53 private String comment; 54 55 public Integer getEventId() 56 { 57 return eventId; 58 } 59 60 public void setEventId(Integer eventId) 61 { 62 this.eventId = eventId; 63 } 64 65 public Integer getRepositoryId() 66 { 67 return repositoryId; 68 } 69 70 public void setRepositoryId(Integer repositoryId) 71 { 72 this.repositoryId = repositoryId; 73 } 74 75 public String [] getSelList() 76 { 77 return getRequest().getParameterValues("sel"); 78 } 79 80 protected String doExecute() throws Exception 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 doComment() throws Exception 89 { 90 return "comment"; 91 } 92 93 private String getApplicationBaseUrl(HttpServletRequest request) 94 { 95 return request.getRequestURL().toString().substring(0, request.getRequestURL().lastIndexOf("/") + 1) + "ViewCMSTool.action"; 96 } 97 98 private void setEvents(String [] eventArguments) throws SystemException, Exception 99 { 100 List events = new ArrayList (); 101 102 for(int i=0; i < eventArguments.length; i++) 103 { 104 logger.info("EventId:" + eventArguments[i]); 105 EventVO eventVO = EventController.getEventVOWithId(new Integer (eventArguments[i])); 106 events.add(eventVO); 107 } 108 109 this.events = events; 110 } 111 112 public String getComment() 113 { 114 return comment; 115 } 116 117 public void setComment(String comment) 118 { 119 this.comment = comment; 120 } 121 122 } 123 | Popular Tags |