Revision 60646
Added by Michele Artini about 3 years ago
Project.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
private static final String PROJECT_REGEX = "info:eu-repo\\/grantAgreement\\/(.*)\\/(.*)\\/(.*)\\/(.*)\\/(.*)\\/(.*)"; |
44 | 44 |
|
45 |
public static Project newInstance(final URI url) { |
|
45 |
public static Project newInstance(final URI url, final String accessToken) {
|
|
46 | 46 |
|
47 | 47 |
try { |
48 | 48 |
final SAXReader reader = new SAXReader(); |
49 |
final String s = HttpFetcher.fetch(url); |
|
49 |
final String s = HttpFetcher.fetch(url, accessToken);
|
|
50 | 50 |
final Document doc = reader.read(new StringReader(s)); |
51 | 51 |
|
52 | 52 |
final String openaireId = doc.valueOf("//*[local-name()='objIdentifier']"); |
... | ... | |
84 | 84 |
final String acronym = StringUtils.defaultIfBlank(matcher.group(6), name); |
85 | 85 |
|
86 | 86 |
if (StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(program) |
87 |
&& StringUtils.isNotEmpty(funder)) { return new Project(openaireId, code, name, acronym, funder, program, jurisdiction); } |
|
87 |
&& StringUtils.isNotEmpty(funder)) { |
|
88 |
return new Project(openaireId, code, name, acronym, funder, program, jurisdiction); |
|
89 |
} |
|
88 | 90 |
} |
89 | 91 |
|
90 | 92 |
log.warn("Invalid project ID: " + infoId); |
Also available in: Unified diff
Openaire API with Access Token