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.gl.batch.service.impl; 017 018 import org.kuali.kfs.gl.batch.service.BalancePredicate; 019 import org.kuali.kfs.gl.businessobject.Balance; 020 021 /** 022 * A predicate that only allows the selection of balances with a total that isn't zero (those with zero as a total are somewhat 023 * pointless to process) 024 */ 025 public class BalanceTotalNotZeroPredicate implements BalancePredicate { 026 027 /** 028 * Selects only balances whose total (annual accounting line balance + beginning balance + contracts and grants beginning 029 * balance) is not zero 030 * 031 * @param balance the balance to qualify 032 * @return true if the balance total is not zero, false if it is 033 * @see org.kuali.kfs.gl.batch.service.BalancePredicate#select(org.kuali.kfs.gl.businessobject.Balance) 034 */ 035 public boolean select(Balance balance) { 036 return !balance.getAccountLineAnnualBalanceAmount().add(balance.getBeginningBalanceLineAmount()).add(balance.getContractsGrantsBeginningBalanceAmount()).isZero(); 037 } 038 039 }