use of org.apache.shindig.social.core.model.MediaItemImpl in project liferay-ide by liferay.
the class LiferayMediaItemService method toMediaItem.
protected MediaItem toMediaItem(FileEntry fileEntry, Set<String> fields, SecurityToken securityToken) throws Exception {
MediaItem mediaItem = new MediaItemImpl();
mediaItem.setAlbumId(String.valueOf(fileEntry.getFolderId()));
mediaItem.setCreated(String.valueOf(fileEntry.getCreateDate()));
mediaItem.setDescription(fileEntry.getDescription());
mediaItem.setId(String.valueOf(fileEntry.getFileEntryId()));
mediaItem.setLastUpdated(String.valueOf(fileEntry.getModifiedDate()));
mediaItem.setMimeType(MimeTypesUtil.getContentType(StringPool.PERIOD.concat(fileEntry.getExtension())));
mediaItem.setNumViews(String.valueOf(fileEntry.getReadCount()));
mediaItem.setTitle(fileEntry.getTitle());
mediaItem.setType(toMediaItemType(StringPool.PERIOD.concat(fileEntry.getExtension())));
String fileEntryURL = ShindigUtil.getFileEntryURL(securityToken.getDomain(), fileEntry.getFileEntryId());
mediaItem.setUrl(fileEntryURL);
FileVersion fileVersion = fileEntry.getLatestFileVersion();
SerializerUtil.copyProperties(fileVersion.getAttributes(), mediaItem, _MEDIA_ITEM_FIELDS);
return mediaItem;
}
use of org.apache.shindig.social.core.model.MediaItemImpl in project liferay-ide by liferay.
the class LiferayActivityService method getMediaItems.
protected List<MediaItem> getMediaItems(JSONArray mediaItemsJSONArray) {
if (mediaItemsJSONArray == null) {
return null;
}
List<MediaItem> mediaItems = new ArrayList<MediaItem>();
for (int i = 0; i < mediaItemsJSONArray.length(); i++) {
JSONObject mediaItemsJsonObject = mediaItemsJSONArray.getJSONObject(i);
MediaItem mediaItem = new MediaItemImpl(mediaItemsJsonObject.getString("mimeType"), Type.valueOf(mediaItemsJsonObject.getString("type")), mediaItemsJsonObject.getString("url"));
mediaItems.add(mediaItem);
}
return mediaItems;
}
Aggregations