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.Arrays;
019    import java.util.Collections;
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.fp.service.FiscalYearFunctionControlService;
033    import org.kuali.kfs.module.bc.BCConstants;
034    import org.kuali.kfs.module.bc.BCKeyConstants;
035    import org.kuali.kfs.module.bc.BCPropertyConstants;
036    import org.kuali.kfs.module.bc.BCConstants.OrgSelOpMode;
037    import org.kuali.kfs.module.bc.businessobject.BudgetConstructionAccountOrganizationHierarchy;
038    import org.kuali.kfs.module.bc.businessobject.BudgetConstructionAccountSelect;
039    import org.kuali.kfs.module.bc.businessobject.BudgetConstructionHeader;
040    import org.kuali.kfs.module.bc.businessobject.BudgetConstructionLockSummary;
041    import org.kuali.kfs.module.bc.document.BudgetConstructionDocument;
042    import org.kuali.kfs.module.bc.document.service.BudgetDocumentService;
043    import org.kuali.kfs.module.bc.document.service.OrganizationBCDocumentSearchService;
044    import org.kuali.kfs.module.bc.document.validation.event.AddBudgetConstructionDocumentEvent;
045    import org.kuali.kfs.module.bc.report.ReportControlListBuildHelper;
046    import org.kuali.kfs.module.bc.util.BudgetUrlUtil;
047    import org.kuali.kfs.sys.KFSConstants;
048    import org.kuali.kfs.sys.KFSKeyConstants;
049    import org.kuali.kfs.sys.KFSPropertyConstants;
050    import org.kuali.kfs.sys.KFSConstants.BudgetConstructionConstants;
051    import org.kuali.kfs.sys.context.SpringContext;
052    import org.kuali.rice.kns.question.ConfirmationQuestion;
053    import org.kuali.rice.kns.service.DocumentService;
054    import org.kuali.rice.kns.service.KualiConfigurationService;
055    import org.kuali.rice.kns.service.KualiRuleService;
056    import org.kuali.rice.kns.service.PersistenceService;
057    import org.kuali.rice.kns.util.GlobalVariables;
058    
059    
060    /**
061     * This class...
062     */
063    public class BudgetConstructionSelectionAction extends BudgetExpansionAction {
064        private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BudgetConstructionSelectionAction.class);
065    
066        /**
067         * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping,
068         *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
069         */
070        @Override
071        public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
072            ActionForward forward = super.execute(mapping, form, request, response);
073    
074            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
075    
076            // set force rebuild on report build helper so each time we go out of report screen and come back the list will be rebuilt
077            ReportControlListBuildHelper buildHelper = (ReportControlListBuildHelper) GlobalVariables.getUserSession().retrieveObject(BCConstants.Report.CONTROL_BUILD_HELPER_SESSION_NAME);
078            if (buildHelper == null) {
079                buildHelper = new ReportControlListBuildHelper();
080            }
081            buildHelper.setForceRebuild(true);
082            GlobalVariables.getUserSession().addObject(BCConstants.Report.CONTROL_BUILD_HELPER_SESSION_NAME, buildHelper);
083    
084            return forward;
085        }
086    
087        /**
088         * Performs the initial load of the selection screen. Checks for the active BC fiscal year and initializes the fiscal year to be
089         * budgeted and used for all other operations throughout the system
090         * 
091         * @param mapping
092         * @param form
093         * @param request
094         * @param response
095         * @return
096         * @throws Exception
097         */
098        public ActionForward loadExpansionScreen(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
099    
100            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
101            FiscalYearFunctionControlService fiscalYearFunctionControlService = SpringContext.getBean(FiscalYearFunctionControlService.class);
102            KualiConfigurationService kualiConfiguration = SpringContext.getBean(KualiConfigurationService.class);
103    
104            Boolean isBCInProgress = (Boolean) GlobalVariables.getUserSession().retrieveObject(BCConstants.BC_IN_PROGRESS_SESSIONFLAG);
105            if (isBCInProgress != null && isBCInProgress) {
106    
107                Object question = request.getParameter(KFSConstants.QUESTION_INST_ATTRIBUTE_NAME);
108                if (question == null) {
109                    // ask question if not already asked
110                    return this.performQuestionWithoutInput(mapping, form, request, response, KFSConstants.DOCUMENT_DELETE_QUESTION, kualiConfiguration.getPropertyString(BCKeyConstants.QUESTION_CONFIRM_CLEANUP), KFSConstants.CONFIRMATION_QUESTION, "loadExpansionScreen", "");
111                }
112                else {
113                    Object buttonClicked = request.getParameter(KFSConstants.QUESTION_CLICKED_BUTTON);
114                    if ((KFSConstants.DOCUMENT_DELETE_QUESTION.equals(question)) && ConfirmationQuestion.YES.equals(buttonClicked)) {
115                        // clear out all BC related Objects(forms) stored in GlobalVariables.UserSession
116                        // to help prevent memory leaks if the user fails to use application control flow
117                        GlobalVariables.getUserSession().removeObjectsByPrefix(BCConstants.FORMKEY_PREFIX);
118    
119                        // clear out any session object form attribute
120                        HttpSession sess = request.getSession(Boolean.FALSE);
121                        sess.removeAttribute(BCConstants.MAPPING_ATTRIBUTE_KUALI_FORM);
122    
123                    }
124                    else {
125                        budgetConstructionSelectionForm.setSessionInProgressDetected(true);
126                        GlobalVariables.getMessageList().add(BCKeyConstants.MESSAGE_BUDGET_PREVIOUS_SESSION_NOTCLEANED);
127                        return mapping.findForward(KFSConstants.MAPPING_BASIC);
128                    }
129                }
130            }
131    
132    
133            // get active BC year and complain when anything other than one year active for now
134            List<Integer> activeBCYears = fiscalYearFunctionControlService.getActiveBudgetYear();
135            if (activeBCYears.size() != 1) {
136                budgetConstructionSelectionForm.setUniversityFiscalYear(null);
137                if (activeBCYears.size() < 1) {
138                    GlobalVariables.getMessageList().add(BCKeyConstants.MESSAGE_BUDGET_SYSTEM_NOT_ACTIVE);
139                }
140                else {
141                    GlobalVariables.getMessageList().add(BCKeyConstants.MESSAGE_BUDGET_SYSTEM_MULTIPLE_ACTIVE);
142                }
143            }
144            else {
145                budgetConstructionSelectionForm.setUniversityFiscalYear(activeBCYears.get(0));
146            }
147    
148            budgetConstructionSelectionForm.getBudgetConstructionHeader().setUniversityFiscalYear(budgetConstructionSelectionForm.getUniversityFiscalYear());
149    
150            // add the heart beat flag used to test for session time out in the expansion screens
151            GlobalVariables.getUserSession().addObject(BCConstants.BC_HEARTBEAT_SESSIONFLAG, Boolean.TRUE);
152    
153            return mapping.findForward(KFSConstants.MAPPING_BASIC);
154        }
155    
156        /**
157         * called when a session time out happens in one of the BC expansion screens to load the selection screen with a message
158         * notifying the user about the session time out.
159         * 
160         * @param mapping
161         * @param form
162         * @param request
163         * @param response
164         * @return
165         * @throws Exception
166         */
167        public ActionForward loadExpansionScreenSessionTimeOut(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
168    
169            GlobalVariables.getMessageList().add(BCKeyConstants.MESSAGE_BUDGET_PREVIOUS_SESSION_TIMEOUT);
170            return loadExpansionScreen(mapping, form, request, response);
171        }
172    
173        /**
174         * Opens a Budget Construction document. Creates a new (blank) BC document, if one does not exist. The new BC document is
175         * created at level zero and the associated account organization hierarchy is built.
176         * 
177         * @param mapping
178         * @param form
179         * @param request
180         * @param response
181         * @return
182         * @throws Exception
183         */
184        public ActionForward performBCDocumentOpen(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
185    
186            // do lookup of header and call open if found, otherwise create blank doc and account hierarchy, then open if no error
187            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
188    
189            BudgetConstructionHeader bcHeader = budgetConstructionSelectionForm.getBudgetConstructionHeader();
190    
191            Integer universityFiscalYear = bcHeader.getUniversityFiscalYear();
192            String chartOfAccountsCode = bcHeader.getChartOfAccountsCode();
193            String accountNumber = bcHeader.getAccountNumber();
194            String subAccountNumber;
195            if (StringUtils.isBlank(bcHeader.getSubAccountNumber())) {
196                subAccountNumber = KFSConstants.getDashSubAccountNumber();
197            }
198            else {
199                subAccountNumber = bcHeader.getSubAccountNumber();
200            }
201    
202            BudgetConstructionHeader tHeader = (BudgetConstructionHeader) SpringContext.getBean(BudgetDocumentService.class).getByCandidateKey(chartOfAccountsCode, accountNumber, subAccountNumber, universityFiscalYear);
203            if (tHeader == null) {
204    
205                // get a bare bones BC document to run the rule engine against
206                // if rulesPassed, use the document to instantiate to the DB
207                BudgetConstructionDocument budgetConstructionDocument = (BudgetConstructionDocument) SpringContext.getBean(DocumentService.class).getNewDocument(BCConstants.BUDGET_CONSTRUCTION_DOCUMENT_NAME);
208                budgetConstructionDocument.setUniversityFiscalYear(universityFiscalYear);
209                budgetConstructionDocument.setChartOfAccountsCode(chartOfAccountsCode);
210                budgetConstructionDocument.setAccountNumber(accountNumber);
211                budgetConstructionDocument.setSubAccountNumber(subAccountNumber);
212                List refreshFields = Collections.unmodifiableList(Arrays.asList(new String[] { KFSPropertyConstants.ACCOUNT, KFSPropertyConstants.SUB_ACCOUNT }));
213                SpringContext.getBean(PersistenceService.class).retrieveReferenceObjects(budgetConstructionDocument, refreshFields);
214    
215                boolean rulePassed = SpringContext.getBean(KualiRuleService.class).applyRules(new AddBudgetConstructionDocumentEvent(BCPropertyConstants.BUDGET_CONSTRUCTION_HEADER, budgetConstructionDocument));
216                if (rulePassed) {
217                    List<BudgetConstructionAccountOrganizationHierarchy> newAccountOrganizationHierarchy = (List<BudgetConstructionAccountOrganizationHierarchy>) SpringContext.getBean(BudgetDocumentService.class).retrieveOrBuildAccountOrganizationHierarchy(universityFiscalYear, chartOfAccountsCode, accountNumber);
218                    if (newAccountOrganizationHierarchy == null || newAccountOrganizationHierarchy.isEmpty()) {
219                        GlobalVariables.getMessageMap().putError("budgetConstructionHeader", BCKeyConstants.ERROR_BUDGET_ACCOUNT_ORGANIZATION_HIERARCHY, chartOfAccountsCode + "-" + accountNumber);
220                        return mapping.findForward(KFSConstants.MAPPING_BASIC);
221                    }
222    
223                    // hierarchy created - attempt to create BC document
224                    // SpringContext.getBean(BudgetDocumentService.class).instantiateNewBudgetConstructionDocument(universityFiscalYear,
225                    // chartOfAccountsCode, accountNumber, subAccountNumber);
226                    SpringContext.getBean(BudgetDocumentService.class).instantiateNewBudgetConstructionDocument(budgetConstructionDocument);
227                    tHeader = (BudgetConstructionHeader) SpringContext.getBean(BudgetDocumentService.class).getByCandidateKey(chartOfAccountsCode, accountNumber, subAccountNumber, universityFiscalYear);
228                    if (tHeader == null) {
229    
230                        GlobalVariables.getMessageMap().putError("budgetConstructionHeader", KFSKeyConstants.ERROR_EXISTENCE, "BC Document");
231                        return mapping.findForward(KFSConstants.MAPPING_BASIC);
232                    }
233                    else {
234                        // drop to open the newly created document
235                    }
236                }
237                else {
238                    return mapping.findForward(KFSConstants.MAPPING_BASIC);
239                }
240            }
241            this.flagBCInProgress();
242    
243            // open the existing or newly created BC document
244            Map<String, String> parameters = new HashMap<String, String>();
245            parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, BCConstants.BC_DOCUMENT_METHOD);
246            parameters.put("universityFiscalYear", tHeader.getUniversityFiscalYear().toString());
247            parameters.put("chartOfAccountsCode", tHeader.getChartOfAccountsCode());
248            parameters.put("accountNumber", tHeader.getAccountNumber());
249            parameters.put("subAccountNumber", tHeader.getSubAccountNumber());
250            parameters.put("pickListMode", "false");
251            parameters.put(BCPropertyConstants.MAIN_WINDOW, "true");
252    
253            String lookupUrl = BudgetUrlUtil.buildBudgetUrl(mapping, budgetConstructionSelectionForm, BCConstants.BC_DOCUMENT_ACTION, parameters);
254    
255            return new ActionForward(lookupUrl, true);
256        }
257    
258    
259        /**
260         * @see org.kuali.rice.kns.web.struts.action.KualiAction#refresh(org.apache.struts.action.ActionMapping,
261         *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
262         */
263        @Override
264        public ActionForward refresh(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
265    
266            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
267            String refreshCaller = request.getParameter(KFSConstants.REFRESH_CALLER);
268    
269            // returning from account lookup sets refreshCaller to accountLookupable, due to setting in account.xml
270            if (refreshCaller != null && (refreshCaller.toUpperCase().endsWith(KFSConstants.LOOKUPABLE_SUFFIX.toUpperCase()))) {
271                final List REFRESH_FIELDS = Collections.unmodifiableList(Arrays.asList(new String[] { "chartOfAccounts", "account", "subAccount", "budgetConstructionAccountReports" }));
272                SpringContext.getBean(PersistenceService.class).retrieveReferenceObjects(budgetConstructionSelectionForm.getBudgetConstructionHeader(), REFRESH_FIELDS);
273            }
274    
275            // clearout any BC inprogress semaphore, regardless of where we are returning from
276            // this handles the lock monitor no refreshCaller return case
277            GlobalVariables.getUserSession().removeObject(BCConstants.BC_IN_PROGRESS_SESSIONFLAG);
278    
279            // clear out any session object form attribute
280            HttpSession sess = request.getSession(Boolean.FALSE);
281            sess.removeAttribute(BCConstants.MAPPING_ATTRIBUTE_KUALI_FORM);
282    
283            return mapping.findForward(KFSConstants.MAPPING_BASIC);
284        }
285    
286        public ActionForward returnToCaller(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
287    
288            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
289    
290            return mapping.findForward(KFSConstants.MAPPING_PORTAL);
291        }
292    
293        public ActionForward performOrgSalarySetting(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
294    
295            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
296    
297            ActionForward forward = performOrgSelectionTree(OrgSelOpMode.SALSET, mapping, form, request, response);
298    
299            return forward;
300        }
301    
302        /**
303         * This method sets up to forward to the BC Organization Selection screen using a specific operating mode. The various operating
304         * modes include PULLUP, PUSHDOWN, REPORTS, SALSET, ACCOUNT.
305         * 
306         * @param opMode
307         * @param mapping
308         * @param form
309         * @param request
310         * @param response
311         * @return
312         * @throws Exception
313         */
314        public ActionForward performOrgSelectionTree(OrgSelOpMode opMode, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
315            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
316    
317            this.flagBCInProgress();
318    
319            Map<String, String> parameters = new HashMap<String, String>();
320            parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, BCConstants.ORG_SEL_TREE_METHOD);
321            parameters.put("operatingMode", opMode.toString());
322            parameters.put("universityFiscalYear", budgetConstructionSelectionForm.getUniversityFiscalYear().toString());
323    
324            String lookupUrl = BudgetUrlUtil.buildBudgetUrl(mapping, budgetConstructionSelectionForm, BCConstants.ORG_SEL_TREE_ACTION, parameters);
325    
326            return new ActionForward(lookupUrl, true);
327        }
328    
329        /**
330         * Passes control to the Organization Selection to run the organization reports subsystem
331         * 
332         * @param mapping
333         * @param form
334         * @param request
335         * @param response
336         * @return
337         * @throws Exception
338         */
339        public ActionForward performReportDump(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
340            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
341            ActionForward forward = performOrgSelectionTree(OrgSelOpMode.REPORTS, mapping, form, request, response);
342    
343            return forward;
344        }
345    
346        /**
347         * Passes control to the request import subsystem
348         * 
349         * @param mapping
350         * @param form
351         * @param request
352         * @param response
353         * @return
354         * @throws Exception
355         */
356        public ActionForward performRequestImport(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
357            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
358            this.flagBCInProgress();
359    
360            String lookupUrl = BudgetUrlUtil.buildBudgetUrl(mapping, budgetConstructionSelectionForm, BCConstants.REQUEST_IMPORT_ACTION, null);
361    
362            return new ActionForward(lookupUrl, true);
363        }
364    
365        /**
366         * Passes control to the Pay Rate import/export subsystem
367         * 
368         * @param mapping
369         * @param form
370         * @param request
371         * @param response
372         * @return
373         * @throws Exception
374         */
375        public ActionForward performPayrateImportExport(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
376            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
377            this.flagBCInProgress();
378    
379            String lookupUrl = BudgetUrlUtil.buildBudgetUrl(mapping, budgetConstructionSelectionForm, BCConstants.PAYRATE_IMPORT_EXPORT_ACTION, null);
380    
381            return new ActionForward(lookupUrl, true);
382        }
383    
384        /**
385         * Builds forward URL to lock monitor page, following expansion screen pattern. Also checks if the user has permission for the
386         * unlock action and sets the show action column property accordingly.
387         * 
388         * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping,
389         *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
390         */
391        public ActionForward performLockMonitor(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
392            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
393            this.flagBCInProgress();
394    
395            Map<String, String> urlParms = new HashMap<String, String>();
396    
397            // forward to temp list action for displaying results
398            String url = BudgetUrlUtil.buildTempListLookupUrl(mapping, budgetConstructionSelectionForm, BCConstants.TempListLookupMode.LOCK_MONITOR, BudgetConstructionLockSummary.class.getName(), urlParms);
399    
400            return new ActionForward(url, true);
401        }
402    
403        /**
404         * Passes control to the Organization Selection to run the organization pullup subsystem
405         * 
406         * @param mapping
407         * @param form
408         * @param request
409         * @param response
410         * @return
411         * @throws Exception
412         */
413        public ActionForward performOrgPullup(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
414            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
415            ActionForward forward = performOrgSelectionTree(OrgSelOpMode.PULLUP, mapping, form, request, response);
416    
417            return forward;
418        }
419    
420        /**
421         * Passes control to the Organization Selection to run the organization pushdown subsystem
422         * 
423         * @param mapping
424         * @param form
425         * @param request
426         * @param response
427         * @return
428         * @throws Exception
429         */
430        public ActionForward performOrgPushdown(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
431            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
432            ActionForward forward = performOrgSelectionTree(OrgSelOpMode.PUSHDOWN, mapping, form, request, response);
433    
434            return forward;
435        }
436    
437        /**
438         * Calls service to build the account list for which the user is a manager and delegate. Then forwards to temp list action to
439         * display the results.
440         * 
441         * @see org.kuali.rice.kns.web.struts.action.KualiAction#execute(org.apache.struts.action.ActionMapping,
442         *      org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
443         */
444        public ActionForward performMyAccounts(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
445            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
446            this.flagBCInProgress();
447    
448            // call service to build account list and give message if empty
449            int rowCount = SpringContext.getBean(OrganizationBCDocumentSearchService.class).buildAccountManagerDelegateList(GlobalVariables.getUserSession().getPerson().getPrincipalId(), budgetConstructionSelectionForm.getUniversityFiscalYear());
450            if (rowCount == 0) {
451                GlobalVariables.getMessageList().add(BCKeyConstants.ERROR_NO_RECORDS_MY_ACCOUNTS);
452    
453                return mapping.findForward(KFSConstants.MAPPING_BASIC);
454            }
455    
456            // forward to temp list action for displaying results
457            String url = BudgetUrlUtil.buildTempListLookupUrl(mapping, budgetConstructionSelectionForm, BCConstants.TempListLookupMode.ACCOUNT_SELECT_MANAGER_DELEGATE, BudgetConstructionAccountSelect.class.getName(), null);
458    
459            return new ActionForward(url, true);
460        }
461    
462        /**
463         * Passes control to the Organization Selection to run the organization budgeted account list subsystem
464         * 
465         * @param mapping
466         * @param form
467         * @param request
468         * @param response
469         * @return
470         * @throws Exception
471         */
472        public ActionForward performMyOrganization(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
473            BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form;
474            ActionForward forward = performOrgSelectionTree(OrgSelOpMode.ACCOUNT, mapping, form, request, response);
475    
476            return forward;
477        }
478    
479        public void flagBCInProgress() {
480    
481            // Overwrite or add the BC in progress flag
482            // This is used as a semaphore to control cleanup of session BC Temp objects
483            GlobalVariables.getUserSession().addObject(BCConstants.BC_IN_PROGRESS_SESSIONFLAG, Boolean.TRUE);
484        }
485    }