Search in sources :

Example 1 with VNOrganization

use of org.devgateway.ocvn.persistence.mongo.dao.VNOrganization in project ocvn by devgateway.

the class PublicInstitutionRowImporter method importRow.

@Override
public void importRow(final String[] row) throws ParseException {
    if (getRowCell(row, 0) == null) {
        throw new RuntimeException("Main identifier empty!");
    }
    String newIdentifier = getRowCellUpper(row, 0);
    String name = getRowCellUpper(row, 1);
    VNOrganization organization = repository.findByName(name);
    Identifier identifier = new Identifier();
    identifier.setId(newIdentifier);
    if (organization == null) {
        organization = (VNOrganization) newOrganization(new VNOrganization(), identifier, name);
        newAddress(organization, getRowCell(row, 14));
        if (getRowCell(row, 44) != null) {
            Identifier additionalIdentifier = new Identifier();
            additionalIdentifier.setId(getRowCellUpper(row, 44));
            addAditionalIdentifierOrFail(organization, additionalIdentifier, null);
        }
        newContactPoint(organization, getRowCell(row, 5), getRowCell(row, 7), getRowCell(row, 8), getRowCell(row, 9), getRowCell(row, 18));
        if (getRowCell(row, 13) != null) {
            newCity(organization, getInteger(getRowCell(row, 13)));
        }
        if (getRowCell(row, 47) != null) {
            newDepartment(organization, getInteger(getRowCell(row, 47)));
        }
        if (getRowCell(row, 48) != null) {
            newOrgGroup(organization, getInteger(getRowCell(row, 48)));
        }
    } else {
        addAditionalIdentifierOrFail(organization, identifier, null);
    }
    repository.save(organization);
}
Also used : Identifier(org.devgateway.ocds.persistence.mongo.Identifier) VNOrganization(org.devgateway.ocvn.persistence.mongo.dao.VNOrganization)

Aggregations

Identifier (org.devgateway.ocds.persistence.mongo.Identifier)1 VNOrganization (org.devgateway.ocvn.persistence.mongo.dao.VNOrganization)1