Search in sources :

Example 1 with I5Options

use of net.idea.i5.io.I5Options in project ambit-mirror by ideaconsult.

the class Context method importI5Z.

protected int importI5Z(IStructureKey keytomatch, boolean i6, StructureRecordValidator validator) throws Exception {
    // validator uses parsertype
    setParserType(i6 ? _parsertype.i6z : _parsertype.i5z);
    logger_cli.log(Level.INFO, "MSG_IMPORT", new Object[] { String.format("i%sz", i6 ? "6" : "5"), inputFile.getAbsolutePath() });
    IZReader reader = null;
    Connection c = null;
    try {
        DBConnectionConfigurable<Context> dbc = null;
        dbc = getConnection(getConfigFile());
        c = dbc.getConnection();
        c.setAutoCommit(true);
        I5Options options = new I5Options();
        options.setMaxReferenceStructures(maxRefSubstances);
        options.setExceptionOnMaxReferenceStructures(false);
        options.setAllowMultipleSubstances(false);
        if (i6)
            reader = new I6ZReader<>(inputFile, options);
        else
            reader = new I5ZReader<>(inputFile, options);
        QASettings qa = new QASettings(false);
        qa.setAll();
        reader.setQASettings(qa);
        matchByKey = keytomatch == null ? new CASKey() : keytomatch;
        return write(reader, c, matchByKey, true, clearMeasurements, clearComposition, validator, null, true, false);
    } catch (Exception x) {
        throw x;
    } finally {
        if (reader != null)
            reader.close();
        try {
            if (c != null)
                c.close();
        } catch (Exception x) {
        }
    }
}
Also used : I5Options(net.idea.i5.io.I5Options) IZReader(net.idea.i5.io.IZReader) CASKey(ambit2.core.processors.structure.key.CASKey) Connection(java.sql.Connection) MySQLSingleConnection(net.idea.modbcum.c.MySQLSingleConnection) QASettings(net.idea.i5.io.QASettings) I5ZReader(net.idea.i5.io.I5ZReader) I6ZReader(net.idea.i6.io.I6ZReader) AmbitException(net.idea.modbcum.i.exceptions.AmbitException) CommunicationsException(com.mysql.jdbc.CommunicationsException) FileNotFoundException(java.io.FileNotFoundException) SQLException(java.sql.SQLException) ConnectException(java.net.ConnectException) IOException(java.io.IOException)

Aggregations

CASKey (ambit2.core.processors.structure.key.CASKey)1 CommunicationsException (com.mysql.jdbc.CommunicationsException)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ConnectException (java.net.ConnectException)1 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 I5Options (net.idea.i5.io.I5Options)1 I5ZReader (net.idea.i5.io.I5ZReader)1 IZReader (net.idea.i5.io.IZReader)1 QASettings (net.idea.i5.io.QASettings)1 I6ZReader (net.idea.i6.io.I6ZReader)1 MySQLSingleConnection (net.idea.modbcum.c.MySQLSingleConnection)1 AmbitException (net.idea.modbcum.i.exceptions.AmbitException)1