Search in sources :

Example 1 with QueryParam

use of net.idea.modbcum.i.query.QueryParam in project ambit-mirror by ideaconsult.

the class QueryCachedResults method getParameters.

public List<QueryParam> getParameters() throws AmbitException {
    if ((getFieldname() == null) || (getValue() == null) || (getCategory() == null))
        throw new AmbitException("Undefined parameters");
    List<QueryParam> params = new ArrayList<QueryParam>();
    params.add(new QueryParam<String>(String.class, getCategory()));
    params.add(new QueryParam<String>(String.class, getFieldname()));
    params.add(new QueryParam<Integer>(Integer.class, getValue().getIdchemical()));
    return params;
}
Also used : QueryParam(net.idea.modbcum.i.query.QueryParam) ArrayList(java.util.ArrayList) AmbitException(net.idea.modbcum.i.exceptions.AmbitException)

Example 2 with QueryParam

use of net.idea.modbcum.i.query.QueryParam in project ambit-mirror by ideaconsult.

the class PreparedStatementBatchExecutor method addBatch.

public int addBatch(Q query) throws SQLException, AmbitException {
    String[] sqls = query.getSQL();
    int n = 0;
    for (int i = 0; i < sqls.length; i++) {
        PreparedStatement ps = getCachedStatement(sqls[i]);
        if (ps == null) {
            if (query.returnKeys(i))
                ps = connection.prepareStatement(sqls[i], Statement.RETURN_GENERATED_KEYS);
            else
                ps = connection.prepareStatement(sqls[i]);
            addStatementToCache(sqls[i], ps);
        }
        List<QueryParam> params = query.getParameters(i);
        StatementExecutor.setParameters(ps, params);
        ps.addBatch();
        n++;
    }
    return n;
}
Also used : QueryParam(net.idea.modbcum.i.query.QueryParam) PreparedStatement(java.sql.PreparedStatement)

Example 3 with QueryParam

use of net.idea.modbcum.i.query.QueryParam in project ambit-mirror by ideaconsult.

the class BookmarksByTopicFacetQuery method getParameters.

@Override
public List<QueryParam> getParameters() throws AmbitException {
    if ((getFieldname() == null) || (getFieldname().getCreator() == null))
        throw new AmbitException("No user name");
    List<QueryParam> params = new ArrayList<QueryParam>();
    params.add(new QueryParam<String>(String.class, getFieldname().getCreator()));
    return params;
}
Also used : QueryParam(net.idea.modbcum.i.query.QueryParam) ArrayList(java.util.ArrayList) AmbitException(net.idea.modbcum.i.exceptions.AmbitException)

Example 4 with QueryParam

use of net.idea.modbcum.i.query.QueryParam in project ambit-mirror by ideaconsult.

the class EndpointRoleByBundle method getParameters.

@Override
public List<QueryParam> getParameters() throws AmbitException {
    if ((getFieldname() == null) || (getFieldname().getEndpoint() == null || getFieldname().getSubcategoryTitle() == null))
        throw new AmbitException("Endpoint not defined");
    if (getValue() == null || getValue().getID() <= 0)
        throw new AmbitException("Bundle not defined");
    List<QueryParam> params = new ArrayList<QueryParam>();
    params.add(new QueryParam<Integer>(Integer.class, getValue().getID()));
    params.add(new QueryParam<String>(String.class, getFieldname().getSubcategoryTitle()));
    params.add(new QueryParam<String>(String.class, getFieldname().getEndpoint().name()));
    return params;
}
Also used : QueryParam(net.idea.modbcum.i.query.QueryParam) ArrayList(java.util.ArrayList) AmbitException(net.idea.modbcum.i.exceptions.AmbitException)

Example 5 with QueryParam

use of net.idea.modbcum.i.query.QueryParam in project ambit-mirror by ideaconsult.

the class SubstanceRoleByBundle method getParameters.

@Override
public List<QueryParam> getParameters() throws AmbitException {
    if ((getFieldname() == null) || (getFieldname().getIdsubstance() <= 0))
        throw new AmbitException("Substance not defined");
    if (getValue() == null || getValue().getID() <= 0)
        throw new AmbitException("Bundle not defined");
    List<QueryParam> params = new ArrayList<QueryParam>();
    params.add(new QueryParam<Integer>(Integer.class, getValue().getID()));
    params.add(new QueryParam<Integer>(Integer.class, getFieldname().getIdsubstance()));
    return params;
}
Also used : QueryParam(net.idea.modbcum.i.query.QueryParam) ArrayList(java.util.ArrayList) AmbitException(net.idea.modbcum.i.exceptions.AmbitException)

Aggregations

QueryParam (net.idea.modbcum.i.query.QueryParam)128 AmbitException (net.idea.modbcum.i.exceptions.AmbitException)110 ArrayList (java.util.ArrayList)109 Test (org.junit.Test)7 Property (ambit2.base.data.Property)6 AbstractPropertyWriter.mode (ambit2.db.processors.AbstractPropertyWriter.mode)3 FP1024_status (ambit2.db.processors.FP1024Writer.FP1024_status)3 QueryField (ambit2.db.search.structure.QueryField)3 BigInteger (java.math.BigInteger)3 PreparedStatement (java.sql.PreparedStatement)3 ResultSet (java.sql.ResultSet)3 SQLException (java.sql.SQLException)3 DbAmbitException (net.idea.modbcum.i.exceptions.DbAmbitException)3 ILiteratureEntry (ambit2.base.data.ILiteratureEntry)2 ISourceDataset (ambit2.base.data.ISourceDataset)2 Params (ambit2.base.data.study.Params)2 IStructureRecord (ambit2.base.interfaces.IStructureRecord)2 DictionarySubjectQuery (ambit2.db.search.DictionarySubjectQuery)2 IStoredQuery (ambit2.db.search.IStoredQuery)2 QueryCombined (ambit2.db.search.QueryCombined)2