use of org.orcid.persistence.jpa.entities.EndDateEntity in project ORCID-Source by ORCID.
the class Jaxb2JpaAdapterImpl method getOrgAffiliationRelationEntity.
private OrgAffiliationRelationEntity getOrgAffiliationRelationEntity(Affiliation affiliation, OrgAffiliationRelationEntity exisitingOrgAffiliationEntity) {
if (affiliation != null) {
// Get the org
OrgEntity orgEntity = getOrgEntity(affiliation);
OrgAffiliationRelationEntity orgRelationEntity = null;
if (exisitingOrgAffiliationEntity == null) {
String putCode = affiliation.getPutCode();
if (StringUtils.isNotBlank(putCode) && !"-1".equals(putCode)) {
throw new IllegalArgumentException("Invalid put-code was supplied for an affiliation: " + putCode);
}
orgRelationEntity = new OrgAffiliationRelationEntity();
setSource(sourceManager.retrieveSourceEntity(), orgRelationEntity);
} else {
orgRelationEntity = exisitingOrgAffiliationEntity;
orgRelationEntity.clean();
}
FuzzyDate startDate = affiliation.getStartDate();
FuzzyDate endDate = affiliation.getEndDate();
if (affiliation.getType() != null) {
orgRelationEntity.setAffiliationType(org.orcid.jaxb.model.v3.dev1.record.AffiliationType.fromValue(affiliation.getType().value()));
}
if (affiliation.getVisibility() != null) {
orgRelationEntity.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(affiliation.getVisibility().value()));
} else {
orgRelationEntity.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
}
orgRelationEntity.setDepartment(affiliation.getDepartmentName());
orgRelationEntity.setEndDate(endDate != null ? new EndDateEntity(endDate) : null);
orgRelationEntity.setOrg(orgEntity);
orgRelationEntity.setTitle(affiliation.getRoleTitle());
orgRelationEntity.setStartDate(startDate != null ? new StartDateEntity(startDate) : null);
if (affiliation.getCreatedDate() != null && affiliation.getCreatedDate().getValue() != null)
orgRelationEntity.setDateCreated(affiliation.getCreatedDate().getValue().toGregorianCalendar().getTime());
if (affiliation.getLastModifiedDate() != null && affiliation.getLastModifiedDate().getValue() != null)
orgRelationEntity.setLastModified(affiliation.getLastModifiedDate().getValue().toGregorianCalendar().getTime());
return orgRelationEntity;
}
return null;
}
use of org.orcid.persistence.jpa.entities.EndDateEntity in project ORCID-Source by ORCID.
the class JpaJaxbServiceAdapterTest method getEntity.
private OrgAffiliationRelationEntity getEntity() {
OrgEntity orgEntity = new OrgEntity();
orgEntity.setCity("org:city");
orgEntity.setCountry(org.orcid.jaxb.model.message.Iso3166Country.US);
orgEntity.setName("org:name");
orgEntity.setRegion("org:region");
orgEntity.setUrl("org:url");
orgEntity.setSource(new SourceEntity("APP-000000001"));
OrgAffiliationRelationEntity result = new OrgAffiliationRelationEntity();
result.setAffiliationType(AffiliationType.SERVICE);
result.setDepartment("service:department");
result.setEndDate(new EndDateEntity(2020, 2, 2));
result.setId(123456L);
result.setOrg(orgEntity);
result.setProfile(new ProfileEntity("0000-0001-0002-0003"));
result.setStartDate(new StartDateEntity(2000, 1, 1));
result.setTitle("service:title");
result.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
result.setClientSourceId("APP-000000001");
return result;
}
use of org.orcid.persistence.jpa.entities.EndDateEntity in project ORCID-Source by ORCID.
the class JpaJaxbInvitedPositionAdapterTest method getEntity.
private OrgAffiliationRelationEntity getEntity() {
OrgEntity orgEntity = new OrgEntity();
orgEntity.setCity("org:city");
orgEntity.setCountry(org.orcid.jaxb.model.message.Iso3166Country.US);
orgEntity.setName("org:name");
orgEntity.setRegion("org:region");
orgEntity.setUrl("org:url");
orgEntity.setSource(new SourceEntity("APP-000000001"));
OrgAffiliationRelationEntity result = new OrgAffiliationRelationEntity();
result.setAffiliationType(AffiliationType.INVITED_POSITION);
result.setDepartment("invited-position:department");
result.setEndDate(new EndDateEntity(2020, 2, 2));
result.setId(123456L);
result.setOrg(orgEntity);
result.setProfile(new ProfileEntity("0000-0001-0002-0003"));
result.setStartDate(new StartDateEntity(2000, 1, 1));
result.setTitle("invited-position:title");
result.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
result.setClientSourceId("APP-000000001");
return result;
}
use of org.orcid.persistence.jpa.entities.EndDateEntity in project ORCID-Source by ORCID.
the class JpaJaxbDistinctionAdapterTest method getEntity.
private OrgAffiliationRelationEntity getEntity() {
OrgEntity orgEntity = new OrgEntity();
orgEntity.setCity("org:city");
orgEntity.setCountry(org.orcid.jaxb.model.message.Iso3166Country.US);
orgEntity.setName("org:name");
orgEntity.setRegion("org:region");
orgEntity.setUrl("org:url");
orgEntity.setSource(new SourceEntity("APP-000000001"));
OrgAffiliationRelationEntity result = new OrgAffiliationRelationEntity();
result.setAffiliationType(AffiliationType.DISTINCTION);
result.setDepartment("distinction:department");
result.setEndDate(new EndDateEntity(2020, 2, 2));
result.setId(123456L);
result.setOrg(orgEntity);
result.setProfile(new ProfileEntity("0000-0001-0002-0003"));
result.setStartDate(new StartDateEntity(2000, 1, 1));
result.setTitle("distinction:title");
result.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
result.setClientSourceId("APP-000000001");
return result;
}
use of org.orcid.persistence.jpa.entities.EndDateEntity in project ORCID-Source by ORCID.
the class JpaJaxbEducationAdapterTest method getEducationEntity.
private OrgAffiliationRelationEntity getEducationEntity() {
OrgEntity orgEntity = new OrgEntity();
orgEntity.setCity("org:city");
orgEntity.setCountry(org.orcid.jaxb.model.message.Iso3166Country.US);
orgEntity.setName("org:name");
orgEntity.setRegion("org:region");
orgEntity.setUrl("org:url");
orgEntity.setSource(new SourceEntity("APP-000000001"));
OrgAffiliationRelationEntity result = new OrgAffiliationRelationEntity();
result.setAffiliationType(AffiliationType.EDUCATION);
result.setDepartment("education:department");
result.setEndDate(new EndDateEntity(2020, 2, 2));
result.setId(123456L);
result.setOrg(orgEntity);
result.setProfile(new ProfileEntity("0000-0001-0002-0003"));
result.setStartDate(new StartDateEntity(2000, 1, 1));
result.setTitle("education:title");
result.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
result.setClientSourceId("APP-000000001");
return result;
}
Aggregations