1 package org.kuali.ole.docstore.common.document.content.instance;
2
3 import com.thoughtworks.xstream.annotations.XStreamAlias;
4 import com.thoughtworks.xstream.annotations.XStreamImplicit;
5
6 import javax.xml.bind.JAXBContext;
7 import javax.xml.bind.Marshaller;
8 import javax.xml.bind.annotation.*;
9 import java.io.StringWriter;
10 import java.util.ArrayList;
11 import java.util.List;
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 @XmlAccessorType(XmlAccessType.FIELD)
38 @XmlType(name = "items", propOrder = {
39 "item"
40 })
41 @XStreamAlias("items")
42 @XmlRootElement(name = "items")
43 public class Items {
44
45 @XmlElement(name = "item", required = true)
46 @XStreamImplicit(itemFieldName = "item")
47 protected List<Item> item;
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69 public List<Item> getItem() {
70 if (item == null) {
71 item = new ArrayList<Item>();
72 }
73 return this.item;
74 }
75
76 public void setItem(List<Item> item) {
77 this.item = item;
78 }
79
80 public static String serialize(Object object) {
81 String result = null;
82 StringWriter sw = new StringWriter();
83 Items items = (Items) object;
84 try {
85 JAXBContext jaxbContext = JAXBContext.newInstance(Items.class);
86 Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
87 jaxbMarshaller.marshal(items, sw);
88 result = sw.toString().replace("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>","");
89 } catch (Exception e) {
90
91 }
92 return result;
93 }
94 }