Package com.ibatis.sqlmap.client

Examples of com.ibatis.sqlmap.client.SqlMapClient


  protected SqlMapClient getSqlMapClient() throws FeedServerAdapterException {
    String dataSourceId = config.getFeedConfigLocation();
    if (sqlMapClients.containsKey(dataSourceId)) {
      return sqlMapClients.get(dataSourceId);
    } else {
      SqlMapClient client;
      try {
        client =
            SqlMapClientBuilder.buildSqlMapClient(config.getAdapterConfiguration()
                .getAdapterConfigAsReader());
      } catch (IOException e) {
View Full Code Here


  }

  @Override
  @SuppressWarnings("unchecked")
  public Feed retrieveFeed(RequestContext request) throws FeedServerAdapterException {
    SqlMapClient client = getSqlMapClient();
    String queryId = config.getFeedId() + "-get-feed";
    List<Map<String, Object>> rows;
    try {
      rows = client.queryForList(queryId, getRequestParams(request));
    } catch (SQLException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ERROR_EXECUTING_ADAPTER_REQUEST, e.getMessage());
    }
    Feed feed = createFeed();
View Full Code Here

  @Override
  @SuppressWarnings("unchecked")
  public Entry retrieveEntry(RequestContext request, Object entryId)
      throws FeedServerAdapterException {
    String queryId = config.getFeedId() + "-get-entry";
    SqlMapClient client = getSqlMapClient();
    Map<String, Object> row;
    try {
      row = (Map<String, Object>) client.queryForObject(queryId, entryId,  getRequestParams(request));
    } catch (SQLException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ERROR_EXECUTING_ADAPTER_REQUEST, e.getMessage());
    }
    if (row == null) {
View Full Code Here

    return createEntryFromProperties(null, row);
  }

  @Override
  public Entry createEntry(RequestContext request, Entry entry) throws FeedServerAdapterException {
    SqlMapClient client = getSqlMapClient();
    String queryId = config.getFeedId() + "-insert-entry";
    Object newEntryId;
    try {
      Map<String, Object> params = getRequestParams(request);
      params.putAll(getPropertyMapForEntry(entry));
      newEntryId = client.insert(queryId, params);
    } catch (SQLException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ERROR_EXECUTING_ADAPTER_REQUEST, e.getMessage());
    }
    return retrieveEntry(request, newEntryId);
View Full Code Here

  }

  @Override
  public Entry updateEntry(RequestContext request, Object entryId, Entry entry)
      throws FeedServerAdapterException {
    SqlMapClient client = getSqlMapClient();
    String queryId = config.getFeedId() + "-update-entry";
    try {
        Map<String, Object> params = getRequestParams(request);
        params.putAll(getPropertyMapForEntry(entry));
      return client.update(queryId, params) > 0 ? retrieveEntry(request,
          entryId) : null;
    } catch (SQLException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ERROR_EXECUTING_ADAPTER_REQUEST, e.getMessage());
    }
View Full Code Here

  }

  @Override
  public void deleteEntry(RequestContext request, Object entryId) throws FeedServerAdapterException {
    String queryId = config.getFeedId() + "-delete-entry";
    SqlMapClient client = getSqlMapClient();
    try {
      Map<String, Object> params = getRequestParams(request);
      params.put("id", entryId);
      if (!(client.delete(queryId, params) > 0)) {
        throw new FeedServerAdapterException(
            FeedServerAdapterException.Reason.ERROR_EXECUTING_ADAPTER_REQUEST, "could not delete");
      }
    } catch (SQLException e) {
      throw new FeedServerAdapterException(
View Full Code Here

TOP

Related Classes of com.ibatis.sqlmap.client.SqlMapClient

Copyright © 2018 www.massapicom. 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.