Exemplo n.º 1
0
 @PUT
 @Consumes(MediaType.APPLICATION_JSON)
 public Response updateHr(@HeaderParam("authorization") String authorization, Hr hr) {
   EntityManager em = helper.getEntityManager();
   helper.mergeObject(em, hr);
   return Response.ok().entity("Succesffully update!").build();
 }
Exemplo n.º 2
0
 @POST
 @Consumes(MediaType.APPLICATION_JSON)
 public Response insertHr(@HeaderParam("authorization") String authorization, Hr hr) {
   EntityManager em = helper.getEntityManager();
   helper.persistObject(em, hr);
   return Response.status(Response.Status.CREATED).build();
 }
Exemplo n.º 3
0
 @GET
 @Produces(MediaType.APPLICATION_JSON)
 public Response getHrs(@HeaderParam("authorization") String authorization) {
   EntityManager em = helper.getEntityManager();
   List<Hr> hrs = em.createNamedQuery("Hr.findAll").getResultList();
   return Response.ok().entity(hrs).build();
 }
Exemplo n.º 4
0
 @GET
 @Produces(MediaType.APPLICATION_JSON)
 @Path("/{id}")
 public Response getHr(
     @HeaderParam("authorization") String authorization, @PathParam("id") long id) {
   EntityManager em = helper.getEntityManager();
   Hr hrs = (Hr) em.createNamedQuery("Hr.findById").setParameter("id", id).getSingleResult();
   return Response.ok().entity(hrs).build();
 }
Exemplo n.º 5
0
 public HRRESTEndpoint() {
   helper = new Helper();
   tokenJson = helper.getAbstractToken();
 }