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.ar.document.validation.impl; 017 018 import org.kuali.kfs.module.ar.ArConstants; 019 import org.kuali.kfs.module.ar.document.CustomerInvoiceDocument; 020 import org.kuali.kfs.sys.document.validation.BranchingValidation; 021 import org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent; 022 import org.kuali.rice.kns.service.ParameterService; 023 024 public class CustomerInvoiceReceivableBranchingValidation extends BranchingValidation { 025 026 public static final String IS_CHART_CODE_RECEIVABLE_VALIDATION = "isChartCodeReceivableValidation"; 027 public static final String IS_SUB_FUND_GROUP_RECEIVABLE_VALIDATION = "isSubFundGroupReceivableValidation"; 028 public static final String IS_FAU_RECEIVABLE_VALIDATION = "isFauReceivableValidation"; 029 030 private ParameterService parameterService; 031 032 @Override 033 protected String determineBranch(AttributedDocumentEvent event) { 034 035 String receivableOffsetOption = parameterService.getParameterValue(CustomerInvoiceDocument.class, ArConstants.GLPE_RECEIVABLE_OFFSET_GENERATION_METHOD); 036 if (ArConstants.GLPE_RECEIVABLE_OFFSET_GENERATION_METHOD_CHART.equals(receivableOffsetOption)) { 037 return IS_CHART_CODE_RECEIVABLE_VALIDATION; 038 } else if (ArConstants.GLPE_RECEIVABLE_OFFSET_GENERATION_METHOD_SUBFUND.equals(receivableOffsetOption)) { 039 return IS_SUB_FUND_GROUP_RECEIVABLE_VALIDATION; 040 } else if (ArConstants.GLPE_RECEIVABLE_OFFSET_GENERATION_METHOD_FAU.equals( receivableOffsetOption ) ){ 041 return IS_FAU_RECEIVABLE_VALIDATION; 042 } 043 return null; 044 } 045 046 public ParameterService getParameterService() { 047 return parameterService; 048 } 049 050 public void setParameterService(ParameterService parameterService) { 051 this.parameterService = parameterService; 052 } 053 054 }