1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.select.service.impl;
17
18 import org.kuali.ole.select.businessobject.BibInfoBean;
19 import org.kuali.ole.select.service.ItemMarcXMLGenerationService;
20
21 import java.util.HashMap;
22
23 public class ItemMarcXMLGenerationServiceImpl implements ItemMarcXMLGenerationService {
24
25 private static ItemMarcXMLGenerationServiceImpl itemMarcXMLGenerationServiceImpl;
26 protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ItemMarcXMLGenerationServiceImpl.class);
27
28
29 public String getMarcXML(BibInfoBean bibInfoBean, HashMap dataMap) throws Exception {
30 return buildXmlString(bibInfoBean, dataMap);
31 }
32
33 private String buildXmlString(BibInfoBean bibInfoBean, HashMap dataMap) throws Exception {
34 StringBuilder xmlString = new StringBuilder();
35 xmlString.append("<collection xmlns=\"http://www.loc.gov/MARC21/slim\">");
36 xmlString.append("<record>");
37 xmlString.append("<leader></leader>");
38 xmlString.append("<controlfield tag=\"001\"></controlfield>");
39 xmlString.append("<datafield tag=\"999\" ind1=\"\" ind2=\"\" >");
40 xmlString.append("<subfield code=\"a\"></subfield>");
41 xmlString.append("<subfield code=\"b\">").append(bibInfoBean.getVolumeNumber() != null ? bibInfoBean.getVolumeNumber() : "").append("</subfield>");
42 xmlString.append("<subfield code=\"i\"></subfield>");
43 xmlString.append("<subfield code=\"l\">").append(bibInfoBean.getLocation() != null ? bibInfoBean.getLocation() : "").append("</subfield>");
44 xmlString.append("<subfield code=\"m\"></subfield>");
45 xmlString.append("<subfield code=\"p\">").append(bibInfoBean.getListprice() != null ? bibInfoBean.getListprice() : "").append("</subfield>");
46 xmlString.append("</datafield>");
47 xmlString.append("</record>");
48 xmlString.append("</collection>");
49 if (LOG.isDebugEnabled())
50 LOG.debug("itemxmlString----------->" + xmlString.toString());
51 return xmlString.toString();
52 }
53 }