Example #1
0
  @PUT
  @Path("setdefault")
  @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
  public Response updateGroup(@QueryParam("default") String defaultValue) {
    if (!isUserInRole("cp,ops,support")) {
      return ResponseFactory.accessDenied();
    }

    GroupRateLimit lbLimitGroup = new GroupRateLimit();
    lbLimitGroup.setId(id);

    if (defaultValue != null && defaultValue.equalsIgnoreCase("Y")) {
      lbLimitGroup.setDefault(true);
    } else {
      lbLimitGroup.setDefault(false);
    }

    try {

      groupService.updateGroup(lbLimitGroup);
      return Response.status(Response.Status.ACCEPTED).build();

    } catch (Exception e) {
      return ResponseFactory.getErrorResponse(e, null, null);
    }
  }
Example #2
0
  @DELETE
  public Response deleteGroup() {
    try {
      GroupRateLimit addLimitGroup = new GroupRateLimit();
      addLimitGroup.setId(id);

      groupService.deleteGroup(addLimitGroup);
      return Response.status(Response.Status.ACCEPTED).build();
    } catch (Exception e) {
      return ResponseFactory.getErrorResponse(e, null, null);
    }
  }