Search in sources :

Example 56 with Employment

use of org.orcid.jaxb.model.v3.dev1.record.Employment in project ORCID-Source by ORCID.

the class PublicV3ApiServiceDelegatorTest method testViewEmployments.

@Test
public void testViewEmployments() {
    Response response = serviceDelegator.viewEmployments(ORCID);
    assertNotNull(response);
    Employments employments = (Employments) response.getEntity();
    assertNotNull(employments);
    assertEquals("/0000-0000-0000-0003/employments", employments.getPath());
    assertNotNull(employments.getLastModifiedDate());
    assertNotNull(employments.getLastModifiedDate().getValue());
    assertEquals(1, employments.getSummaries().size());
    EmploymentSummary employment = employments.getSummaries().get(0);
    assertEquals(Long.valueOf(17), employment.getPutCode());
    assertNotNull(employment.getLastModifiedDate());
    assertNotNull(employment.getLastModifiedDate().getValue());
    assertEquals("/0000-0000-0000-0003/employment/17", employment.getPath());
    assertEquals("PUBLIC Department", employment.getDepartmentName());
    assertEquals(Visibility.PUBLIC.value(), employment.getVisibility().value());
    assertEquals("APP-5555555555555555", employment.getSource().retrieveSourcePath());
}
Also used : Response(javax.ws.rs.core.Response) Employments(org.orcid.jaxb.model.v3.dev1.record.summary.Employments) EmploymentSummary(org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 57 with Employment

use of org.orcid.jaxb.model.v3.dev1.record.Employment in project ORCID-Source by ORCID.

the class PublicV3ApiServiceDelegatorImpl method viewEmployment.

@Override
public Response viewEmployment(String orcid, Long putCode) {
    Employment e = affiliationsManagerReadOnly.getEmploymentAffiliation(orcid, putCode);
    publicAPISecurityManagerV3.checkIsPublic(e);
    ActivityUtils.setPathToActivity(e, orcid);
    sourceUtilsReadOnly.setSourceName(e);
    return Response.ok(e).build();
}
Also used : Employment(org.orcid.jaxb.model.v3.dev1.record.Employment)

Example 58 with Employment

use of org.orcid.jaxb.model.v3.dev1.record.Employment in project ORCID-Source by ORCID.

the class PojoUtilTest method affiliationsCreateDateSortString_StartDateOnlyTest.

@Test
public void affiliationsCreateDateSortString_StartDateOnlyTest() {
    Affiliation aff = new Employment();
    FuzzyDate start = new FuzzyDate();
    start.setDay(new Day(1));
    start.setMonth(new Month(2));
    start.setYear(new Year(3));
    aff.setStartDate(start);
    String dateSortString = PojoUtil.createDateSortString(aff);
    assertEquals("Y-3-02-01", dateSortString);
}
Also used : Month(org.orcid.jaxb.model.v3.dev1.common.Month) Year(org.orcid.jaxb.model.v3.dev1.common.Year) Employment(org.orcid.jaxb.model.v3.dev1.record.Employment) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) Day(org.orcid.jaxb.model.v3.dev1.common.Day) Affiliation(org.orcid.jaxb.model.v3.dev1.record.Affiliation) Test(org.junit.Test)

Example 59 with Employment

use of org.orcid.jaxb.model.v3.dev1.record.Employment in project ORCID-Source by ORCID.

the class PojoUtilTest method affiliationsCreateDateSortString_EndDateOnlyTest.

@Test
public void affiliationsCreateDateSortString_EndDateOnlyTest() {
    Affiliation aff = new Employment();
    FuzzyDate end = new FuzzyDate();
    end.setDay(new Day(1));
    end.setMonth(new Month(2));
    end.setYear(new Year(3));
    aff.setEndDate(end);
    String dateSortString = PojoUtil.createDateSortString(aff);
    assertEquals("X-3-02-01", dateSortString);
}
Also used : Month(org.orcid.jaxb.model.v3.dev1.common.Month) Year(org.orcid.jaxb.model.v3.dev1.common.Year) Employment(org.orcid.jaxb.model.v3.dev1.record.Employment) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) Day(org.orcid.jaxb.model.v3.dev1.common.Day) Affiliation(org.orcid.jaxb.model.v3.dev1.record.Affiliation) Test(org.junit.Test)

Example 60 with Employment

use of org.orcid.jaxb.model.v3.dev1.record.Employment in project ORCID-Source by ORCID.

the class PojoUtilTest method affiliationsCreateDateSortString_StartDate_NullMonthNullDayTest.

@Test
public void affiliationsCreateDateSortString_StartDate_NullMonthNullDayTest() {
    Affiliation aff = new Employment();
    FuzzyDate start = new FuzzyDate();
    start.setYear(new Year(2017));
    aff.setStartDate(start);
    String dateSortString = PojoUtil.createDateSortString(aff);
    assertEquals("Y-2017-00-00", dateSortString);
}
Also used : Year(org.orcid.jaxb.model.v3.dev1.common.Year) Employment(org.orcid.jaxb.model.v3.dev1.record.Employment) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) Affiliation(org.orcid.jaxb.model.v3.dev1.record.Affiliation) Test(org.junit.Test)

Aggregations

Employment (org.orcid.jaxb.model.v3.dev1.record.Employment)61 Test (org.junit.Test)53 DBUnitTest (org.orcid.test.DBUnitTest)21 Response (javax.ws.rs.core.Response)20 Affiliation (org.orcid.jaxb.model.v3.dev1.record.Affiliation)18 Education (org.orcid.jaxb.model.v3.dev1.record.Education)13 Distinction (org.orcid.jaxb.model.v3.dev1.record.Distinction)11 Membership (org.orcid.jaxb.model.v3.dev1.record.Membership)11 Service (org.orcid.jaxb.model.v3.dev1.record.Service)11 FuzzyDate (org.orcid.jaxb.model.v3.dev1.common.FuzzyDate)10 InvitedPosition (org.orcid.jaxb.model.v3.dev1.record.InvitedPosition)10 Qualification (org.orcid.jaxb.model.v3.dev1.record.Qualification)10 Day (org.orcid.jaxb.model.v3.dev1.common.Day)8 Month (org.orcid.jaxb.model.v3.dev1.common.Month)8 Year (org.orcid.jaxb.model.v3.dev1.common.Year)8 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)8 EmploymentSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary)8 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)7 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)6 Work (org.orcid.jaxb.model.v3.dev1.record.Work)6