use of com.liferay.portlet.documentlibrary.model.DLFileEntry in project liferay-ide by liferay.
the class AlbumStagedModelDataHandler method _getContentStream.
private InputStream _getContentStream(FileEntry fileEntry) throws PortalException, SystemException {
long repositoryId = DLFolderConstants.getDataRepositoryId(fileEntry.getRepositoryId(), fileEntry.getFolderId());
String name = ((DLFileEntry) fileEntry.getModel()).getName();
InputStream is = DLStoreUtil.getFileAsStream(fileEntry.getCompanyId(), repositoryId, name, fileEntry.getVersion());
if (is == null) {
is = new UnsyncByteArrayInputStream(new byte[0]);
}
return is;
}
use of com.liferay.portlet.documentlibrary.model.DLFileEntry in project liferay-ide by liferay.
the class ArtistStagedModelDataHandler method _getContentStream.
private InputStream _getContentStream(FileEntry fileEntry) throws PortalException, SystemException {
long repositoryId = DLFolderConstants.getDataRepositoryId(fileEntry.getRepositoryId(), fileEntry.getFolderId());
String name = ((DLFileEntry) fileEntry.getModel()).getName();
InputStream is = DLStoreUtil.getFileAsStream(fileEntry.getCompanyId(), repositoryId, name, fileEntry.getVersion());
if (is == null) {
is = new UnsyncByteArrayInputStream(new byte[0]);
}
return is;
}
use of com.liferay.portlet.documentlibrary.model.DLFileEntry in project liferay-ide by liferay.
the class WebServerServlet method isLegacyImageGalleryImageId.
protected boolean isLegacyImageGalleryImageId(HttpServletRequest request, HttpServletResponse response) {
try {
long imageId = getImageId(request);
if (imageId == 0) {
return false;
}
DLFileEntry dlFileEntry = DLFileEntryServiceUtil.fetchFileEntryByImageId(imageId);
if (dlFileEntry == null) {
return false;
}
StringBundler sb = new StringBundler(9);
sb.append("/documents/");
sb.append(dlFileEntry.getGroupId());
sb.append(StringPool.SLASH);
sb.append(dlFileEntry.getFolderId());
sb.append(StringPool.SLASH);
sb.append(HttpUtil.encodeURL(HtmlUtil.unescape(dlFileEntry.getTitle()), true));
sb.append("?version=");
sb.append(dlFileEntry.getVersion());
if (imageId == dlFileEntry.getSmallImageId()) {
sb.append("&imageThumbnail=1");
} else if (imageId == dlFileEntry.getSmallImageId()) {
sb.append("&imageThumbnail=2");
} else if (imageId == dlFileEntry.getSmallImageId()) {
sb.append("&imageThumbnail=3");
}
response.setHeader(HttpHeaders.LOCATION, sb.toString());
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
return true;
} catch (Exception e) {
}
return false;
}
use of com.liferay.portlet.documentlibrary.model.DLFileEntry in project liferay-ide by liferay.
the class ArtistIndexer method addRelatedEntryFields.
@Override
public void addRelatedEntryFields(Document document, Object obj) throws Exception {
if (obj instanceof DLFileEntry) {
DLFileEntry dlFileEntry = (DLFileEntry) obj;
Artist artist = ArtistLocalServiceUtil.getArtist(GetterUtil.getLong(dlFileEntry.getTitle()));
document.addKeyword(Field.CLASS_NAME_ID, PortalUtil.getClassNameId(Artist.class.getName()));
document.addKeyword(Field.CLASS_PK, artist.getArtistId());
document.addKeyword(Field.RELATED_ENTRY, true);
}
}
use of com.liferay.portlet.documentlibrary.model.DLFileEntry in project liferay-ide by liferay.
the class SongIndexer method addRelatedEntryFields.
@Override
public void addRelatedEntryFields(Document document, Object obj) throws Exception {
if (obj instanceof DLFileEntry) {
DLFileEntry dlFileEntry = (DLFileEntry) obj;
Song song = SongLocalServiceUtil.getSong(GetterUtil.getLong(dlFileEntry.getTitle()));
document.addKeyword(Field.CLASS_NAME_ID, PortalUtil.getClassNameId(Song.class.getName()));
document.addKeyword(Field.CLASS_PK, song.getSongId());
document.addKeyword(Field.RELATED_ENTRY, true);
}
}
Aggregations