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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Oct 2 11:49:55 BST 2012


Author: whalley
Date: Tue Oct  2 11:49:55 2012
New Revision: 1575

Log:
updates and addtions for locating with DOI for Elsevier

Added:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/DoiBanner.java
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/DoiData.java
Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewBase.java

Added: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/DoiBanner.java
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/DoiBanner.java	Tue Oct  2 11:49:55 2012	(r1575)
@@ -0,0 +1,40 @@
+package cedar.hepdata.webapp.pages;
+
+import java.util.Date;
+
+import org.apache.tapestry5.*;
+import org.apache.tapestry5.annotations.*;
+import org.apache.tapestry5.ioc.annotations.*;
+import org.apache.tapestry5.services.*;
+
+import org.hibernate.*;
+
+
+public class DoiBanner extends ViewBase{
+ 
+    @Inject
+    private org.hibernate.Session _session;
+    
+    private boolean rtn=false;
+    public void onActivate(EventContext context) {
+        parseBaseViewContext(context);
+        Query q=null;
+        StringBuffer b = new StringBuffer();
+        b.append("select count(distinct p) from Paper p");
+        b.append(" where p._doi like '");
+        for (int i = 0; i < context.getCount(); i++) {
+            String ps = context.get(String.class, i);
+            if(i>0) { b.append("/");}
+            b.append(ps);
+        }
+        b.append("'");
+        q=_session.createQuery(b.toString());
+        Long result = (Long) q.uniqueResult();
+        if(result>0) { rtn=true;}
+    }
+
+    public boolean getHavePaper(){
+        return rtn;
+    }
+
+}

