Search in sources :

Example 21 with MismatchedPutCodeException

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

the class MemberV3ApiServiceDelegatorImpl method updateDistinction.

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

Example 22 with MismatchedPutCodeException

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

the class MemberV3ApiServiceDelegatorImpl 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.v3.dev1.groupid.GroupIdRecord) MismatchedPutCodeException(org.orcid.core.exception.MismatchedPutCodeException)

Example 23 with MismatchedPutCodeException

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

the class MemberV3ApiServiceDelegatorImpl 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.v3.dev1.record.Education) 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