Revision 56334
Added by Miriam Baglioni almost 5 years ago
modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/openaire/directindex/api/OpenaireResultSubmitter.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
private static final Log log = LogFactory.getLog(OpenaireResultSubmitter.class); |
31 | 31 |
|
32 |
@Value(value = "${openaire.api.community}") |
|
33 |
private String community_api; |
|
34 |
|
|
32 | 35 |
@Value(value = "oaf.schema.location") |
33 | 36 |
private String oafSchemaLocation; |
34 | 37 |
|
... | ... | |
134 | 137 |
private String feed(final ResultEntry pub) throws DirecIndexApiException { |
135 | 138 |
try { |
136 | 139 |
|
137 |
final String oafRecord = pub.asOafRecord(velocityEngine, serviceLocator.getService(ISLookUpService.class), oafSchemaLocation); |
|
140 |
final String oafRecord = pub.asOafRecord(velocityEngine, serviceLocator.getService(ISLookUpService.class), oafSchemaLocation, community_api);
|
|
138 | 141 |
|
139 | 142 |
for(Map.Entry<IndexDsInfo, CloudIndexClient> e : clientMap.getClients().entrySet()) { |
140 | 143 |
final IndexDsInfo idx = e.getKey(); |
modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/openaire/directindex/api/OpenAIRESubmitterUtils.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(OpenAIRESubmitterUtils.class); |
21 | 21 |
private static final String ZENODO_COMMUNITY = "zenodo.org/communities/"; |
22 |
private String community_api; |
|
23 |
public OpenAIRESubmitterUtils(String community_api){ |
|
24 |
this.community_api = community_api; |
|
25 |
} |
|
26 |
|
|
22 | 27 |
public Map<String, String> calculateProjectInfo(final String link) { |
23 | 28 |
final Map<String, String> info = new HashMap<String, String>(); |
24 | 29 |
final String[] arr = link.split("/"); |
... | ... | |
151 | 156 |
return null; |
152 | 157 |
}).collect(Collectors.toList()); |
153 | 158 |
|
154 |
// for(String c:contexts){ |
|
155 |
// if(c.contains(ZENODO_COMMUNITY)){ |
|
156 |
// zenodoContexts.add(c.substring(c.lastIndexOf("/")+1)); |
|
157 |
// } |
|
158 |
// } |
|
159 | 159 |
if (zenodoContexts.size()>0){ |
160 |
contexts = contexts.stream().filter(c -> !c.contains("https://zenodo.org/communities/")).collect(Collectors.toList());
|
|
160 |
contexts = contexts.stream().filter(c -> !c.contains(ZENODO_COMMUNITY)).collect(Collectors.toList());
|
|
161 | 161 |
RestTemplate rt = new RestTemplate(); |
162 | 162 |
Set<String> zenodoOpenAIRE = new HashSet<>(); |
163 | 163 |
for (String context: zenodoContexts){ |
164 | 164 |
//String ct = context.substring(context.lastIndexOf("/")+1); |
165 |
zenodoOpenAIRE.addAll(rt.getForObject("http://beta.services.openaire.eu/openaire/community/"+context+"/openairecommunities", ZenodoContextList.class).getOpenAirecommunitylist());
|
|
165 |
zenodoOpenAIRE.addAll(rt.getForObject(community_api +context+"/openairecommunities", ZenodoContextList.class).getOpenAirecommunitylist());
|
|
166 | 166 |
|
167 | 167 |
} |
168 | 168 |
contexts.addAll(zenodoOpenAIRE); |
modules/dnet-directindex-api/trunk/src/main/java/eu/dnetlib/openaire/directindex/objects/ResultEntry.java | ||
---|---|---|
233 | 233 |
|
234 | 234 |
public String asOafRecord(final VelocityEngine ve, |
235 | 235 |
final ISLookUpService lookupService, |
236 |
final String oafSchemaLocation) throws Exception { |
|
236 |
final String oafSchemaLocation, |
|
237 |
final String community_api) throws Exception { |
|
237 | 238 |
|
238 | 239 |
if (StringUtils.isBlank(getOriginalId()) |
239 | 240 |
&& StringUtils |
... | ... | |
258 | 259 |
|
259 | 260 |
final Map<String, Object> model = new HashMap<>(); |
260 | 261 |
model.put("esc", new EscapeXml()); |
261 |
model.put("util", new OpenAIRESubmitterUtils()); |
|
262 |
model.put("util", new OpenAIRESubmitterUtils(community_api));
|
|
262 | 263 |
model.put("pub", this); |
263 | 264 |
model.put("objIdentifier", getOpenaireId()); |
264 | 265 |
model.put("oafSchemaLocation", oafSchemaLocation); |
modules/dnet-directindex-api/trunk/src/main/resources/eu/dnetlib/openaire/directindex/applicationContext-api.properties | ||
---|---|---|
6 | 6 |
openaire.api.directindex.findSolrIndexUrl.xquery=/eu/dnetlib/openaire/directindex/findSolrIndexUrl.xquery |
7 | 7 |
openaire.api.directindex.findIndexDsInfo.xquery=/eu/dnetlib/openaire/directindex/findIndexDsInfo.xquery |
8 | 8 |
openaire.api.directindex.autocommit.active=true |
9 |
openaire.api.directindex.autocommit.frequency=60 |
|
9 |
openaire.api.directindex.autocommit.frequency=6 |
|
10 |
openaire.api.community=http://${container.hostname}/openaire/community/ |
Also available in: Unified diff
added property for community api address