use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegatorImpl 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 MemberV3ApiServiceDelegatorImpl 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 MemberV3ApiServiceDelegatorImpl method updateFunding.
@Override
public Response updateFunding(String orcid, Long putCode, Funding funding) {
orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.FUNDING_UPDATE);
if (!putCode.equals(funding.getPutCode())) {
Map<String, String> params = new HashMap<String, String>();
params.put("urlPutCode", String.valueOf(putCode));
params.put("bodyPutCode", String.valueOf(funding.getPutCode()));
throw new MismatchedPutCodeException(params);
}
clearSource(funding);
Funding f = profileFundingManager.updateFunding(orcid, funding, true);
sourceUtils.setSourceName(f);
return Response.ok(f).build();
}
use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegatorImpl method updatePeerReview.
@Override
public Response updatePeerReview(String orcid, Long putCode, PeerReview peerReview) {
orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.PEER_REVIEW_UPDATE);
if (!putCode.equals(peerReview.getPutCode())) {
Map<String, String> params = new HashMap<String, String>();
params.put("urlPutCode", String.valueOf(putCode));
params.put("bodyPutCode", String.valueOf(peerReview.getPutCode()));
throw new MismatchedPutCodeException(params);
}
clearSource(peerReview);
PeerReview updatedPeerReview = peerReviewManager.updatePeerReview(orcid, peerReview, true);
sourceUtils.setSourceName(updatedPeerReview);
return Response.ok(updatedPeerReview).build();
}
use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegatorImpl method updateInvitedPosition.
@Override
public Response updateInvitedPosition(String orcid, Long putCode, InvitedPosition invitedPosition) {
orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.AFFILIATIONS_UPDATE);
if (!putCode.equals(invitedPosition.getPutCode())) {
Map<String, String> params = new HashMap<String, String>();
params.put("urlPutCode", String.valueOf(putCode));
params.put("bodyPutCode", String.valueOf(invitedPosition.getPutCode()));
throw new MismatchedPutCodeException(params);
}
clearSource(invitedPosition);
InvitedPosition e = affiliationsManager.updateInvitedPositionAffiliation(orcid, invitedPosition, true);
sourceUtils.setSourceName(e);
return Response.ok(e).build();
}
Aggregations