@PUT @Path("/mod") @Consumes("application/json") @Produces("application/json") @Transactional(propagation = Propagation.REQUIRED) public ResponseModel mod(IclubEntityTypeModel model) { try { IclubEntityType iCEt = IclubEntityTypeTrans.fromWStoORM(model); iclubEntityTypeDAO.merge(iCEt); LOGGER.info("Merge Success with ID :: " + model.getEtId()); 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 IclubEntityTypeModel getById(@PathParam("id") Long id) { IclubEntityTypeModel model = new IclubEntityTypeModel(); try { IclubEntityType bean = iclubEntityTypeDAO.findById(id); model = IclubEntityTypeTrans.fromORMtoWS(bean); } catch (Exception e) { LOGGER.error(e, e); } return model; }
@GET @Path("/list") @Produces("application/json") @Transactional(propagation = Propagation.REQUIRED) public <T extends IclubEntityTypeModel> List<T> list() { List<T> ret = new ArrayList<T>(); try { List batmod = iclubEntityTypeDAO.findAll(); if (batmod != null && batmod.size() > 0) { for (Object object : batmod) { IclubEntityType bean = (IclubEntityType) object; IclubEntityTypeModel model = IclubEntityTypeTrans.fromORMtoWS(bean); ret.add((T) model); } } } catch (Exception e) { LOGGER.error(e, e); } return ret; }