Revision 55031
Added by Miriam Baglioni about 5 years ago
modules/dnet-openaire-exporter/trunk/src/main/java/eu/dnetlib/openaire/community/CommunityMappingUtils.java | ||
---|---|---|
113 | 113 |
} |
114 | 114 |
|
115 | 115 |
|
116 |
|
|
116 | 117 |
private static List<String> splitValues(final Stream<String> stream, final String separator) { |
117 | 118 |
return stream.map(s -> s.split(separator)) |
118 | 119 |
.map(Arrays::asList) |
... | ... | |
144 | 145 |
final StringBuilder sb = new StringBuilder(); |
145 | 146 |
sb.append( |
146 | 147 |
String.format( |
147 |
"<concept claim='true' id='%s%s%s%s' label='%s'>\n",
|
|
148 |
"<concept claim='false' id='%s%s%s%s' label='%s'>\n",
|
|
148 | 149 |
escape(esc, contextId), PROJECTS_ID_SUFFIX, ID_SEPARATOR, escape(esc, String.valueOf(project.getId())), escape(esc, project.getAcronym()))); |
149 | 150 |
sb.append(paramXML(CPROJECT_FULLNAME, project.getName())); |
150 | 151 |
sb.append(paramXML(CPROJECT_ACRONYM, project.getAcronym())); |
... | ... | |
175 | 176 |
final StringBuilder sb = new StringBuilder(); |
176 | 177 |
sb.append( |
177 | 178 |
String.format( |
178 |
"<concept claim='true' id='%s%s%s%s' label='%s'>\n",
|
|
179 |
"<concept claim='false' id='%s%s%s%s' label='%s'>\n",
|
|
179 | 180 |
escape(esc, contextId), ZENODOCOMMUNITY_ID_SUFFIX, ID_SEPARATOR, escape(esc, String.valueOf(zc.getId())), escape(esc, zc.getZenodoid()))); |
180 | 181 |
|
181 | 182 |
sb.append(paramXML(CZENODOCOMMUNITY_ID, zc.getZenodoid())); |
... | ... | |
183 | 184 |
return sb.toString(); |
184 | 185 |
} |
185 | 186 |
|
187 |
|
|
188 |
|
|
186 | 189 |
private static String paramXML(final String paramName, final String value) { |
187 | 190 |
return String.format("<param name='%s'>%s</param>\n", paramName, escape(XmlEscapers.xmlContentEscaper(), value)); |
188 | 191 |
} |
modules/dnet-openaire-exporter/trunk/src/main/java/eu/dnetlib/openaire/community/CommunityApiController.java | ||
---|---|---|
247 | 247 |
@ApiResponse(code = 200, message = "OK"), |
248 | 248 |
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), |
249 | 249 |
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) |
250 |
public List<String> getOpenAireCommunities(
|
|
250 |
public CommunityOpenAIRECommunities getOpenAireCommunities(
|
|
251 | 251 |
@PathVariable final String zenodoId) throws IOException { |
252 | 252 |
|
253 | 253 |
return communityApiCore.getOpenAIRECommunities(zenodoId); |
modules/dnet-openaire-exporter/trunk/src/main/java/eu/dnetlib/openaire/community/CommunityApiCore.java | ||
---|---|---|
221 | 221 |
return zc; |
222 | 222 |
} |
223 | 223 |
|
224 |
public List<String> getOpenAIRECommunities(String zenodoId) throws IOException {
|
|
224 |
public CommunityOpenAIRECommunities getOpenAIRECommunities(String zenodoId) throws IOException {
|
|
225 | 225 |
|
226 | 226 |
if(cci.getInverseZenodoCommunityMap().containsKey(zenodoId)) |
227 |
return cci.getInverseZenodoCommunityMap().get(zenodoId).stream().collect(Collectors.toList());
|
|
228 |
return new ArrayList<>();
|
|
227 |
return new CommunityOpenAIRECommunities().setZenodoid(zenodoId).setOpenAirecommunitylist(cci.getInverseZenodoCommunityMap().get(zenodoId).stream().collect(Collectors.toList()));
|
|
228 |
return new CommunityOpenAIRECommunities();
|
|
229 | 229 |
|
230 | 230 |
} |
231 | 231 |
|
Also available in: Unified diff
update for the mapping to the CommunityIpenAIRECommunities class