Beispiel #1
0
 @DELETE
 @Consumes({"application/xml", "application/json"})
 @Transactional
 public void remove(Domain entity) {
   Long id = entity.getId();
   try {
     entity = entityManager.getReference(Domain.class, entity.getId());
     entityManager.remove(entity);
     UserSessions.info(
         "ru.gispro.petrores.doc.service.DomainRESTFacade",
         UserSessions.getFacadeCallRequestUser(),
         "REMOVE_REFBOOK_ITEM",
         "Remove Domain",
         id,
         true,
         "RefBook item successfully removed");
   } catch (RuntimeException e) {
     UserSessions.error(
         "ru.gispro.petrores.doc.service.DomainRESTFacade",
         UserSessions.getFacadeCallRequestUser(),
         "REMOVE_REFBOOK_ITEM",
         "Remove Domain",
         id,
         false,
         "RefBook item removing error: " + e.toString(),
         e);
     throw e;
   }
 }
Beispiel #2
0
 @PUT
 @Consumes({"application/xml", "application/json"})
 @Produces({"application/xml", "application/json"})
 @Transactional
 public Domains edit(Domain entity) {
   try {
     if (entity.getSite().getId() == null) entity.setSite(null);
     if (entity.getWell().getId() == null) entity.setWell(null);
     if (entity.getTypeOfWork().getId() == null) entity.setTypeOfWork(null);
     if (entity.getWorkProcess().getId() == null) entity.setWorkProcess(null);
     entity = entityManager.merge(entity);
     entityManager.flush();
     UserSessions.info(
         "ru.gispro.petrores.doc.service.DomainRESTFacade",
         UserSessions.getFacadeCallRequestUser(),
         "EDIT_REFBOOK_ITEM",
         "Edit Domain",
         entity.getId(),
         true,
         "RefBook item successfully changed");
     return new Domains(Arrays.asList(entity), 1l);
   } catch (RuntimeException e) {
     UserSessions.error(
         "ru.gispro.petrores.doc.service.DomainRESTFacade",
         UserSessions.getFacadeCallRequestUser(),
         "EDIT_REFBOOK_ITEM",
         "Edit Domain",
         entity.getId(),
         false,
         "Edit RefBook item error: " + e.toString(),
         e);
     throw e;
   }
 }