applicationDataMap.setValues(values);
return applicationDataMap;
}
private ActivityDb buildCanonicalActivity(String userId, String id) {
ActivityDb activity = buildActivityTemplate(userId, id);
// Common attributes
activity.setPriority(0.7F);
activity.setStreamFaviconUrl("http://upload.wikimedia.org/wikipedia/commons/0/02/Nuvola_apps_edu_languages.gif");
activity.setStreamSourceUrl("http://www.example.org/canonical/streamsource");
activity.setStreamTitle("All my activities");
activity.setStreamUrl("http://www.example.org/canonical/activities");
// Set othe attributes depending on given id
if ("1".equals(id)) {
activity.setBody("Went rafting");
activity.setBodyId("1");
activity.setExternalId("http://www.example.org/123456");
List<MediaItem> mediaItems = new ArrayList<MediaItem>();
MediaItemDb mediaItem1 = new MediaItemDb();
mediaItem1.setMimeType("image/*");
mediaItem1.setType(MediaItem.Type.IMAGE);
mediaItem1.setUrl("http://upload.wikimedia.org/wikipedia/commons/thumb/7/77/Rafting_em_Brotas.jpg/800px-Rafting_em_Brotas.jpg");
MediaItemDb mediaItem2 = new MediaItemDb();
mediaItem2.setMimeType("audio/mpeg");
mediaItem2.setType(MediaItem.Type.AUDIO);
mediaItem2.setUrl("http://www.archive.org/download/testmp3testfile/mpthreetest.mp3");
mediaItems.add(mediaItem1);
mediaItems.add(mediaItem2);
activity.setMediaItems(mediaItems);
activity.setPostedTime(1111111111L);
Map<String, String> templateParams = new MapMaker().makeMap();
templateParams.put("small", "true");
templateParams.put("otherContent", "and got wet");
activity.setTemplateParams(templateParams);
activity.setTitle("My trip");
activity.setTitleId("1");
activity.setUpdated(new Date());
activity.setUrl("http://www.example.org/canonical/activities/1");
} else if ("2".equals(id)) {
activity.setBody("Went skiing");
activity.setBodyId("2");
activity.setExternalId("http://www.example.org/123457");
List<MediaItem> mediaItems = new ArrayList<MediaItem>();
activity.setMediaItems(mediaItems);
activity.setPostedTime(1111111112L);
Map<String, String> templateParams = new MapMaker().makeMap();
templateParams.put("small", "true");
templateParams.put("otherContent", "and went fast");
activity.setTemplateParams(templateParams);
activity.setTitle("My next trip");
activity.setTitleId("2");
activity.setUpdated(new Date());
activity.setUrl("http://www.example.org/canonical/activities/2");
}
return activity;
}