Commit 04ca33b45903563b3a8bb9ad087de0399f7decec

Authored by Paulo Graça
1 parent bc6a818466
Exists in master

add method readFundingSummary

src/main/java/org/um/dsi/gavea/orcid/client/OrcidOAuthClient.java
@@ -49,23 +49,23 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -49,23 +49,23 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
49 private static final long serialVersionUID = -6655680509383446710L; 49 private static final long serialVersionUID = -6655680509383446710L;
50 50
51 private static final Logger _log = LoggerFactory.getLogger(OrcidOAuthClient.class); 51 private static final Logger _log = LoggerFactory.getLogger(OrcidOAuthClient.class);
52 - 52 +
53 public OrcidOAuthClient(String loginUri, String apiUri, String clientId, String clientSecret, String redirectUri) { 53 public OrcidOAuthClient(String loginUri, String apiUri, String clientId, String clientSecret, String redirectUri) {
54 this(null, loginUri, apiUri, clientId, clientSecret, redirectUri); 54 this(null, loginUri, apiUri, clientId, clientSecret, redirectUri);
55 } 55 }
56 - 56 +
57 public OrcidOAuthClient(String loginUri, String apiUri, String clientId, String clientSecret, String redirectUri, boolean debugMode) { 57 public OrcidOAuthClient(String loginUri, String apiUri, String clientId, String clientSecret, String redirectUri, boolean debugMode) {
58 this(null, loginUri, apiUri, clientId, clientSecret, redirectUri, debugMode); 58 this(null, loginUri, apiUri, clientId, clientSecret, redirectUri, debugMode);
59 } 59 }
60 - 60 +
61 public OrcidOAuthClient(Client restClient, String loginUri, String apiUri, String clientId, String clientSecret, String redirectUri) { 61 public OrcidOAuthClient(Client restClient, String loginUri, String apiUri, String clientId, String clientSecret, String redirectUri) {
62 super(restClient, loginUri, apiUri, clientId, clientSecret, redirectUri); 62 super(restClient, loginUri, apiUri, clientId, clientSecret, redirectUri);
63 } 63 }
64 - 64 +
65 public OrcidOAuthClient(Client restClient, String loginUri, String apiUri, String clientId, String clientSecret, String redirectUri, boolean debugMode) { 65 public OrcidOAuthClient(Client restClient, String loginUri, String apiUri, String clientId, String clientSecret, String redirectUri, boolean debugMode) {
66 super(restClient, loginUri, apiUri, clientId, clientSecret, redirectUri, debugMode); 66 super(restClient, loginUri, apiUri, clientId, clientSecret, redirectUri, debugMode);
67 } 67 }
68 - 68 +
69 /** 69 /**
70 * 70 *
71 * @param scopes 71 * @param scopes
@@ -100,7 +100,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -100,7 +100,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
100 public String getAuthorizeUri(final List<ScopePathType> scopes, final String state, final String familyNames, final String givenNames) throws Exception { 100 public String getAuthorizeUri(final List<ScopePathType> scopes, final String state, final String familyNames, final String givenNames) throws Exception {
101 return getAuthorizeUri(scopes, state, null, familyNames, givenNames, null, null, false); 101 return getAuthorizeUri(scopes, state, null, familyNames, givenNames, null, null, false);
102 } 102 }
103 - 103 +
104 /** 104 /**
105 * 105 *
106 * @param scopes 106 * @param scopes
@@ -131,10 +131,10 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -131,10 +131,10 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
131 // Optional params 131 // Optional params
132 if (state != null && !"".equals(state)) 132 if (state != null && !"".equals(state))
133 builder.queryParam("state", state); 133 builder.queryParam("state", state);
134 - 134 +
135 if (orcidId != null && !"".equals(orcidId)) 135 if (orcidId != null && !"".equals(orcidId))
136 builder.queryParam("orcid", orcidId); 136 builder.queryParam("orcid", orcidId);
137 - 137 +
138 if (familyNames != null && !"".equals(familyNames)) 138 if (familyNames != null && !"".equals(familyNames))
139 builder.queryParam("family_names", familyNames); 139 builder.queryParam("family_names", familyNames);
140 140
@@ -153,7 +153,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -153,7 +153,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
153 153
154 return builder.toString(); 154 return builder.toString();
155 } 155 }
156 - 156 +
157 /** 157 /**
158 * 158 *
159 * @param authorizationCode 159 * @param authorizationCode
@@ -169,60 +169,74 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -169,60 +169,74 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
169 169
170 return post(authorizationCode, formData).readEntity(OrcidAccessToken.class); 170 return post(authorizationCode, formData).readEntity(OrcidAccessToken.class);
171 } 171 }
172 -  
173 - 172 +
  173 +
174 /* Activities */ 174 /* Activities */
175 public ActivitiesSummary readActivitiesSummary(final OrcidAccessToken token) throws OrcidClientException { 175 public ActivitiesSummary readActivitiesSummary(final OrcidAccessToken token) throws OrcidClientException {
176 Response response = null; 176 Response response = null;
177 try { 177 try {
178 response = get(OrcidConstants.ENDPOINT_ACTIVITIES, token, null); 178 response = get(OrcidConstants.ENDPOINT_ACTIVITIES, token, null);
179 - 179 +
180 return response.readEntity(ActivitiesSummary.class); 180 return response.readEntity(ActivitiesSummary.class);
181 } finally { 181 } finally {
182 if (response != null) 182 if (response != null)
183 response.close(); 183 response.close();
184 } 184 }
185 } 185 }
186 - 186 +
187 /* Activities - Works */ 187 /* Activities - Works */
188 public org.um.dsi.gavea.orcid.model.activities.Works readWorksSummary(final OrcidAccessToken token) throws OrcidClientException { 188 public org.um.dsi.gavea.orcid.model.activities.Works readWorksSummary(final OrcidAccessToken token) throws OrcidClientException {
189 Response response = null; 189 Response response = null;
190 try { 190 try {
191 response = get(OrcidConstants.ENDPOINT_WORKS, token, null); 191 response = get(OrcidConstants.ENDPOINT_WORKS, token, null);
192 - 192 +
193 return response.readEntity(org.um.dsi.gavea.orcid.model.activities.Works.class); 193 return response.readEntity(org.um.dsi.gavea.orcid.model.activities.Works.class);
194 } finally { 194 } finally {
195 if (response != null) 195 if (response != null)
196 response.close(); 196 response.close();
197 } 197 }
198 } 198 }
199 -  
200 - 199 +
  200 + /* Activities - Fundings */
  201 + public org.um.dsi.gavea.orcid.model.activities.Fundings readFundingSummary(final OrcidAccessToken token) throws OrcidClientException {
  202 + Response response = null;
  203 + try {
  204 + response = get(OrcidConstants.ENDPOINT_FUNDING, token, null);
  205 +
  206 + return response.readEntity(org.um.dsi.gavea.orcid.model.activities.Fundings.class);
  207 + } finally {
  208 + if (response != null)
  209 + response.close();
  210 + }
  211 + }
  212 +
  213 +
  214 +
