Package org.apache.shindig.social.opensocial.model

Examples of org.apache.shindig.social.opensocial.model.MediaItem


        }
        List<MediaItem> mediaItemList = new ArrayList<MediaItem>();

        if (activityObj.getMediaItems() != null) {
            for (org.wso2.carbon.registry.social.api.activity.MediaItem item : activityObj.getMediaItems()) {
                MediaItem itemObj = new MediaItemImpl();
                if (item != null) {
                    if (item.getMimeType() != null) {
                        itemObj.setMimeType(item.getMimeType());
                    }
                    if (item.getThumbnailUrl() != null) {
                        itemObj.setThumbnailUrl(item.getThumbnailUrl());
                    }
                    if (item.getType() != null) {
                        org.wso2.carbon.registry.social.api.activity.MediaItem.Type itemType = item.getType();
                        if (itemType.name().equals(MEDIA_ITEM_TYPE_AUDIO)) {
                            itemObj.setType(MediaItem.Type.AUDIO);
                        }
                        if (itemType.name().equals(MEDIA_ITEM_TYPE_IMAGE)) {
                            itemObj.setType(MediaItem.Type.IMAGE);
                        }
                        if (itemType.name().equals(MEDIA_ITEM_TYPE_VIDEO)) {
                            itemObj.setType(MediaItem.Type.VIDEO);
                        }

                    }
                    if (item.getUrl() != null) {
                        itemObj.setUrl(item.getUrl());
                    }
                    mediaItemList.add(itemObj);
                }

            }
View Full Code Here


    assertEquals(activity.getId(), result.getString("id"));

    JSONArray mediaItemsArray = result.getJSONArray("mediaItems");
    assertEquals(1, mediaItemsArray.length());

    MediaItem expectedItem = activity.getMediaItems().get(0);
    JSONObject actualItem = mediaItemsArray.getJSONObject(0);

    assertEquals(expectedItem.getUrl(), actualItem.getString("url"));
    assertEquals(expectedItem.getMimeType(), actualItem.getString("mimeType"));
    assertEquals(expectedItem.getType().toString(),
        actualItem.getString("type"));
  }
View Full Code Here

    assertEquals("5", result.getUserId());
    assertEquals("6", result.getId());

    assertEquals(1, result.getMediaItems().size());

    MediaItem actualItem = result.getMediaItems().get(0);

    assertEquals("hello", actualItem.getUrl());
    assertEquals("mimey", actualItem.getMimeType());
    assertEquals("video", actualItem.getType().toString());
  }
View Full Code Here

    assertEquals(activity.getUserId(), parsedActivity.getUserId());
    assertEquals(activity.getId(), parsedActivity.getId());

    assertEquals(1, parsedActivity.getMediaItems().size());

    MediaItem expectedItem = activity.getMediaItems().get(0);
    MediaItem actualItem = parsedActivity.getMediaItems().get(0);

    assertEquals(expectedItem.getUrl(), actualItem.getUrl());
    assertEquals(expectedItem.getMimeType(), actualItem.getMimeType());
    assertEquals(expectedItem.getType().toString(), actualItem.getType().toString());
  }
View Full Code Here

    assertEquals("5", result.getUserId());
    assertEquals("6", result.getId());

    assertEquals(1, result.getMediaItems().size());

    MediaItem actualItem = result.getMediaItems().get(0);

    assertEquals("hello", actualItem.getUrl());
    assertEquals("mimey", actualItem.getMimeType());
    assertEquals("video", actualItem.getType().toString());
  }
View Full Code Here

  }

  protected MediaItem getRequestMediaItem(SocialRequestItem request) {
    // 'data' missing is ok, but then 'mediaItem' must exist.
    // 'data' or 'mediaItem' invalid will lead to errors.
    MediaItem result = request.getOptionalTypedParameter("data", MediaItem.class);
    if (result == null) {
      result = request.getTypedParameter("mediaItem", MediaItem.class);
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.social.opensocial.model.MediaItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.