1 /* 2 * Copyright 2011 The Kuali Foundation. 3 * 4 * Licensed under the Educational Community License, Version 1.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl1.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.ole.coa.service.impl; 17 18 import org.apache.commons.lang.StringUtils; 19 20 /** 21 * Represents an exemption in AccountReferencePersistencestructureServiceImpl - a business object and related-to-object 22 * keys which will lawlessly not abide by the rules 23 */ 24 public class AccountReferencePersistenceExemption { 25 protected Class<?> parentBusinessObjectClass; 26 protected String chartOfAccountsCodePropertyName; 27 protected String accountNumberPropertyName; 28 29 /** 30 * @return the business object class which owns a relationship that will be exempted 31 */ 32 public Class<?> getParentBusinessObjectClass() { 33 return parentBusinessObjectClass; 34 } 35 /** 36 * Sets the business object class which owns a relationship that will be exempted 37 * @param parentBusinessObjectClass the business object class which owns a relationship that will be exempted 38 */ 39 public void setParentBusinessObjectClass(Class<?> parentBusinessObjectClass) { 40 this.parentBusinessObjectClass = parentBusinessObjectClass; 41 } 42 /** 43 * @return the name of the property on the parentBusinessObjectClass which represents the chart of accounts code portion of the Account relationship 44 */ 45 public String getChartOfAccountsCodePropertyName() { 46 return chartOfAccountsCodePropertyName; 47 } 48 /** 49 * Sets the name of the property on the parentBusinessObjectClass which represents the chart of accounts code portion of the Account relationship 50 * @param chartOfAccountsCodePropertyName the name of the property on the parentBusinessObjectClass which represents the chart of accounts code portion of the Account relationship 51 */ 52 public void setChartOfAccountsCodePropertyName(String chartOfAccountsCodePropertyName) { 53 this.chartOfAccountsCodePropertyName = chartOfAccountsCodePropertyName; 54 } 55 /** 56 * @return the name of the property on the parentBusinessObjectClass which represents the account number portion of the Account relationship 57 */ 58 public String getAccountNumberPropertyName() { 59 return accountNumberPropertyName; 60 } 61 /** 62 * Sets the name of the property on the parentBusinessObjectClass which represents the account number portion of the Account relationship 63 * @param accountNumberPropertyName the name of the property on the parentBusinessObjectClass which represents the account number portion of the Account relationship 64 */ 65 public void setAccountNumberPropertyName(String accountNumberPropertyName) { 66 this.accountNumberPropertyName = accountNumberPropertyName; 67 } 68 69 /** 70 * Determines if the given chart of accounts code property name and account number property name would match the relationship-to-account chart of accounts code property name and account number property name encapsulated herein 71 * @param chartOfAccountsCodePropertyName the name of the chart of accounts code property name in the relationship 72 * @param accountNumberPropertyName the name of the account number property name in the relationship 73 * @return true if the property names all match 74 */ 75 public boolean matches(String chartOfAccountsCodePropertyName, String accountNumberPropertyName) { 76 return ( ( !StringUtils.isBlank(chartOfAccountsCodePropertyName) && !StringUtils.isBlank(getChartOfAccountsCodePropertyName()) && chartOfAccountsCodePropertyName.equals(getChartOfAccountsCodePropertyName()) ) && ( !StringUtils.isBlank(accountNumberPropertyName) && !StringUtils.isBlank(getAccountNumberPropertyName()) && accountNumberPropertyName.equals(getAccountNumberPropertyName()) ) ); 77 } 78 }