1
|
package eu.dnetlib.oai.conf;
|
2
|
|
3
|
import java.util.*;
|
4
|
import java.util.stream.Collectors;
|
5
|
|
6
|
import com.google.common.base.Joiner;
|
7
|
import eu.dnetlib.oai.PublisherField;
|
8
|
import eu.dnetlib.oai.info.SetInfo;
|
9
|
import eu.dnetlib.rmi.provision.MDFInfo;
|
10
|
|
11
|
/**
|
12
|
* An instance of this class represents an OAI Configuration profile.
|
13
|
*
|
14
|
* @author alessia
|
15
|
*/
|
16
|
public class OAIConfiguration {
|
17
|
|
18
|
/**
|
19
|
* Map for OAI sets. Keys: setSpec, values: SetInfo instances.
|
20
|
*/
|
21
|
private Map<String, SetInfo> setsMap;
|
22
|
|
23
|
/**
|
24
|
* Map for metadata formats. Keys: metadata prefix, values: MDFInfo instances.
|
25
|
*/
|
26
|
private Map<String, MDFInfo> mdFormatsMap;
|
27
|
|
28
|
private List<PublisherField> fields;
|
29
|
|
30
|
private List<String> fieldNames;
|
31
|
|
32
|
/**
|
33
|
* Used to generate the OAI identifiers compliant to the protocol. See
|
34
|
* http://www.openarchives.org/OAI/openarchivesprotocol.html#UniqueIdentifier. See property services.oai.publisher.id.scheme.
|
35
|
*/
|
36
|
private String idScheme;
|
37
|
/**
|
38
|
* Used to generate the OAI identifiers compliant to the protocol. See
|
39
|
* http://www.openarchives.org/OAI/openarchivesprotocol.html#UniqueIdentifier. See property services.oai.publisher.id.namespace.
|
40
|
*/
|
41
|
private String idNamespace;
|
42
|
|
43
|
private Set<MDFInfo> sourcesMDF = new HashSet<>();
|
44
|
|
45
|
public Collection<PublisherField> getFieldsFor(final String format, final String layout, final String interpretation) {
|
46
|
final String mdRef = Joiner.on("-").join(format, layout, interpretation);
|
47
|
|
48
|
return this.getFields().stream().filter(theField -> {
|
49
|
if (theField.getSources() == null) return false;
|
50
|
return theField.getSources().containsKey(mdRef);
|
51
|
}).collect(Collectors.toList());
|
52
|
}
|
53
|
|
54
|
public Map<String, SetInfo> getSetsMap() {
|
55
|
return setsMap;
|
56
|
}
|
57
|
|
58
|
public void setSetsMap(final Map<String, SetInfo> setsMap) {
|
59
|
this.setsMap = setsMap;
|
60
|
}
|
61
|
|
62
|
public Map<String, MDFInfo> getMdFormatsMap() {
|
63
|
return mdFormatsMap;
|
64
|
}
|
65
|
|
66
|
public void setMdFormatsMap(final Map<String, MDFInfo> mdFormatsMap) {
|
67
|
this.mdFormatsMap = mdFormatsMap;
|
68
|
}
|
69
|
|
70
|
public List<PublisherField> getFields() {
|
71
|
return fields;
|
72
|
}
|
73
|
|
74
|
public void setFields(final List<PublisherField> fields) {
|
75
|
this.fields = fields;
|
76
|
}
|
77
|
|
78
|
public List<String> getFieldNames() {
|
79
|
return fieldNames;
|
80
|
}
|
81
|
|
82
|
public void setFieldNames(final List<String> fieldNames) {
|
83
|
this.fieldNames = fieldNames;
|
84
|
}
|
85
|
|
86
|
public Set<MDFInfo> getSourcesMDF() {
|
87
|
return sourcesMDF;
|
88
|
}
|
89
|
|
90
|
public void setSourcesMDF(final Set<MDFInfo> sourcesMDF) {
|
91
|
this.sourcesMDF = sourcesMDF;
|
92
|
}
|
93
|
|
94
|
public String getIdScheme() {
|
95
|
return idScheme;
|
96
|
}
|
97
|
|
98
|
public void setIdScheme(final String idScheme) {
|
99
|
this.idScheme = idScheme;
|
100
|
}
|
101
|
|
102
|
public String getIdNamespace() {
|
103
|
return idNamespace;
|
104
|
}
|
105
|
|
106
|
public void setIdNamespace(final String idNamespace) {
|
107
|
this.idNamespace = idNamespace;
|
108
|
}
|
109
|
|
110
|
}
|