Package com.bookstore.service.workflow

Examples of com.bookstore.service.workflow.CustomerActivity


  @Path("/")
  public List<OrderRepresentation> getOrders(
      @QueryParam("username") String username,
      @QueryParam("password") String password) {
    OrderActivity orderActivity = new OrderActivity();
    CustomerActivity customerActivity = new CustomerActivity();
    String customerId = customerActivity.authenticate(username, password);
    return orderActivity.getOrders(customerId);
  }
View Full Code Here


  public Response getOrder(
      @PathParam("id") String id,
      @QueryParam("username") String username,
      @QueryParam("password") String password) {
    OrderActivity orderActivity = new OrderActivity();
    CustomerActivity customerActivity = new CustomerActivity();
    // If they're authorized, return the results
    String customerId = customerActivity.authenticate(username, password);
    if (customerId != null) {
      return Response.ok(orderActivity.getOrder(id, customerId)).build();
    }
    // If they aren't authorized, return unauthorized
    return Response.status(Status.UNAUTHORIZED).build();
View Full Code Here

  @Path("/")
  public Response createOrder(
      @QueryParam("username") String username,
      @QueryParam("password") String password) {
    OrderActivity orderActivity = new OrderActivity();
    CustomerActivity customerActivity = new CustomerActivity();
    // If they're authorized, return the results
    String customerId = customerActivity.authenticate(username, password);
    if (customerId != null) {
      return Response.ok(orderActivity.createOrder(customerId)).build();
    }
    return Response.status(Status.UNAUTHORIZED).build();
  }
View Full Code Here

      @PathParam("id") String id,
      @QueryParam("username") String username,
      @QueryParam("password") String password,
      OrderRepresentation orderRequest) {
    OrderActivity orderActivity = new OrderActivity();
    CustomerActivity customerActivity = new CustomerActivity();
    // If they're authorized, return the results
    String customerId = customerActivity.authenticate(username, password);
    if (customerId != null) {
      return Response.ok(orderActivity.updateOrder(id, orderRequest.getCustomer(), orderRequest.getBillingAddress(),
          orderRequest.getShippingAddress(), orderRequest.getCreditCard(), orderRequest.getShippingCompany(),
          orderRequest.getLines(), orderRequest.isPaymentReceived(), orderRequest.getOrderState())).build();
    }
View Full Code Here

      @QueryParam("book_id") String bookId,
      @QueryParam("username") String username,
      @QueryParam("password") String password) {
   
    OrderActivity orderActivity = new OrderActivity();
    CustomerActivity customerActivity = new CustomerActivity();
    // If they're authorized, return the results
    String customerId = customerActivity.authenticate(username, password);
    if (customerId != null) {
      return Response.ok(orderActivity.addBookToOrder(customerId, bookId)).build();
    }
    return Response.status(Status.UNAUTHORIZED).build();
  }
View Full Code Here

  @GET
  @Produces({MediaType.APPLICATION_JSON})
  @Path("/")
  public List<CustomerRepresentation> getCustomers() {
    CustomerActivity customerActivity = new CustomerActivity();
    return customerActivity.getCustomers();
  }
View Full Code Here

  }
 
  @GET
  @Path("/auth")
  public Response customerAuth(@QueryParam("username") String username, @QueryParam("password") String password) {
    CustomerActivity customerActivity = new CustomerActivity();
    if (customerActivity.authenticate(username, password) == null) {
      return Response.status(Status.UNAUTHORIZED).build();
    }
    return Response.status(Status.OK).build();
  }
View Full Code Here

 
  @GET
  @Produces({MediaType.APPLICATION_JSON})
  @Path("/{id}")
  public CustomerRepresentation getCustomer(@PathParam("id") String id) {
    CustomerActivity customerActivity = new CustomerActivity();
    return customerActivity.getCustomer(id);
  }
View Full Code Here

  @POST
  @Produces({MediaType.APPLICATION_JSON})
  @Consumes({MediaType.APPLICATION_JSON})
  @Path("/")
  public CustomerRepresentation createCustomer(CustomerRequest customerRequest) {
    CustomerActivity customerActivity = new CustomerActivity();
    return customerActivity.createCustomer(customerRequest.getFirstName(), customerRequest.getLastName(),
        customerRequest.getAddresses(), customerRequest.getCreditCards(), customerRequest.getBooks());
  }
View Full Code Here

  @DELETE
  @Produces({MediaType.APPLICATION_JSON})
  @Consumes({MediaType.APPLICATION_JSON})
  @Path("/{id}")
  public Response deleteCustomer(@PathParam("id") String id) {
    CustomerActivity customerActivity = new CustomerActivity();
    String res = customerActivity.deleteCustomer(id);
    if (res.equals("OK")) {
      return Response.status(Status.OK).build();
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of com.bookstore.service.workflow.CustomerActivity

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.