<commit_before>/*
 * Copyright 2007 The Kuali Foundation.
 * 
 * Licensed under the Educational Community License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/ecl1.php
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.kfs.module.bc.document.web.struts;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.kuali.kfs.coa.businessobject.Organization;
import org.kuali.kfs.module.bc.BCConstants;
import org.kuali.kfs.module.bc.businessobject.BCKeyLabelPair;
import org.kuali.kfs.module.bc.businessobject.BudgetConstructionAccountOrganizationHierarchy;
import org.kuali.kfs.module.bc.businessobject.PendingBudgetConstructionGeneralLedger;
import org.kuali.kfs.module.bc.document.BudgetConstructionDocument;
import org.kuali.kfs.module.bc.document.service.BenefitsCalculationService;
import org.kuali.kfs.module.bc.document.service.BudgetConstructionProcessorService;
import org.kuali.kfs.module.bc.document.service.BudgetDocumentService;
import org.kuali.kfs.module.bc.document.service.BudgetParameterService;
import org.kuali.kfs.module.bc.document.service.SalarySettingService;
import org.kuali.kfs.module.bc.util.BudgetParameterFinder;
import org.kuali.kfs.sys.KFSConstants;
import org.kuali.kfs.sys.context.SpringContext;
import org.kuali.kfs.sys.document.web.struts.FinancialSystemTransactionalDocumentFormBase;
import org.kuali.kfs.sys.service.OptionsService;
import org.kuali.rice.kns.service.BusinessObjectDictionaryService;
import org.kuali.rice.kns.service.PersistenceService;
import org.kuali.rice.kns.util.GlobalVariables;
import org.kuali.rice.kns.util.KNSConstants;
import org.kuali.rice.kns.util.KualiDecimal;
import org.kuali.rice.kns.util.KualiInteger;
import org.kuali.rice.kns.util.TypedArrayList;


public class BudgetConstructionForm extends FinancialSystemTransactionalDocumentFormBase {
    private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BudgetConstructionForm.class);

    private PendingBudgetConstructionGeneralLedger newRevenueLine;
    private PendingBudgetConstructionGeneralLedger newExpenditureLine;
    
    private static String revenueObjectTypeCodesLookup = SpringContext.getBean(BudgetParameterService.class).getLookupObjectTypes(true);
    private static String expenditureObjectTypeCodesLookup = SpringContext.getBean(BudgetParameterService.class).getLookupObjectTypes(false);

    private boolean closingDocument = false;

    private boolean hideDetails = false;
    private boolean pickListClose = false;
    private boolean securityNoAccess = false;
    private boolean hideAdjustmentMeasurement = true;
    private KualiDecimal revenueAdjustmentAmount;
    private KualiDecimal expenditureAdjustmentAmount;

    private List<BCKeyLabelPair> pushdownLevelKeyLabels;
    private List<BCKeyLabelPair> pullupLevelKeyLabels;
    private String pushdownKeyCode;
    private String pullupKeyCode;
    private List<BudgetConstructionAccountOrganizationHierarchy> accountOrgHierLevels;

    // a flag set during initial load to force a benefits calc and 2plg adjustment
    // at the first instance a BC doc becomes editable - which is detected in action execute
    private boolean checkTwoPlugAdjustment = false;

    // holds Salary Setting associated rows as they looked before applying any DB changes from performSalarySetting
    // this is used to compare before and after state.
    private HashMap<String, PendingBudgetConstructionGeneralLedger> preSalarySettingRows;

    // passed parms
    private String backLocation;
    private String returnAnchor;
    private String returnFormKey;
    private Integer universityFiscalYear;
    private String chartOfAccountsCode;
    private String accountNumber;
    private String subAccountNumber;
    private boolean pickListMode;
    private boolean accountReportsExist;
    private boolean mainWindow = false;

    // holds anchor value to return to when doing doing balance inquiry
    // it is only set when setting up to do balance inquiry and reset in refresh
    private String balanceInquiryReturnAnchor;

    public BudgetConstructionForm() {
        super();

        // create objects used to hold data filled later either from this.populate or Action.loadDocument
        this.setNewExpenditureLine(new PendingBudgetConstructionGeneralLedger());
        this.setNewRevenueLine(new PendingBudgetConstructionGeneralLedger());
        this.setAccountOrgHierLevels(new TypedArrayList(BudgetConstructionAccountOrganizationHierarchy.class));
        this.setPullupLevelKeyLabels(new TypedArrayList(BCKeyLabelPair.class));
        this.setPushdownLevelKeyLabels(new TypedArrayList(BCKeyLabelPair.class));

        LOG.debug("creating BudgetConstructionForm");
    }

    @Override
    protected String getDefaultDocumentTypeName() {
        return BCConstants.BUDGET_CONSTRUCTION_DOCUMENT_NAME;
//        return "BC";<commit_msg>removed commented code from previous update<commit_after>/*
 * Copyright 2007 The Kuali Foundation.
 * 
 * Licensed under the Educational Community License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/ecl1.php
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.kfs.module.bc.document.web.struts;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.kuali.kfs.coa.businessobject.Organization;
import org.kuali.kfs.module.bc.BCConstants;
import org.kuali.kfs.module.bc.businessobject.BCKeyLabelPair;
import org.kuali.kfs.module.bc.businessobject.BudgetConstructionAccountOrganizationHierarchy;
import org.kuali.kfs.module.bc.businessobject.PendingBudgetConstructionGeneralLedger;
import org.kuali.kfs.module.bc.document.BudgetConstructionDocument;
import org.kuali.kfs.module.bc.document.service.BenefitsCalculationService;
import org.kuali.kfs.module.bc.document.service.BudgetConstructionProcessorService;
import org.kuali.kfs.module.bc.document.service.BudgetDocumentService;
import org.kuali.kfs.module.bc.document.service.BudgetParameterService;
import org.kuali.kfs.module.bc.document.service.SalarySettingService;
import org.kuali.kfs.module.bc.util.BudgetParameterFinder;
import org.kuali.kfs.sys.KFSConstants;
import org.kuali.kfs.sys.context.SpringContext;
import org.kuali.kfs.sys.document.web.struts.FinancialSystemTransactionalDocumentFormBase;
import org.kuali.kfs.sys.service.OptionsService;
import org.kuali.rice.kns.service.BusinessObjectDictionaryService;
import org.kuali.rice.kns.service.PersistenceService;
import org.kuali.rice.kns.util.GlobalVariables;
import org.kuali.rice.kns.util.KNSConstants;
import org.kuali.rice.kns.util.KualiDecimal;
import org.kuali.rice.kns.util.KualiInteger;
import org.kuali.rice.kns.util.TypedArrayList;


public class BudgetConstructionForm extends FinancialSystemTransactionalDocumentFormBase {
    private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BudgetConstructionForm.class);

    private PendingBudgetConstructionGeneralLedger newRevenueLine;
    private PendingBudgetConstructionGeneralLedger newExpenditureLine;
    
    private static String revenueObjectTypeCodesLookup = SpringContext.getBean(BudgetParameterService.class).getLookupObjectTypes(true);
    private static String expenditureObjectTypeCodesLookup = SpringContext.getBean(BudgetParameterService.class).getLookupObjectTypes(false);

    private boolean closingDocument = false;

    private boolean hideDetails = false;
    private boolean pickListClose = false;
    private boolean securityNoAccess = false;
    private boolean hideAdjustmentMeasurement = true;
    private KualiDecimal revenueAdjustmentAmount;
    private KualiDecimal expenditureAdjustmentAmount;

    private List<BCKeyLabelPair> pushdownLevelKeyLabels;
    private List<BCKeyLabelPair> pullupLevelKeyLabels;
    private String pushdownKeyCode;
    private String pullupKeyCode;
    private List<BudgetConstructionAccountOrganizationHierarchy> accountOrgHierLevels;

    // a flag set during initial load to force a benefits calc and 2plg adjustment
    // at the first instance a BC doc becomes editable - which is detected in action execute
    private boolean checkTwoPlugAdjustment = false;

    // holds Salary Setting associated rows as they looked before applying any DB changes from performSalarySetting
    // this is used to compare before and after state.
    private HashMap<String, PendingBudgetConstructionGeneralLedger> preSalarySettingRows;

    // passed parms
    private String backLocation;
    private String returnAnchor;
    private String returnFormKey;
    private Integer universityFiscalYear;
    private String chartOfAccountsCode;
    private String accountNumber;
    private String subAccountNumber;
    private boolean pickListMode;
    private boolean accountReportsExist;
    private boolean mainWindow = false;

    // holds anchor value to return to when doing doing balance inquiry
    // it is only set when setting up to do balance inquiry and reset in refresh
    private String balanceInquiryReturnAnchor;

    public BudgetConstructionForm() {
        super();

        // create objects used to hold data filled later either from this.populate or Action.loadDocument
        this.setNewExpenditureLine(new PendingBudgetConstructionGeneralLedger());
        this.setNewRevenueLine(new PendingBudgetConstructionGeneralLedger());
        this.setAccountOrgHierLevels(new TypedArrayList(BudgetConstructionAccountOrganizationHierarchy.class));
        this.setPullupLevelKeyLabels(new TypedArrayList(BCKeyLabelPair.class));
        this.setPushdownLevelKeyLabels(new TypedArrayList(BCKeyLabelPair.class));

        LOG.debug("creating BudgetConstructionForm");
    }

    @Override
    protected String getDefaultDocumentTypeName() {
        return BCConstants.BUDGET_CONSTRUCTION_DOCUMENT_NAME;
{'fraction_non_alphanumeric': 0.06870792216176334, 'fraction_numerical': 0.0018445079774970026, 'mean_word_length': 5.044593088071349, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3439943', 'n_tokens_mistral': 3089, 'n_tokens_neox': 2951, 'n_words': 742}