0% found this document useful (0 votes)
6 views10 pages

Patient Entity Processing in Spring Batch

The document outlines the creation and implementation of a PatientEntity class for processing patient records in a batch job configuration. It details the use of an item processor to transform input data and includes testing to ensure functionality. Key components include entity definition, data transformation, and validation processes.

Uploaded by

KIRAKRATOS
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views10 pages

Patient Entity Processing in Spring Batch

The document outlines the creation and implementation of a PatientEntity class for processing patient records in a batch job configuration. It details the use of an item processor to transform input data and includes testing to ensure functionality. Key components include entity definition, data transformation, and validation processes.

Uploaded by

KIRAKRATOS
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Processing Input Data

Michael Hoffman
DEVELOPER AND PLURALSIGHT AUTHOR

@mhi_inc [Link]/michaelhoffmantech
Apply business rules repeatedly

Item Processor Transform input data


Validation
PatientEntity Class
@Entity
@Table(name = "patient")
public class PatientEntity implements Serializable {

@Id
@GeneratedValue(strategy = [Link],
generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
@Column(name = "patient_id")
private Long id;

@NotNull
@Column(name = "source_id", nullable = false)
private String sourceId;

}
Demo
Demo 15 – Creating the entity type for
transformation
@Bean
@StepScope
public Function<PatientRecord, PatientEntity> processor() {
return (patientRecord) -> {
return new PatientEntity(
[Link](),
[Link](),

[Link]([Link](),
[Link]("M/dd/yyyy"))
};
}

[Link]
Package [Link]
Demo
Demo 16 – Implementing the item
processor
@Test
public void testProcessor() throws Exception {

PatientRecord patientRecord = new PatientRecord( … );


PatientEntity entity = [Link](patientRecord);
assertNotNull(entity);
assertEquals("72739d22-3c12-539b-b3c2-13d9d4224d40", [Link]());

[Link]
Class in the test folder under the package
[Link]
Demo

Demo 17 – Testing the item processor


Demo
Demo 18 – Executing the job with the
item processor
Summary
Added a new entity type
Implemented an item processor
Tested the item processor

You might also like