[HepData-svn] r1474 - trunk/hepdata-model/src/main/java/cedar/hepdata/model

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Thu Oct 13 22:17:20 BST 2011


Author: whalley
Date: Thu Oct 13 22:17:19 2011
New Revision: 1474

Log:
adding code for inspire ids

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	Wed Oct 12 16:02:04 2011	(r1473)
+++ trunk/hepdata-model/src/main/java/cedar/hepdata/model/Paper.java	Thu Oct 13 22:17:19 2011	(r1474)
@@ -29,6 +29,11 @@
     /** SPIRES publication identifier. */
     private Long _spiresId = null;
 
+    @Column(name="InspireId", unique=false, nullable=true)
+    /** INSPIRE publication identifier. */
+    private Long _inspireId = null;
+
+
 
     @Column(name="RedId", unique=false, nullable=true)
     /** Durham reaction database legacy identifier. */
@@ -161,7 +166,6 @@
 
 
     public String getFirstPublished() {
-//        String firstpublished = "Not published";
         String firstpublished = null;
         /// @todo Reinstate pubtype enum
         for (Reference ref : getReferences()) {
@@ -172,8 +176,20 @@
         }
         return firstpublished;
     }
+
+    public String getSecondPublished() {
+        String secondpublished = null;
+        int n=0;
+        /// @todo Reinstate pubtype enum
+        for (Reference ref : getReferences()) {
+            if (ref.getType().equals("JOUR")) {
+                n+=1;
+                if(n==2) {secondpublished = ref.getDescription(); break;}
+            }
+        }
+        return secondpublished;
+    }
     public String getFirstErratum() {
-//        String firsterratum = "Not published";
         String firsterratum = null;
         for (Reference ref : getReferences()) {
             if (ref.getType().startsWith("ERR")) {
@@ -183,22 +199,43 @@
         }
         return firsterratum;
     }
+    public String getSecondErratum() {
+        String seconderratum = null;
+        int n=0;
+        for (Reference ref : getReferences()) {
+            if (ref.getType().startsWith("ERR")) {
+                n+=1;
+                if(n==2){seconderratum = ref.getDescription(); break;}
+            }
+        }
+        return seconderratum;
+    }
 
     public String getFirstPreprint() {
-//        String firstpreprint = "Not known";
         String firstpreprint = null;
         /// @todo Reinstate pubtype enum
         for (Reference ref : getReferences()) {
-            if (!ref.getType().equals("JOUR") && !ref.getDescription().startsWith("ARXIV")) {
+            if (ref.getType().equals("PREP") && !ref.getDescription().startsWith("ARXIV")) {
                 firstpreprint = ref.getDescription();
                 break;
             }
         }
         return firstpreprint;
     }
+    public String getSecondPreprint() {
+        String secondpreprint = null;
+        /// @todo Reinstate pubtype enum
+        int n=0;
+        for (Reference ref : getReferences()) {
+            if (ref.getType().equals("PREP") && !ref.getDescription().startsWith("ARXIV")) {
+                n+=1;
+                if(n==2){secondpreprint = ref.getDescription(); break;}           
+            }
+        }
+        return secondpreprint;
+    }
 
     public String getArchive() {
-//        String archive = "Not known";
         String archive = null;
         /// @todo Reinstate pubtype enum
         for (Reference ref : getReferences()) {
@@ -209,6 +246,18 @@
         }
         return archive;
     }
+    public String getSecondArchive() {
+        String archive = null;
+        /// @todo Reinstate pubtype enum
+        int n=0;
+        for (Reference ref : getReferences()) {
+            if (ref.getDescription().startsWith("ARXIV")) {
+                n+=1;
+                if(n==2){ archive = ref.getDescription(); break;}
+            }
+        }
+        return archive;
+    }
 
     public String getReferenceString(int n){
         StringBuffer s = new StringBuffer();
@@ -368,6 +417,21 @@
         return this;
     }
 
+    /** Get method for INSPIRE ID */
+    public Long getInspireId() {
+        return _inspireId;
+    }
+    /** Set method for INSPIRE ID */
+    public Paper setInspireId(Long inspireId) {
+        _inspireId = inspireId;
+        return this;
+    }
+    /** Compatibility set method for INSPIRE ID */
+    public Paper setInspireId(Integer inspireId) {
+        _inspireId = new Long(inspireId);
+        return this;
+    }
+
 
     /** Get method for reaction database ID */
     public Long getRedId() {
@@ -659,6 +723,7 @@
     public int hashCode() {
         int code = 37;
         if (getSpiresId() != null) code ^= getSpiresId().hashCode();
+        if (getInspireId() != null) code ^= getInspireId().hashCode();
 
         if (getRedId() != null)    code ^= getRedId().hashCode();
         if (getTitle() != null)    code ^= getTitle().hashCode();


More information about the HepData-svn mailing list