|
[HepData-svn] r1587 - trunk/hepdata-model/src/main/java/cedar/hepdata/modelblackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Oct 22 16:20:06 BST 2012
Author: whalley Date: Mon Oct 22 16:20:06 2012 New Revision: 1587 Log: make SortName use publication date Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java Modified: trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java ============================================================================== --- trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java Mon Oct 22 16:15:58 2012 (r1586) +++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java Mon Oct 22 16:20:06 2012 (r1587) @@ -45,7 +45,7 @@ /** Title of the paper. */ private String _title = ""; - @Column(name="DOI", unique=false, nullable=true) + @Column(name="DOI", unique=false, nullable=true, length=80) /** DOI of the paper/journal. */ private String _doi = ""; @@ -135,7 +135,10 @@ public String getShortName() { String firstauthor = getAuthors().first(); - Reference ref = getReferences().first(); + Reference ref = getFirstPublishedReference(); + if(ref == null){ + ref = getReferences().first(); + } if (firstauthor != null && ref != null) { String rtn = firstauthor + " " + ref.getDate(); return rtn; @@ -180,6 +183,17 @@ } return firstpublished; } + public Reference getFirstPublishedReference() { + Reference firstpubref = null; + /// @todo Reinstate pubtype enum + for (Reference ref : getReferences()) { + if (ref.getType().equals("JOUR")) { + firstpubref = ref; + break; + } + } + return firstpubref; + } public String getSecondPublished() { String secondpublished = null;
More information about the HepData-svn mailing list |