Search in sources :

Example 16 with ExternalIdentifierEntity

use of org.orcid.persistence.jpa.entities.ExternalIdentifierEntity in project ORCID-Source by ORCID.

the class JpaJaxbExternalIdentifierAdapterTest method getExternalIdentifierEntity.

private ExternalIdentifierEntity getExternalIdentifierEntity() {
    ExternalIdentifierEntity entity = new ExternalIdentifierEntity();
    entity.setDateCreated(new Date());
    entity.setLastModified(new Date());
    entity.setExternalIdCommonName("common-name");
    entity.setExternalIdReference("id-reference");
    entity.setExternalIdUrl("http://myurl.com");
    entity.setId(123L);
    entity.setClientSourceId("APP-0000000000000000");
    entity.setVisibility(Visibility.LIMITED);
    return entity;
}
Also used : ExternalIdentifierEntity(org.orcid.persistence.jpa.entities.ExternalIdentifierEntity) Date(java.util.Date)

Example 17 with ExternalIdentifierEntity

use of org.orcid.persistence.jpa.entities.ExternalIdentifierEntity in project ORCID-Source by ORCID.

the class JpaJaxbExternalIdentifierAdapterTest method fromExternalIdentifierEntityToExternalIdentifier.

@Test
public void fromExternalIdentifierEntityToExternalIdentifier() {
    ExternalIdentifierEntity entity = getExternalIdentifierEntity();
    PersonExternalIdentifier extId = jpaJaxbExternalIdentifierAdapter.toExternalIdentifier(entity);
    assertNotNull(extId);
    assertNotNull(extId.getCreatedDate());
    assertNotNull(extId.getCreatedDate().getValue());
    assertNotNull(extId.getLastModifiedDate());
    assertNotNull(extId.getLastModifiedDate().getValue());
    assertEquals("common-name", extId.getType());
    assertEquals("id-reference", extId.getValue());
    assertNotNull(extId.getUrl());
    assertEquals("http://myurl.com", extId.getUrl().getValue());
    assertEquals(Long.valueOf(123), extId.getPutCode());
    assertNotNull(extId.getSource());
    assertEquals("APP-0000000000000000", extId.getSource().retrieveSourcePath());
    assertEquals(Visibility.LIMITED.value(), extId.getVisibility().value());
    assertNotNull(extId.getCreatedDate());
    assertNotNull(extId.getLastModifiedDate());
}
Also used : ExternalIdentifierEntity(org.orcid.persistence.jpa.entities.ExternalIdentifierEntity) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) Test(org.junit.Test)

Aggregations

ExternalIdentifierEntity (org.orcid.persistence.jpa.entities.ExternalIdentifierEntity)17 Test (org.junit.Test)6 Date (java.util.Date)5 OtherNameEntity (org.orcid.persistence.jpa.entities.OtherNameEntity)5 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)5 ProfileKeywordEntity (org.orcid.persistence.jpa.entities.ProfileKeywordEntity)5 ResearcherUrlEntity (org.orcid.persistence.jpa.entities.ResearcherUrlEntity)5 AddressEntity (org.orcid.persistence.jpa.entities.AddressEntity)4 DBUnitTest (org.orcid.test.DBUnitTest)4 OrcidDuplicatedElementException (org.orcid.core.exception.OrcidDuplicatedElementException)3 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)3 OrgAffiliationRelationEntity (org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity)3 ProfileFundingEntity (org.orcid.persistence.jpa.entities.ProfileFundingEntity)3 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)3 Transactional (org.springframework.transaction.annotation.Transactional)3 HashMap (java.util.HashMap)2 ApplicationException (org.orcid.core.exception.ApplicationException)2 Visibility (org.orcid.jaxb.model.common_v2.Visibility)2 FamilyName (org.orcid.jaxb.model.record_v2.FamilyName)2 GivenNames (org.orcid.jaxb.model.record_v2.GivenNames)2