View Javadoc

1   /*
2    * Copyright 2005-2007 The Kuali Foundation
3    *
4    *
5    * Licensed under the Educational Community License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    * http://www.opensource.org/licenses/ecl2.php
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.kuali.rice.kew.routelog.web;
18  
19  import java.util.ArrayList;
20  import java.util.List;
21  import java.util.Properties;
22  
23  import org.kuali.rice.core.config.ConfigContext;
24  import org.kuali.rice.kew.util.Utilities;
25  import org.kuali.rice.kns.util.UrlFactory;
26  import org.kuali.rice.kns.web.struts.form.KualiForm;
27  
28  
29  /**
30   * The Struts ActionForm used with {@link RouteLogAction} to display the routelog.
31   *
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  public class RouteLogForm extends KualiForm {
35  
36      private static final long serialVersionUID = -3997667167734868281L;
37      private String methodToCall = "";
38      private String routeHeaderId;
39      private List rootRequests = new ArrayList();
40      private int pendingActionRequestCount;
41      private List futureRootRequests = new ArrayList();
42      private int futureActionRequestCount;
43      private boolean showFuture;
44      private String showFutureError;
45      private boolean removeHeader;
46      private boolean lookFuture;
47      private boolean showNotes;
48      private String docId;
49      private String returnUrlLocation = null;
50      private boolean showCloseButton = false;
51      private String newRouteLogActionMessage;
52      private boolean enableLogAction = false;
53  
54      public boolean isShowCloseButton() {
55          return showCloseButton;
56      }
57      public void setShowCloseButton(boolean showCloseButton) {
58          this.showCloseButton = showCloseButton;
59      }
60      public String getReturnUrlLocation() {
61          return returnUrlLocation;
62      }
63      public void setReturnUrlLocation(String returnUrlLocation) {
64          this.returnUrlLocation = returnUrlLocation;
65      }
66      public String getDocId() {
67          return docId;
68      }
69      public void setDocId(String docId) {
70          this.docId = docId;
71      }
72      public boolean isShowFutureHasError() {
73          return !Utilities.isEmpty(getShowFutureError());
74      }
75      public String getShowFutureError() {
76          return showFutureError;
77      }
78      public void setShowFutureError(String showFutureError) {
79          this.showFutureError = showFutureError;
80      }
81      public boolean isShowFuture() {
82          return showFuture;
83      }
84      public void setShowFuture(boolean showReportURL) {
85          this.showFuture = showReportURL;
86      }
87      public String getMethodToCall() {
88          return methodToCall;
89      }
90      public void setMethodToCall(String methodToCall) {
91          this.methodToCall = methodToCall;
92      }
93      public String getRouteHeaderId() {
94          return routeHeaderId;
95      }
96      public void setRouteHeaderId(String routeHeaderId) {
97          this.routeHeaderId = routeHeaderId;
98      }
99  
100     public int getPendingActionRequestCount() {
101         return pendingActionRequestCount;
102     }
103 
104     public void setPendingActionRequestCount(int pendingActionRequestCount) {
105         this.pendingActionRequestCount = pendingActionRequestCount;
106     }
107 
108     public List getRootRequests() {
109         return rootRequests;
110     }
111     public void setRootRequests(List rootRequests) {
112         this.rootRequests = rootRequests;
113     }
114     public int getFutureActionRequestCount() {
115         return futureActionRequestCount;
116     }
117     public void setFutureActionRequestCount(int futureActionRequestCount) {
118         this.futureActionRequestCount = futureActionRequestCount;
119     }
120     public List getFutureRootRequests() {
121         return futureRootRequests;
122     }
123     public void setFutureRootRequests(List futureRootRequests) {
124         this.futureRootRequests = futureRootRequests;
125     }
126     public boolean isRemoveHeader() {
127         return removeHeader;
128     }
129     public void setRemoveHeader(boolean removeBar) {
130         this.removeHeader = removeBar;
131     }
132     public boolean isLookFuture() {
133         return lookFuture;
134     }
135     public void setLookFuture(boolean showFutureLink) {
136         this.lookFuture = showFutureLink;
137     }
138 	public boolean isShowNotes() {
139 		return showNotes;
140 	}
141 	public void setShowNotes(boolean showNotes) {
142 		this.showNotes = showNotes;
143 	}
144 	
145 	public String getNewRouteLogActionMessage() {
146 		return this.newRouteLogActionMessage;
147 	}
148 	
149 	public void setNewRouteLogActionMessage(String newRouteLogActionMessage) {
150 		this.newRouteLogActionMessage = newRouteLogActionMessage;
151 	}
152 	
153 	public boolean isEnableLogAction() {
154 		return this.enableLogAction;
155 	}
156 	
157 	public void setEnableLogAction(boolean enableLogAction) {
158 		this.enableLogAction = enableLogAction;
159 	}
160 	
161 	public String getHeaderMenuBar() {
162 		Properties parameters = new Properties();
163         parameters.put("showFuture", isShowFuture());
164         parameters.put("showNotes", isShowNotes());
165 		if (getRouteHeaderId() != null) {
166 			parameters.put("routeHeaderId", getRouteHeaderId());
167 		}
168 		if (getDocId() != null) {
169 			parameters.put("docId", getDocId());
170 		}
171 		if (getReturnUrlLocation() != null) {
172 			parameters.put("backUrl", getReturnUrlLocation());
173 		}
174         String url = UrlFactory.parameterizeUrl("RouteLog.do", parameters);
175         String krBaseUrl = ConfigContext.getCurrentContextConfig().getKRBaseURL();
176         url = "<div class=\"lookupcreatenew\" title=\"Refresh\"><a href=\"" + url + "\"><img src=\""+krBaseUrl+"/images/tinybutton-refresh.gif\" alt=\"refresh\"></a></div>";
177         return url;
178 	}
179 }