Package com.theoryinpractise.halbuilder.api

Examples of com.theoryinpractise.halbuilder.api.Representation


    Preconditions.checkNotNull(cartItem, "cartItem");
    Preconditions.checkNotNull(cartItem.getItem().getId(), "id");

    // Create the Customer Item resource
    Representation customerItemRepresentation = publicItemRepresentation.get(cartItem.getItem());

    // Create the wrapping CartItem resource
    RepresentationFactory factory = new DefaultRepresentationFactory();

    return factory.newRepresentation("/cart/item/" + cartItem.getIndex())
View Full Code Here


    int pageNumber = Integer.valueOf(rawPageNumber.get());

    PaginatedList<Item> items = itemReadService.getPaginatedList(pageSize, pageNumber);

    // Provide a representation to the client
    Representation representation = new PublicItemCollectionRepresentation().get(items);

    return ok(representation);

  }
View Full Code Here

    Optional<Item> itemOptional = itemReadService.getBySKU(sku);
    ResourceAsserts.assertPresent(itemOptional, "item");

    // Provide a representation to the client
    Representation representation = new PublicItemRepresentation().get(itemOptional.get());

    return ok(representation);

  }
View Full Code Here

    Preconditions.checkNotNull(deliveryItem, "deliveryItem");
    Preconditions.checkNotNull(deliveryItem.getItem().getId(), "id");

    // Create the Customer Item resource
    Representation publicItemRepresentation = new PublicItemRepresentation().get(deliveryItem.getItem());

    // Create the wrapping DeliveryItem resource
    RepresentationFactory factory = new DefaultRepresentationFactory();

    return factory.newRepresentation("/delivery/item/" + deliveryItem.getItem().getSKU())
View Full Code Here

    // Persist the user
    User persistentUser = userReadService.saveOrUpdate(user);

    // Provide a representation to the client
    Representation representation = new AdminUserRepresentation().get(persistentUser, Optional.of(adminUser));
    URI location = uriInfo.getAbsolutePathBuilder().path(persistentUser.getId().toString()).build();

    return created(representation,location);

  }
View Full Code Here

    int pageNumber = Integer.valueOf(rawPageNumber.get());

    PaginatedList<User> users = userReadService.getPaginatedList(pageSize, pageNumber);

    // Provide a representation to the client
    Representation representation = new AdminUserCollectionRepresentation().get(users, Optional.of(adminUser));

    return ok(representation);

  }
View Full Code Here

    // Persist the updated user
    persistentUser = userReadService.saveOrUpdate(user.get());

    // Provide a representation to the client
    Representation representation = new AdminUserRepresentation().get(persistentUser, Optional.of(adminUser));

    return ok(representation);

  }
View Full Code Here

    // Persist the updated user
    persistentUser = userReadService.saveOrUpdate(user.get());

    // Provide a representation to the client
    Representation representation = new AdminUserRepresentation().get(persistentUser, Optional.of(adminUser));

    return ok(representation);

  }
View Full Code Here

    // Persist the User with cascade for the Customer
    User persistentUser = userReadService.saveOrUpdate(user);

    // Provide a minimal representation to the client
    Representation representation = new ClientUserRepresentation().get(persistentUser);
    URI location = UriBuilder.fromResource(CustomerUserResource.class).build();

    return created(representation, location);

  }
View Full Code Here

    // Persist the User with cascade for the Customer
    User persistentUser = userReadService.saveOrUpdate(user);

    // Provide a minimal representation to the client
    Representation representation = new ClientUserRepresentation().get(persistentUser);
    URI location = uriInfo.getAbsolutePathBuilder().path(persistentUser.getApiKey()).build();

    return created(representation, location);

  }
View Full Code Here

TOP

Related Classes of com.theoryinpractise.halbuilder.api.Representation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.