1 package org.kuali.ole.systemintegration.rest.bo;
2
3 import com.thoughtworks.xstream.annotations.XStreamAlias;
4 import org.apache.log4j.Logger;
5 import org.kuali.ole.docstore.common.document.content.instance.OleHoldings;
6
7 import javax.xml.bind.JAXBContext;
8 import javax.xml.bind.Marshaller;
9 import javax.xml.bind.annotation.XmlRootElement;
10 import javax.xml.bind.annotation.XmlType;
11 import java.io.StringWriter;
12
13
14
15
16
17
18
19
20 @XmlType(name = "holdingsSerialReceiving", propOrder = {
21 "serialReceiving"
22 })
23 @XStreamAlias("oleHoldings")
24 @XmlRootElement(name = "oleHoldings")
25 public class HoldingsSerialReceiving extends OleHoldings {
26
27 private static final Logger LOG = Logger.getLogger(HoldingsSerialReceiving.class);
28
29 private SerialReceiving serialReceiving;
30
31 public SerialReceiving getSerialReceiving() {
32 return serialReceiving;
33 }
34
35 public void setSerialReceiving(SerialReceiving serialReceiving) {
36 this.serialReceiving = serialReceiving;
37 }
38
39 public HoldingsSerialReceiving copyHoldingSerialReceiving(OleHoldings oleHoldings){
40 HoldingsSerialReceiving oleHoldingsSerialReceiving = new HoldingsSerialReceiving();
41 oleHoldingsSerialReceiving.setHoldingsIdentifier(oleHoldings.getHoldingsIdentifier());
42 oleHoldingsSerialReceiving.setBibIdentifier(oleHoldings.getBibIdentifier());
43 oleHoldingsSerialReceiving. setUri(oleHoldings.getUri());
44 oleHoldingsSerialReceiving.setStaffOnlyFlag(oleHoldings.isStaffOnlyFlag());
45 oleHoldingsSerialReceiving.setAccessStatus(oleHoldings.getAccessStatus());
46 oleHoldingsSerialReceiving.setCallNumber(oleHoldings.getCallNumber());
47 oleHoldingsSerialReceiving.setDonorInfo(oleHoldings.getDonorInfo());
48 oleHoldingsSerialReceiving.setCopyNumber(oleHoldings.getCopyNumber());
49 oleHoldingsSerialReceiving.setDonorNote(oleHoldings.getDonorNote());
50 oleHoldingsSerialReceiving.setDonorPublicDisplay(oleHoldings.getDonorPublicDisplay());
51 oleHoldingsSerialReceiving.setEResourceId(oleHoldings.getEResourceId());
52 oleHoldingsSerialReceiving.setExtension(oleHoldings.getExtension());
53 oleHoldingsSerialReceiving.setExtentOfOwnership(oleHoldings.getExtentOfOwnership());
54 oleHoldingsSerialReceiving.setHoldingsType(oleHoldings.getHoldingsType());
55 oleHoldingsSerialReceiving.setImprint(oleHoldings.getImprint());
56 oleHoldingsSerialReceiving.setInterLibraryLoanAllowed(oleHoldings.isInterLibraryLoanAllowed());
57 oleHoldingsSerialReceiving.setHoldingsAccessInformation(oleHoldings.getHoldingsAccessInformation());
58 oleHoldingsSerialReceiving.setLink(oleHoldings.getLink());
59 oleHoldingsSerialReceiving.setLocalPersistentLink(oleHoldings.getLocalPersistentLink());
60 oleHoldingsSerialReceiving.setLocation(oleHoldings.getLocation());
61 oleHoldingsSerialReceiving.setNote(oleHoldings.getNote());
62 oleHoldingsSerialReceiving.setPlatform(oleHoldings.getPlatform());
63 oleHoldingsSerialReceiving.setPrimary(oleHoldings.getPrimary());
64 oleHoldingsSerialReceiving.setInterLibraryLoanAllowed(oleHoldings.isInterLibraryLoanAllowed());
65 oleHoldingsSerialReceiving.setPublisher(oleHoldings.getPublisher());
66 oleHoldingsSerialReceiving.setStatisticalSearchingCode(oleHoldings.getStatisticalSearchingCode());
67 oleHoldingsSerialReceiving.setStatusDate(oleHoldings.getStatusDate());
68 oleHoldingsSerialReceiving.setSubscriptionStatus(oleHoldings.getSubscriptionStatus());
69 return oleHoldingsSerialReceiving;
70 }
71
72
73 public String serialize(Object object) {
74 String result = null;
75 StringWriter sw = new StringWriter();
76 HoldingsSerialReceiving holdingsSerialReceiving = (HoldingsSerialReceiving) object;
77 try {
78 JAXBContext jaxbContext = JAXBContext.newInstance(HoldingsSerialReceiving.class);
79 Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
80 jaxbMarshaller.marshal(holdingsSerialReceiving, sw);
81 result = sw.toString().replace("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>","");
82 } catch (Exception e) {
83 LOG.error("Exception :", e);
84 }
85 return result;
86 }
87 }