Beispiel #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();
 }
Beispiel #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();
 }
Beispiel #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();
 }
Beispiel #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();
 }
Beispiel #5
0
 public HRRESTEndpoint() {
   helper = new Helper();
   tokenJson = helper.getAbstractToken();
 }