Search in sources :

Example 21 with GroupIdRecord

use of org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecord in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegatorImpl method createGroupIdRecord.

@Override
public Response createGroupIdRecord(GroupIdRecord groupIdRecord) {
    orcidSecurityManager.checkScopes(ScopePathType.GROUP_ID_RECORD_UPDATE);
    GroupIdRecord newRecord = groupIdRecordManager.createGroupIdRecord(groupIdRecord);
    try {
        return Response.created(new URI(String.valueOf(newRecord.getPutCode()))).build();
    } catch (URISyntaxException ex) {
        throw new RuntimeException(localeManager.resolveMessage("apiError.creategroupidrecord_response.exception"), ex);
    }
}
Also used : GroupIdRecord(org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecord) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Example 22 with GroupIdRecord

use of org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecord 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)

Aggregations

GroupIdRecord (org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecord)21 Test (org.junit.Test)10 InvalidPutCodeException (org.orcid.core.exception.InvalidPutCodeException)4 OrcidValidationException (org.orcid.core.exception.OrcidValidationException)4 DBUnitTest (org.orcid.test.DBUnitTest)4 HashMap (java.util.HashMap)3 Response (javax.ws.rs.core.Response)3 BaseTest (org.orcid.core.BaseTest)3 DuplicatedGroupIdRecordException (org.orcid.core.exception.DuplicatedGroupIdRecordException)3 GroupIdRecordNotFoundException (org.orcid.core.exception.GroupIdRecordNotFoundException)3 GroupIdRecordEntity (org.orcid.persistence.jpa.entities.GroupIdRecordEntity)3 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)3 ArrayList (java.util.ArrayList)2 LastModifiedDate (org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate)2 PeerReview (org.orcid.jaxb.model.v3.dev1.record.PeerReview)2 PeerReviewForm (org.orcid.pojo.ajaxForm.PeerReviewForm)2 ClientResponse (com.sun.jersey.api.client.ClientResponse)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 AccessControlException (java.security.AccessControlException)1