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.text.MessageFormat; 019 import java.util.ArrayList; 020 import java.util.HashMap; 021 import java.util.List; 022 import java.util.Map; 023 024 import javax.servlet.http.HttpServletRequest; 025 import javax.servlet.http.HttpServletResponse; 026 import javax.servlet.http.HttpSession; 027 028 import org.apache.commons.lang.StringUtils; 029 import org.apache.struts.action.ActionForm; 030 import org.apache.struts.action.ActionForward; 031 import org.apache.struts.action.ActionMapping; 032 import org.kuali.kfs.coa.businessobject.Organization; 033 import org.kuali.kfs.module.bc.BCConstants; 034 import org.kuali.kfs.module.bc.BCKeyConstants; 035 import org.kuali.kfs.module.bc.BudgetConstructionReportMode; 036 import org.kuali.kfs.module.bc.BCConstants.OrgSelControlOption; 037 import org.kuali.kfs.module.bc.BCConstants.OrgSelOpMode; 038 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionAccountSelect; 039 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionIntendedIncumbentSelect; 040 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionOrganizationReports; 041 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionPositionSelect; 042 import org.kuali.kfs.module.bc.businessobject.BudgetConstructionPullup; 043 import org.kuali.kfs.module.bc.document.service.BudgetConstructionProcessorService; 044 import org.kuali.kfs.module.bc.document.service.BudgetOrganizationTreeService; 045 import org.kuali.kfs.module.bc.document.service.BudgetPushPullService; 046 import org.kuali.kfs.module.bc.document.service.OrganizationBCDocumentSearchService; 047 import org.kuali.kfs.module.bc.report.ReportControlListBuildHelper; 048 import org.kuali.kfs.module.bc.util.BudgetUrlUtil; 049 import org.kuali.kfs.sys.KFSConstants; 050 import org.kuali.kfs.sys.context.SpringContext; 051 import org.kuali.rice.kim.bo.Person; 052 import org.kuali.rice.kns.service.BusinessObjectService; 053 import org.kuali.rice.kns.service.KualiConfigurationService; 054 import org.kuali.rice.kns.util.GlobalVariables; 055 import org.kuali.rice.kns.util.KNSConstants; 056 import org.kuali.rice.kns.util.TypedArrayList; 057 import org.kuali.rice.core.util.KeyLabelPair; 058 059 /** 060 * Handles organization budget action requests from menu. 061 */ 062 public class OrganizationSelectionTreeAction extends BudgetExpansionAction { 063 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OrganizationSelectionTreeAction.class); 064 065 /** 066 * @see org.kuali.kfs.module.bc.document.web.struts.BudgetExpansionAction#execute(org.apache.struts.action.ActionMapping, 067 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 068 */ 069 @Override 070 public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 071 072 ActionForward actionForward = super.execute(mapping, form, request, response); 073 074 OrganizationSelectionTreeForm orgSelTreeForm = (OrganizationSelectionTreeForm) form; 075 076 if (!orgSelTreeForm.isLostSession()){ 077 078 // re-init the session form if session scoped 079 if (orgSelTreeForm.getMethodToCall().equals("refresh")) { 080 if (BCConstants.MAPPING_SCOPE_SESSION.equals(mapping.getScope())) { 081 HttpSession sess = request.getSession(Boolean.FALSE); 082 String formName = mapping.getAttribute(); 083 sess.setAttribute(formName, orgSelTreeForm); 084 } 085 } 086 087 if (orgSelTreeForm.getPullFlagKeyLabels().isEmpty() && orgSelTreeForm.getOperatingMode() != null) { 088 OrgSelOpMode opMode = OrgSelOpMode.valueOf(orgSelTreeForm.getOperatingMode()); 089 switch (opMode) { 090 case SALSET: 091 orgSelTreeForm.setOperatingModeTitle("Budget Salary Setting Organization Selection"); 092 orgSelTreeForm.setOperatingModePullFlagLabel("Selected"); 093 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.NO.getKey(), OrgSelControlOption.NO.getLabel())); 094 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.YES.getKey(), OrgSelControlOption.YES.getLabel())); 095 break; 096 case REPORTS: 097 orgSelTreeForm.setOperatingModeTitle("BC Reports Organization Selection"); 098 orgSelTreeForm.setOperatingModePullFlagLabel("Selected"); 099 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.NO.getKey(), OrgSelControlOption.NO.getLabel())); 100 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.YES.getKey(), OrgSelControlOption.YES.getLabel())); 101 break; 102 case PULLUP: 103 orgSelTreeForm.setOperatingModeTitle("BC Pull Up Organization Selection"); 104 orgSelTreeForm.setOperatingModePullFlagLabel("Pull Up Type"); 105 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.NOTSEL.getKey(), OrgSelControlOption.NOTSEL.getLabel())); 106 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.BOTH.getKey(), OrgSelControlOption.BOTH.getLabel())); 107 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.ORG.getKey(), OrgSelControlOption.ORG.getLabel())); 108 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.SUBORG.getKey(), OrgSelControlOption.SUBORG.getLabel())); 109 break; 110 case PUSHDOWN: 111 orgSelTreeForm.setOperatingModeTitle("BC Push Down Organization Selection"); 112 orgSelTreeForm.setOperatingModePullFlagLabel("Push Down Type"); 113 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.NOTSEL.getKey(), OrgSelControlOption.NOTSEL.getLabel())); 114 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.ORGLEV.getKey(), OrgSelControlOption.ORGLEV.getLabel())); 115 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.MGRLEV.getKey(), OrgSelControlOption.MGRLEV.getLabel())); 116 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.ORGMGRLEV.getKey(), OrgSelControlOption.ORGMGRLEV.getLabel())); 117 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.LEVONE.getKey(), OrgSelControlOption.LEVONE.getLabel())); 118 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.LEVZERO.getKey(), OrgSelControlOption.LEVZERO.getLabel())); 119 break; 120 default: 121 // default to ACCOUNT operating mode 122 orgSelTreeForm.setOperatingModeTitle("Budgeted Account List Search Organization Selection"); 123 orgSelTreeForm.setOperatingModePullFlagLabel("Selected"); 124 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.NO.getKey(), OrgSelControlOption.NO.getLabel())); 125 orgSelTreeForm.getPullFlagKeyLabels().add(new KeyLabelPair(OrgSelControlOption.YES.getKey(), OrgSelControlOption.YES.getLabel())); 126 break; 127 } 128 } 129 } 130 131 return actionForward; 132 } 133 134 /** 135 * Sets up the initial mode of the drill down screen based on a passed in calling mode attribute This can be one of five modes - 136 * pullup, pushdown, reports, salset, account. Each mode causes a slightly different rendition of the controls presented to the 137 * user, but the basic point of view selection and organization drill down functionality is the same in all five modes. 138 * 139 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 140 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 141 */ 142 public ActionForward loadExpansionScreen(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 143 OrganizationSelectionTreeForm orgSelTreeForm = (OrganizationSelectionTreeForm) form; 144 Person person = GlobalVariables.getUserSession().getPerson(); 145 146 // check if user has only one available point of view. if so, select that point of view and build selection 147 List<Organization> pointOfViewOrgs = SpringContext.getBean(BudgetConstructionProcessorService.class).getProcessorOrgs(person); 148 if (pointOfViewOrgs != null && pointOfViewOrgs.size() == 1) { 149 orgSelTreeForm.setCurrentPointOfViewKeyCode(pointOfViewOrgs.get(0).getChartOfAccountsCode() + "-" + pointOfViewOrgs.get(0).getOrganizationCode()); 150 151 return performBuildPointOfView(mapping, form, request, response); 152 } 153 if (pointOfViewOrgs.isEmpty()) { 154 GlobalVariables.getMessageMap().putError("pointOfViewOrg", BCKeyConstants.ERROR_BUDGET_USER_NOT_ORG_APPROVER); 155 } 156 157 return mapping.findForward(KFSConstants.MAPPING_BASIC); 158 } 159 160 /** 161 * Called by the close button. It removes the user's BudgetConstructionPullup table rows and returns the user to the seleection 162 * screen action. 163 * 164 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 165 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 166 */ 167 public ActionForward returnToCaller(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 168 // depopulate any selection subtrees for the user 169 String principalName = GlobalVariables.getUserSession().getPerson().getPrincipalId(); 170 SpringContext.getBean(BudgetOrganizationTreeService.class).cleanPullup(principalName); 171 172 return super.returnToCaller(mapping, form, request, response); 173 } 174 175 /** 176 * Implements functionality behind the refresh button on the Organization Selection Tree screen. This is also called when the 177 * value of the point of view select control changed and javascript is enabled on the user's browser 178 * 179 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 180 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 181 */ 182 public ActionForward performBuildPointOfView(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 183 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 184 185 // check for point of view change 186 if (organizationSelectionTreeForm.getCurrentPointOfViewKeyCode() != null) { 187 if ((organizationSelectionTreeForm.getPreviousPointOfViewKeyCode() == null) || (!organizationSelectionTreeForm.getPreviousPointOfViewKeyCode().equalsIgnoreCase(organizationSelectionTreeForm.getCurrentPointOfViewKeyCode()) == true)) { 188 String[] flds = organizationSelectionTreeForm.getCurrentPointOfViewKeyCode().split("[-]"); 189 organizationSelectionTreeForm.setPreviousPointOfViewKeyCode(organizationSelectionTreeForm.getCurrentPointOfViewKeyCode()); 190 191 HashMap<String, Object> map = new HashMap<String, Object>(); 192 map.put("chartOfAccountsCode", flds[0]); 193 map.put("organizationCode", flds[1]); 194 organizationSelectionTreeForm.setPointOfViewOrg((BudgetConstructionOrganizationReports) SpringContext.getBean(BusinessObjectService.class).findByPrimaryKey(BudgetConstructionOrganizationReports.class, map)); 195 196 // build a new selection subtree 197 String principalId = GlobalVariables.getUserSession().getPerson().getPrincipalId(); 198 SpringContext.getBean(BudgetOrganizationTreeService.class).buildPullupSql(principalId, flds[0], flds[1]); 199 200 // initialize the selection tool to the root 201 map.put("principalId", principalId); 202 organizationSelectionTreeForm.setSelectionSubTreeOrgs((List<BudgetConstructionPullup>) SpringContext.getBean(BusinessObjectService.class).findMatching(BudgetConstructionPullup.class, map)); 203 organizationSelectionTreeForm.populateSelectionSubTreeOrgs(); 204 organizationSelectionTreeForm.setPreviousBranchOrgs(new TypedArrayList(BudgetConstructionPullup.class)); 205 } 206 } 207 else { 208 organizationSelectionTreeForm.setPreviousPointOfViewKeyCode(organizationSelectionTreeForm.getCurrentPointOfViewKeyCode()); 209 organizationSelectionTreeForm.setPointOfViewOrg(new BudgetConstructionOrganizationReports()); 210 organizationSelectionTreeForm.setSelectionSubTreeOrgs(new TypedArrayList(BudgetConstructionPullup.class)); 211 organizationSelectionTreeForm.setPreviousBranchOrgs(new TypedArrayList(BudgetConstructionPullup.class)); 212 } 213 214 return mapping.findForward(KFSConstants.MAPPING_BASIC); 215 } 216 217 /** 218 * Handles saving the BudgetConstructionPullup current row to the previous branches stack and displaying the associated 219 * children. 220 * 221 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 222 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 223 */ 224 public ActionForward navigateDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 225 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 226 String principalId = GlobalVariables.getUserSession().getPerson().getPrincipalId(); 227 228 // reset any set pullflags in the database before navigation 229 SpringContext.getBean(BudgetOrganizationTreeService.class).resetPullFlag(principalId); 230 231 232 // push parent org onto the branch stack 233 organizationSelectionTreeForm.getPreviousBranchOrgs().add(organizationSelectionTreeForm.getSelectionSubTreeOrgs().get(this.getSelectedLine(request))); 234 235 // get the children 236 String chartOfAccountsCode = organizationSelectionTreeForm.getSelectionSubTreeOrgs().get(this.getSelectedLine(request)).getChartOfAccountsCode(); 237 String organizationCode = organizationSelectionTreeForm.getSelectionSubTreeOrgs().get(this.getSelectedLine(request)).getOrganizationCode(); 238 organizationSelectionTreeForm.setSelectionSubTreeOrgs((List<BudgetConstructionPullup>) SpringContext.getBean(BudgetOrganizationTreeService.class).getPullupChildOrgs(principalId, chartOfAccountsCode, organizationCode)); 239 organizationSelectionTreeForm.populateSelectionSubTreeOrgs(); 240 241 return mapping.findForward(KFSConstants.MAPPING_BASIC); 242 } 243 244 /** 245 * Handles navigation back to a previous branch BudgetConstructionPullup row displaying the associated parent and it's siblings 246 * 247 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 248 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 249 */ 250 public ActionForward navigateUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 251 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 252 String principalId = GlobalVariables.getUserSession().getPerson().getPrincipalId(); 253 254 // reset any set pullflags in the database before navigation 255 SpringContext.getBean(BudgetOrganizationTreeService.class).resetPullFlag(principalId); 256 257 // pop the parent org off the branch stack 258 int popIdx = this.getSelectedLine(request); 259 BudgetConstructionPullup previousBranchOrg = organizationSelectionTreeForm.getPreviousBranchOrgs().remove(popIdx); 260 if (popIdx == 0) { 261 organizationSelectionTreeForm.setPreviousBranchOrgs(new TypedArrayList(BudgetConstructionPullup.class)); 262 263 // reinitialize the selection tool to the root 264 HashMap<String, Object> map = new HashMap<String, Object>(); 265 map.put("chartOfAccountsCode", previousBranchOrg.getChartOfAccountsCode()); 266 map.put("organizationCode", previousBranchOrg.getOrganizationCode()); 267 map.put("principalId", principalId); 268 organizationSelectionTreeForm.setSelectionSubTreeOrgs((List<BudgetConstructionPullup>) SpringContext.getBean(BusinessObjectService.class).findMatching(BudgetConstructionPullup.class, map)); 269 organizationSelectionTreeForm.populateSelectionSubTreeOrgs(); 270 271 } 272 else { 273 organizationSelectionTreeForm.setPreviousBranchOrgs(organizationSelectionTreeForm.getPreviousBranchOrgs().subList(0, popIdx)); 274 275 // get the parent and parent siblings 276 String chartOfAccountsCode = previousBranchOrg.getReportsToChartOfAccountsCode(); 277 String organizationCode = previousBranchOrg.getReportsToOrganizationCode(); 278 organizationSelectionTreeForm.setSelectionSubTreeOrgs((List<BudgetConstructionPullup>) SpringContext.getBean(BudgetOrganizationTreeService.class).getPullupChildOrgs(principalId, chartOfAccountsCode, organizationCode)); 279 organizationSelectionTreeForm.populateSelectionSubTreeOrgs(); 280 } 281 282 return mapping.findForward(KFSConstants.MAPPING_BASIC); 283 } 284 285 /** 286 * Sets the pullFlag for all displayed subtree organizations 287 * 288 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 289 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 290 */ 291 public ActionForward selectAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 292 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 293 setPullFlag(organizationSelectionTreeForm.getSelectionSubTreeOrgs(), OrgSelControlOption.YES.getKey()); 294 295 return mapping.findForward(KFSConstants.MAPPING_BASIC); 296 } 297 298 /** 299 * Clears the pullFlag for all displayed subtree organizations 300 * 301 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 302 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 303 */ 304 public ActionForward clearAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 305 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 306 setPullFlag(organizationSelectionTreeForm.getSelectionSubTreeOrgs(), OrgSelControlOption.NO.getKey()); 307 308 return mapping.findForward(KFSConstants.MAPPING_BASIC); 309 } 310 311 /** 312 * Sets the pullFlag for all displayed subtree organizations to the setting implied by the method name. 313 * 314 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 315 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 316 */ 317 public ActionForward selectPullOrgAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 318 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 319 setPullFlag(organizationSelectionTreeForm.getSelectionSubTreeOrgs(), OrgSelControlOption.ORG.getKey()); 320 321 return mapping.findForward(KFSConstants.MAPPING_BASIC); 322 } 323 324 /** 325 * Sets the pullFlag for all displayed subtree organizations to the setting implied by the method name. 326 * 327 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 328 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 329 */ 330 public ActionForward selectPullSubOrgAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 331 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 332 setPullFlag(organizationSelectionTreeForm.getSelectionSubTreeOrgs(), OrgSelControlOption.SUBORG.getKey()); 333 334 return mapping.findForward(KFSConstants.MAPPING_BASIC); 335 } 336 337 /** 338 * Sets the pullFlag for all displayed subtree organizations to the setting implied by the method name. 339 * 340 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 341 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 342 */ 343 public ActionForward selectPullBothAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 344 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 345 setPullFlag(organizationSelectionTreeForm.getSelectionSubTreeOrgs(), OrgSelControlOption.BOTH.getKey()); 346 347 return mapping.findForward(KFSConstants.MAPPING_BASIC); 348 } 349 350 /** 351 * Sets the pullFlag for all displayed subtree organizations to the setting implied by the method name. 352 * 353 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 354 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 355 */ 356 public ActionForward selectPushOrgLevAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 357 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 358 setPullFlag(organizationSelectionTreeForm.getSelectionSubTreeOrgs(), OrgSelControlOption.ORGLEV.getKey()); 359 360 return mapping.findForward(KFSConstants.MAPPING_BASIC); 361 } 362 363 /** 364 * Sets the pullFlag for all displayed subtree organizations to the setting implied by the method name. 365 * 366 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 367 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 368 */ 369 public ActionForward selectPushMgrLevAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 370 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 371 setPullFlag(organizationSelectionTreeForm.getSelectionSubTreeOrgs(), OrgSelControlOption.MGRLEV.getKey()); 372 373 return mapping.findForward(KFSConstants.MAPPING_BASIC); 374 } 375 376 /** 377 * Sets the pullFlag for all displayed subtree organizations to the setting implied by the method name. 378 * 379 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 380 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 381 */ 382 public ActionForward selectPushOrgMgrLevAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 383 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 384 setPullFlag(organizationSelectionTreeForm.getSelectionSubTreeOrgs(), OrgSelControlOption.ORGMGRLEV.getKey()); 385 386 return mapping.findForward(KFSConstants.MAPPING_BASIC); 387 } 388 389 /** 390 * Sets the pullFlag for all displayed subtree organizations to the setting implied by the method name. 391 * 392 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 393 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 394 */ 395 public ActionForward selectPushLevOneAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 396 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 397 setPullFlag(organizationSelectionTreeForm.getSelectionSubTreeOrgs(), OrgSelControlOption.LEVONE.getKey()); 398 399 return mapping.findForward(KFSConstants.MAPPING_BASIC); 400 } 401 402 /** 403 * Sets the pullFlag for all displayed subtree organizations to the setting implied by the method name. 404 * 405 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 406 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 407 */ 408 public ActionForward selectPushLevZeroAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 409 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 410 setPullFlag(organizationSelectionTreeForm.getSelectionSubTreeOrgs(), OrgSelControlOption.LEVZERO.getKey()); 411 412 return mapping.findForward(KFSConstants.MAPPING_BASIC); 413 } 414 415 /** 416 * Sets the pullFlags for each of the objects in the list to the pullFlagValue. 417 * 418 * @param selOrgs 419 * @param pullFlagValue 420 */ 421 protected void setPullFlag(List<BudgetConstructionPullup> selOrgs, Integer pullFlagValue) { 422 for (int i = 0; i < selOrgs.size(); i++) { 423 selOrgs.get(i).setPullFlag(pullFlagValue); 424 } 425 } 426 427 /** 428 * Checks that at least one organization is selected and stores the selection settings. If no organization is selected, an error 429 * message is displayed to the user. 430 * 431 * @param selectionSubTreeOrgs 432 * @return boolean - true if there was a selection and the list was saved, otherwise false 433 */ 434 protected boolean storedSelectedOrgs(List<BudgetConstructionPullup> selectionSubTreeOrgs) { 435 boolean foundSelected = false; 436 437 // check to see if at least one pullflag is set and store the pullflag settings for currently displayed set of orgs 438 for (BudgetConstructionPullup budgetConstructionPullup : selectionSubTreeOrgs) { 439 if (budgetConstructionPullup.getPullFlag() > 0) { 440 foundSelected = true; 441 break; 442 } 443 } 444 445 // if selection was found, save the org tree seletions, otherwise build error message 446 if (foundSelected) { 447 SpringContext.getBean(BusinessObjectService.class).save(selectionSubTreeOrgs); 448 } 449 else { 450 GlobalVariables.getMessageMap().putError(BCConstants.SELECTION_SUB_TREE_ORGS, BCKeyConstants.ERROR_BUDGET_ORG_NOT_SELECTED); 451 } 452 453 454 return foundSelected; 455 } 456 457 /** 458 * Checks the selection and calls the Position Pick list screen action. 459 * 460 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 461 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 462 */ 463 public ActionForward performPositionPick(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 464 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 465 466 if (!storedSelectedOrgs(organizationSelectionTreeForm.getSelectionSubTreeOrgs())) { 467 return mapping.findForward(KFSConstants.MAPPING_BASIC); 468 } 469 organizationSelectionTreeForm.setNoResetOnReturn(true); 470 471 // forward to temp list action for displaying results 472 String url = BudgetUrlUtil.buildTempListLookupUrl(mapping, organizationSelectionTreeForm, BCConstants.TempListLookupMode.POSITION_SELECT, BudgetConstructionPositionSelect.class.getName(), null); 473 474 return new ActionForward(url, true); 475 } 476 477 /** 478 * Checks the selection and calls the Budgeted Incumbents Pick list screen action. 479 * 480 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 481 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 482 */ 483 public ActionForward performIncumbentPick(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 484 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 485 486 if (!storedSelectedOrgs(organizationSelectionTreeForm.getSelectionSubTreeOrgs())) { 487 return mapping.findForward(KFSConstants.MAPPING_BASIC); 488 } 489 organizationSelectionTreeForm.setNoResetOnReturn(true); 490 491 // forward to temp list action for displaying results 492 String url = BudgetUrlUtil.buildTempListLookupUrl(mapping, organizationSelectionTreeForm, BCConstants.TempListLookupMode.INTENDED_INCUMBENT_SELECT, BudgetConstructionIntendedIncumbentSelect.class.getName(), null); 493 494 return new ActionForward(url, true); 495 } 496 497 /** 498 * Checks the selection and calls the Budget Documents pick list screen action. 499 * 500 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 501 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 502 */ 503 public ActionForward performShowBudgetDocs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 504 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 505 506 if (!storedSelectedOrgs(organizationSelectionTreeForm.getSelectionSubTreeOrgs())) { 507 return mapping.findForward(KFSConstants.MAPPING_BASIC); 508 } 509 510 // build table but give a message if empty 511 int rowCount = SpringContext.getBean(OrganizationBCDocumentSearchService.class).buildAccountSelectPullList(GlobalVariables.getUserSession().getPerson().getPrincipalId(), organizationSelectionTreeForm.getUniversityFiscalYear()); 512 if (rowCount == 0) { 513 GlobalVariables.getMessageList().add("error.inquiry"); 514 return mapping.findForward(KFSConstants.MAPPING_BASIC); 515 } 516 organizationSelectionTreeForm.setNoResetOnReturn(true); 517 518 // forward to temp list action for displaying results 519 String url = BudgetUrlUtil.buildTempListLookupUrl(mapping, organizationSelectionTreeForm, BCConstants.TempListLookupMode.ACCOUNT_SELECT_BUDGETED_DOCUMENTS, BudgetConstructionAccountSelect.class.getName(), null); 520 521 return new ActionForward(url, true); 522 } 523 524 /** 525 * Checks the selection and performs the Pull up screen action. 526 * 527 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 528 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 529 */ 530 public ActionForward performPullUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 531 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 532 533 if (!storedSelectedOrgs(organizationSelectionTreeForm.getSelectionSubTreeOrgs())) { 534 return mapping.findForward(KFSConstants.MAPPING_BASIC); 535 } 536 537 // get the needed params from the form and environment 538 String pointOfViewCharOfAccountsCode = organizationSelectionTreeForm.getPointOfViewOrg().getChartOfAccountsCode(); 539 String pointOfViewOrganizationCode = organizationSelectionTreeForm.getPointOfViewOrg().getOrganizationCode(); 540 Integer bcFiscalYear = organizationSelectionTreeForm.getUniversityFiscalYear(); 541 String principalId = GlobalVariables.getUserSession().getPerson().getPrincipalId(); 542 543 SpringContext.getBean(BudgetPushPullService.class).pullupSelectedOrganizationDocuments(principalId, bcFiscalYear, pointOfViewCharOfAccountsCode, pointOfViewOrganizationCode); 544 545 // build Budgeted Account list of Documents set at level that is less than the user's point of view 546 // build process should return number of accounts in list, if non-zero call display otherwise add successful pullup message 547 // if no accounts are on the list 548 int rowCount = SpringContext.getBean(BudgetPushPullService.class).buildPullUpBudgetedDocuments(principalId, bcFiscalYear, pointOfViewCharOfAccountsCode, pointOfViewOrganizationCode); 549 if (rowCount != 0) { 550 organizationSelectionTreeForm.setNoResetOnReturn(true); 551 String url = BudgetUrlUtil.buildTempListLookupUrl(mapping, organizationSelectionTreeForm, BCConstants.TempListLookupMode.ACCOUNT_SELECT_PULLUP_DOCUMENTS, BudgetConstructionAccountSelect.class.getName(), null); 552 553 return new ActionForward(url, true); 554 } 555 556 GlobalVariables.getMessageList().add(BCKeyConstants.MSG_ORG_PULL_UP_SUCCESSFUL); 557 558 return mapping.findForward(KFSConstants.MAPPING_BASIC); 559 } 560 561 /** 562 * Checks at least one org was selected then calls organization push/pull service to built the account list for budgeted 563 * documents below the user's point of view and forwards to the temp list action to display the results. 564 * 565 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 566 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 567 */ 568 public ActionForward performShowPullUpBudgetDocs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 569 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 570 571 if (!storedSelectedOrgs(organizationSelectionTreeForm.getSelectionSubTreeOrgs())) { 572 return mapping.findForward(KFSConstants.MAPPING_BASIC); 573 } 574 575 String pointOfViewCharOfAccountsCode = organizationSelectionTreeForm.getPointOfViewOrg().getChartOfAccountsCode(); 576 String pointOfViewOrganizationCode = organizationSelectionTreeForm.getPointOfViewOrg().getOrganizationCode(); 577 Integer bcFiscalYear = organizationSelectionTreeForm.getUniversityFiscalYear(); 578 String principalId = GlobalVariables.getUserSession().getPerson().getPrincipalId(); 579 580 // call service to build account list data 581 int rowCount = SpringContext.getBean(BudgetPushPullService.class).buildPullUpBudgetedDocuments(principalId, bcFiscalYear, pointOfViewCharOfAccountsCode, pointOfViewOrganizationCode); 582 if (rowCount == 0) { 583 String message = SpringContext.getBean(KualiConfigurationService.class).getPropertyString(BCKeyConstants.ERROR_NO_ACCOUNTS_PULL_UP); 584 message = MessageFormat.format(message, pointOfViewCharOfAccountsCode, pointOfViewOrganizationCode); 585 organizationSelectionTreeForm.addMessage(message); 586 587 return mapping.findForward(KFSConstants.MAPPING_BASIC); 588 } 589 organizationSelectionTreeForm.setNoResetOnReturn(true); 590 591 // forward to temp list action for displaying results 592 String url = BudgetUrlUtil.buildTempListLookupUrl(mapping, organizationSelectionTreeForm, BCConstants.TempListLookupMode.ACCOUNT_SELECT_PULLUP_DOCUMENTS, BudgetConstructionAccountSelect.class.getName(), null); 593 594 return new ActionForward(url, true); 595 } 596 597 /** 598 * Checks the selection and performs the Push down screen action. 599 * 600 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 601 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 602 */ 603 public ActionForward performPushDown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 604 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 605 606 if (!storedSelectedOrgs(organizationSelectionTreeForm.getSelectionSubTreeOrgs())) { 607 return mapping.findForward(KFSConstants.MAPPING_BASIC); 608 } 609 610 // get the needed params from the form and environment 611 String pointOfViewCharOfAccountsCode = organizationSelectionTreeForm.getPointOfViewOrg().getChartOfAccountsCode(); 612 String pointOfViewOrganizationCode = organizationSelectionTreeForm.getPointOfViewOrg().getOrganizationCode(); 613 Integer bcFiscalYear = organizationSelectionTreeForm.getUniversityFiscalYear(); 614 String principalId = GlobalVariables.getUserSession().getPerson().getPrincipalId(); 615 616 SpringContext.getBean(BudgetPushPullService.class).pushdownSelectedOrganizationDocuments(principalId, bcFiscalYear, pointOfViewCharOfAccountsCode, pointOfViewOrganizationCode); 617 618 // build Budgeted Account list of Documents set at level that is less than the user's point of view 619 // build process should return number of accounts in list, if non-zero call display 620 // otherwise add successful pullup message if no accounts are on the list 621 int rowCount = SpringContext.getBean(BudgetPushPullService.class).buildPushDownBudgetedDocuments(principalId, bcFiscalYear, pointOfViewCharOfAccountsCode, pointOfViewOrganizationCode); 622 if (rowCount != 0) { 623 organizationSelectionTreeForm.setNoResetOnReturn(true); 624 String url = BudgetUrlUtil.buildTempListLookupUrl(mapping, organizationSelectionTreeForm, BCConstants.TempListLookupMode.ACCOUNT_SELECT_PUSHDOWN_DOCUMENTS, BudgetConstructionAccountSelect.class.getName(), null); 625 626 return new ActionForward(url, true); 627 } 628 629 GlobalVariables.getMessageList().add(BCKeyConstants.MSG_ORG_PUSH_DOWN_SUCCESSFUL); 630 631 return mapping.findForward(KFSConstants.MAPPING_BASIC); 632 } 633 634 /** 635 * Checks at least one org was selected then calls organization push/pull service to built the account list for budgeted 636 * documents at the user's point of view and forwards to the temp list action to display the results. 637 * 638 * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping, 639 * org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) 640 */ 641 public ActionForward performShowPushDownBudgetDocs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 642 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 643 644 if (!storedSelectedOrgs(organizationSelectionTreeForm.getSelectionSubTreeOrgs())) { 645 return mapping.findForward(KFSConstants.MAPPING_BASIC); 646 } 647 648 String pointOfViewCharOfAccountsCode = organizationSelectionTreeForm.getPointOfViewOrg().getChartOfAccountsCode(); 649 String pointOfViewOrganizationCode = organizationSelectionTreeForm.getPointOfViewOrg().getOrganizationCode(); 650 Integer bcFiscalYear = organizationSelectionTreeForm.getUniversityFiscalYear(); 651 String principalId = GlobalVariables.getUserSession().getPerson().getPrincipalId(); 652 653 // call service to build account list data 654 int rowCount = SpringContext.getBean(BudgetPushPullService.class).buildPushDownBudgetedDocuments(principalId, bcFiscalYear, pointOfViewCharOfAccountsCode, pointOfViewOrganizationCode); 655 if (rowCount == 0) { 656 String message = SpringContext.getBean(KualiConfigurationService.class).getPropertyString(BCKeyConstants.ERROR_NO_ACCOUNTS_PUSH_DOWN); 657 message = MessageFormat.format(message, pointOfViewCharOfAccountsCode, pointOfViewOrganizationCode); 658 organizationSelectionTreeForm.addMessage(message); 659 660 return mapping.findForward(KFSConstants.MAPPING_BASIC); 661 } 662 organizationSelectionTreeForm.setNoResetOnReturn(true); 663 664 // forward to temp list action for displaying results 665 String url = BudgetUrlUtil.buildTempListLookupUrl(mapping, organizationSelectionTreeForm, BCConstants.TempListLookupMode.ACCOUNT_SELECT_PUSHDOWN_DOCUMENTS, BudgetConstructionAccountSelect.class.getName(), null); 666 667 return new ActionForward(url, true); 668 } 669 670 /** 671 * Handles forwarding to account list or report selection screen. 672 */ 673 public ActionForward performReport(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 674 OrganizationSelectionTreeForm organizationSelectionTreeForm = (OrganizationSelectionTreeForm) form; 675 676 List<BudgetConstructionPullup> selectionSubTreeOrgs = organizationSelectionTreeForm.getSelectionSubTreeOrgs(); 677 if (!storedSelectedOrgs(selectionSubTreeOrgs)) { 678 return mapping.findForward(KFSConstants.MAPPING_BASIC); 679 } 680 681 // set up buildhelper to be used by called action 682 ReportControlListBuildHelper buildHelper = (ReportControlListBuildHelper) GlobalVariables.getUserSession().retrieveObject(BCConstants.Report.CONTROL_BUILD_HELPER_SESSION_NAME); 683 if (buildHelper == null) { 684 buildHelper = new ReportControlListBuildHelper(); 685 } 686 687 BudgetConstructionReportMode reportMode = setupReportMode(request, organizationSelectionTreeForm); 688 buildHelper.addBuildRequest(organizationSelectionTreeForm.getCurrentPointOfViewKeyCode(), removeUnselectedSubTreeOrgs(selectionSubTreeOrgs), reportMode.reportBuildMode); 689 GlobalVariables.getUserSession().addObject(BCConstants.Report.CONTROL_BUILD_HELPER_SESSION_NAME, buildHelper); 690 691 // check if there are any accounts above user's point of view, if so forward to account listing page. if not, forward to 692 // report select(subfund or object code) screen 693 String[] pointOfViewFields = organizationSelectionTreeForm.getCurrentPointOfViewKeyCode().split("[-]"); 694 int rowCount = SpringContext.getBean(OrganizationBCDocumentSearchService.class).buildBudgetedAccountsAbovePointsOfView(GlobalVariables.getUserSession().getPerson().getPrincipalId(), organizationSelectionTreeForm.getUniversityFiscalYear(), pointOfViewFields[0], pointOfViewFields[1]); 695 696 // in case of 2PLG or Sync report should move to account list page. 697 boolean forceToAccountListScreen = false; 698 String reportModeName = organizationSelectionTreeForm.getReportMode(); 699 if (reportModeName.equals(BudgetConstructionReportMode.TWOPLG_LIST_REPORT.reportModeName) || reportModeName.equals(BudgetConstructionReportMode.SYNCHRONIZATION_PROBLEMS_REPORT.reportModeName)) { 700 forceToAccountListScreen = true; 701 } 702 organizationSelectionTreeForm.setNoResetOnReturn(true); 703 704 String forwardURL = ""; 705 if (rowCount != 0 || forceToAccountListScreen) { 706 forwardURL = buildAccountListForwardURL(organizationSelectionTreeForm, mapping, forceToAccountListScreen); 707 } 708 else { 709 forwardURL = buildReportSelectForwardURL(organizationSelectionTreeForm, mapping); 710 } 711 712 return new ActionForward(forwardURL, true); 713 } 714 715 /** 716 * Removes unselected SubTreeOrgs since selectionSubTreeOrgs contains all SubTreeOrgs. 717 * 718 * @param selectionSubTreeOrgs 719 * @return 720 */ 721 public List<BudgetConstructionPullup> removeUnselectedSubTreeOrgs(List<BudgetConstructionPullup> selectionSubTreeOrgs) { 722 List<BudgetConstructionPullup> returnList = new ArrayList<BudgetConstructionPullup>(); 723 for (BudgetConstructionPullup pullUp : selectionSubTreeOrgs) { 724 if (pullUp.getPullFlag() > 0) { 725 returnList.add(pullUp); 726 } 727 } 728 729 return returnList; 730 } 731 732 /** 733 * Parses the report name from the methodToCall request parameter and retrieves the associated ReportMode. 734 * 735 * @param request - HttpServletRequest containing the methodToCall parameter 736 * @param organizationSelectionTreeForm - OrganizationSelectionTreeForm to set report mode on 737 * @return BudgetConstructionReportMode - mode associated with parsed report name 738 */ 739 private BudgetConstructionReportMode setupReportMode(HttpServletRequest request, OrganizationSelectionTreeForm organizationSelectionTreeForm) { 740 String fullParameter = (String) request.getAttribute(KNSConstants.METHOD_TO_CALL_ATTRIBUTE); 741 String reportName = StringUtils.substringBetween(fullParameter, KNSConstants.METHOD_TO_CALL_PARM1_LEFT_DEL, KNSConstants.METHOD_TO_CALL_PARM1_RIGHT_DEL); 742 organizationSelectionTreeForm.setReportMode(reportName); 743 744 return BudgetConstructionReportMode.getBudgetConstructionReportModeByName(organizationSelectionTreeForm.getReportMode()); 745 } 746 747 /** 748 * Builds URL for the action listing action. 749 */ 750 private String buildAccountListForwardURL(OrganizationSelectionTreeForm organizationSelectionTreeForm, ActionMapping mapping, boolean forceToAccountListScreen) { 751 Map<String, String> urlParms = new HashMap<String, String>(); 752 urlParms.put(BCConstants.Report.REPORT_MODE, organizationSelectionTreeForm.getReportMode()); 753 urlParms.put(BCConstants.CURRENT_POINT_OF_VIEW_KEYCODE, organizationSelectionTreeForm.getCurrentPointOfViewKeyCode()); 754 755 if (forceToAccountListScreen) { 756 urlParms.put(BCConstants.FORCE_TO_ACCOUNT_LIST_SCREEN, "true"); 757 } 758 else { 759 urlParms.put(BCConstants.FORCE_TO_ACCOUNT_LIST_SCREEN, "false"); 760 } 761 762 if ((organizationSelectionTreeForm.getReportMode().equals(BudgetConstructionReportMode.ACCOUNT_SUMMARY_REPORT.reportModeName) && organizationSelectionTreeForm.isAccountSummaryConsolidation()) || (organizationSelectionTreeForm.getReportMode().equals(BudgetConstructionReportMode.ACCOUNT_OBJECT_DETAIL_REPORT.reportModeName) && organizationSelectionTreeForm.isAccountObjectDetailConsolidation()) || (organizationSelectionTreeForm.getReportMode().equals(BudgetConstructionReportMode.MONTH_SUMMARY_REPORT.reportModeName) && organizationSelectionTreeForm.isMonthObjectSummaryConsolidation())) { 763 urlParms.put(BCConstants.Report.REPORT_CONSOLIDATION, "true"); 764 } 765 766 return BudgetUrlUtil.buildTempListLookupUrl(mapping, organizationSelectionTreeForm, BCConstants.TempListLookupMode.ACCOUNT_SELECT_ABOVE_POV, BudgetConstructionAccountSelect.class.getName(), urlParms); 767 } 768 769 /** 770 * Builds URL for the organization selection action. 771 */ 772 private String buildReportSelectForwardURL(OrganizationSelectionTreeForm organizationSelectionTreeForm, ActionMapping mapping) { 773 Map<String, String> parameters = new HashMap<String, String>(); 774 parameters.put(BCConstants.Report.REPORT_MODE, organizationSelectionTreeForm.getReportMode()); 775 parameters.put(BCConstants.CURRENT_POINT_OF_VIEW_KEYCODE, organizationSelectionTreeForm.getCurrentPointOfViewKeyCode()); 776 777 if ((organizationSelectionTreeForm.getReportMode().equals(BudgetConstructionReportMode.ACCOUNT_SUMMARY_REPORT.reportModeName) && organizationSelectionTreeForm.isAccountSummaryConsolidation()) || (organizationSelectionTreeForm.getReportMode().equals(BudgetConstructionReportMode.ACCOUNT_OBJECT_DETAIL_REPORT.reportModeName) && organizationSelectionTreeForm.isAccountObjectDetailConsolidation()) || (organizationSelectionTreeForm.getReportMode().equals(BudgetConstructionReportMode.MONTH_SUMMARY_REPORT.reportModeName) && organizationSelectionTreeForm.isMonthObjectSummaryConsolidation())) { 778 parameters.put(BCConstants.Report.REPORT_CONSOLIDATION, "true"); 779 } 780 781 return BudgetUrlUtil.buildBudgetUrl(mapping, organizationSelectionTreeForm, BCConstants.ORG_REPORT_SELECTION_ACTION, parameters); 782 } 783 784 }