001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021package org.biojava.nbio.structure;
022
023import java.io.Serializable;
024import java.util.ArrayList;
025import java.util.List;
026
027/**
028 * PDB-specific
029 * @author Jules Jacobsen
030 * @since 1.7
031 */
032public class JournalArticle implements Serializable {
033
034        private static final long serialVersionUID = 5062668226159515468L;
035        private List<Author> authorList = new ArrayList<Author>();
036        private List<Author> editorList = new ArrayList<Author>();
037        private String title = "";
038        private String ref = "";
039        private String journalName = "";
040        private String volume;
041        private String startPage;
042        private int publicationDate;
043        private String publisher = "";
044        private String refn = "";
045        private String pmid = "";
046        private String doi = "";
047        private boolean published = false;
048
049        /**
050         * Get the list of Authors of the JournalArticle
051         *
052         * @return the List of authors
053         */
054        public List<Author> getAuthorList() {
055                return authorList;
056        }
057
058        public void setAuthorList(List<Author> authorList) {
059                this.authorList = authorList;
060        }
061
062        /**
063         * Get the list of editors of the JournalArticle
064         *
065         * @return the List of editors
066         */
067        public List<Author> getEditorList() {
068                return editorList;
069        }
070
071        public void setEditorList(List<Author> editorList) {
072                this.editorList = editorList;
073        }
074
075        /**
076         * Get the value of DOI field.
077         * For example: 10.1016/S0969-2126(02)00720-7
078         *
079         * @return the value of doi
080         */
081        public String getDoi() {
082                return doi;
083        }
084
085        /**
086         * Set the value of doi
087         *
088         * @param doi new value of doi
089         */
090        public void setDoi(String doi) {
091                this.doi = doi;
092        }
093
094        /**
095         * Sets the publication state of a JournalArticle - TO BE PUBLISHED == false
096         * @param state
097         */
098        public void setIsPublished(Boolean state) {
099                this.published = state;
100        }
101        /**
102         * Get the value of PMID field.
103         * For example: 12005435
104         *
105         * @return the value of pmid
106         */
107        public String getPmid() {
108                return pmid;
109        }
110
111        /**
112         * Set the value of pmid
113         *
114         * @param pmid new value of pmid
115         */
116        public void setPmid(String pmid) {
117                this.pmid = pmid;
118        }
119
120        /**
121         * Get the value of REF field.
122         * For example: TO BE PUBLISHED
123         *
124         * @return the value of ref
125         */
126        public String getRef() {
127                return ref;
128        }
129
130        /**
131         * Set the value of the ref.
132         *
133         * @param ref new value of ref
134         */
135        public void setRef(String ref) {
136                this.ref = ref;
137        }
138
139        /**
140         * Get the value of REFN field.
141         * For example: ISSN 0969-2126
142         *
143         * @return the value of ref
144         */
145        public String getRefn() {
146                return refn;
147        }
148
149        /**
150         * Set the value of the refn
151         *
152         * @param refn new value of refn
153         */
154        public void setRefn(String refn) {
155                this.refn = refn;
156        }
157
158        /**
159         * Get the value of title
160         *
161         * @return the value of title
162         */
163        public String getTitle() {
164                return title;
165        }
166
167        /**
168         * Set the value of title
169         *
170         * @param title new value of title
171         */
172        public void setTitle(String title) {
173                this.title = title;
174        }
175
176        public String getJournalName() {
177                return journalName;
178        }
179
180        public void setJournalName(String journalName) {
181                this.journalName = journalName;
182        }
183
184        public int getPublicationDate() {
185                return publicationDate;
186        }
187
188        public void setPublicationDate(int publicationDate) {
189                this.publicationDate = publicationDate;
190        }
191
192        public boolean isPublished() {
193                return published;
194        }
195
196        public void setPublished(boolean published) {
197                this.published = published;
198        }
199
200        public String getPublisher() {
201                return publisher;
202        }
203
204        public void setPublisher(String publisher) {
205                this.publisher = publisher;
206        }
207
208        public String getStartPage() {
209                return startPage;
210        }
211
212        public void setStartPage(String startPage) {
213                this.startPage = startPage;
214        }
215
216        public String getVolume() {
217                return volume;
218        }
219
220        public void setVolume(String volume) {
221                this.volume = volume;
222        }
223
224        @Override
225        public String toString() {
226//        JRNL        AUTH   M.HAMMEL,G.SFYROERA,D.RICKLIN,P.MAGOTTI,
227//        JRNL        AUTH 2 J.D.LAMBRIS,B.V.GEISBRECHT
228//        JRNL        TITL   A STRUCTURAL BASIS FOR COMPLEMENT INHIBITION BY
229//        JRNL        TITL 2 STAPHYLOCOCCUS AUREUS.
230//        JRNL        REF    NAT.IMMUNOL.                  V.   8   430 2007
231//        JRNL        REFN                   ISSN 1529-2908
232//        JRNL        PMID   17351618
233//        JRNL        DOI    10.1038/NI1450
234                String eol = System.getProperty("line.separator");
235
236                StringBuilder jrnlString = new StringBuilder();
237
238                StringBuilder authString = new StringBuilder("JRNL        AUTH   ");
239                StringBuilder titlString = new StringBuilder("JRNL        TITL   ");
240                StringBuilder editString = new StringBuilder("JRNL        EDIT   ");
241                StringBuilder refString = new StringBuilder("JRNL        REF    ");
242                StringBuilder publString = new StringBuilder("JRNL        PUBL   ");
243                StringBuilder refnString = new StringBuilder("JRNL        REFN                   ");
244                StringBuilder pmidString = new StringBuilder("JRNL        PMID   ");
245                StringBuilder doiString = new StringBuilder("JRNL        DOI    ");
246
247                for (Author author : authorList) {
248                        authString.append(author).append(",");
249                }
250                jrnlString.append(authString).append(eol);
251                titlString.append(title);
252                jrnlString.append(titlString).append(eol);
253                if (!editorList.isEmpty()) {
254                        for (Author editor : editorList) {
255                                editString.append(editor).append(",");
256                        }
257                        jrnlString.append(editString).append(eol);
258                }
259                refString.append(ref);
260                jrnlString.append(refString).append(eol);
261                if (!publisher.equals("")) {
262                        publString.append(publisher);
263                        jrnlString.append(publString).append(eol);
264                }
265                if (!refn.equals("")) {
266                        refnString.append(refn);
267                        jrnlString.append(refnString).append(eol);
268                }
269                if (!pmid.equals("")) {
270                        pmidString.append(pmid);
271                        jrnlString.append(pmidString).append(eol);
272                }
273                if (!doi.equals("")) {
274                        doiString.append(doi);
275                        jrnlString.append(doiString).append(eol);
276                }
277
278                return jrnlString.toString();
279        }
280}