@@ -17,35 +17,32 @@ public class SavePersonHandler implements RequestHandler<PersonRequest, PersonRe
1717
1818 private DynamoDB dynamoDb ;
1919
20- private final String DYNAMODB_TABLE_NAME = "Person" ;
21- private final Regions REGION = Regions .US_WEST_2 ;
20+ private String DYNAMODB_TABLE_NAME = "Person" ;
21+ private Regions REGION = Regions .US_WEST_2 ;
2222
2323 public PersonResponse handleRequest (PersonRequest personRequest , Context context ) {
24- context .getLogger ().log ("personRequest: " + personRequest );
2524 this .initDynamoDbClient ();
2625
2726 persistData (personRequest );
2827
2928 PersonResponse personResponse = new PersonResponse ();
3029 personResponse .setMessage ("Saved Successfully!!!" );
31- context .getLogger ().log ("personResponse: " + personResponse );
3230 return personResponse ;
3331 }
3432
3533 private PutItemOutcome persistData (PersonRequest personRequest ) throws ConditionalCheckFailedException {
3634 return this .dynamoDb .getTable (DYNAMODB_TABLE_NAME )
37- .putItem (
38- new PutItemSpec ().withItem (new Item ()
39- .withNumber ("id" , personRequest .getId ())
40- .withString ("firstName" , personRequest .getFirstName ())
41- .withString ("lastName" , personRequest .getLastName ())
42- .withNumber ("age" , personRequest .getAge ())
43- .withString ("address" , personRequest .getAddress ())
44- ));
35+ .putItem (
36+ new PutItemSpec ().withItem (new Item ()
37+ .withNumber ("id" , personRequest .getId ())
38+ .withString ("firstName" , personRequest .getFirstName ())
39+ .withString ("lastName" , personRequest .getLastName ())
40+ .withNumber ("age" , personRequest .getAge ())
41+ .withString ("address" , personRequest .getAddress ())));
4542 }
4643
4744 private void initDynamoDbClient () {
48- final AmazonDynamoDBClient client = new AmazonDynamoDBClient ();
45+ AmazonDynamoDBClient client = new AmazonDynamoDBClient ();
4946 client .setRegion (Region .getRegion (REGION ));
5047 this .dynamoDb = new DynamoDB (client );
5148 }
0 commit comments