[HepData-svn] r1606 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Fri Nov 30 09:12:08 GMT 2012


Author: whalley
Date: Fri Nov 30 09:12:08 2012
New Revision: 1606

Log:
addition of code of code for the MarcXML formatter

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java	Fri Nov 30 09:11:11 2012	(r1605)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/View.java	Fri Nov 30 09:12:08 2012	(r1606)
@@ -37,7 +37,7 @@
         parseBaseViewContext(context);
 
         // Handle pattern parsing separately
-        Pattern patt = Pattern.compile("\\A" + "(short|long|full|plain.txt|yoda|aida|pyroot.py|root|mpl|bdms|hepml|jhepwork.py|input)" + "\\Z",
+        Pattern patt = Pattern.compile("\\A" + "(short|long|full|plain.txt|yoda|aida|pyroot.py|root|mpl|bdms|hepml|jhepwork.py|input|marcxml)" + "\\Z",
                                        Pattern.CASE_INSENSITIVE);
         Pattern patt2 = Pattern.compile("\\A" + "(irn\\d+)" + "\\Z",Pattern.CASE_INSENSITIVE);
         String stype = "i";
@@ -60,6 +60,7 @@
         if (fmt != null) {
             if (fmt.equals("jhepwork.py")) return asJhepwork();
             if (fmt.equals("hepml")) return asHepML();
+            if (fmt.equals("marcxml")) return asMarcXML();
             if (fmt.equals("bdms")) return asBDMS();
             if (fmt.equals("input")) return asINPUT();
             if (fmt.equals("plain.txt")) return asPlain();
@@ -115,6 +116,18 @@
         return new TextStreamResponse("text/plain", asHepML);
     }
 
+    public Object getMarcXMLContext() {
+        return formatContext("marcxml");
+    }
+    public StreamResponse asMarcXML() {
+        Paper p = getPaper();
+        String asMarcXML = MarcXMLFormatter.format(p);
+        if (asMarcXML == null) {
+            asMarcXML = "No valid paper specified";
+        }
+        return new TextStreamResponse("text/xml", asMarcXML);
+    }
+
     public Object getBdmsContext() {
         return formatContext("bdms");
     }


More information about the HepData-svn mailing list