Search in sources :

Example 1 with MediaItemImpl

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;
}
Also used : MediaItemImpl(org.apache.shindig.social.core.model.MediaItemImpl) MediaItem(org.apache.shindig.social.opensocial.model.MediaItem) FileVersion(com.liferay.portal.kernel.repository.model.FileVersion)

Example 2 with MediaItemImpl

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;
}
Also used : MediaItemImpl(org.apache.shindig.social.core.model.MediaItemImpl) JSONObject(com.liferay.portal.kernel.json.JSONObject) MediaItem(org.apache.shindig.social.opensocial.model.MediaItem) ArrayList(java.util.ArrayList)

Aggregations

MediaItemImpl (org.apache.shindig.social.core.model.MediaItemImpl)2 MediaItem (org.apache.shindig.social.opensocial.model.MediaItem)2 JSONObject (com.liferay.portal.kernel.json.JSONObject)1 FileVersion (com.liferay.portal.kernel.repository.model.FileVersion)1 ArrayList (java.util.ArrayList)1