42a3f54fe6fdee199ff0d22628a55d586e40fbbb
[debian/jabref.git] / src / java / net / sf / jabref / export / layout / format / DOICheck.java
1 package net.sf.jabref.export.layout.format;
2
3 import net.sf.jabref.export.layout.LayoutFormatter;
4
5 /**
6  * Used to fix [ 1588028 ] export HTML table doi url.
7  * 
8  * Will prepend "http://dx.doi.org/" if only doi number and not a URL is given.
9  * 
10  * @author $Author: coezbek $
11  * @version $Revision: 1807 $ ($Date: 2006-11-12 03:42:42 +0100 (Sun, 12 Nov 2006) $)
12  *
13  */
14 public class DOICheck implements LayoutFormatter {
15
16         public String format(String fieldText) {
17                 
18                 if (fieldText == null){
19                         return null;
20                 }
21                 
22                 fieldText = fieldText.trim();
23                 
24                 if (fieldText.length() == 0){
25                         return fieldText;
26                 }
27                 
28                 if (fieldText.startsWith("10")){
29                         return "http://dx.doi.org/" + fieldText;
30                 }
31                 
32                 return fieldText;
33         }
34 }