@Override public Information findInformationByUuid(String uuid) { try { Information information = informationDao.get(uuid); return information; } catch (CustomException e) { e.printStackTrace(); } return null; }
@Override @Transactional(propagation = Propagation.REQUIRED) public void deleteInformation(String uuid) { try { Information information = informationDao.load(uuid); information.setDeleteDate(new Date()); informationDao.update(information); } catch (CustomException e) { e.printStackTrace(); } }
@Override @Transactional(propagation = Propagation.REQUIRED) public void updateInformation(Information information) { try { Information tmp = informationDao.get(information.getUuid()); tmp.setTitle(information.getTitle()); tmp.setPictureUrl(information.getPictureUrl()); tmp.setAuthorName(information.getAuthorName()); tmp.setSummary(information.getSummary()); tmp.setModifyDate(new Date()); if (tmp instanceof InformationText) { ((InformationText) tmp).setContent(((InformationText) information).getContent()); } informationDao.update(information); } catch (CustomException e) { e.printStackTrace(); this.saveInformation(information); } }