1 package org.kuali.ole;
2
3 import com.thoughtworks.xstream.XStream;
4 import org.kuali.ole.pojo.OleBibRecord;
5 import org.kuali.ole.pojo.OleEditorResponse;
6 import org.kuali.ole.pojo.OleOrderRecord;
7 import org.kuali.ole.pojo.OleTxRecord;
8 import org.kuali.ole.pojo.bib.BibliographicRecord;
9 import org.kuali.ole.pojo.edi.EDIOrder;
10
11
12
13
14
15
16
17
18 public class OleEditorResponseHandler {
19 public OleEditorResponse fromXML(String marcXMLContent) {
20 XStream xStream = new XStream();
21 xStream.alias("oleEditorResponse", OleEditorResponse.class);
22 xStream.alias("oleBibRecord", OleBibRecord.class);
23 xStream.aliasField("tokenId", OleEditorResponse.class, "tokenId");
24 return (OleEditorResponse) xStream.fromXML(marcXMLContent);
25
26 }
27
28
29 public String toXML(OleEditorResponse oleEditorResponse) {
30 StringBuffer stringBuffer = new StringBuffer();
31 stringBuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
32 XStream xStream = new XStream();
33 xStream.alias("oleEditorResponse", OleEditorResponse.class);
34 xStream.alias("oleBibRecord", OleBibRecord.class);
35 xStream.aliasField("tokenId", OleEditorResponse.class, "tokenId");
36 String xml = xStream.toXML(oleEditorResponse);
37 stringBuffer.append(xml);
38 stringBuffer.append("\n");
39 return stringBuffer.toString();
40 }
41 }