Пример #1
0
 boolean checkPP(String pib) {
   try {
     List<PoslovniPartneri> poslovniPartneri;
     poslovniPartneri = ppDao.findAll();
     for (PoslovniPartneri pp : poslovniPartneri) {
       if (pp.getFirma().getPib().equals(pib)) {
         return true;
       }
     }
     return false;
   } catch (IOException | JAXBException e) {
     e.printStackTrace();
     return false;
   }
 }
Пример #2
0
  @POST
  @Consumes(MediaType.APPLICATION_XML)
  public Response createPP(PoslovniPartneri pp) {
    PoslovniPartneri retVal = null;
    Response r;

    try {
      retVal = ppDao.persist(pp);
      r = Response.ok().build();
    } catch (JAXBException e) {
      r = Response.status(Status.BAD_REQUEST).build();
      log.error(e.getMessage(), e);
    } catch (Exception e) {
      r = Response.status(Status.SERVICE_UNAVAILABLE).build();
      log.error(e.getMessage(), e);
    }
    return r;
  }