|
[HepData-svn] r1780 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pagesblackhole at projects.hepforge.org blackhole at projects.hepforge.orgTue Apr 15 13:07:03 BST 2014
Author: whalley Date: Tue Apr 15 13:07:03 2014 New Revision: 1780 Log: allowing up to 4 multiple papers Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewBase.java 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 Tue Apr 15 12:56:24 2014 (r1779) +++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/pages/ViewBase.java Tue Apr 15 13:07:03 2014 (r1780) @@ -246,6 +246,13 @@ } return ctx; } + public List<String> getHDPaper4Context() { + List<String> ctx = new Vector<String>(); + if (getPaper4() != null) { + ctx.add("p" + getPaper4().getId()); + } + return ctx; + } public List<String> getSpiresContext() { List<String> ctx = new Vector<String>(); if (getPaper() != null) { @@ -424,6 +431,24 @@ /////////////////////////////////////////////// +// public boolean getIsLatestVersion(){ +// Boolean result = false; +// if(getPaper().getInspireId() != null) { +// Query q = getSession().createQuery("select distinct p from Paper p where p._inspireId="+getPaper().getInspireId()); +// Short maxversion=0; +// for (Object obj : q.list()){ +// Paper px = (Paper) obj; +// if(px.getVersion()>maxversion) { maxversion=px.getVersion(); } +// } +// if(maxversion==getPaper().getVersion()) { result=true; } +// } +// else{ +// result = false; +// } +// +// return result; +// } + public boolean getHaveMultiple(){ Long ins = getPaper().getInspireId(); if(ins != null) { @@ -454,6 +479,16 @@ return ( constructQuery().list().size() == 3); } } + public boolean getHaveMultiple4(){ + Long ins = getPaper().getInspireId(); + if(ins != null) { + Query q = getSession().createQuery("select distinct p from Paper p where p._inspireId="+ins); + return (q.list().size() == 4); + } + else { + return ( constructQuery().list().size() == 4); + } + } public Paper getPaper() { Paper p = (Paper) constructQuery().setMaxResults(1).uniqueResult(); @@ -503,6 +538,18 @@ } return p; } + public Paper getPaper4() { + Long ins = getPaper().getInspireId(); + Paper p = null; + if(ins != null) { + Query q = getSession().createQuery("select distinct p from Paper p where p._inspireId="+ins+ " order by p._hepdataId"); + p = (Paper) q.list().get(3); + } + else { + p = (Paper) constructQuery().list().get(3); + } + return p; + } private Query constructQuery() { Query q = null;
More information about the HepData-svn mailing list |