View Javadoc
1   /**
2    * Copyright 2005-2014 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  
53      public boolean isShowCloseButton() {
54          return showCloseButton;
55      }
56      public void setShowCloseButton(boolean showCloseButton) {
57          this.showCloseButton = showCloseButton;
58      }
59      public String getReturnUrlLocation() {
60          return returnUrlLocation;
61      }
62      public void setReturnUrlLocation(String returnUrlLocation) {
63          this.returnUrlLocation = returnUrlLocation;
64      }
65      public String getDocId() {
66          return docId;
67      }
68      public void setDocId(String docId) {
69          this.docId = docId;
70      }
71      public boolean isShowFutureHasError() {
72          return !org.apache.commons.lang.StringUtils.isEmpty(getShowFutureError());
73      }
74      public String getShowFutureError() {
75          return showFutureError;
76      }
77      public void setShowFutureError(String showFutureError) {
78          this.showFutureError = showFutureError;
79      }
80      public boolean isShowFuture() {
81          return showFuture;
82      }
83      public void setShowFuture(boolean showReportURL) {
84          this.showFuture = showReportURL;
85      }
86      public String getMethodToCall() {
87          return methodToCall;
88      }
89      public void setMethodToCall(String methodToCall) {
90          this.methodToCall = methodToCall;
91      }
92      public String getDocumentId() {
93          return documentId;
94      }
95      public void setDocumentId(String documentId) {
96          this.documentId = documentId;
97      }
98  
99      public int getPendingActionRequestCount() {
100         return pendingActionRequestCount;
101     }
102 
103     public void setPendingActionRequestCount(int pendingActionRequestCount) {
104         this.pendingActionRequestCount = pendingActionRequestCount;
105     }
106 
107     public List getRootRequests() {
108         return rootRequests;
109     }
110     public void setRootRequests(List rootRequests) {
111         this.rootRequests = rootRequests;
112     }
113     public int getFutureActionRequestCount() {
114         return futureActionRequestCount;
115     }
116     public void setFutureActionRequestCount(int futureActionRequestCount) {
117         this.futureActionRequestCount = futureActionRequestCount;
118     }
119     public List getFutureRootRequests() {
120         return futureRootRequests;
121     }
122     public void setFutureRootRequests(List futureRootRequests) {
123         this.futureRootRequests = futureRootRequests;
124     }
125     public boolean isRemoveHeader() {
126         return removeHeader;
127     }
128     public void setRemoveHeader(boolean removeBar) {
129         this.removeHeader = removeBar;
130     }
131     public boolean isLookFuture() {
132         return lookFuture;
133     }
134     public void setLookFuture(boolean showFutureLink) {
135         this.lookFuture = showFutureLink;
136     }
137 	public boolean isShowNotes() {
138 		return showNotes;
139 	}
140 	public void setShowNotes(boolean showNotes) {
141 		this.showNotes = showNotes;
142 	}
143 	
144 	public String getNewRouteLogActionMessage() {
145 		return this.newRouteLogActionMessage;
146 	}
147 	
148 	public void setNewRouteLogActionMessage(String newRouteLogActionMessage) {
149 		this.newRouteLogActionMessage = newRouteLogActionMessage;
150 	}
151 	
152 	public boolean isEnableLogAction() {
153 		return this.enableLogAction;
154 	}
155 	
156 	public void setEnableLogAction(boolean enableLogAction) {
157 		this.enableLogAction = enableLogAction;
158 	}
159 	
160 	public String getHeaderMenuBar() {
161 		Properties parameters = new Properties();
162         parameters.put("showFuture", isShowFuture());
163         parameters.put("showNotes", isShowNotes());
164 		if (getDocumentId() != null) {
165 			parameters.put("documentId", getDocumentId());
166 		}
167 		if (getDocId() != null) {
168 			parameters.put("docId", getDocId());
169 		}
170 		if (getReturnUrlLocation() != null) {
171 			parameters.put("backUrl", getReturnUrlLocation());
172 		}
173         String url = UrlFactory.parameterizeUrl("RouteLog.do", parameters);
174         String krBaseUrl = ConfigContext.getCurrentContextConfig().getKRBaseURL();
175         url = "<div class=\"lookupcreatenew\" title=\"Refresh\"><a href=\"" + url + "\"><img src=\""+krBaseUrl+"/images/tinybutton-refresh.gif\" alt=\"refresh\"></a></div>";
176         return url;
177 	}
178 }