Beispiel #1
0
  @DELETE
  @RolesAllowed({Role.TEACHER})
  @Path("/spell/{id}")
  @Produces(MediaType.TEXT_PLAIN)
  public String deleteGame(@PathParam("id") int id) {

    gameManager.delete(id);

    return "ok";
  }
Beispiel #2
0
  @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;
  }
Beispiel #3
0
  @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;
  }
Beispiel #4
0
  @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;
  }
Beispiel #5
0
  @GET
  @Path("/student/spell/{id}")
  @RolesAllowed({Role.STUDENT})
  @Produces(MediaType.APPLICATION_JSON)
  public SpellGameStudentTO getGameForStudent(
      @HeaderParam("login") String login, @PathParam("id") int id) {

    SpellGame spellGame = gameManager.getSpellGameByID(id);

    SpellGameStudentTO spellGameStudentTO =
        CurrentGameCreator.createAndStartCurrSpellGame(spellGame, login);

    return spellGameStudentTO;
  }