001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.kew.routelog.web; 017 018import org.kuali.rice.core.api.config.property.ConfigContext; 019import org.kuali.rice.kew.actionrequest.ActionRequestValue; 020import org.kuali.rice.kns.web.struts.form.KualiForm; 021import org.kuali.rice.krad.util.UrlFactory; 022 023import java.util.ArrayList; 024import java.util.List; 025import java.util.Properties; 026 027 028/** 029 * The Struts ActionForm used with {@link RouteLogAction} to display the routelog. 030 * 031 * @author Kuali Rice Team (rice.collab@kuali.org) 032 */ 033public class RouteLogForm extends KualiForm { 034 035 private static final long serialVersionUID = -3997667167734868281L; 036 private String methodToCall = ""; 037 private String documentId; 038 private List rootRequests = new ArrayList(); 039 private int pendingActionRequestCount; 040 private List<ActionRequestValue> futureRootRequests = new ArrayList<ActionRequestValue>(); 041 private int futureActionRequestCount; 042 private boolean showFuture; 043 private String showFutureError; 044 private boolean removeHeader; 045 private boolean lookFuture; 046 private boolean showNotes; 047 private String docId; 048 private String returnUrlLocation = null; 049 private boolean showCloseButton = false; 050 private String newRouteLogActionMessage; 051 private boolean enableLogAction = false; 052 053 public boolean isShowCloseButton() { 054 return showCloseButton; 055 } 056 public void setShowCloseButton(boolean showCloseButton) { 057 this.showCloseButton = showCloseButton; 058 } 059 public String getReturnUrlLocation() { 060 return returnUrlLocation; 061 } 062 public void setReturnUrlLocation(String returnUrlLocation) { 063 this.returnUrlLocation = returnUrlLocation; 064 } 065 public String getDocId() { 066 return docId; 067 } 068 public void setDocId(String docId) { 069 this.docId = docId; 070 } 071 public boolean isShowFutureHasError() { 072 return !org.apache.commons.lang.StringUtils.isEmpty(getShowFutureError()); 073 } 074 public String getShowFutureError() { 075 return showFutureError; 076 } 077 public void setShowFutureError(String showFutureError) { 078 this.showFutureError = showFutureError; 079 } 080 public boolean isShowFuture() { 081 return showFuture; 082 } 083 public void setShowFuture(boolean showReportURL) { 084 this.showFuture = showReportURL; 085 } 086 public String getMethodToCall() { 087 return methodToCall; 088 } 089 public void setMethodToCall(String methodToCall) { 090 this.methodToCall = methodToCall; 091 } 092 public String getDocumentId() { 093 return documentId; 094 } 095 public void setDocumentId(String documentId) { 096 this.documentId = documentId; 097 } 098 099 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}