@@ -0,0 +1,2072 @@
+package eu.socialsensor.framework.abstractions.socialmedia.topsy;%0D%0A%0D%0Aimport java.net.MalformedURLException;%0D%0Aimport java.net.URL;%0D%0Aimport java.text.ParseException;%0D%0Aimport java.text.SimpleDateFormat;%0D%0Aimport java.util.Date;%0D%0A%0D%0Aimport com.maruti.otterapi.search.Post;%0D%0A%0D%0Aimport eu.socialsensor.framework.common.domain.Item;%0D%0Aimport eu.socialsensor.framework.common.domain.MediaItem;%0D%0Aimport eu.socialsensor.framework.common.domain.SocialNetworkSource;%0D%0A%0D%0A%0D%0Apublic class TopsyItem extends Item%7B%0D%0A%09public TopsyItem(String id, Operation operation) %7B%0D%0A%09%09super(SocialNetworkSource.Topsy.toString(), operation);%0D%0A%09%09setId(SocialNetworkSource.Topsy + %22#%22 + id);%0D%0A%09%7D%0D%0A%09%0D%0A%09public TopsyItem(Post post)%7B%0D%0A%09%09super(SocialNetworkSource.Topsy.toString(), Operation.NEW);%0D%0A%09%09%0D%0A%09%09if(post == null)%0D%0A%09%09%09return;%0D%0A%09%09%0D%0A%09%09//Id%0D%0A%09%09id = SocialNetworkSource.Topsy + %22#%22 + Math.abs(post.hashCode());%0D%0A%09%09//SocialNetwork Name%0D%0A%09%09streamId = SocialNetworkSource.Topsy.toString();%0D%0A%09%09//Timestamp of the creation of the post%0D%0A%0D%0A%09%09if(post.getFirstpost_date() != null)%0D%0A%09%09publicationTime = Long.parseLong(post.getFirstpost_date()) * 1000;%0D%0A%09%09%0D%0A%09%09title = post.getTitle();%0D%0A%09%09description = post.getContent();%0D%0A%09%09%0D%0A%09%09//Media Items - WebPages in a post%0D%0A%09%09String pageURL = post.getUrl();%0D%0A%09%09%0D%0A%09%09URL url = null;%0D%0A%09%09try %7B%0D%0A%09%09%09url = new URL(pageURL);%0D%0A%09%09%7D catch (MalformedURLException e) %7B%0D%0A%09%09%09// TODO Auto-generated catch block%0D%0A%09%09%09e.printStackTrace();%0D%0A%09%09%09return;%0D%0A%09%09%7D%0D%0A%09%09//url%0D%0A%09%09MediaItem mediaItem = new MediaItem(url);%0D%0A%09%0D%0A%09%09String mediaId = SocialNetworkSource.Topsy + %22#%22+pageURL; %0D%0A%09%09%0D%0A%09%09//id%0D%0A%09%09mediaItem.setId(mediaId);%0D%0A%09%09//SocialNetwork Name%0D%0A%09%09mediaItem.setStreamId(streamId);%0D%0A%09%09//Reference%0D%0A%09%09mediaItem.setRef(id);%0D%0A%09%09//Type %0D%0A%09%09mediaItem.setType(%22image%22);%0D%0A%09%09//Time of publication%0D%0A%09%09mediaItem.setPublicationTime(publicationTime);%0D%0A%09%09//Author%0D%0A%09%09mediaItem.setUser(streamUser);%0D%0A%09%09//PageUrl%0D%0A%09%09mediaItem.setPageUrl(pageURL);%0D%0A%09%09//Title%0D%0A%09%09mediaItem.setTitle(title);%0D%0A%09%09//Description%0D%0A%09%09mediaItem.setDescription(description);%0D%0A%09%0D%0A%09%09mediaIds.add(mediaId);%0D%0A%09%09mediaItems.add(mediaItem);%0D%0A%09%09%0D%0A%09%09%0D%0A%09%7D%0D%0A%7D%0D%0A

add topsy item