201 /* Address */ 215 /* Address */
202 public Addresses readAddresses(final OrcidAccessToken token) throws OrcidClientException { 216 public Addresses readAddresses(final OrcidAccessToken token) throws OrcidClientException {
203 Response response = null; 217 Response response = null;
204 try { 218 try {
205 response = get(OrcidConstants.ENDPOINT_ADDRESS, token, null); 219 response = get(OrcidConstants.ENDPOINT_ADDRESS, token, null);
206 - 220 +
207 return response.readEntity(Addresses.class); 221 return response.readEntity(Addresses.class);
208 } finally { 222 } finally {
209 if (response != null) 223 if (response != null)
210 response.close(); 224 response.close();
211 } 225 }
212 } 226 }
213 - 227 +
214 public Address readAddress(final OrcidAccessToken token, final String putCode) throws OrcidClientException { 228 public Address readAddress(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
215 Response response = null; 229 Response response = null;
216 try { 230 try {
217 response = get(OrcidConstants.ENDPOINT_ADDRESS, token, putCode); 231 response = get(OrcidConstants.ENDPOINT_ADDRESS, token, putCode);
218 - 232 +
219 return response.readEntity(Address.class); 233 return response.readEntity(Address.class);
220 } finally { 234 } finally {
221 if (response != null) 235 if (response != null)
222 response.close(); 236 response.close();
223 } 237 }
224 } 238 }
225 - 239 +
226 public void addAddress(final OrcidAccessToken token, Address address) throws OrcidClientException { 240 public void addAddress(final OrcidAccessToken token, Address address) throws OrcidClientException {
227 Response response = null; 241 Response response = null;
228 try { 242 try {
@@ -252,28 +266,28 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -252,28 +266,28 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
252 response.close(); 266 response.close();
253 } 267 }
254 } 268 }
255 -  
256 - 269 +
  270 +
