Search in sources :

Example 1 with OrgDisambiguatedEntity

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++;
}
Also used : OrgDisambiguatedEntity(org.orcid.persistence.jpa.entities.OrgDisambiguatedEntity)

Example 2 with OrgDisambiguatedEntity

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;
}
Also used : OrgDisambiguatedEntity(org.orcid.persistence.jpa.entities.OrgDisambiguatedEntity) Iso3166Country(org.orcid.jaxb.model.message.Iso3166Country)

Example 3 with OrgDisambiguatedEntity

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;
}
Also used : OrgDisambiguatedEntity(org.orcid.persistence.jpa.entities.OrgDisambiguatedEntity)

Example 4 with OrgDisambiguatedEntity

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);
    }
}
Also used : OrgDisambiguatedEntity(org.orcid.persistence.jpa.entities.OrgDisambiguatedEntity)

Example 5 with OrgDisambiguatedEntity

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;
}
Also used : OrgDisambiguatedEntity(org.orcid.persistence.jpa.entities.OrgDisambiguatedEntity) OrgDisambiguated(org.orcid.pojo.OrgDisambiguated)

Aggregations

OrgDisambiguatedEntity (org.orcid.persistence.jpa.entities.OrgDisambiguatedEntity)15 Iso3166Country (org.orcid.jaxb.model.message.Iso3166Country)3 FuzzyDateEntity (org.orcid.persistence.jpa.entities.FuzzyDateEntity)2 CSVWriter (au.com.bytecode.opencsv.CSVWriter)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Date (java.util.Date)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 XPathExpressionException (javax.xml.xpath.XPathExpressionException)1 FundingExternalIdentifiers (org.orcid.core.adapter.impl.jsonidentifiers.FundingExternalIdentifiers)1 AmbiguousOrgEntity (org.orcid.persistence.jpa.entities.AmbiguousOrgEntity)1 OrgEntity (org.orcid.persistence.jpa.entities.OrgEntity)1 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)1 OrgDisambiguated (org.orcid.pojo.OrgDisambiguated)1 Document (org.w3c.dom.Document)1 NodeList (org.w3c.dom.NodeList)1 SAXException (org.xml.sax.SAXException)1