diff --git a/src/main/java/com/example/cosmos_serversb/resources/GroupsRest.java b/src/main/java/com/example/cosmos_serversb/resources/GroupsRest.java index 4e99566..883f781 100644 --- a/src/main/java/com/example/cosmos_serversb/resources/GroupsRest.java +++ b/src/main/java/com/example/cosmos_serversb/resources/GroupsRest.java @@ -15,15 +15,15 @@ @GET public String getGroupsListByUid(@QueryParam("uId") String uId, @QueryParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(Groups.getGroupsListByUid(uId)); + String json = mapper.writeValueAsString(Groups.getInstance().getGroupsListByUid(uId)); return json; } @Path("/groups") @POST - public String createGroup(@FormParam("name") String name, @FormParam("uId") String uId) throws JsonProcessingException{ + public String createGroup(@FormParam("name") String name, @FormParam("uId") String uId, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(Groups.createGroup(name, uId)); + String json = mapper.writeValueAsString(Groups.getInstance().createGroup(name, uId)); return json; } @@ -31,7 +31,7 @@ @GET public String getGroupByGid(@PathParam("gId") String gId, @QueryParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(Groups.getGroupByGid(gId)); + String json = mapper.writeValueAsString(Groups.getInstance().getGroupByGid(gId)); return json; } @@ -39,7 +39,7 @@ @DELETE public String deleteGroup(@PathParam("gId") String gId, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(Groups.deleteGroup(gId)); + String json = mapper.writeValueAsString(Groups.getInstance().deleteGroup(gId)); return json; } @@ -47,7 +47,7 @@ @GET public String getGroupMembersListByGid(@PathParam("gId") String gId, @QueryParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(Groups.getMembersListByGid(gId)); + String json = mapper.writeValueAsString(Groups.getInstance().getMembersListByGid(gId)); return json; } @@ -55,7 +55,7 @@ @POST public String addMember(@PathParam("gId") String gId, @FormParam("uId") String uId, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(Groups.addMember(gId, uId)); + String json = mapper.writeValueAsString(Groups.getInstance().addMember(gId, uId)); return json; } @@ -63,7 +63,7 @@ @DELETE public String deleteMember(@PathParam("gId") String gId, @FormParam("uId") String uId, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(Groups.deleteMember(gId, uId)); + String json = mapper.writeValueAsString(Groups.getInstance().deleteMember(gId, uId)); return json; } @@ -71,7 +71,7 @@ @GET public String getRequestsListByGid(@PathParam("gId") String gId, @QueryParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(Groups.getRequestsListByGid(gId)); + String json = mapper.writeValueAsString(Groups.getInstance().getRequestsListByGid(gId)); return json; } @@ -79,7 +79,7 @@ @POST public String addRequests(@PathParam("gId") String gId, @FormParam("uId") String uId, @FormParam("product") String product, @FormParam("deadline") String deadline, @FormParam("location") int location, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(Groups.addRequests(gId, uId, product, deadline, location)); + String json = mapper.writeValueAsString(Groups.getInstance().addRequests(gId, uId, product, deadline, location)); return json; } @@ -87,7 +87,7 @@ @GET public String getRequestsDetailByGidAndRid(@PathParam("gId") String gId, @PathParam("rId") String rId, @QueryParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(Groups.getRequestDetailByGidAndRid(gId, rId)); + String json = mapper.writeValueAsString(Groups.getInstance().getRequestDetailByGidAndRid(gId, rId)); return json; } @@ -95,7 +95,7 @@ @PUT public String updateRequest(@PathParam("gId") String gId, @PathParam("rId") String rId, @FormParam("uId") String uId, @FormParam("product") String product, @FormParam("deadline") String deadline, @FormParam("location") int location, @FormParam("done") boolean done, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(Groups.updateRequest(gId, rId, uId, product, deadline, location, done)); + String json = mapper.writeValueAsString(Groups.getInstance().updateRequest(gId, rId, uId, product, deadline, location, done)); return json; } @@ -103,7 +103,7 @@ @DELETE public String deleteRequest(@PathParam("gId") String gId, @PathParam("rId") String rId, @FormParam("token") String token) throws JsonProcessingException{ ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(Groups.deleteRequest(gId, rId)); + String json = mapper.writeValueAsString(Groups.getInstance().deleteRequest(gId, rId)); return json; } }