Examples of SqlMapClient


Examples of com.ibatis.sqlmap.client.SqlMapClient

        }
    }

    @SuppressWarnings("unchecked")
    public List<Object> poll(IBatisConsumer consumer, IBatisEndpoint endpoint) throws Exception {
        SqlMapClient client = endpoint.getSqlMapClient();
        return client.queryForList(endpoint.getStatement(), null);
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

    protected SqlMapClient getSqlMapClient() throws Exception {
        String dataSourceId = config.getFeedConfigLocation();
        if (sqlMapClients.containsKey(dataSourceId)) {
            return sqlMapClients.get(dataSourceId);
        } else {
            SqlMapClient client =
                SqlMapClientBuilder.buildSqlMapClient(config.getAdapterConfiguration().getAdapterConfigAsReader());
            sqlMapClients.put(dataSourceId, client);
            return client;
        }
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

        }
    }

    @SuppressWarnings("unchecked")
    public Feed getFeed() throws Exception {
        SqlMapClient client = getSqlMapClient();
        String queryId = config.getFeedId() + "-get-feed";
        List<Map<String, Object>> rows = client.queryForList(queryId);
        Feed feed = createFeed();
        ServerConfiguration serverConfig = config.getServerConfiguration();
        if (serverConfig.getFeedNamespacePrefix() != null && serverConfig.getFeedNamespacePrefix().length() > 0) {
            feed.declareNS(serverConfig.getFeedNamespace(), serverConfig.getFeedNamespacePrefix());
        }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

    }

    @SuppressWarnings("unchecked")
    public Entry getEntry(Object entryId) throws Exception {
        String queryId = config.getFeedId() + "-get-entry";
        SqlMapClient client = getSqlMapClient();
        Map<String, Object> row = (Map<String, Object>)client.queryForObject(queryId, entryId);
        if (row == null) {
            // didn't find the entry.
            return null;
        }
        return createEntryFromRow(null, row);
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

        }
        return createEntryFromRow(null, row);
    }

    public Entry createEntry(Entry entry) throws Exception {
        SqlMapClient client = getSqlMapClient();
        String queryId = config.getFeedId() + "-insert-entry";
        Object newEntryId = client.insert(queryId, collectColumns(entry));
        return getEntry(newEntryId);
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

        Object newEntryId = client.insert(queryId, collectColumns(entry));
        return getEntry(newEntryId);
    }

    public Entry updateEntry(Object entryId, Entry entry) throws Exception {
        SqlMapClient client = getSqlMapClient();
        String queryId = config.getFeedId() + "-update-entry";
        return client.update(queryId, collectColumns(entry)) > 0 ? getEntry(entryId) : null;
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

        return client.update(queryId, collectColumns(entry)) > 0 ? getEntry(entryId) : null;
    }

    public boolean deleteEntry(Object entryId) throws Exception {
        String queryId = config.getFeedId() + "-delete-entry";
        SqlMapClient client = getSqlMapClient();
        return client.delete(queryId, entryId) > 0;
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

            throw new IllegalArgumentException("Unsupported statementType: " + endpoint.getStatementType());
        }
    }

    private void doQueryForObject(Exchange exchange) throws Exception {
        SqlMapClient client = endpoint.getSqlMapClient();

        Object result;
        Object in = exchange.getIn().getBody();
        if (in != null) {
            LOG.trace("QueryForObject: {} using statement: {}", in, statement);
            result = client.queryForObject(statement, in);
        } else {
            LOG.trace("QueryForObject using statement: {}", statement);
            result = client.queryForObject(statement);
        }

        doProcessResult(exchange, result);
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

        doProcessResult(exchange, result);
    }

    private void doQueryForList(Exchange exchange) throws Exception {
        SqlMapClient client = endpoint.getSqlMapClient();

        Object result;
        Object in = exchange.getIn().getBody();
        if (in != null) {
            LOG.trace("QueryForList: {} using statement: {}", in, statement);
            result = client.queryForList(statement, in);
        } else {
            LOG.trace("QueryForList using statement: {}", statement);
            result = client.queryForList(statement);
        }

        doProcessResult(exchange, result);
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

        doProcessResult(exchange, result);
    }

    private void doInsert(Exchange exchange) throws Exception {
        SqlMapClient client = endpoint.getSqlMapClient();

        Object result;
        Object in = exchange.getIn().getBody();
        if (in != null) {
            // lets handle arrays or collections of objects
            Iterator iter = ObjectHelper.createIterator(in);
            while (iter.hasNext()) {
                Object value = iter.next();
                LOG.trace("Inserting: {} using statement: {}", value, statement);
                result = client.insert(statement, value);
                doProcessResult(exchange, result);
            }
        } else {
            LOG.trace("Inserting using statement: {}", statement);
            result = client.insert(statement);
            doProcessResult(exchange, result);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.