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;
017
018 import static org.kuali.kfs.module.bc.BCConstants.Report.BuildMode.BCAF;
019 import static org.kuali.kfs.module.bc.BCConstants.Report.BuildMode.MONTH;
020 import static org.kuali.kfs.module.bc.BCConstants.Report.BuildMode.PBGL;
021 import static org.kuali.kfs.module.bc.BCConstants.Report.ReportSelectMode.ACCOUNT;
022 import static org.kuali.kfs.module.bc.BCConstants.Report.ReportSelectMode.OBJECT_CODE;
023 import static org.kuali.kfs.module.bc.BCConstants.Report.ReportSelectMode.REASON;
024 import static org.kuali.kfs.module.bc.BCConstants.Report.ReportSelectMode.SUBFUND;
025
026 import java.util.EnumSet;
027
028 import org.kuali.kfs.module.bc.BCConstants.Report.BuildMode;
029 import org.kuali.kfs.module.bc.BCConstants.Report.ReportSelectMode;
030
031 /**
032 * Contains properties related to a budget construction report.
033 */
034 public enum BudgetConstructionReportMode {
035 ACCOUNT_FUNDING_DETAIL_REPORT("AccountFundingDetailReport", BCAF, OBJECT_CODE, "BudgetOrgAccountFundingDetail", true),
036 ACCOUNT_OBJECT_DETAIL_REPORT("AccountObjectDetailReport", PBGL, SUBFUND, "BudgetOrgAccountObjectDetail", true),
037 ACCOUNT_SUMMARY_REPORT("AccountSummaryReport", PBGL, SUBFUND, "BudgetOrgAccountSummary", true),
038 LEVEL_SUMMARY_REPORT("LevelSummaryReport", PBGL, SUBFUND, "BudgetOrgLevelSummary", true),
039 MONTH_SUMMARY_REPORT("MonthSummaryReport", MONTH, SUBFUND, "BudgetOrgMonthSummary", true),
040 OBJECT_SUMMARY_REPORT("ObjectSummaryReport", PBGL, SUBFUND, "BudgetOrgObjectSummary", true),
041 POSITION_FUNDING_DETAIL_REPORT("PositionFundingDetailReport", BCAF, OBJECT_CODE, "BudgetOrgPositionFundingDetail", true),
042 REASON_STATISTICS_REPORT("ReasonStatisticsReport", BCAF, REASON, "BudgetOrgReasonStatistics", false),
043 REASON_SUMMARY_REPORT("ReasonSummaryReport", BCAF, REASON, "BudgetOrgReasonSummary", false),
044 SALARY_STATISTICS_REPORT("SalaryStatisticsReport", BCAF, OBJECT_CODE, "BudgetOrgSalaryStatistics", true),
045 SALARY_SUMMARY_REPORT("SalarySummaryReport", BCAF, OBJECT_CODE, "BudgetOrgSalarySummary", false),
046 SUBFUND_SUMMARY_REPORT("SubFundSummaryReport", PBGL, SUBFUND, "BudgetOrgSubFundSummary", true),
047 SYNCHRONIZATION_PROBLEMS_REPORT("SynchronizationProblemsReport", PBGL, ACCOUNT, "BudgetOrgSynchronizationProblems", true),
048 TWOPLG_LIST_REPORT("TwoPLGListReport", PBGL, ACCOUNT, "BudgetOrgTwoPLGList", true),
049 ACCOUNT_EXPORT("AccountExport", PBGL, SUBFUND, true),
050 MONTHLY_EXPORT("MonthlyExport", MONTH, SUBFUND, true),
051 FUNDING_EXPORT("FundingExport", BCAF, SUBFUND, true);
052
053
054 public final String reportModeName;
055 public final BuildMode reportBuildMode;
056 public final ReportSelectMode reportSelectMode;
057 public final String jasperFileName;
058 public final boolean lockThreshold;
059 public final boolean export;
060
061 /**
062 * Constructs a BudgetConstructionReportMode.java.
063 */
064 private BudgetConstructionReportMode(final String reportModeName, final BuildMode reportBuildMode, final ReportSelectMode reportSelectMode, final String jasperFileName, final boolean lockThreshold) {
065 this.reportModeName = reportModeName;
066 this.reportBuildMode = reportBuildMode;
067 this.reportSelectMode = reportSelectMode;
068 this.jasperFileName = jasperFileName;
069 this.lockThreshold = lockThreshold;
070 this.export = false;
071 }
072
073 /**
074 * Constructs a BudgetConstructionReportMode.java.
075 */
076 private BudgetConstructionReportMode(final String reportModeName, final BuildMode reportBuildMode, final ReportSelectMode reportSelectMode, final boolean export) {
077 this.reportModeName = reportModeName;
078 this.reportBuildMode = reportBuildMode;
079 this.reportSelectMode = reportSelectMode;
080 this.lockThreshold = false;
081 this.export = export;
082 this.jasperFileName = "";
083 }
084
085 /**
086 * Returns the BudgetConstructionReportMode with name that matches given report mode name.
087 *
088 * @param reportModeName - report name to find BudgetConstructionReportMode for
089 * @return BudgetConstructionReportMode if found, or null
090 */
091 public static BudgetConstructionReportMode getBudgetConstructionReportModeByName(String reportModeName) {
092 BudgetConstructionReportMode foundReportMode = null;
093
094 for(BudgetConstructionReportMode reportMode : EnumSet.allOf(BudgetConstructionReportMode.class)) {
095 if (reportMode.reportModeName.equals(reportModeName)) {
096 foundReportMode = reportMode;
097 break;
098 }
099 }
100
101 return foundReportMode;
102 }
103 }