Added: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/DoiData.java
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/DoiData.java	Tue Oct  2 11:49:55 2012	(r1575)
@@ -0,0 +1,530 @@
+package cedar.hepdata.webapp.pages;
+
+import cedar.hepdata.model.*;
+import cedar.hepdata.util.*;
+import cedar.hepdata.xml.*;
+import cedar.hepdata.db.*;
+import cedar.hepdata.formats.*;
+
+import org.apache.tapestry5.EventContext;
+import org.apache.tapestry5.StreamResponse;
+import org.apache.tapestry5.util.TextStreamResponse;
+import org.apache.tapestry5.annotations.*;
+import org.apache.tapestry5.ioc.annotations.*;
+import org.apache.tapestry5.services.*;
+
+import org.hibernate.*;
+import org.hibernate.criterion.*;
+import java.util.*;
+import java.io.*;
+import java.util.regex.*;
+import java.io.File;
+
+
+public class DoiData extends ViewBase {
+
+    // @Inject
+    // private Request _req;
+    // public Request getRequest() { return _req; }
+
+    // @Inject
+    // private org.hibernate.Session _session;
+
+
+    // Decode URL context into the params map
+    public StreamResponse onActivate(EventContext context) {
+        // Do the basic parsing via the base class
+        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.CASE_INSENSITIVE);
+        Pattern patt2 = Pattern.compile("\\A" + "(irn\\d+)" + "\\Z",Pattern.CASE_INSENSITIVE);
+        String stype = "i";
+        for (int i = 0; i < context.getCount(); i++) {
+            String ps = context.get(String.class, i);
+            Matcher m = patt.matcher(ps);
+            if (m.matches()) {
+                setQueryParam("format", m.group(1).toLowerCase());
+            } else {
+                setQueryParam("format", "full");
+            }
+            m = patt2.matcher(ps);
+            if (m.matches()) {
+                stype = "s";
+            } 
+        }
+
+        // Now handle the special formats (after parsing *all* context elements)
+        String fmt = getQueryParam("format");
+        if (fmt != null) {
+            if (fmt.equals("jhepwork.py")) return asJhepwork();
+            if (fmt.equals("hepml")) return asHepML();
+            if (fmt.equals("bdms")) return asBDMS();
+            if (fmt.equals("input")) return asINPUT();
+            if (fmt.equals("plain.txt")) return asPlain();
+            if (fmt.equals("aida")) return asAIDA(stype);
+            if (fmt.equals("pyroot.py")) return asPyROOT();
+            if (fmt.equals("yoda")) return asYODA();
+            if (fmt.equals("root")) return asROOT();
+            if (fmt.equals("mpl")) return asMatplotlib();
+            //if (fmt.equals("gnuplot")) return asPlain();
+        }
+
+        // Normal rendering
+        return null;
+    }
+
+
+    public Object formatContext(String fmt) {
+        Vector<String> ctx = new Vector<String>(getBaseContext());
+        ctx.add(fmt);
+        return ctx;
+    }
+    public Object getShortContext() {
+        return formatContext("short");
+    }
+    public Object getFullContext() {
+        return getBaseContext();
+    }
+
+
+    ///////////////////////////////////////////////
+    //
+    public Object getJhepworkContext() {
+        return formatContext("jhepwork.py");
+    }
+    public StreamResponse asJhepwork() {
+        Set<Dataset> ds = getDatasets();
+        String asJhepwork = JhepworkFormatter.format(ds, getQueryX(), getQueryY());
+        if (asJhepwork == null) {
+            asJhepwork = "No valid paper and dataset specified";
+        }
+        return new TextStreamResponse("text/plain", asJhepwork);
+    }
+
+    public Object getHepMLContext() {
+        return formatContext("hepml");
+    }
+    public StreamResponse asHepML() {
+        Paper p = getPaper();
+        String asHepML = HepMLFormatter.format(p);
+        if (asHepML == null) {
+            asHepML = "No valid paper specified";
+        }
+        return new TextStreamResponse("text/plain", asHepML);
+    }
+
+    public Object getBdmsContext() {
+        return formatContext("bdms");
+    }
+    public StreamResponse asBDMS() {
+        Paper p = getPaper();
+        String asBDMS = BdmsFormatter.format(p);
+        if (asBDMS == null) {
+            asBDMS = "No valid paper specified";
+        }
+        return new TextStreamResponse("text/plain", asBDMS);
+    }
+
+    public Object getInputContext() {
+        return formatContext("input");
+    }
+    public StreamResponse asINPUT() {
+        Paper p = getPaper();
+        String asINPUT = InputFormatter.format(p);
+        if (asINPUT == null) {
+            asINPUT = "No valid paper specified";
+        }
+        return new TextStreamResponse("text/plain", asINPUT);
+    }
+
+
+    public Object getPlainContext() {
+        return formatContext("plain.txt");
+    }
+    public StreamResponse asPlain() {
+        Set<Dataset> ds = getDatasets();
+        String asPlain = PlainFormatter.format(ds, getQueryX(), getQueryY());
+        if (asPlain == null) {
+            asPlain = "No valid paper and dataset specified";
+        }
+        return new TextStreamResponse("text/plain", asPlain);
+    }
+
+
+    public Object getYodaContext() {
+        return formatContext("yoda");
+    }
+    public StreamResponse asYODA() {
+        Set<Dataset> ds = getDatasets();
+        String asYODA = YodaFormatter.format(ds);
+        if (asYODA == null) {
+            asYODA = "No valid paper and dataset specified";
+        }
+        return new TextStreamResponse("text/plain", asYODA);
+    }
+
+
+    public Object getAidaContext() {
+        return formatContext("aida");
+    }
+    public StreamResponse asAIDA(String stype) {
+        Set<Dataset> ds = getDatasets();
+        String asAIDA = AidaFormatter.format(ds,stype);
+        if (asAIDA == null) {
+            asAIDA = "No valid paper and dataset specified";
+        }
+        return new TextStreamResponse("text/xml", asAIDA);
+    }
+
+
+    public Object getRootContext() {
+        return formatContext("root");
+    }
+    public StreamResponse asROOT() {
+        /// @todo This should really be called "asCINT"
+        Set<Dataset> ds = getDatasets();
+        String asRoot = RootFormatter.format(ds);
+        if (asRoot == null) {
+            asRoot = "No valid paper and dataset specified";
+        }
+        return new TextStreamResponse("text/plain", asRoot);
+    }
+
+
+    public Object getMatplotlibContext() {
+        return formatContext("mpl");
+    }
+    public StreamResponse asMatplotlib() {
+        /// @todo This should really be called "asCINT"
+        Set<Dataset> ds = getDatasets();
+        String asMpl = MatplotlibFormatter.format(ds);
+        if (asMpl == null) {
+            asMpl = "No valid paper and dataset specified";
+        }
+        return new TextStreamResponse("text/plain", asMpl);
+    }
+
+
+    public Object getPyRootContext() {
+        return formatContext("pyroot.py");
+    }
+    public StreamResponse asPyROOT() {
+        Set<Dataset> ds = getDatasets();
+        String asPyRoot = PyRootFormatter.format(ds);
+        if (asPyRoot == null) {
+            asPyRoot = "No valid paper and dataset specified";
+        }
+        return new TextStreamResponse("text/plain", asPyRoot);
+    }
+
+
+    //////////////////////////////////////////
+
+
+    public String getFormat() {
+        String fmt = getQueryParam("format");
+        if (fmt == null) fmt = "full";
+        return fmt;
+    }
+
+    public boolean getShortFormat() {
+        return getFormat().equals("short");
+    }
+
+    public boolean getLongFormat() {
+        return getFormat().equals("full");
+    }
+
+    public boolean getShowList() {
+        return getShortFormat();
+    }
+
+
+    public boolean getShowSys() {
+        return getLongFormat();
+    }
+
+    public boolean getHaveSys() {
+        String filename = "/home/whalley/systematics/files/" + getPaper().getSpiresId() + ".sys";
+        File testfile = new File(filename);
+        return testfile.exists();
+    }
+
+
+    public boolean getShowExtra() {
+        return getLongFormat();
+    }
+
+    public boolean getHaveExtraIRN() {
+        String filename = "/home/whalley/resource/" + getPaper().getSpiresId() + "/index.html";
+        File testfile = new File(filename);
+        return testfile.exists();
+    }
+    
+    public boolean getHaveExtraIRNDesc() {
+        File testfile = new File("/home/whalley/resource/" + getPaper().getSpiresId() + "/description");
+        return testfile.exists();
+    }
+    public boolean getHaveExtraIRNDesc1() {
+        File testfile = new File("/home/whalley/resource/" + getPaper().getSpiresId() + "/description1");
+        return testfile.exists();
+    }
+    public boolean getHaveExtraIRNDesc2() {
+        File testfile = new File("/home/whalley/resource/" + getPaper().getSpiresId() + "/description2");
+        return testfile.exists();
+    }
+    public boolean getHaveExtraIRNDesc3() {
+        File testfile = new File("/home/whalley/resource/" + getPaper().getSpiresId() + "/description3");
+        return testfile.exists();
+    }
+    public boolean getHaveExtraIRNDesc4() {
+        File testfile = new File("/home/whalley/resource/" + getPaper().getSpiresId() + "/description4");
+        return testfile.exists();
+    }
+    
+    public boolean getHaveExtraRED() {
+        String filename = "/home/whalley/resource/" + getPaper().getRedId() + "/index.shtml";
+        File testfile = new File(filename);
+        return testfile.exists();
+    }
+    public boolean getHaveExtraREDDesc() {
+        File testfile = new File("/home/whalley/resource/" + getPaper().getRedId() + "/description");
+        return testfile.exists();
+    }
+    public boolean getHaveExtraREDDesc1() {
+        File testfile = new File("/home/whalley/resource/" + getPaper().getRedId() + "/description1");
+        return testfile.exists();
+    }
+    public boolean getHaveExtraREDDesc2() {
+        File testfile = new File("/home/whalley/resource/" + getPaper().getRedId() + "/description2");
+        return testfile.exists();
+    }
+    public boolean getHaveExtraREDDesc3() {
+        File testfile = new File("/home/whalley/resource/" + getPaper().getRedId() + "/description3");
+        return testfile.exists();
+    }
+    public boolean getHaveExtraREDDesc4() {
+        File testfile = new File("/home/whalley/resource/" + getPaper().getRedId() + "/description4");
+        return testfile.exists();
+    }
+
+    public String getShowExtraIRNDesc() {
+        String filename = "/home/whalley/resource/" + getPaper().getSpiresId() + "/description";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraIRNDesc1() {
+        String filename = "/home/whalley/resource/" + getPaper().getSpiresId() + "/description1";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraIRNLink1() {
+        String filename = "/home/whalley/resource/" + getPaper().getSpiresId() + "/link1";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraIRNDesc2() {
+        String filename = "/home/whalley/resource/" + getPaper().getSpiresId() + "/description2";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraIRNLink2() {
+        String filename = "/home/whalley/resource/" + getPaper().getSpiresId() + "/link2";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+     public String getShowExtraIRNDesc3() {
+        String filename = "/home/whalley/resource/" + getPaper().getSpiresId() + "/description3";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraIRNLink3() {
+        String filename = "/home/whalley/resource/" + getPaper().getSpiresId() + "/link3";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+     public String getShowExtraIRNDesc4() {
+        String filename = "/home/whalley/resource/" + getPaper().getSpiresId() + "/description4";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraIRNLink4() {
+        String filename = "/home/whalley/resource/" + getPaper().getSpiresId() + "/link4";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+   public String getShowExtraREDDesc() {
+        String filename = "/home/whalley/resource/" + getPaper().getRedId() + "/description";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraREDDesc1() {
+        String filename = "/home/whalley/resource/" + getPaper().getRedId() + "/description1";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraREDLink1() {
+        String filename = "/home/whalley/resource/" + getPaper().getRedId() + "/link1";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraREDDesc2() {
+        String filename = "/home/whalley/resource/" + getPaper().getRedId() + "/description2";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraREDLink2() {
+        String filename = "/home/whalley/resource/" + getPaper().getRedId() + "/link2";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraREDDesc3() {
+        String filename = "/home/whalley/resource/" + getPaper().getRedId() + "/description3";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraREDLink3() {
+        String filename = "/home/whalley/resource/" + getPaper().getRedId() + "/link3";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraREDDesc4() {
+        String filename = "/home/whalley/resource/" + getPaper().getRedId() + "/description4";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+    public String getShowExtraREDLink4() {
+        String filename = "/home/whalley/resource/" + getPaper().getRedId() + "/link4";
+        File testfile = new File(filename);
+        String line = "";
+        if(testfile.exists()){
+            try {
+               BufferedReader in = new BufferedReader(new FileReader(filename));
+               line = in.readLine();
+               } catch (IOException e){}
+        }
+        return line;
+    }
+
+}

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewBase.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewBase.java	Thu Sep 27 13:21:01 2012	(r1574)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewBase.java	Tue Oct  2 11:49:55 2012	(r1575)
@@ -121,6 +121,13 @@
                 _params.put("ins", m.group(1));
                 continue;
             }
+            m = Pattern.compile("\\A" + "10.1016" + "\\Z").matcher(ps);
+            if (m.matches()) {
+                 String doi2=context.get(String.class, i+1);
+                 String doi3="10.1016/"+doi2;
+                _params.put("doi",doi3);
+                continue;
+            }
 
             m = Pattern.compile("\\A" + "red" + "(-?\\d+)\\Z").matcher(ps);
             if (m.matches()) {
@@ -252,6 +259,7 @@
         String irn = getQueryParam("irn");
         String ins = getQueryParam("ins");
         String red = getQueryParam("red");
+        String doi = getQueryParam("doi");
         if (p != null) {
             ctx.add("p" + p);
         } else if (irn != null) {
@@ -260,6 +268,10 @@
             ctx.add("ins" + ins);
         } else if (red != null) {
             ctx.add("red" + red);
+        } else if (doi != null) {
+            String[] ctx2 = doi.split("/");
+            ctx.add(ctx2[0]);
+            ctx.add(ctx2[1]);
         } else {
             return ctx;
         }
@@ -302,24 +314,42 @@
         String p = getQueryParam("p");
         String irn = getQueryParam("irn");
         String ins = getQueryParam("ins");
-       String red = getQueryParam("red");
+        String red = getQueryParam("red");
+        String doi = getQueryParam("doi");
         String paper = null;
         if      (p != null)    paper = "p" + p;
         else if (irn != null)  paper = "irn" + irn;
         else if (ins != null)  paper = "ins" + ins;
         else if (red != null)  paper = "red" + red;
+        else if (doi != null)  paper = "doi" + doi;
         return paper;
     }
     public List<String> getNextContext() {
         List<String> ctx = new Vector<String>();
-        if(getPaperNumber() != null) ctx.add(getPaperNumber());
+        if(getPaperNumber() != null) {
+            if(getPaperNumber().startsWith("doi")) {
+                String[] ctx2 = getPaperNumber().substring(3).split("/");
+                ctx.add(ctx2[0]);
+                ctx.add(ctx2[1]);
+            } else{ 
+                ctx.add(getPaperNumber());
+            }
+        } 
         ctx.add("next");
         if(getQueryParam("format").equals("short")) ctx.add("short");
         return ctx;
     }
     public List<String> getPrevContext() {
         List<String> ctx = new Vector<String>();
-        if(getPaperNumber() != null) ctx.add(getPaperNumber());
+        if(getPaperNumber() != null) {
+            if(getPaperNumber().startsWith("doi")) {
+                String[] ctx2 = getPaperNumber().substring(3).split("/");
+                ctx.add(ctx2[0]);
+                ctx.add(ctx2[1]);
+            } else{ 
+                ctx.add(getPaperNumber());
+            }
+        }
         ctx.add("prev");
         if(getQueryParam("format").equals("short")) ctx.add("short");
         return ctx;
@@ -327,7 +357,15 @@
 
     public List<String> getFirstContext() {
         List<String> ctx = new Vector<String>();
-        if(getPaperNumber() != null) ctx.add(getPaperNumber());
+        if(getPaperNumber() != null) {
+            if(getPaperNumber().startsWith("doi")) {
+                String[] ctx2 = getPaperNumber().substring(3).split("/");
+                ctx.add(ctx2[0]);
+                ctx.add(ctx2[1]);
+            } else{ 
+                ctx.add(getPaperNumber());
+            }
+        }
         ctx.add("first");
         if(getQueryParam("format").equals("short")) ctx.add("short");
         return ctx;
@@ -335,7 +373,15 @@
 
     public List<String> getLastContext() {
         List<String> ctx = new Vector<String>();
-        if(getPaperNumber() != null) ctx.add(getPaperNumber());
+        if(getPaperNumber() != null) {
+            if(getPaperNumber().startsWith("doi")) {
+                String[] ctx2 = getPaperNumber().substring(3).split("/");
+                ctx.add(ctx2[0]);
+                ctx.add(ctx2[1]);
+            } else{ 
+                ctx.add(getPaperNumber());
+            }
+        }
         ctx.add("last");
         if(getQueryParam("format").equals("short")) ctx.add("short");
         return ctx;
@@ -441,11 +487,17 @@
         } else if (getQueryParam("red") != null) {
             pid = getQueryParam("red");
             qs.append("p._redId = :pid");
+        } else if (getQueryParam("doi") != null) {
+            pid = getQueryParam("doi");
+            qs.append("p._doi like ");
+            qs.append("'");
+            qs.append(pid);
+            qs.append("'");
         } else {
             return q;
         }
         q = getSession().createQuery(qs.toString());
-        q.setString("pid", pid);
+        if(getQueryParam("doi")==null){ q.setString("pid", pid);}
         return q;
     }
     
@@ -467,6 +519,9 @@
             } else if (getQueryParam("red") != null) {
                 pid = getQueryParam("red");
                 qs.append(" p._redId = :pid");
+            } else if (getQueryParam("doi") != null) {
+                pid = getQueryParam("doi");
+                qs.append(" p._doi like :pid");
             }    
             Integer dsmin = getCounter();
             Integer dsmax = getCounter() + getLength() - 1;


More information about the HepData-svn mailing list