001/*- 002 * #%L 003 * HAPI FHIR JPA Server - Batch2 Task Processor 004 * %% 005 * Copyright (C) 2014 - 2024 Smile CDR, Inc. 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package ca.uhn.fhir.batch2.api; 021 022/** 023 * Return type for {@link IJobStepWorker#run(StepExecutionDetails, IJobDataSink)} 024 */ 025public class RunOutcome { 026 027 /** 028 * RunOutcome with 0 records processed 029 */ 030 public static final RunOutcome SUCCESS = new RunOutcome(0); 031 032 private final int myRecordsProcessed; 033 034 /** 035 * Constructor 036 * 037 * @param theRecordsProcessed The number of records processed by this step. This number is not used for anything 038 * other than calculating the total number of records processed by the job. Therefore in many 039 * cases it will make sense to return a count of 0 for all steps except for the final 040 * step. For example, if you have a step that fetches files and a step that saves them, 041 * you might choose to only return a non-zero count indicating the number of saved files 042 * (or even the number of records within those files) so that the ultimate total 043 * reflects the real total. 044 */ 045 public RunOutcome(int theRecordsProcessed) { 046 myRecordsProcessed = theRecordsProcessed; 047 } 048 049 public int getRecordsProcessed() { 050 return myRecordsProcessed; 051 } 052}