| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
package org.apache.shindig.social.core.util.atom; |
| 19 | |
|
| 20 | |
import org.apache.shindig.social.opensocial.model.Activity; |
| 21 | |
import org.apache.shindig.social.opensocial.model.Person; |
| 22 | |
|
| 23 | |
import java.util.Date; |
| 24 | |
import java.util.Map.Entry; |
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
public class AtomEntry { |
| 31 | |
|
| 32 | |
@SuppressWarnings("unused") |
| 33 | |
private String id; |
| 34 | |
@SuppressWarnings("unused") |
| 35 | |
private String title; |
| 36 | |
@SuppressWarnings("unused") |
| 37 | |
private String summary; |
| 38 | |
@SuppressWarnings("unused") |
| 39 | |
private String icon; |
| 40 | |
@SuppressWarnings("unused") |
| 41 | |
private AtomSource source; |
| 42 | |
@SuppressWarnings("unused") |
| 43 | |
private AtomGenerator generator; |
| 44 | |
@SuppressWarnings("unused") |
| 45 | |
private AtomAuthor author; |
| 46 | |
@SuppressWarnings("unused") |
| 47 | |
private Date updated; |
| 48 | |
@SuppressWarnings("unused") |
| 49 | |
private AtomLink link; |
| 50 | |
@SuppressWarnings("unused") |
| 51 | |
private Object content; |
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | 10 | public AtomEntry(Object o) { |
| 57 | 10 | if (o instanceof Person) { |
| 58 | 1 | Person person = (Person) o; |
| 59 | 1 | content = new AtomContent(person); |
| 60 | 1 | id = "urn:guid:" + person.getId(); |
| 61 | 1 | updated = person.getUpdated(); |
| 62 | 1 | } else if (o instanceof Activity) { |
| 63 | 1 | Activity activity = (Activity) o; |
| 64 | 1 | content = new AtomContent(activity); |
| 65 | 1 | title = activity.getTitle(); |
| 66 | 1 | summary = activity.getBody(); |
| 67 | 1 | link = new AtomLink("self", activity.getUrl()); |
| 68 | 1 | icon = activity.getStreamFaviconUrl(); |
| 69 | 1 | source = new AtomSource(activity); |
| 70 | 1 | generator = new AtomGenerator(activity); |
| 71 | 1 | author = new AtomAuthor(activity); |
| 72 | 1 | updated = activity.getUpdated(); |
| 73 | 1 | } else if ( o instanceof Entry ) { |
| 74 | 4 | Entry<?, ?> e = (Entry<?, ?>) o; |
| 75 | 4 | id = (String) e.getKey(); |
| 76 | 4 | content = new AtomContent(e.getValue()); |
| 77 | 4 | } else { |
| 78 | 4 | content = o; |
| 79 | |
} |
| 80 | 10 | } |
| 81 | |
|
| 82 | |
} |