use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method updateResearcherUrl.
@Override
public Response updateResearcherUrl(String orcid, Long putCode, ResearcherUrl researcherUrl) {
orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.ORCID_BIO_UPDATE);
if (!putCode.equals(researcherUrl.getPutCode())) {
Map<String, String> params = new HashMap<String, String>();
params.put("urlPutCode", String.valueOf(putCode));
params.put("bodyPutCode", String.valueOf(researcherUrl.getPutCode()));
throw new MismatchedPutCodeException(params);
}
clearSource(researcherUrl);
ResearcherUrl updatedResearcherUrl = researcherUrlManager.updateResearcherUrl(orcid, researcherUrl, true);
ElementUtils.setPathToResearcherUrl(updatedResearcherUrl, orcid);
sourceUtils.setSourceName(updatedResearcherUrl);
return Response.ok(updatedResearcherUrl).build();
}
use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method updateOtherName.
@Override
public Response updateOtherName(String orcid, Long putCode, OtherName otherName) {
orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.ORCID_BIO_UPDATE);
if (!putCode.equals(otherName.getPutCode())) {
Map<String, String> params = new HashMap<String, String>();
params.put("urlPutCode", String.valueOf(putCode));
params.put("bodyPutCode", String.valueOf(otherName.getPutCode()));
throw new MismatchedPutCodeException(params);
}
clearSource(otherName);
OtherName updatedOtherName = otherNameManager.updateOtherName(orcid, putCode, otherName, true);
ElementUtils.setPathToOtherName(updatedOtherName, orcid);
sourceUtils.setSourceName(updatedOtherName);
return Response.ok(updatedOtherName).build();
}
use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method updateExternalIdentifier.
@Override
public Response updateExternalIdentifier(String orcid, Long putCode, PersonExternalIdentifier externalIdentifier) {
orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.ORCID_BIO_EXTERNAL_IDENTIFIERS_CREATE);
if (!putCode.equals(externalIdentifier.getPutCode())) {
Map<String, String> params = new HashMap<String, String>();
params.put("urlPutCode", String.valueOf(putCode));
params.put("bodyPutCode", String.valueOf(externalIdentifier.getPutCode()));
throw new MismatchedPutCodeException(params);
}
clearSource(externalIdentifier);
PersonExternalIdentifier extId = externalIdentifierManager.updateExternalIdentifier(orcid, externalIdentifier, true);
ElementUtils.setPathToExternalIdentifier(extId, orcid);
sourceUtils.setSourceName(extId);
return Response.ok(extId).build();
}
use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method updateEmployment.
@Override
public Response updateEmployment(String orcid, Long putCode, Employment employment) {
orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.AFFILIATIONS_UPDATE);
if (!putCode.equals(employment.getPutCode())) {
Map<String, String> params = new HashMap<String, String>();
params.put("urlPutCode", String.valueOf(putCode));
params.put("bodyPutCode", String.valueOf(employment.getPutCode()));
throw new MismatchedPutCodeException(params);
}
clearSource(employment);
Employment e = affiliationsManager.updateEmploymentAffiliation(orcid, employment, true);
sourceUtils.setSourceName(e);
return Response.ok(e).build();
}
use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegatorImpl method updateQualification.
@Override
public Response updateQualification(String orcid, Long putCode, Qualification qualification) {
orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.AFFILIATIONS_UPDATE);
if (!putCode.equals(qualification.getPutCode())) {
Map<String, String> params = new HashMap<String, String>();
params.put("urlPutCode", String.valueOf(putCode));
params.put("bodyPutCode", String.valueOf(qualification.getPutCode()));
throw new MismatchedPutCodeException(params);
}
clearSource(qualification);
Qualification e = affiliationsManager.updateQualificationAffiliation(orcid, qualification, true);
sourceUtils.setSourceName(e);
return Response.ok(e).build();
}
Aggregations