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