Commit b3ef490cb0316232ae8f31abdb11cee82f7f77c5

Authored by Luis Pedro
1 parent 61fdde6f9a
Exists in master and in 1 other branch API_v3.0

C5311

src/main/java/org/um/dsi/gavea/orcid/client/OrcidOAuthClient.java
... ... @@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory;
16 16 import org.um.dsi.gavea.orcid.client.constants.OrcidConstants;
17 17 import org.um.dsi.gavea.orcid.client.exception.OrcidClientException;
18 18 import org.um.dsi.gavea.orcid.client.extend.ScopePathTypeExt;
  19 +import org.um.dsi.gavea.orcid.client.util.RecordUtil;
19 20 import org.um.dsi.gavea.orcid.model.activities.ActivitiesSummary;
20 21 import org.um.dsi.gavea.orcid.model.activities.Fundings;
21 22 import org.um.dsi.gavea.orcid.model.activities.Works;
... ... @@ -192,7 +193,13 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
192 193 try {
193 194 response = get(OrcidConstants.ENDPOINT_WORKS, token, null);
194 195  
195   - return response.readEntity(Works.class);
  196 + Works works = response.readEntity(Works.class);
  197 +
  198 + if (debugMode || _log.isTraceEnabled()) {
  199 + _log.debug("[readWorksSummary].[Works] " + RecordUtil.convertToString(works));
  200 + }
  201 +
  202 + return works;
196 203 } finally {
197 204 if (response != null)
198 205 response.close();
... ... @@ -205,7 +212,13 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
205 212 try {
206 213 response = get(OrcidConstants.ENDPOINT_FUNDINGS, token, null);
207 214  
208   - return response.readEntity(Fundings.class);
  215 + Fundings fundings = response.readEntity(Fundings.class);
  216 +
  217 + if (debugMode || _log.isTraceEnabled()) {
  218 + _log.debug("[readFundingsSummary].[Fundings] " + RecordUtil.convertToString(fundings));
  219 + }
  220 +
  221 + return fundings;
209 222 } finally {
210 223 if (response != null)
211 224 response.close();
... ... @@ -477,7 +490,13 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
477 490 try {
478 491 response = get(OrcidConstants.ENDPOINT_FUNDING, token, putCode);
479 492  
480   - return response.readEntity(Funding.class);
  493 + Funding funding = response.readEntity(Funding.class);
  494 +
  495 + if (debugMode || _log.isTraceEnabled()) {
  496 + _log.debug("[readFunding].[Funding] " + RecordUtil.convertToString(funding));
  497 + }
  498 +
  499 + return funding;
481 500 } finally {
482 501 if (response != null)
483 502 response.close();
... ... @@ -793,7 +812,13 @@ public class OrcidOAuthClient extends BaseOrcidOAuthClient {
793 812 try {
794 813 response = get(OrcidConstants.ENDPOINT_WORK, token, putCode);
795 814  
796   - return response.readEntity(Work.class);
  815 + Work work = response.readEntity(Work.class);
  816 +
  817 + if (debugMode || _log.isTraceEnabled()) {
  818 + _log.debug("[readWork].[Work] " + RecordUtil.convertToString(work));
  819 + }
  820 +
  821 + return work;
797 822 } finally {
798 823 if (response != null)
799 824 response.close();
... ...