Search in sources :

Example 1 with MismatchedPutCodeException

use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl 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.record_v2.Funding) MismatchedPutCodeException(org.orcid.core.exception.MismatchedPutCodeException)

Example 2 with MismatchedPutCodeException

use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl method updateEducation.

@Override
public Response updateEducation(String orcid, Long putCode, Education education) {
    orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.AFFILIATIONS_UPDATE);
    if (!putCode.equals(education.getPutCode())) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("urlPutCode", String.valueOf(putCode));
        params.put("bodyPutCode", String.valueOf(education.getPutCode()));
        throw new MismatchedPutCodeException(params);
    }
    clearSource(education);
    Education e = affiliationsManager.updateEducationAffiliation(orcid, education, true);
    sourceUtils.setSourceName(e);
    return Response.ok(e).build();
}
Also used : HashMap(java.util.HashMap) Education(org.orcid.jaxb.model.record_v2.Education) MismatchedPutCodeException(org.orcid.core.exception.MismatchedPutCodeException)

Example 3 with MismatchedPutCodeException

use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl method updateWork.

@Override
public Response updateWork(String orcid, Long putCode, Work work) {
    orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.ORCID_WORKS_UPDATE);
    if (!putCode.equals(work.getPutCode())) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("urlPutCode", String.valueOf(putCode));
        params.put("bodyPutCode", String.valueOf(work.getPutCode()));
        throw new MismatchedPutCodeException(params);
    }
    clearSource(work);
    Work w = workManager.updateWork(orcid, work, true);
    sourceUtils.setSourceName(w);
    return Response.ok(w).build();
}
Also used : HashMap(java.util.HashMap) Work(org.orcid.jaxb.model.record_v2.Work) MismatchedPutCodeException(org.orcid.core.exception.MismatchedPutCodeException)

Example 4 with MismatchedPutCodeException

use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl 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.record_v2.PeerReview) MismatchedPutCodeException(org.orcid.core.exception.MismatchedPutCodeException)

Example 5 with MismatchedPutCodeException

use of org.orcid.core.exception.MismatchedPutCodeException in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl method updateGroupIdRecord.

@Override
public Response updateGroupIdRecord(GroupIdRecord groupIdRecord, Long putCode) {
    orcidSecurityManager.checkScopes(ScopePathType.GROUP_ID_RECORD_UPDATE);
    if (!putCode.equals(groupIdRecord.getPutCode())) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("urlPutCode", String.valueOf(putCode));
        params.put("bodyPutCode", String.valueOf(groupIdRecord.getPutCode()));
        throw new MismatchedPutCodeException(params);
    }
    GroupIdRecord updatedRecord = groupIdRecordManager.updateGroupIdRecord(putCode, groupIdRecord);
    return Response.ok(updatedRecord).build();
}
Also used : HashMap(java.util.HashMap) GroupIdRecord(org.orcid.jaxb.model.groupid_v2.GroupIdRecord) 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