Package com.bookstore.service.workflow

Examples of com.bookstore.service.workflow.OrderActivity


  @Produces({MediaType.APPLICATION_JSON})
  @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


  @Path("/{id}")
  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

  @Produces({MediaType.APPLICATION_JSON})
  @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

  public Response updateOrder(
      @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();
    }
    return Response.status(Status.UNAUTHORIZED).build();
  }
View Full Code Here

  public Response addBookToOrder(
      @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

  @DELETE
  @Produces({MediaType.APPLICATION_JSON})
  @Consumes({MediaType.APPLICATION_JSON})
  @Path("/{id}")
  public Response deleteOrder(@PathParam("id") String id) {
    OrderActivity orderActivity = new OrderActivity();
    String res = orderActivity.deleteOrder(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.OrderActivity

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.