8
8
import org .jabref .logic .importer .fetcher .IacrEprintFetcher ;
9
9
import org .jabref .logic .importer .fetcher .IsbnFetcher ;
10
10
import org .jabref .model .entry .BibEntry ;
11
+ import org .jabref .model .entry .identifier .ArXivIdentifier ;
12
+ import org .jabref .model .entry .identifier .DOI ;
13
+ import org .jabref .model .entry .identifier .Eprint ;
14
+ import org .jabref .model .entry .identifier .ISBN ;
11
15
12
16
import org .slf4j .Logger ;
13
17
import org .slf4j .LoggerFactory ;
14
18
15
- public class CompositeIdFetcher implements IdBasedFetcher {
19
+ public class CompositeIdFetcher {
16
20
17
21
private static final Logger LOGGER = LoggerFactory .getLogger (CompositeIdFetcher .class );
18
22
@@ -22,51 +26,42 @@ public CompositeIdFetcher(ImportFormatPreferences importFormatPreferences) {
22
26
this .importFormatPreferences = importFormatPreferences ;
23
27
}
24
28
25
- @ Override
26
29
public Optional <BibEntry > performSearchById (String identifier ) {
27
-
28
- Optional <BibEntry > fetchedEntry ;
29
-
30
30
try {
31
- fetchedEntry = new ArXiv (importFormatPreferences ).performSearchById (identifier );
32
- if (fetchedEntry .isPresent ()) {
33
- return fetchedEntry ;
31
+ if (ArXivIdentifier .parse (identifier ).isPresent ()) {
32
+ return new ArXiv (importFormatPreferences ).performSearchById (identifier );
34
33
}
35
34
} catch (FetcherException fetcherException ) {
36
35
LOGGER .debug (fetcherException .getMessage ());
37
36
}
38
37
39
38
try {
40
- fetchedEntry = new IsbnFetcher (importFormatPreferences ).performSearchById (identifier );
41
- if (fetchedEntry .isPresent ()) {
42
- return fetchedEntry ;
39
+ if (ISBN .parse (identifier ).isPresent ()) {
40
+ return new IsbnFetcher (importFormatPreferences ).performSearchById (identifier );
43
41
}
44
42
} catch (FetcherException fetcherException ) {
45
43
LOGGER .debug (fetcherException .getMessage ());
46
44
}
47
45
48
46
try {
49
- fetchedEntry = new DoiFetcher (importFormatPreferences ).performSearchById (identifier );
50
- if (fetchedEntry .isPresent ()) {
51
- return fetchedEntry ;
47
+ if (DOI .parse (identifier ).isPresent ()) {
48
+ return new DoiFetcher (importFormatPreferences ).performSearchById (identifier );
52
49
}
53
50
} catch (FetcherException fetcherException ) {
54
51
LOGGER .debug (fetcherException .getMessage ());
55
52
}
56
53
57
54
try {
58
- fetchedEntry = new IacrEprintFetcher (importFormatPreferences ).performSearchById (identifier );
59
- if (fetchedEntry .isPresent ()) {
60
- return fetchedEntry ;
55
+ if (DOI .parse (identifier ).isPresent ()) {
56
+ return new CrossRef ().performSearchById (identifier );
61
57
}
62
58
} catch (FetcherException fetcherException ) {
63
59
LOGGER .debug (fetcherException .getMessage ());
64
60
}
65
61
66
62
try {
67
- fetchedEntry = new CrossRef ().performSearchById (identifier );
68
- if (fetchedEntry .isPresent ()) {
69
- return fetchedEntry ;
63
+ if (Eprint .build (identifier ).isPresent ()) {
64
+ return new IacrEprintFetcher (importFormatPreferences ).performSearchById (identifier );
70
65
}
71
66
} catch (FetcherException fetcherException ) {
72
67
LOGGER .debug (fetcherException .getMessage ());
@@ -76,8 +71,4 @@ public Optional<BibEntry> performSearchById(String identifier) {
76
71
77
72
}
78
73
79
- @ Override
80
- public String getName () {
81
- return "CompositeIdFetcher" ;
82
- }
83
74
}
0 commit comments