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