Search in sources :

Example 1 with OrcidNoResultException

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

the class MemberV2ApiServiceDelegatorImpl method viewBulkWorks.

@Override
public Response viewBulkWorks(String orcid, String putCodes) {
    ProfileEntity profileEntity = profileEntityManager.findByOrcid(orcid);
    if (profileEntity == null) {
        throw new OrcidNoResultException("No such profile: " + orcid);
    }
    WorkBulk workBulk = workManagerReadOnly.findWorkBulk(orcid, putCodes, profileEntity.getLastModified().getTime());
    orcidSecurityManager.checkAndFilter(orcid, workBulk, ScopePathType.ORCID_WORKS_READ_LIMITED);
    ActivityUtils.cleanEmptyFields(workBulk);
    sourceUtils.setSourceName(workBulk);
    return Response.ok(workBulk).build();
}
Also used : OrcidNoResultException(org.orcid.core.exception.OrcidNoResultException) WorkBulk(org.orcid.jaxb.model.record_v2.WorkBulk) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity)

Example 2 with OrcidNoResultException

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

the class PublicV2ApiServiceDelegatorImpl method viewBulkWorks.

@Override
public Response viewBulkWorks(String orcid, String putCodes) {
    ProfileEntity profileEntity = profileEntityManagerReadOnly.findByOrcid(orcid);
    if (profileEntity == null) {
        throw new OrcidNoResultException("No such profile: " + orcid);
    }
    WorkBulk workBulk = workManagerReadOnly.findWorkBulk(orcid, putCodes, profileEntity.getLastModified().getTime());
    publicAPISecurityManagerV2.filter(workBulk);
    ActivityUtils.cleanEmptyFields(workBulk);
    sourceUtils.setSourceName(workBulk);
    return Response.ok(workBulk).build();
}
Also used : OrcidNoResultException(org.orcid.core.exception.OrcidNoResultException) WorkBulk(org.orcid.jaxb.model.record_v2.WorkBulk) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity)

Aggregations

OrcidNoResultException (org.orcid.core.exception.OrcidNoResultException)2 WorkBulk (org.orcid.jaxb.model.record_v2.WorkBulk)2 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)2