use of org.orcid.persistence.jpa.entities.OrgDisambiguatedEntity in project ORCID-Source by ORCID.
the class LoadRinggoldData method processNew.
private void processNew(String gpCode, String pCode, String name, String city, String state, Iso3166Country country, String type) {
if (isDuplicate(pCode, name, city, state, country)) {
return;
}
OrgDisambiguatedEntity orgDisambiguatedEntity = new OrgDisambiguatedEntity();
setFields(orgDisambiguatedEntity, gpCode, pCode, name, city, country, state, type);
orgDisambiguatedDao.persist(orgDisambiguatedEntity);
createOrUpdateOrg(name, city, country, state, orgDisambiguatedEntity.getId());
numAdded++;
}
use of org.orcid.persistence.jpa.entities.OrgDisambiguatedEntity in project ORCID-Source by ORCID.
the class LoadFundRefData method findByDetails.
/**
* DATABASE FUNCTIONS
* */
/**
* TODO
* */
private OrgDisambiguatedEntity findByDetails(RDFOrganization org) {
Iso3166Country country = StringUtils.isBlank(org.country) ? null : Iso3166Country.valueOf(org.country);
// Find the org by name, city, country and state
OrgDisambiguatedEntity existingEntity = orgDisambiguatedDao.findByNameCityRegionCountryAndSourceType(org.name, org.stateCode, org.stateCode, country, FUNDREF_SOURCE_TYPE);
// If no match is found, try with the doi and source type
if (existingEntity == null) {
existingEntity = orgDisambiguatedDao.findBySourceIdAndSourceType(org.doi, FUNDREF_SOURCE_TYPE);
}
return existingEntity;
}
use of org.orcid.persistence.jpa.entities.OrgDisambiguatedEntity in project ORCID-Source by ORCID.
the class LoadRinggoldData method isDuplicate.
private boolean isDuplicate(String pCode, String name, String city, String state, Iso3166Country country) {
OrgDisambiguatedEntity duplicate = orgDisambiguatedDao.findByNameCityRegionCountryAndSourceType(name, city, state, country, RINGGOLD_SOURCE_TYPE);
if (duplicate != null) {
LOGGER.info("Skipping disambiguated org with sourceId={} because it appears to be a duplicate of sourceId={}, sourceType={}", new Object[] { pCode, duplicate.getSourceId(), RINGGOLD_SOURCE_TYPE });
numSkipped++;
return true;
}
return false;
}
use of org.orcid.persistence.jpa.entities.OrgDisambiguatedEntity in project ORCID-Source by ORCID.
the class LoadRinggoldData method processOrg.
private void processOrg(String gpCode, String pCode, String name, String city, String state, Iso3166Country country, String type) {
OrgDisambiguatedEntity existingEntity = orgDisambiguatedDao.findBySourceIdAndSourceType(pCode, RINGGOLD_SOURCE_TYPE);
if (existingEntity == null) {
LOGGER.info("No existing disambiguated org with sourceId={} and sourceType={}", pCode, RINGGOLD_SOURCE_TYPE);
processNew(gpCode, pCode, name, city, state, country, type);
} else {
LOGGER.info("Found existing disambiguated org with sourceId={} and sourceType={}", pCode, RINGGOLD_SOURCE_TYPE);
processExisting(existingEntity, gpCode, pCode, name, city, country, state, type);
}
}
use of org.orcid.persistence.jpa.entities.OrgDisambiguatedEntity in project ORCID-Source by ORCID.
the class OrgDisambiguatedManagerImpl method findInDB.
@Override
public OrgDisambiguated findInDB(Long id) {
OrgDisambiguatedEntity orgDisambiguatedEntity = orgDisambiguatedDao.find(id);
OrgDisambiguated org = new OrgDisambiguated();
org.setValue(orgDisambiguatedEntity.getName());
org.setCity(orgDisambiguatedEntity.getCity());
org.setRegion(orgDisambiguatedEntity.getRegion());
org.setCountry(orgDisambiguatedEntity.getCountry().value());
org.setOrgType(orgDisambiguatedEntity.getOrgType());
org.setSourceId(orgDisambiguatedEntity.getSourceId());
org.setSourceType(orgDisambiguatedEntity.getSourceType());
return org;
}
Aggregations