Package org.apache.shindig.social.opensocial.jpa

Examples of org.apache.shindig.social.opensocial.jpa.ActivityDb


    String uid = SPIUtils.getUserList(userId, token);

    try {
      // Map activity into a new ActivityDb instance
      // TODO Could we use dozer to do this mapping instead, for future-proofing reasons?
      ActivityDb activityDb = new ActivityDb();
      activityDb.setPostedTime(new Date().getTime());
      activityDb.setAppId(appId);
      activityDb.setUserId(uid);
      activityDb.setId(activity.getId());
      activityDb.setBodyId(activity.getBodyId());
      activityDb.setBody(activity.getBody());
      activityDb.setExternalId(activity.getExternalId());
      activityDb.setTitleId(activity.getTitleId());
      activityDb.setTitle(activity.getTitle());
      activityDb.setUpdated(new Date());
      activityDb.setPriority(activity.getPriority());
      activityDb.setStreamFaviconUrl(activity.getStreamFaviconUrl());
      activityDb.setStreamSourceUrl(activity.getStreamSourceUrl());
      activityDb.setStreamTitle(activity.getStreamTitle());
      activityDb.setStreamUrl(activity.getStreamUrl());
      activityDb.setUrl(activity.getUrl());
      if(activity.getMediaItems() != null) {
        List<MediaItem> mediaItems = new ArrayList<MediaItem>();
        for(MediaItem m : activity.getMediaItems()) {
          MediaItemDb mediaItem = new MediaItemDb();
          mediaItem.setMimeType(m.getMimeType());
          mediaItem.setType(m.getType());
          mediaItem.setUrl(m.getUrl());
          mediaItems.add(mediaItem);
        }
        activityDb.setMediaItems(mediaItems);
      }
      if (activity.getTemplateParams() != null) {
        activityDb.setTemplateParams(activity.getTemplateParams());
      }

      // TODO How should transactions be managed? Should samples be using warp-persist instead?
      if (!entityManager.getTransaction().isActive()) {
        entityManager.getTransaction().begin();
View Full Code Here

TOP

Related Classes of org.apache.shindig.social.opensocial.jpa.ActivityDb

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.