001 /* 002 * Copyright 2011 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 */ 016 package org.kuali.kfs.module.bc.document.web.struts; 017 018 import java.util.HashMap; 019 import java.util.Map; 020 021 import org.kuali.kfs.module.bc.BCConstants; 022 import org.kuali.rice.kns.util.ErrorMap; 023 import org.kuali.rice.kns.util.KNSConstants; 024 import org.kuali.rice.kns.util.MessageList; 025 import org.kuali.rice.kns.web.struts.form.KualiForm; 026 027 /** 028 * Holds properties necessary for expansion screen handling. 029 */ 030 public class BudgetExpansionForm extends KualiForm { 031 private String backLocation; 032 private String returnAnchor; 033 private String returnFormKey; 034 035 // current active budget fiscal year 036 private Integer universityFiscalYear; 037 038 // form messages 039 private MessageList messages; 040 041 private MessageList callBackMessages = new MessageList(); 042 private ErrorMap callBackErrors = new ErrorMap(); 043 044 private Map<String, String> editingMode; 045 private Map<String, String> documentActions; 046 047 private boolean lostSession = false; 048 private boolean mainWindow = true; 049 050 /** 051 * Default Constructor 052 */ 053 public BudgetExpansionForm() { 054 super(); 055 messages = new MessageList(); 056 editingMode = new HashMap<String, String>(); 057 documentActions = new HashMap<String, String>(); 058 } 059 060 /** 061 * Gets the backLocation attribute. 062 * 063 * @return Returns the backLocation. 064 */ 065 public String getBackLocation() { 066 return backLocation; 067 } 068 069 /** 070 * Sets the backLocation attribute value. 071 * 072 * @param backLocation The backLocation to set. 073 */ 074 public void setBackLocation(String backLocation) { 075 this.backLocation = backLocation; 076 } 077 078 /** 079 * Gets the returnAnchor attribute. 080 * 081 * @return Returns the returnAnchor. 082 */ 083 public String getReturnAnchor() { 084 return returnAnchor; 085 } 086 087 /** 088 * Sets the returnAnchor attribute value. 089 * 090 * @param returnAnchor The returnAnchor to set. 091 */ 092 public void setReturnAnchor(String returnAnchor) { 093 this.returnAnchor = returnAnchor; 094 } 095 096 /** 097 * Gets the returnFormKey attribute. 098 * 099 * @return Returns the returnFormKey. 100 */ 101 public String getReturnFormKey() { 102 return returnFormKey; 103 } 104 105 /** 106 * Sets the returnFormKey attribute value. 107 * 108 * @param returnFormKey The returnFormKey to set. 109 */ 110 public void setReturnFormKey(String returnFormKey) { 111 this.returnFormKey = returnFormKey; 112 } 113 114 /** 115 * Gets the universityFiscalYear attribute. 116 * 117 * @return Returns the universityFiscalYear. 118 */ 119 public Integer getUniversityFiscalYear() { 120 return universityFiscalYear; 121 } 122 123 /** 124 * Sets the universityFiscalYear attribute value. 125 * 126 * @param universityFiscalYear The universityFiscalYear to set. 127 */ 128 public void setUniversityFiscalYear(Integer universityFiscalYear) { 129 this.universityFiscalYear = universityFiscalYear; 130 } 131 132 /** 133 * Gets the messages attribute. 134 * 135 * @return Returns the messages. 136 */ 137 public MessageList getMessages() { 138 return messages; 139 } 140 141 /** 142 * Sets the messages attribute value. 143 * 144 * @param messages The messages to set. 145 */ 146 public void setMessages(MessageList messages) { 147 this.messages = messages; 148 } 149 150 /** 151 * Adds a message to the form message list. 152 * 153 * @param message message to add 154 */ 155 public void addMessage(String message) { 156 if (this.messages == null) { 157 messages = new MessageList(); 158 } 159 160 this.messages.add(message); 161 } 162 163 /** 164 * Gets the callBackMessages attribute. 165 * 166 * @return Returns the callBackMessages. 167 */ 168 public MessageList getCallBackMessages() { 169 return callBackMessages; 170 } 171 172 /** 173 * Gets the callBackErrors attribute. 174 * 175 * @return Returns the callBackErrors. 176 */ 177 public ErrorMap getCallBackErrors() { 178 return callBackErrors; 179 } 180 181 /** 182 * Gets the editingMode attribute. 183 * 184 * @return Returns the editingMode. 185 */ 186 public Map<String, String> getEditingMode() { 187 return editingMode; 188 } 189 190 /** 191 * Sets the editingMode attribute value. 192 * 193 * @param editingMode The editingMode to set. 194 */ 195 public void setEditingMode(Map<String, String> editingMode) { 196 this.editingMode = editingMode; 197 } 198 199 /** 200 * Gets the documentActions attribute. 201 * 202 * @return Returns the documentActions. 203 */ 204 public Map<String, String> getDocumentActions() { 205 return documentActions; 206 } 207 208 /** 209 * Sets the documentActions attribute value. 210 * 211 * @param documentActions The documentActions to set. 212 */ 213 public void setDocumentActions(Map<String, String> documentActions) { 214 this.documentActions = documentActions; 215 } 216 217 /** 218 * Helper method to check edit mode Map for system view only entry 219 */ 220 public boolean isSystemViewOnly() { 221 return getEditingMode().containsKey(BCConstants.EditModes.SYSTEM_VIEW_ONLY); 222 } 223 224 /** 225 * Helper method to check document actions Map for can edit entry 226 */ 227 public boolean isEditAllowed() { 228 return getDocumentActions().keySet().contains(KNSConstants.KUALI_ACTION_CAN_EDIT); 229 } 230 231 /** 232 * Gets the lostSession attribute. 233 * 234 * @return Returns the lostSession. 235 */ 236 public boolean isLostSession() { 237 return lostSession; 238 } 239 240 /** 241 * Sets the lostSession attribute value. 242 * 243 * @param lostSession The lostSession to set. 244 */ 245 public void setLostSession(boolean lostSession) { 246 this.lostSession = lostSession; 247 } 248 249 /** 250 * Gets the mainWindow attribute. 251 * 252 * @return Returns the mainWindow. 253 */ 254 public boolean isMainWindow() { 255 return mainWindow; 256 } 257 258 /** 259 * Sets the mainWindow attribute value. 260 * 261 * @param mainWindow The mainWindow to set. 262 */ 263 public void setMainWindow(boolean mainWindow) { 264 this.mainWindow = mainWindow; 265 } 266 }