Project

General

Profile

« Previous | Next » 

Revision 56334

added property for community api address

View differences:

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);

Also available in: Unified diff