Example usage for com.amazonaws.services.dynamodbv2.document PutItemOutcome getPutItemResult

List of usage examples for com.amazonaws.services.dynamodbv2.document PutItemOutcome getPutItemResult

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.document PutItemOutcome getPutItemResult.

Prototype

public PutItemResult getPutItemResult() 

Source Link

Document

Returns a non-null low-level result returned from the server side.

Usage

From source file:AddUserPassword.java

License:Open Source License

public static void main(String[] args) throws Exception {

    AmazonDynamoDBClient client = new AmazonDynamoDBClient(new ProfileCredentialsProvider());

    DynamoDB dynamoDB = new DynamoDB(client);

    Table table = dynamoDB.getTable("UserLogin");

    int UserID = 0;
    String UserName = "Patrick Laflin";
    int UserPassword = 18924;

    try {//from w w  w .  ja va2  s.c  om
        System.out.println("Adding a new item...");
        PutItemOutcome outcome = table.putItem(new Item().withPrimaryKey("UserID", UserID)
                .withString("User Name", UserName).withNumber("User Password", UserPassword));

        System.out.println("PutItem succeeded:\n" + outcome.getPutItemResult());

    } catch (Exception e) {
        System.err.println("Unable to add item: " + UserID + " " + UserName);
        System.err.println(e.getMessage());
    }

}

From source file:AddUserInfo.java

License:Open Source License

public static void main(String[] args) throws Exception {

    AmazonDynamoDBClient client = new AmazonDynamoDBClient(new ProfileCredentialsProvider());

    DynamoDB dynamoDB = new DynamoDB(client);

    Table table = dynamoDB.getTable("UserInfo");

    int UserID = 0;
    String FirstName = "Patrick";
    String LastName = "Laflin";
    String PhoneNumber = "(850)276-3816";
    String StreetAddressLine1 = "118 E Lakeshore Drive";
    String StreetAddressLine2 = "Unit B";
    String City = "Panama City Beach";
    String State = "FL";
    int ZipCode = 32413;
    String EmailAddress = "pbl14@my.fsu.edu";

    try {// ww w  . ja  v  a2 s.co  m
        System.out.println("Adding a new item...");
        PutItemOutcome outcome = table.putItem(new Item().withPrimaryKey("UserID", UserID)
                .withString("First Name", FirstName).withString("Last Name", LastName)
                .withString("Phone Number", PhoneNumber).withString("Street Address Line 1", StreetAddressLine1)
                .withString("Street Address Line 2", StreetAddressLine2).withString("City", City)
                .withString("State", State).withNumber("Zip Code", ZipCode)
                .withString("Email Address", EmailAddress));

        System.out.println("PutItem succeeded:\n" + outcome.getPutItemResult());

    } catch (Exception e) {
        System.err.println("Unable to add item: " + UserID);
        System.err.println(e.getMessage());
    }

}

From source file:AddUserRoutes.java

License:Open Source License

public static void main(String[] args) throws Exception {

    AmazonDynamoDBClient client = new AmazonDynamoDBClient(new ProfileCredentialsProvider());

    DynamoDB dynamoDB = new DynamoDB(client);

    Table table = dynamoDB.getTable("UserRoutes");

    int UserID = 0;
    String Route1 = "NULL";
    String Route2 = "NULL";
    String Route3 = "NULL";
    String Route4 = "NULL";
    String Route5 = "NULL";

    try {//from   w w  w  .  j  ava 2s.  c om
        System.out.println("Adding a new item...");
        PutItemOutcome outcome = table.putItem(new Item().withPrimaryKey("UserID", UserID)
                .withString("Route 1", Route1).withString("Route 2", Route2).withString("Route 3", Route3)
                .withString("Route 4", Route4).withString("Route 5", Route5));

        System.out.println("PutItem succeeded:\n" + outcome.getPutItemResult());

    } catch (Exception e) {
        System.err.println("Unable to add item: " + UserID);
        System.err.println(e.getMessage());
    }

}

From source file:AddUserFavorites.java

License:Open Source License

public static void main(String[] args) throws Exception {

    AmazonDynamoDBClient client = new AmazonDynamoDBClient(new ProfileCredentialsProvider());

    DynamoDB dynamoDB = new DynamoDB(client);

    Table table = dynamoDB.getTable("UserFavorites");

    int UserID = 0;
    String Location1 = "NULL";
    String Location2 = "NULL";
    String Location3 = "NULL";
    String Location4 = "NULL";
    String Location5 = "NULL";

    try {/*from ww  w.ja v  a2 s .c  o  m*/
        System.out.println("Adding a new item...");
        PutItemOutcome outcome = table
                .putItem(new Item().withPrimaryKey("UserID", UserID).withString("Location 1", Location1)
                        .withString("Location 2", Location2).withString("Location 3", Location3)
                        .withString("Location 4", Location4).withString("Location 5", Location5));

        System.out.println("PutItem succeeded:\n" + outcome.getPutItemResult());

    } catch (Exception e) {
        System.err.println("Unable to add item: " + UserID);
        System.err.println(e.getMessage());
    }

}