001/* 002 * Copyright 2006-2007 the original author or authors. 003 * 004 * Licensed under the Apache 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 * https://www.apache.org/licenses/LICENSE-2.0 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 017package org.springframework.batch.repeat.policy; 018 019import org.springframework.batch.repeat.CompletionPolicy; 020import org.springframework.batch.repeat.RepeatStatus; 021import org.springframework.batch.repeat.RepeatContext; 022 023/** 024 * Very simple {@link CompletionPolicy} that bases its decision on the result of 025 * a batch operation. If the result is null or not continuable according to the 026 * {@link RepeatStatus} the batch is complete, otherwise not. 027 * 028 * @author Dave Syer 029 * 030 */ 031public class DefaultResultCompletionPolicy extends CompletionPolicySupport { 032 033 /** 034 * True if the result is null, or a {@link RepeatStatus} indicating 035 * completion. 036 * 037 * @see org.springframework.batch.repeat.CompletionPolicy#isComplete(org.springframework.batch.repeat.RepeatContext, 038 * RepeatStatus) 039 */ 040 @Override 041 public boolean isComplete(RepeatContext context, RepeatStatus result) { 042 return (result == null || !result.isContinuable()); 043 } 044 045 /** 046 * Always false. 047 * 048 * @see org.springframework.batch.repeat.CompletionPolicy#isComplete(org.springframework.batch.repeat.RepeatContext) 049 */ 050 @Override 051 public boolean isComplete(RepeatContext context) { 052 return false; 053 } 054 055}