diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java index a1d7854cd77..1e3f5016083 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java @@ -440,7 +440,7 @@ public class JpaJobPersistenceImpl implements IJobPersistence { Page page = myWorkChunkMetadataViewRepo.findAll( Pageable.ofSize(thePageSize).withPage(thePageIndex)); for (Batch2WorkChunkMetadataView metadataView : page.getContent()) { - theConsumer.accept((WorkChunk) metadataView.toChunkMetadata()); + theConsumer.accept(metadataView.toChunkMetadata().toWorkChunk()); } } }); diff --git a/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/model/WorkChunkMetadata.java b/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/model/WorkChunkMetadata.java index 123f9a2c154..e06384bff75 100644 --- a/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/model/WorkChunkMetadata.java +++ b/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/model/WorkChunkMetadata.java @@ -94,4 +94,16 @@ public class WorkChunkMetadata implements IModelJson { public void setSequence(int theSequence) { mySequence = theSequence; } + + public WorkChunk toWorkChunk() { + WorkChunk workChunk = new WorkChunk(); + workChunk.setId(getId()); + workChunk.setStatus(getStatus()); + workChunk.setInstanceId(getInstanceId()); + workChunk.setJobDefinitionId(getJobDefinitionId()); + workChunk.setJobDefinitionVersion(getJobDefinitionVersion()); + workChunk.setSequence(getSequence()); + workChunk.setTargetStepId(getTargetStepId()); + return workChunk; + } }