@GET @Path("/del/{id}") @Consumes("application/json") @Produces("application/json") @Transactional(propagation = Propagation.REQUIRED) public Response del(@PathParam("id") Long id) { try { iclubQuoteStatusDAO.delete(iclubQuoteStatusDAO.findById(id)); return Response.ok().build(); } catch (Exception e) { LOGGER.error(e, e); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } }
@POST @Path("/add") @Consumes("application/json") @Produces("application/json") @Transactional(propagation = Propagation.REQUIRED) public ResponseModel add(IclubQuoteStatusModel model) { try { IclubQuoteStatus iQs = IclubQuoteStatusTrans.fromWStoORM(model); iQs.setQsId(iclubCommonDAO.getNextId(IclubQuoteStatus.class)); iclubQuoteStatusDAO.save(iQs); LOGGER.info("Save Success with ID :: " + iQs.getQsId()); ResponseModel message = new ResponseModel(); message.setStatusCode(0); message.setStatusDesc("Success"); return message; } catch (Exception e) { LOGGER.error(e, e); ResponseModel message = new ResponseModel(); message.setStatusCode(1); message.setStatusDesc(e.getMessage()); return message; } }
@GET @Path("/get/{id}") @Produces("application/json") @Transactional(propagation = Propagation.REQUIRED) public IclubQuoteStatusModel getById(@PathParam("id") Long id) { IclubQuoteStatusModel model = new IclubQuoteStatusModel(); try { IclubQuoteStatus bean = iclubQuoteStatusDAO.findById(id); model = IclubQuoteStatusTrans.fromORMtoWS(bean); } catch (Exception e) { LOGGER.error(e, e); } return model; }
@GET @Path("/list") @Produces("application/json") @Transactional(propagation = Propagation.REQUIRED) public <T extends IclubQuoteStatusModel> List<T> list() { List<T> ret = new ArrayList<T>(); try { List batmod = iclubQuoteStatusDAO.findAll(); if (batmod != null && batmod.size() > 0) { for (Object object : batmod) { IclubQuoteStatus bean = (IclubQuoteStatus) object; IclubQuoteStatusModel model = IclubQuoteStatusTrans.fromORMtoWS(bean); ret.add((T) model); } } } catch (Exception e) { LOGGER.error(e, e); } return ret; }