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

Processing Input Data: Michael Hoffman

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)
22 views10 pages

Processing Input Data: Michael Hoffman

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
You are on page 1/ 10

Processing Input Data

Michael Hoffman
DEVELOPER AND PLURALSIGHT AUTHOR

@mhi_inc github.com/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 = GenerationType.SEQUENCE,
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(
patientRecord.getSourceId(),
patientRecord.getFirstName(),

LocalDate.parse(patientRecord.getBirthDate(),
DateTimeFormatter.ofPattern("M/dd/yyyy"))
};
}

BatchJobConfiguration.java
Package com.pluralsight.springbatch.patientbatchloader.config
Demo
Demo 16 – Implementing the item
processor
@Test
public void testProcessor() throws Exception {

PatientRecord patientRecord = new PatientRecord( … );


PatientEntity entity = processor.apply(patientRecord);
assertNotNull(entity);
assertEquals("72739d22-3c12-539b-b3c2-13d9d4224d40", entity.getSourceId());

BatchJobConfigurationTest.java
Class in the test folder under the package
com.pluralsight.springbatch.patientbatchloader.config
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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy