Class CronologicalBatchAllResourcePidReader

java.lang.Object
ca.uhn.fhir.jpa.batch.reader.CronologicalBatchAllResourcePidReader
All Implemented Interfaces:
org.springframework.batch.item.ItemReader<List<Long>>, org.springframework.batch.item.ItemStream

public class CronologicalBatchAllResourcePidReader extends Object implements org.springframework.batch.item.ItemReader<List<Long>>, org.springframework.batch.item.ItemStream
This Spring Batch reader takes 3 parameters: JOB_PARAM_BATCH_SIZE: The number of resources to return with each search. JOB_PARAM_START_TIME: The latest timestamp of resources to search for JOB_PARAM_REQUEST_PARTITION: (optional) The partition of resources to read

The reader will return at most JOB_PARAM_BATCH_SIZE pids every time it is called, or null once no more matching resources are available. It returns the resources in reverse chronological order appended with "." and the index number of the url list item it has gotten up to. This is to permit restarting jobs that use this reader so it can pick up where it left off.

  • Field Details

  • Constructor Details

  • Method Details

    • setBatchSize

      @Autowired public void setBatchSize(@Value("#{jobParameters[\'batch-size\']}") Integer theBatchSize)
    • setStartTime

      @Autowired public void setStartTime(@Value("#{jobParameters[\'start-time\']}") Date theStartTime)
    • buildJobParameters

      public static org.springframework.batch.core.JobParameters buildJobParameters(Integer theBatchSize, ca.uhn.fhir.interceptor.model.RequestPartitionId theRequestPartitionId)
    • read

      public List<Long> read() throws Exception
      Specified by:
      read in interface org.springframework.batch.item.ItemReader<List<Long>>
      Throws:
      Exception
    • open

      public void open(org.springframework.batch.item.ExecutionContext executionContext) throws org.springframework.batch.item.ItemStreamException
      Specified by:
      open in interface org.springframework.batch.item.ItemStream
      Throws:
      org.springframework.batch.item.ItemStreamException
    • update

      public void update(org.springframework.batch.item.ExecutionContext executionContext) throws org.springframework.batch.item.ItemStreamException
      Specified by:
      update in interface org.springframework.batch.item.ItemStream
      Throws:
      org.springframework.batch.item.ItemStreamException
    • close

      public void close() throws org.springframework.batch.item.ItemStreamException
      Specified by:
      close in interface org.springframework.batch.item.ItemStream
      Throws:
      org.springframework.batch.item.ItemStreamException
    • setRequestPartitionId

      @Autowired public void setRequestPartitionId(@Value("#{jobParameters[\'request-partition\']}") String theRequestPartitionIdJson) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException