View Javadoc
1   package org.kuali.ole.docstore.common.document.content.instance;
2   
3   import com.thoughtworks.xstream.annotations.XStreamAlias;
4   import org.apache.log4j.Logger;
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  
11  /**
12   * Created with IntelliJ IDEA.
13   * User: srirams
14   * Date: 4/17/14
15   * Time: 6:22 PM
16   * To change this template use File | Settings | File Templates.
17   */
18  @XmlAccessorType(XmlAccessType.FIELD)
19  @XmlType(name = "holdingsTree", propOrder = {
20          "oleHoldings",
21          "items"
22  })
23  
24  @XStreamAlias("holdingsTree")
25  @XmlRootElement(name = "holdingsTree")
26  public class HoldingsTree {
27  
28      private static final Logger LOG = Logger.getLogger(HoldingsTree.class);
29  
30      @XmlElement(name ="oleHoldings")
31      private OleHoldings oleHoldings;
32  
33      @XmlElement(name = "items")
34      private Items items;
35  
36      public OleHoldings getOleHoldings() {
37          return oleHoldings;
38      }
39  
40      public void setOleHoldings(OleHoldings oleHoldings) {
41          this.oleHoldings = oleHoldings;
42      }
43  
44      /*public HoldingsSerialReceiving getHoldingsSerialReceiving() {
45          return holdingsSerialReceiving;
46      }
47  
48      public void setHoldingsSerialReceiving(HoldingsSerialReceiving holdingsSerialReceiving) {
49          this.holdingsSerialReceiving = holdingsSerialReceiving;
50      }*/
51  
52      public Items getItems() {
53          return items;
54      }
55  
56      public void setItems(Items items) {
57          this.items = items;
58      }
59  
60      public String serialize(Object object) {
61          StringBuilder stringBuilder = new StringBuilder();
62          stringBuilder.append("<holdingsTree>");
63          HoldingsTree holdingsTree = (HoldingsTree) object;
64          stringBuilder.append(holdingsTree.getOleHoldings().serialize(holdingsTree.getOleHoldings()));
65          stringBuilder.append(holdingsTree.getItems().serialize(holdingsTree.getItems()));
66          stringBuilder.append("</holdingsTree>");
67          return stringBuilder.toString();
68      }
69  
70      public String serialize(HoldingsTree holdingsTree) {
71          StringBuilder stringBuilder = new StringBuilder();
72          stringBuilder.append("<holdingsTree>");
73          stringBuilder.append(holdingsTree.getOleHoldings().serialize(holdingsTree.getOleHoldings()));
74          stringBuilder.append(holdingsTree.getItems().serialize(holdingsTree.getItems()));
75          stringBuilder.append("</holdingsTree>");
76          return stringBuilder.toString();
77      }
78  }