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