Search in sources :

Example 1 with LastModifiedResponse

use of org.orcid.internal.util.LastModifiedResponse in project ORCID-Source by ORCID.

the class InternalApiServiceDelegatorImpl method viewPersonLastModified.

@Override
@AccessControl(requiredScope = ScopePathType.INTERNAL_PERSON_LAST_MODIFIED, requestComesFromInternalApi = true)
public Response viewPersonLastModified(String orcid) {
    Date lastModified = orcidProfileManager.retrieveLastModifiedDate(orcid);
    LastModifiedResponse obj = new LastModifiedResponse(orcid, lastModified.toString());
    Response response = Response.ok(obj).build();
    return response;
}
Also used : LastModifiedResponse(org.orcid.internal.util.LastModifiedResponse) Response(javax.ws.rs.core.Response) LastModifiedResponse(org.orcid.internal.util.LastModifiedResponse) Date(java.util.Date) AccessControl(org.orcid.core.security.visibility.aop.AccessControl)

Example 2 with LastModifiedResponse

use of org.orcid.internal.util.LastModifiedResponse in project ORCID-Source by ORCID.

the class InternalApiServiceDelegatorTest method viewLastModified.

@Test
public void viewLastModified() {
    Response response = internalApiServiceDelegator.viewPersonLastModified(USER_ORCID);
    assertNotNull(response);
    assertNotNull(response.getEntity());
    assertTrue(response.getEntity().getClass().isAssignableFrom(LastModifiedResponse.class));
    LastModifiedResponse obj = (LastModifiedResponse) response.getEntity();
    assertNotNull(obj);
    assertEquals(USER_ORCID, obj.getOrcid());
    assertEquals(orcidProfileManager.retrieveLastModifiedDate(USER_ORCID).toString(), obj.getLastModified());
}
Also used : LastModifiedResponse(org.orcid.internal.util.LastModifiedResponse) Response(javax.ws.rs.core.Response) LastModifiedResponse(org.orcid.internal.util.LastModifiedResponse) Test(org.junit.Test) DBUnitTest(org.orcid.test.DBUnitTest)

Aggregations

Response (javax.ws.rs.core.Response)2 LastModifiedResponse (org.orcid.internal.util.LastModifiedResponse)2 Date (java.util.Date)1 Test (org.junit.Test)1 AccessControl (org.orcid.core.security.visibility.aop.AccessControl)1 DBUnitTest (org.orcid.test.DBUnitTest)1