@Override public ResponseBean SaveSectorCode( HttpServletRequest request, ResponseBean resBean, SectorCodeBean model) { try { /* Object[] param = ParamUtil.getParamsWithoutObject(idGenerator.generateId(),model.getName(),model.getAddress()); springJdbcDao.saveObject(queryManager.saveBranch(),param);*/ if (model.getOid() == null) { model.setOid(idGenerator.generateId()); } SectorCode sectorCode = BeanToEntityConverter.convertSectorCodeBeanToEntity(model); hibernateDao.saveObject(sectorCode); resBean.setSuccess(true); _logger.info("SectorCode Saved successfully"); resBean.setMessage("SectorCode Saved successfully"); } catch (Exception e) { _logger.error("An exception occurred while save new SectorCode : ", e); resBean.setSuccess(false); resBean.setMessage("Failed to save SectorCode"); } return resBean; }
@Override public ResponseBean getSectorCodeByOid(ResponseBean resBean, SectorCodeBean model) { try { SectorCodeBean sectorCode = (SectorCodeBean) springJdbcDao.getObject( queryManager.getSectorCodeByOid(), new Object[] {model.getOid()}, SectorCodeBean.class); if (sectorCode.getValue() != null) { resBean.setSuccess(true); resBean.setData(sectorCode); _logger.info("successfully get barnch for ID : " + model.getOid()); } else { resBean.setSuccess(true); _logger.info("No records avilable for barnch ID: " + model.getOid()); resBean.setMessage("No records avilable for barnch ID" + model.getOid()); } } catch (Exception e) { _logger.error("An exception occurred while get Branc for id : " + model.getOid() + " ", e); resBean.setSuccess(false); resBean.setMessage("Failed to get branch for ID :" + model.getOid()); } return resBean; }
@Override @SuppressWarnings("unchecked") public ResponseBean getAllSectorCode(ResponseBean resBean, SectorCodeBean model) { try { List<SectorCodeBean> allSectorCode = springJdbcDao.getObjectList(queryManager.getAllSectorCode(), null, SectorCodeBean.class); if (allSectorCode.size() > 0) { resBean.setSuccess(true); resBean.setData(allSectorCode); _logger.info("successfully load all barnches: " + model.getOid()); } else { resBean.setSuccess(true); _logger.info("No records avilable for id : " + model.getOid()); resBean.setMessage("No records avilable for barnch"); } } catch (Exception e) { _logger.error("An exception occurred while get All Branchs : ", e); resBean.setSuccess(false); resBean.setMessage("Failed to load branch"); } return resBean; }