257 /* Biography */ 271 /* Biography */
258 public Biography readBiography(final OrcidAccessToken token) throws OrcidClientException { 272 public Biography readBiography(final OrcidAccessToken token) throws OrcidClientException {
259 Response response = null; 273 Response response = null;
260 try { 274 try {
261 response = get(OrcidConstants.ENDPOINT_BIOGRAPHY, token, null); 275 response = get(OrcidConstants.ENDPOINT_BIOGRAPHY, token, null);
262 - 276 +
263 return response.readEntity(Biography.class); 277 return response.readEntity(Biography.class);
264 } finally { 278 } finally {
265 if (response != null) 279 if (response != null)
266 response.close(); 280 response.close();
267 } 281 }
268 } 282 }
269 -  
270 - 283 +
  284 +
271 /* Education */ 285 /* Education */
272 public Education readEducation(final OrcidAccessToken token, final String putCode) throws OrcidClientException { 286 public Education readEducation(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
273 Response response = null; 287 Response response = null;
274 try { 288 try {
275 response = get(OrcidConstants.ENDPOINT_EDUCATION, token, putCode); 289 response = get(OrcidConstants.ENDPOINT_EDUCATION, token, putCode);
276 - 290 +
277 return response.readEntity(Education.class); 291 return response.readEntity(Education.class);
278 } finally { 292 } finally {
279 if (response != null) 293 if (response != null)
@@ -285,19 +299,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -285,19 +299,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
285 Response response = null; 299 Response response = null;
286 try { 300 try {
287 response = get(OrcidConstants.ENDPOINT_EDUCATION_SUMMARY, token, putCode); 301 response = get(OrcidConstants.ENDPOINT_EDUCATION_SUMMARY, token, putCode);
288 - 302 +
289 return response.readEntity(EducationSummary.class); 303 return response.readEntity(EducationSummary.class);
290 } finally { 304 } finally {
291 if (response != null) 305 if (response != null)
292 response.close(); 306 response.close();
293 } 307 }
294 } 308 }
295 - 309 +
296 public String addEducation(final OrcidAccessToken token, final Education education) throws OrcidClientException { 310 public String addEducation(final OrcidAccessToken token, final Education education) throws OrcidClientException {
297 Response response = null; 311 Response response = null;
298 try { 312 try {
299 response = post(OrcidConstants.ENDPOINT_EDUCATION, token, Entity.entity(education, MediaType.APPLICATION_XML_TYPE)); 313 response = post(OrcidConstants.ENDPOINT_EDUCATION, token, Entity.entity(education, MediaType.APPLICATION_XML_TYPE));
300 - 314 +
301 return retrievePutCode(response); 315 return retrievePutCode(response);
302 } finally { 316 } finally {
303 if (response != null) 317 if (response != null)
@@ -324,28 +338,28 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -324,28 +338,28 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
324 response.close(); 338 response.close();
325 } 339 }
326 } 340 }
327 -  
328 - 341 +
  342 +
329 /* Email */ 343 /* Email */
330 public Emails readEmails(final OrcidAccessToken token) throws OrcidClientException { 344 public Emails readEmails(final OrcidAccessToken token) throws OrcidClientException {
331 Response response = null; 345 Response response = null;
332 try { 346 try {
333 response = get(OrcidConstants.ENDPOINT_EMAIL, token, null); 347 response = get(OrcidConstants.ENDPOINT_EMAIL, token, null);
334 - 348 +
335 return response.readEntity(Emails.class); 349 return response.readEntity(Emails.class);
336 } finally { 350 } finally {
337 if (response != null) 351 if (response != null)
338 response.close(); 352 response.close();
339 } 353 }
340 } 354 }
341 -  
342 - 355 +
  356 +
343 /* Employment */ 357 /* Employment */
344 public Employment readEmployment(final OrcidAccessToken token, final String putCode) throws OrcidClientException { 358 public Employment readEmployment(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
345 Response response = null; 359 Response response = null;
346 try { 360 try {
347 response = get(OrcidConstants.ENDPOINT_EMPLOYMENT, token, putCode); 361 response = get(OrcidConstants.ENDPOINT_EMPLOYMENT, token, putCode);
348 - 362 +
349 return response.readEntity(Employment.class); 363 return response.readEntity(Employment.class);
350 } finally { 364 } finally {
351 if (response != null) 365 if (response != null)
@@ -357,19 +371,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -357,19 +371,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
357 Response response = null; 371 Response response = null;
358 try { 372 try {
359 response = get(OrcidConstants.ENDPOINT_EMPLOYMENT_SUMMARY, token, putCode); 373 response = get(OrcidConstants.ENDPOINT_EMPLOYMENT_SUMMARY, token, putCode);
360 - 374 +
361 return response.readEntity(EmploymentSummary.class); 375 return response.readEntity(EmploymentSummary.class);
362 } finally { 376 } finally {
363 if (response != null) 377 if (response != null)
364 response.close(); 378 response.close();
365 } 379 }
366 } 380 }
367 - 381 +
368 public String addEmployment(final OrcidAccessToken token, final Employment employment) throws OrcidClientException { 382 public String addEmployment(final OrcidAccessToken token, final Employment employment) throws OrcidClientException {
369 Response response = null; 383 Response response = null;
370 try { 384 try {
371 response = post(OrcidConstants.ENDPOINT_EMPLOYMENT, token, Entity.entity(employment, MediaType.APPLICATION_XML_TYPE)); 385 response = post(OrcidConstants.ENDPOINT_EMPLOYMENT, token, Entity.entity(employment, MediaType.APPLICATION_XML_TYPE));
372 - 386 +
373 return retrievePutCode(response); 387 return retrievePutCode(response);
374 } finally { 388 } finally {
375 if (response != null) 389 if (response != null)
@@ -396,14 +410,14 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -396,14 +410,14 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
396 response.close(); 410 response.close();
397 } 411 }
398 } 412 }
399 -  
400 - 413 +
  414 +
401 /* External Identifier */ 415 /* External Identifier */
402 public ExternalIdentifiers readExternalIdentifiers(final OrcidAccessToken token, final String putCode) throws OrcidClientException { 416 public ExternalIdentifiers readExternalIdentifiers(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
403 Response response = null; 417 Response response = null;
404 try { 418 try {
405 response = get(OrcidConstants.ENDPOINT_EXTERNAL_IDENTIFIERS, token, putCode); 419 response = get(OrcidConstants.ENDPOINT_EXTERNAL_IDENTIFIERS, token, putCode);
406 - 420 +
407 return response.readEntity(ExternalIdentifiers.class); 421 return response.readEntity(ExternalIdentifiers.class);
408 } finally { 422 } finally {
409 if (response != null) 423 if (response != null)
@@ -415,19 +429,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -415,19 +429,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
415 Response response = null; 429 Response response = null;
416 try { 430 try {
417 response = get(OrcidConstants.ENDPOINT_EXTERNAL_IDENTIFIERS, token, putCode); 431 response = get(OrcidConstants.ENDPOINT_EXTERNAL_IDENTIFIERS, token, putCode);
418 - 432 +
419 return response.readEntity(ExternalIdentifier.class); 433 return response.readEntity(ExternalIdentifier.class);
420 } finally { 434 } finally {
421 if (response != null) 435 if (response != null)
422 response.close(); 436 response.close();
423 } 437 }
424 } 438 }
425 - 439 +
426 public String addExternalIdentifier(final OrcidAccessToken token, final ExternalIdentifier externalIdentifier) throws OrcidClientException { 440 public String addExternalIdentifier(final OrcidAccessToken token, final ExternalIdentifier externalIdentifier) throws OrcidClientException {
427 Response response = null; 441 Response response = null;
428 try { 442 try {
429 response = post(OrcidConstants.ENDPOINT_EXTERNAL_IDENTIFIERS, token, Entity.entity(externalIdentifier, MediaType.APPLICATION_XML_TYPE)); 443 response = post(OrcidConstants.ENDPOINT_EXTERNAL_IDENTIFIERS, token, Entity.entity(externalIdentifier, MediaType.APPLICATION_XML_TYPE));
430 - 444 +
431 return retrievePutCode(response); 445 return retrievePutCode(response);
432 } finally { 446 } finally {
433 if (response != null) 447 if (response != null)
@@ -454,14 +468,14 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -454,14 +468,14 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
454 response.close(); 468 response.close();
455 } 469 }
456 } 470 }
457 -  
458 - 471 +
  472 +
459 /* Funding */ 473 /* Funding */
460 public Funding readFunding(final OrcidAccessToken token, final String putCode) throws OrcidClientException { 474 public Funding readFunding(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
461 Response response = null; 475 Response response = null;
462 try { 476 try {
463 response = get(OrcidConstants.ENDPOINT_FUNDING, token, putCode); 477 response = get(OrcidConstants.ENDPOINT_FUNDING, token, putCode);
464 - 478 +
465 return response.readEntity(Funding.class); 479 return response.readEntity(Funding.class);
466 } finally { 480 } finally {
467 if (response != null) 481 if (response != null)
@@ -472,7 +486,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -472,7 +486,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
472 Response response = null; 486 Response response = null;
473 try { 487 try {
474 response = get(OrcidConstants.ENDPOINT_FUNDING_SUMMARY, token, putCode); 488 response = get(OrcidConstants.ENDPOINT_FUNDING_SUMMARY, token, putCode);
475 - 489 +
476 return response.readEntity(FundingSummary.class); 490 return response.readEntity(FundingSummary.class);
477 } finally { 491 } finally {
478 if (response != null) 492 if (response != null)
@@ -484,7 +498,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -484,7 +498,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
484 Response response = null; 498 Response response = null;
485 try { 499 try {
486 response = post(OrcidConstants.ENDPOINT_FUNDING, token, Entity.entity(funding, MediaType.APPLICATION_XML_TYPE)); 500 response = post(OrcidConstants.ENDPOINT_FUNDING, token, Entity.entity(funding, MediaType.APPLICATION_XML_TYPE));
487 - 501 +
488 return retrievePutCode(response); 502 return retrievePutCode(response);
489 } finally { 503 } finally {
490 if (response != null) 504 if (response != null)
@@ -511,14 +525,14 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -511,14 +525,14 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
511 response.close(); 525 response.close();
512 } 526 }
513 } 527 }
514 -  
515 - 528 +
  529 +
516 /* Keyword */ 530 /* Keyword */
517 public Keywords readKeywords(final OrcidAccessToken token) throws OrcidClientException { 531 public Keywords readKeywords(final OrcidAccessToken token) throws OrcidClientException {
518 Response response = null; 532 Response response = null;
519 try { 533 try {
520 response = get(OrcidConstants.ENDPOINT_KEYWORDS, token, null); 534 response = get(OrcidConstants.ENDPOINT_KEYWORDS, token, null);
521 - 535 +
522 return response.readEntity(Keywords.class); 536 return response.readEntity(Keywords.class);
523 } finally { 537 } finally {
524 if (response != null) 538 if (response != null)
@@ -530,19 +544,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -530,19 +544,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
530 Response response = null; 544 Response response = null;
531 try { 545 try {
532 response = get(OrcidConstants.ENDPOINT_KEYWORDS, token, putCode); 546 response = get(OrcidConstants.ENDPOINT_KEYWORDS, token, putCode);
533 - 547 +
534 return response.readEntity(Keyword.class); 548 return response.readEntity(Keyword.class);
535 } finally { 549 } finally {
536 if (response != null) 550 if (response != null)
537 response.close(); 551 response.close();
538 } 552 }
539 } 553 }
540 - 554 +
541 public String addKeyword(final OrcidAccessToken token, final Keyword keyword) throws OrcidClientException { 555 public String addKeyword(final OrcidAccessToken token, final Keyword keyword) throws OrcidClientException {
542 Response response = null; 556 Response response = null;
543 try { 557 try {
544 response = post(OrcidConstants.ENDPOINT_KEYWORDS, token, Entity.entity(keyword, MediaType.APPLICATION_XML_TYPE)); 558 response = post(OrcidConstants.ENDPOINT_KEYWORDS, token, Entity.entity(keyword, MediaType.APPLICATION_XML_TYPE));
545 - 559 +
546 return retrievePutCode(response); 560 return retrievePutCode(response);
547 } finally { 561 } finally {
548 if (response != null) 562 if (response != null)
@@ -569,14 +583,14 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -569,14 +583,14 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
569 response.close(); 583 response.close();
570 } 584 }
571 } 585 }
572 -  
573 - 586 +
  587 +
574 /* Other Name */ 588 /* Other Name */
575 public OtherNames readOtherNames(final OrcidAccessToken token) throws OrcidClientException { 589 public OtherNames readOtherNames(final OrcidAccessToken token) throws OrcidClientException {
576 Response response = null; 590 Response response = null;
577 try { 591 try {
578 response = get(OrcidConstants.ENDPOINT_OTHER_NAMES, token, null); 592 response = get(OrcidConstants.ENDPOINT_OTHER_NAMES, token, null);
579 - 593 +
580 return response.readEntity(OtherNames.class); 594 return response.readEntity(OtherNames.class);
581 } finally { 595 } finally {
582 if (response != null) 596 if (response != null)
@@ -588,19 +602,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -588,19 +602,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
588 Response response = null; 602 Response response = null;
589 try { 603 try {
590 response = get(OrcidConstants.ENDPOINT_OTHER_NAMES, token, putCode); 604 response = get(OrcidConstants.ENDPOINT_OTHER_NAMES, token, putCode);
591 - 605 +
592 return response.readEntity(OtherName.class); 606 return response.readEntity(OtherName.class);
593 } finally { 607 } finally {
594 if (response != null) 608 if (response != null)
595 response.close(); 609 response.close();
596 } 610 }
597 } 611 }
598 - 612 +
599 public String addOtherName(final OrcidAccessToken token, final OtherName otherName) throws OrcidClientException { 613 public String addOtherName(final OrcidAccessToken token, final OtherName otherName) throws OrcidClientException {
600 Response response = null; 614 Response response = null;
601 try { 615 try {
602 response = post(OrcidConstants.ENDPOINT_OTHER_NAMES, token, Entity.entity(otherName, MediaType.APPLICATION_XML_TYPE)); 616 response = post(OrcidConstants.ENDPOINT_OTHER_NAMES, token, Entity.entity(otherName, MediaType.APPLICATION_XML_TYPE));
603 - 617 +
604 return retrievePutCode(response); 618 return retrievePutCode(response);
605 } finally { 619 } finally {
606 if (response != null) 620 if (response != null)
@@ -627,14 +641,14 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -627,14 +641,14 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
627 response.close(); 641 response.close();
628 } 642 }
629 } 643 }
630 -  
631 - 644 +
  645 +
632 /* Peer Review */ 646 /* Peer Review */
633 public PeerReview readPeerReview(final OrcidAccessToken token, final String putCode) throws OrcidClientException { 647 public PeerReview readPeerReview(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
634 Response response = null; 648 Response response = null;
635 try { 649 try {
636 response = get(OrcidConstants.ENDPOINT_PEERREVIEW, token, putCode); 650 response = get(OrcidConstants.ENDPOINT_PEERREVIEW, token, putCode);
637 - 651 +
638 return response.readEntity(PeerReview.class); 652 return response.readEntity(PeerReview.class);
639 } finally { 653 } finally {
640 if (response != null) 654 if (response != null)
@@ -645,7 +659,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -645,7 +659,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
645 Response response = null; 659 Response response = null;
646 try { 660 try {
647 response = get(OrcidConstants.ENDPOINT_PEERREVIEW_SUMMARY, token, putCode); 661 response = get(OrcidConstants.ENDPOINT_PEERREVIEW_SUMMARY, token, putCode);
648 - 662 +
649 return response.readEntity(PeerReviewSummary.class); 663 return response.readEntity(PeerReviewSummary.class);
650 } finally { 664 } finally {
651 if (response != null) 665 if (response != null)
@@ -657,7 +671,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -657,7 +671,7 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
657 Response response = null; 671 Response response = null;
658 try { 672 try {
659 response = post(OrcidConstants.ENDPOINT_PEERREVIEW, token, Entity.entity(peerReview, MediaType.APPLICATION_XML_TYPE)); 673 response = post(OrcidConstants.ENDPOINT_PEERREVIEW, token, Entity.entity(peerReview, MediaType.APPLICATION_XML_TYPE));
660 - 674 +
661 return retrievePutCode(response); 675 return retrievePutCode(response);
662 } finally { 676 } finally {
663 if (response != null) 677 if (response != null)
@@ -684,42 +698,42 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -684,42 +698,42 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
684 response.close(); 698 response.close();
685 } 699 }
686 } 700 }
687 -  
688 - 701 +
  702 +
689 /* Person */ 703 /* Person */
690 public Person readPerson(final OrcidAccessToken token) throws OrcidClientException { 704 public Person readPerson(final OrcidAccessToken token) throws OrcidClientException {
691 Response response = null; 705 Response response = null;
692 try { 706 try {
693 response = get(OrcidConstants.ENDPOINT_PERSON, token, null); 707 response = get(OrcidConstants.ENDPOINT_PERSON, token, null);
694 - 708 +
695 return response.readEntity(Person.class); 709 return response.readEntity(Person.class);
696 } finally { 710 } finally {
697 if (response != null) 711 if (response != null)
698 response.close(); 712 response.close();
699 } 713 }
700 } 714 }
701 -  
702 - 715 +
  716 +
703 /* Personal Details */ 717 /* Personal Details */
704 public PersonalDetails readPersonalDetails(final OrcidAccessToken token) throws OrcidClientException { 718 public PersonalDetails readPersonalDetails(final OrcidAccessToken token) throws OrcidClientException {
705 Response response = null; 719 Response response = null;
706 try { 720 try {
707 response = get(OrcidConstants.ENDPOINT_PERSONAL_DETAILS, token, null); 721 response = get(OrcidConstants.ENDPOINT_PERSONAL_DETAILS, token, null);
708 - 722 +
709 return response.readEntity(PersonalDetails.class); 723 return response.readEntity(PersonalDetails.class);
710 } finally { 724 } finally {
711 if (response != null) 725 if (response != null)
712 response.close(); 726 response.close();
713 } 727 }
714 } 728 }
715 -  
716 - 729 +
  730 +
717 /* Researcher Url */ 731 /* Researcher Url */
718 public ResearcherUrls readResearcherUrls(final OrcidAccessToken token) throws OrcidClientException { 732 public ResearcherUrls readResearcherUrls(final OrcidAccessToken token) throws OrcidClientException {
719 Response response = null; 733 Response response = null;
720 try { 734 try {
721 response = get(OrcidConstants.ENDPOINT_RESEARCHER_URLS, token, null); 735 response = get(OrcidConstants.ENDPOINT_RESEARCHER_URLS, token, null);
722 - 736 +
723 return response.readEntity(ResearcherUrls.class); 737 return response.readEntity(ResearcherUrls.class);
724 } finally { 738 } finally {
725 if (response != null) 739 if (response != null)
@@ -731,19 +745,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -731,19 +745,19 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
731 Response response = null; 745 Response response = null;
732 try { 746 try {
733 response = get(OrcidConstants.ENDPOINT_RESEARCHER_URLS, token, putCode); 747 response = get(OrcidConstants.ENDPOINT_RESEARCHER_URLS, token, putCode);
734 - 748 +
735 return response.readEntity(ResearcherUrl.class); 749 return response.readEntity(ResearcherUrl.class);
736 } finally { 750 } finally {
737 if (response != null) 751 if (response != null)
738 response.close(); 752 response.close();
739 } 753 }
740 } 754 }
741 - 755 +
742 public String addResearcherUrl(final OrcidAccessToken token, final ResearcherUrl researcherUrl) throws OrcidClientException { 756 public String addResearcherUrl(final OrcidAccessToken token, final ResearcherUrl researcherUrl) throws OrcidClientException {
743 Response response = null; 757 Response response = null;
744 try { 758 try {
745 response = post(OrcidConstants.ENDPOINT_RESEARCHER_URLS, token, Entity.entity(researcherUrl, MediaType.APPLICATION_XML_TYPE)); 759 response = post(OrcidConstants.ENDPOINT_RESEARCHER_URLS, token, Entity.entity(researcherUrl, MediaType.APPLICATION_XML_TYPE));
746 - 760 +
747 return retrievePutCode(response); 761 return retrievePutCode(response);
748 } finally { 762 } finally {
749 if (response != null) 763 if (response != null)
@@ -770,40 +784,40 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -770,40 +784,40 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
770 response.close(); 784 response.close();
771 } 785 }
772 } 786 }
773 -  
774 - 787 +
  788 +
775 /* Work */ 789 /* Work */
776 public Work readWork(final OrcidAccessToken token, final String putCode) throws OrcidClientException { 790 public Work readWork(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
777 Response response = null; 791 Response response = null;
778 try { 792 try {
779 response = get(OrcidConstants.ENDPOINT_WORK, token, putCode); 793 response = get(OrcidConstants.ENDPOINT_WORK, token, putCode);
780 - 794 +
781 return response.readEntity(Work.class); 795 return response.readEntity(Work.class);
782 } finally { 796 } finally {
783 if (response != null) 797 if (response != null)
784 response.close(); 798 response.close();
785 } 799 }
786 } 800 }
787 - 801 +
788 public Bulk readWorks(final OrcidAccessToken token, final List<String> putCodes) throws OrcidClientException { 802 public Bulk readWorks(final OrcidAccessToken token, final List<String> putCodes) throws OrcidClientException {
789 Response response = null; 803 Response response = null;
790 try { 804 try {
791 response = get(OrcidConstants.ENDPOINT_WORKS, token, StringUtils.join(putCodes.iterator(), ",")); 805 response = get(OrcidConstants.ENDPOINT_WORKS, token, StringUtils.join(putCodes.iterator(), ","));
792 - 806 +
793 return response.readEntity(Bulk.class); 807 return response.readEntity(Bulk.class);
794 } finally { 808 } finally {
795 if (response != null) 809 if (response != null)
796 response.close(); 810 response.close();
797 } 811 }
798 } 812 }
799 -  
800 -  
801 - 813 +
  814 +
  815 +
802 public WorkSummary readWorkSummary(final OrcidAccessToken token, final String putCode) throws OrcidClientException { 816 public WorkSummary readWorkSummary(final OrcidAccessToken token, final String putCode) throws OrcidClientException {
803 Response response = null; 817 Response response = null;
804 try { 818 try {
805 response = get(OrcidConstants.ENDPOINT_WORK_SUMMARY, token, putCode); 819 response = get(OrcidConstants.ENDPOINT_WORK_SUMMARY, token, putCode);
806 - 820 +
807 return response.readEntity(WorkSummary.class); 821 return response.readEntity(WorkSummary.class);
808 } finally { 822 } finally {
809 if (response != null) 823 if (response != null)
@@ -815,14 +829,14 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -815,14 +829,14 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
815 Response response = null; 829 Response response = null;
816 try { 830 try {
817 response = post(OrcidConstants.ENDPOINT_WORK, token, Entity.entity(work, MediaType.APPLICATION_XML_TYPE)); 831 response = post(OrcidConstants.ENDPOINT_WORK, token, Entity.entity(work, MediaType.APPLICATION_XML_TYPE));
818 - 832 +
819 return retrievePutCode(response); 833 return retrievePutCode(response);
820 } finally { 834 } finally {
821 if (response != null) 835 if (response != null)
822 response.close(); 836 response.close();
823 } 837 }
824 } 838 }
825 - 839 +
826 /* Bulks */ 840 /* Bulks */
827 public Bulk addWorks(final OrcidAccessToken token, final Bulk bulk) throws OrcidClientException { 841 public Bulk addWorks(final OrcidAccessToken token, final Bulk bulk) throws OrcidClientException {
828 Response response = null; 842 Response response = null;
@@ -854,8 +868,8 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -854,8 +868,8 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
854 response.close(); 868 response.close();
855 } 869 }
856 } 870 }
857 -  
858 - 871 +
  872 +
859 /** 873 /**
860 * 874 *
861 * @param response 875 * @param response
@@ -868,10 +882,10 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient { @@ -868,10 +882,10 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
868 if (putCode.matches("\\d+")) 882 if (putCode.matches("\\d+"))
869 return putCode; 883 return putCode;
870 } 884 }
871 - 885 +
872 return null; 886 return null;
873 } 887 }
874 - 888 +
875 /** 889 /**
876 * 890 *
877 * @param value 891 * @param value