Search in sources :

Example 1 with NamedParameterApplicator

use of com.adaptris.core.services.jdbc.NamedParameterApplicator in project interlok by adaptris.

the class JdbcRawDataCaptureServiceTest method createServiceNamedParameters.

private JdbcRawDataCaptureService createServiceNamedParameters(boolean createConnection) {
    JdbcRawDataCaptureService service = new JdbcRawDataCaptureService();
    if (createConnection) {
        JdbcConnection connection = new JdbcConnection();
        connection.setConnectUrl(PROPERTIES.getProperty(JDBC_CAPTURE_SERVICE_URL));
        connection.setDriverImp(PROPERTIES.getProperty(JDBC_CAPTURE_SERVICE_DRIVER));
        service.setConnection(connection);
    }
    service.setParameterApplicator(new NamedParameterApplicator());
    StatementParameter param1 = new StatementParameter(METADATA_KEY, "java.lang.String", StatementParameter.QueryType.metadata);
    param1.setName("param1");
    service.addStatementParameter(param1);
    DateStatementParameter param2 = new DateStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"));
    param2.setName("param2");
    service.addStatementParameter(param2);
    TimestampStatementParameter param3 = new TimestampStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"));
    param3.setName("param3");
    service.addStatementParameter(param3);
    TimeStatementParameter param4 = new TimeStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"));
    param4.setName("param4");
    service.addStatementParameter(param4);
    StatementParameter param5 = new StatementParameter(null, "java.lang.String", StatementParameter.QueryType.payload);
    param5.setName("param5");
    service.addStatementParameter(param5);
    BytePayloadStatementParameter param6 = new BytePayloadStatementParameter();
    param6.setName("param6");
    service.addStatementParameter(param6);
    CharacterStreamStatementParameter param7 = new CharacterStreamStatementParameter();
    param7.setName("param7");
    service.addStatementParameter(param7);
    BinaryStreamStatementParameter param8 = new BinaryStreamStatementParameter();
    param8.setName("param8");
    service.addStatementParameter(param8);
    StatementParameter param9 = new StatementParameter(null, "java.lang.String", StatementParameter.QueryType.id);
    param9.setName("param9");
    service.addStatementParameter(param9);
    StatementParameter param10 = new StatementParameter(CONSTANT_VALUE, "java.lang.String", StatementParameter.QueryType.constant);
    param10.setName("param10");
    service.addStatementParameter(param10);
    service.setStatement("insert into jdbc_raw_data_capture_basic " + "(string_value, date_value, timestamp_value, time_value, payload_clob, payload_blob, payload_clob2, payload_blob2, id_value, constant_value) " + "values (#param1, #param2, #param3, #param4, #param5, #param6, #param7, #param8, #param9, #param10)");
    return service;
}
Also used : BytePayloadStatementParameter(com.adaptris.core.services.jdbc.BytePayloadStatementParameter) CharacterStreamStatementParameter(com.adaptris.core.services.jdbc.CharacterStreamStatementParameter) DateStatementParameter(com.adaptris.core.services.jdbc.DateStatementParameter) BinaryStreamStatementParameter(com.adaptris.core.services.jdbc.BinaryStreamStatementParameter) TimeStatementParameter(com.adaptris.core.services.jdbc.TimeStatementParameter) TimestampStatementParameter(com.adaptris.core.services.jdbc.TimestampStatementParameter) BinaryStreamStatementParameter(com.adaptris.core.services.jdbc.BinaryStreamStatementParameter) TimestampStatementParameter(com.adaptris.core.services.jdbc.TimestampStatementParameter) DateStatementParameter(com.adaptris.core.services.jdbc.DateStatementParameter) BytePayloadStatementParameter(com.adaptris.core.services.jdbc.BytePayloadStatementParameter) TimeStatementParameter(com.adaptris.core.services.jdbc.TimeStatementParameter) StatementParameter(com.adaptris.core.services.jdbc.StatementParameter) CharacterStreamStatementParameter(com.adaptris.core.services.jdbc.CharacterStreamStatementParameter) JdbcConnection(com.adaptris.core.jdbc.JdbcConnection) NamedParameterApplicator(com.adaptris.core.services.jdbc.NamedParameterApplicator) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

JdbcConnection (com.adaptris.core.jdbc.JdbcConnection)1 BinaryStreamStatementParameter (com.adaptris.core.services.jdbc.BinaryStreamStatementParameter)1 BytePayloadStatementParameter (com.adaptris.core.services.jdbc.BytePayloadStatementParameter)1 CharacterStreamStatementParameter (com.adaptris.core.services.jdbc.CharacterStreamStatementParameter)1 DateStatementParameter (com.adaptris.core.services.jdbc.DateStatementParameter)1 NamedParameterApplicator (com.adaptris.core.services.jdbc.NamedParameterApplicator)1 StatementParameter (com.adaptris.core.services.jdbc.StatementParameter)1 TimeStatementParameter (com.adaptris.core.services.jdbc.TimeStatementParameter)1 TimestampStatementParameter (com.adaptris.core.services.jdbc.TimestampStatementParameter)1 SimpleDateFormat (java.text.SimpleDateFormat)1