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.purap.document.validation.impl;
017    
018    import org.kuali.kfs.module.purap.businessobject.PurApItem;
019    import org.kuali.kfs.sys.document.validation.GenericValidation;
020    import org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent;
021    
022    public class PurchasingAccountsPayableProcessAccountValidation extends GenericValidation {
023    
024        private PurchasingAccountsPayableHasAccountsValidation hasAccountsValidation;
025        private PurchasingAccountsPayableAccountPercentValidation accountPercentValidation;
026        private PurchasingAccountsPayableUniqueAccountingStringsValidation accountingStringsValidation;          
027        private PurApItem itemForValidation;
028        
029        public boolean validate(AttributedDocumentEvent event) {
030            boolean valid = true;
031            
032            hasAccountsValidation.setItemForValidation(itemForValidation);
033            valid &= hasAccountsValidation.validate(event);
034            
035            if(valid){
036                accountPercentValidation.setItemForValidation(itemForValidation);
037                valid &= accountPercentValidation.validate(event);
038            }
039            
040            accountingStringsValidation.setItemForValidation(itemForValidation);
041            valid &= accountingStringsValidation.validate(event);
042            
043            return valid;
044        }
045    
046        public PurchasingAccountsPayableHasAccountsValidation getHasAccountsValidation() {
047            return hasAccountsValidation;
048        }
049    
050        public void setHasAccountsValidation(PurchasingAccountsPayableHasAccountsValidation hasAccountsValidation) {
051            this.hasAccountsValidation = hasAccountsValidation;
052        }
053    
054        public PurchasingAccountsPayableAccountPercentValidation getAccountPercentValidation() {
055            return accountPercentValidation;
056        }
057    
058        public void setAccountPercentValidation(PurchasingAccountsPayableAccountPercentValidation accountPercentValidation) {
059            this.accountPercentValidation = accountPercentValidation;
060        }
061    
062        public PurchasingAccountsPayableUniqueAccountingStringsValidation getAccountingStringsValidation() {
063            return accountingStringsValidation;
064        }
065    
066        public void setAccountingStringsValidation(PurchasingAccountsPayableUniqueAccountingStringsValidation accountingStringsValidation) {
067            this.accountingStringsValidation = accountingStringsValidation;
068        }
069    
070        public PurApItem getItemForValidation() {
071            return itemForValidation;
072        }
073    
074        public void setItemForValidation(PurApItem itemForValidation) {
075            this.itemForValidation = itemForValidation;
076        }
077    
078    }