Search in sources :

Example 1 with AmbiguousOrgEntity

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

the class OrgManagerImpl method writeAmbiguousOrgs.

@Override
public void writeAmbiguousOrgs(Writer writer) {
    @SuppressWarnings("resource") CSVWriter csvWriter = new CSVWriter(writer);
    csvWriter.writeNext(AMBIGUOUS_ORGS_HEADER);
    int firstResult = 0;
    List<AmbiguousOrgEntity> chunk = null;
    do {
        chunk = getAmbiguousOrgs(firstResult, CHUNK_SIZE);
        for (AmbiguousOrgEntity orgEntity : chunk) {
            String[] line = new String[] { String.valueOf(orgEntity.getId()), orgEntity.getSourceOrcid(), orgEntity.getName(), orgEntity.getCity(), orgEntity.getRegion(), orgEntity.getCountry().value(), String.valueOf(orgEntity.getUsedCount()) };
            csvWriter.writeNext(line);
        }
        firstResult += chunk.size();
    } while (!chunk.isEmpty());
}
Also used : CSVWriter(au.com.bytecode.opencsv.CSVWriter) AmbiguousOrgEntity(org.orcid.persistence.jpa.entities.AmbiguousOrgEntity)

Example 2 with AmbiguousOrgEntity

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

the class OrgManagerImpl method writeAmbiguousOrgs.

@Override
public void writeAmbiguousOrgs(Writer writer) {
    @SuppressWarnings("resource") CSVWriter csvWriter = new CSVWriter(writer);
    csvWriter.writeNext(AMBIGUOUS_ORGS_HEADER);
    int firstResult = 0;
    List<AmbiguousOrgEntity> chunk = null;
    do {
        chunk = getAmbiguousOrgs(firstResult, CHUNK_SIZE);
        for (AmbiguousOrgEntity orgEntity : chunk) {
            String[] line = new String[] { String.valueOf(orgEntity.getId()), orgEntity.getSourceOrcid(), orgEntity.getName(), orgEntity.getCity(), orgEntity.getRegion(), orgEntity.getCountry().value(), String.valueOf(orgEntity.getUsedCount()) };
            csvWriter.writeNext(line);
        }
        firstResult += chunk.size();
    } while (!chunk.isEmpty());
}
Also used : CSVWriter(au.com.bytecode.opencsv.CSVWriter) AmbiguousOrgEntity(org.orcid.persistence.jpa.entities.AmbiguousOrgEntity)

Aggregations

CSVWriter (au.com.bytecode.opencsv.CSVWriter)2 AmbiguousOrgEntity (org.orcid.persistence.jpa.entities.AmbiguousOrgEntity)2