public static NewsEntity fromNews(News news) { NewsEntity entity = new NewsEntity(); entity.setTitle(news.getTitle()); entity.setDescription(news.getDescription()); entity.setDate(news.getOnlineDate()); entity.setPermalink(news.getPermalink()); entity.setId(news.getId()); entity.setPublicationId(news.getPublicationId()); entity.setContent(news.getContent()); ThumbnailDetail thumbnail = news.getThumbnail(); if (thumbnail != null) { entity.setThumbnailURL(thumbnail.getURL()); } return entity; }
@Override public void deleteThumbnail(ThumbnailDetail thumbDetail) throws ThumbnailException { Connection con = null; try { con = DBUtil.makeConnection(JNDINames.THUMBNAIL_DATASOURCE); dao.deleteThumbnail( con, thumbDetail.getObjectId(), thumbDetail.getObjectType(), thumbDetail.getInstanceId()); } catch (SQLException se) { throw new ThumbnailException( "ThumbnailBmImpl.deleteThumbnail()", SilverpeasException.ERROR, "thumbnail.EX_MSG_RECORD_NOT_DELETE", se); } finally { DBUtil.close(con); } }
@Override public ThumbnailDetail getCompleteThumbnail(ThumbnailDetail thumbDetail) throws ThumbnailException { Connection con = null; try { con = DBUtil.makeConnection(JNDINames.THUMBNAIL_DATASOURCE); return dao.selectByKey( con, thumbDetail.getInstanceId(), thumbDetail.getObjectId(), thumbDetail.getObjectType()); } catch (SQLException se) { throw new ThumbnailException( "ThumbnailBmImpl.getCompleteThumbnail()", SilverpeasException.ERROR, "thumbnail.EX_MSG_NOT_FOUND", se); } finally { DBUtil.close(con); } }