Search in sources :

Example 16 with MismatchedPutCodeException

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();
}
Also used : HashMap(java.util.HashMap) OtherName(org.orcid.jaxb.model.v3.dev1.record.OtherName) MismatchedPutCodeException(org.orcid.core.exception.MismatchedPutCodeException)

Example 17 with MismatchedPutCodeException

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();
}
Also used : HashMap(java.util.HashMap) PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) MismatchedPutCodeException(org.orcid.core.exception.MismatchedPutCodeException)

Example 18 with MismatchedPutCodeException

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();
}
Also used : HashMap(java.util.HashMap) Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) MismatchedPutCodeException(org.orcid.core.exception.MismatchedPutCodeException)

Example 19 with MismatchedPutCodeException

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();
}
Also used : HashMap(java.util.HashMap) PeerReview(org.orcid.jaxb.model.v3.dev1.record.PeerReview) MismatchedPutCodeException(org.orcid.core.exception.MismatchedPutCodeException)

Example 20 with MismatchedPutCodeException

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();
}
Also used : HashMap(java.util.HashMap) InvitedPosition(org.orcid.jaxb.model.v3.dev1.record.InvitedPosition) MismatchedPutCodeException(org.orcid.core.exception.MismatchedPutCodeException)

Aggregations

HashMap (java.util.HashMap)23 MismatchedPutCodeException (org.orcid.core.exception.MismatchedPutCodeException)23 GroupIdRecord (org.orcid.jaxb.model.groupid_v2.GroupIdRecord)1 Education (org.orcid.jaxb.model.record_v2.Education)1 Employment (org.orcid.jaxb.model.record_v2.Employment)1 Funding (org.orcid.jaxb.model.record_v2.Funding)1 OtherName (org.orcid.jaxb.model.record_v2.OtherName)1 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)1 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)1 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)1 Work (org.orcid.jaxb.model.record_v2.Work)1 GroupIdRecord (org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecord)1 Distinction (org.orcid.jaxb.model.v3.dev1.record.Distinction)1 Education (org.orcid.jaxb.model.v3.dev1.record.Education)1 Employment (org.orcid.jaxb.model.v3.dev1.record.Employment)1 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)1 InvitedPosition (org.orcid.jaxb.model.v3.dev1.record.InvitedPosition)1 Membership (org.orcid.jaxb.model.v3.dev1.record.Membership)1 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)1 PeerReview (org.orcid.jaxb.model.v3.dev1.record.PeerReview)1