コード例 #1
0
  private com.skt.opensocial.persistence.Activity setActivityDBFromActivity(
      Person user, String appId, Activity activity) {
    com.skt.opensocial.persistence.Activity activityDB =
        new com.skt.opensocial.persistence.Activity();

    activityDB.setAppId(appId);

    activityDB.setBody(activity.getBody());
    activityDB.setBodyId(activity.getBodyId());
    activityDB.setExternalId(activity.getExternalId());

    if (activity.getPriority() != null) activityDB.setPriority(new Double(activity.getPriority()));
    else activityDB.setPriority(new Double(0));

    activityDB.setStreamFaviconUrl(activity.getStreamFaviconUrl());
    activityDB.setStreamSourceUrl(activity.getStreamSourceUrl());
    activityDB.setStreamTitle(activity.getStreamTitle());
    activityDB.setStreamUrl(activity.getStreamUrl());
    activityDB.setTitle(activity.getTitle());

    // there should one of Title or TitleId
    if (activityDB.getTitle() == null) activityDB.setTitleId(activity.getTitleId());

    activityDB.setUpdated(activity.getUpdated());
    activityDB.setUrl(activity.getUrl());
    activityDB.setPerson(user);

    return activityDB;
  }
コード例 #2
0
 public void testGetExpectedActivity() throws Exception {
   Activity activity =
       db.getActivity(
               CANON_USER,
               SELF_GROUP,
               APP_ID,
               ImmutableSet.of("appId", "body", "mediaItems"),
               APP_ID,
               new FakeGadgetToken())
           .get();
   assertNotNull(activity);
   // Check that some fields are fetched and others are not
   assertNotNull(activity.getBody());
   assertNull(activity.getBodyId());
 }