1 package yarfraw.mapping.backward.impl;
2
3 import java.util.List;
4
5 import javax.xml.bind.JAXBElement;
6
7 import org.apache.commons.collections.CollectionUtils;
8
9 import yarfraw.core.datamodel.Link;
10 import yarfraw.core.datamodel.Person;
11 import yarfraw.generated.rss10.elements.DcType;
12
13 class Utils{
14 private Utils(){}
15
16 @SuppressWarnings("unchecked")
17 public static String getDcTypeText(JAXBElement<?> dcType) {
18 return dcType == null ? null : ((JAXBElement<DcType>)dcType).getValue().getValue();
19 }
20
21 /***
22 * Gets the <code>emailOrText</code> field of the first person in the input list.
23 * @param persons
24 * @return
25 */
26 public static String getEmailOrText(List<Person> persons){
27 String ret = null;
28 if(CollectionUtils.isNotEmpty(persons)){
29 Person p = persons.get(0);
30 ret = p == null ? null : p.getEmailOrText();
31 }
32 return ret;
33 }
34
35 /***
36 * Gets the <code>href</code> field of the first link in the input list.
37 * @param links
38 * @return
39 */
40 public static String getHrefLink(List<Link> links){
41 String ret = null;
42 if(CollectionUtils.isNotEmpty(links)){
43 Link l = links.get(0);
44 ret = l == null ? null : l.getHref();
45 }
46 return ret;
47 }
48 }