protected void updateThumbnails(long fileEntryId) throws Exception { Connection con = null; PreparedStatement ps = null; ResultSet rs = null; try { con = DataAccess.getUpgradeOptimizedConnection(); ps = con.prepareStatement( "select fileVersionId, userId, extension, mimeType, version " + "from DLFileVersion where fileEntryId = " + fileEntryId + " order by version asc"); rs = ps.executeQuery(); while (rs.next()) { long fileVersionId = rs.getLong("fileVersionId"); long userId = rs.getLong("userId"); String extension = rs.getString("extension"); String mimeType = rs.getString("mimeType"); String version = rs.getString("version"); if (_imageMimeTypes.contains(mimeType)) { DLFileVersion dlFileVersion = new DLFileVersionImpl(); dlFileVersion.setFileVersionId(fileVersionId); dlFileVersion.setUserId(userId); dlFileVersion.setFileEntryId(fileEntryId); dlFileVersion.setExtension(extension); dlFileVersion.setMimeType(mimeType); dlFileVersion.setVersion(version); FileVersion fileVersion = new LiferayFileVersion(dlFileVersion); try { ImageProcessorUtil.generateImages(null, fileVersion); } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn("Unable to generate thumbnails for " + fileVersion.getFileVersionId(), e); } } } } } finally { DataAccess.cleanUp(con, ps, rs); } }
public DLFileVersion updateDLFileVersion(DLFileVersion model) throws SystemException { DLFileVersion dlFileVersion = new DLFileVersionImpl(); dlFileVersion.setNew(false); dlFileVersion.setFileVersionId(model.getFileVersionId()); dlFileVersion.setCompanyId(model.getCompanyId()); dlFileVersion.setUserId(model.getUserId()); dlFileVersion.setUserName(model.getUserName()); dlFileVersion.setCreateDate(model.getCreateDate()); dlFileVersion.setFolderId(model.getFolderId()); dlFileVersion.setName(model.getName()); dlFileVersion.setVersion(model.getVersion()); dlFileVersion.setSize(model.getSize()); return dlFileVersionPersistence.update(dlFileVersion); }