@GET @RolesAllowed({Role.TEACHER}) @Path("/spell/{id}") @Produces(MediaType.APPLICATION_JSON) public SpellGameTO getGame(@PathParam("id") int id) { SpellGame spellGame = gameManager.getSpellGameByID(id); SpellGameTO spellGameTO = TOsGameManager.convertSpellGame(spellGame); return spellGameTO; }
@GET @RolesAllowed({Role.STUDENT, Role.TEACHER}) @Path("/spells") @Produces(MediaType.APPLICATION_JSON) public GameTOs getAllGames(@HeaderParam("login") String login) { List<Game> allGames = gameManager.getAllGames(login, SpellGame.class); GameTOs gameTOs = TOsGameManager.processGames(allGames); return gameTOs; }
@POST @RolesAllowed({Role.TEACHER}) @Path("/spell") @Produces(MediaType.TEXT_PLAIN) public Integer insertGame(SpellGameTO spellGameTO, @HeaderParam("login") String login) { SpellGame spellGame = TOsGameManager.covertSpellGameTO(spellGameTO); Integer id = gameManager.insertGame(spellGame, login); return id; }