Examples of SqlMapClient


Examples of com.ibatis.sqlmap.client.SqlMapClient

  public static int LOGIN_ERROR = -1 ;
  public static int VALIDATE_FAIL = -2 ;
  public static int VALIDATE_OK  =  0 ;
  public static int login(String username, String passwd) throws Exception
  {
    SqlMapClient client = Utils.getMapClient();
    SysUser user = null;   
    user = (SysUser)client.queryForObject("user.getUserByUserName", username);   
    if(user == null) return LOGIN_ERROR;   
    if(user.getPassword().equals(passwd))
    {
      ActionContext.getContext().getSession().put("user", user);
      return user.getUserId().intValue();
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

      return user.getUserId().intValue();
    }
    else return LOGIN_ERROR;
  }
  public static int validateName(String username)throws Exception{
    SqlMapClient client = Utils.getMapClient();
    SysUser user = null;
    user = (SysUser)client.queryForObject("user.getUserByUserName",username);
    if(user != null) return VALIDATE_FAIL;
    return VALIDATE_OK;
  }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

  public String execute() throws Exception{
    System.out.println(userName);
    return ActionSupport.SUCCESS;
  }
  public static void main(String []args)throws Exception{
    SqlMapClient client = Utils.getMapClient();
    Object user = client.queryForObject("user.getUserByUserName","admin");
   
  }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

  }

  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    try {
      SqlMapClient client = null;
      ServletContext context = getServletContext();// ʹ��context���õ�ʵ�ʵ�file
                              // path.
      DataInputStream input = new DataInputStream(context
          .getResourceAsStream("SqlMapConfig.xml"));
      client = Utils.getSqlMapClient(input);
     
      List<FileModel> models= null;     
      models = client.queryForList("getModels");
     
      ObjectOutputStream oos = new ObjectOutputStream(resp.getOutputStream());
      oos.writeObject(models);
      oos.flush();
      oos.close()
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

  }

  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    try {
      SqlMapClient client = null;
      ServletContext context = getServletContext();// ʹ��context���õ�ʵ�ʵ�file
                              // path.
      DataInputStream input = new DataInputStream(context
          .getResourceAsStream("SqlMapConfig.xml"));
      client = Utils.getSqlMapClient(input);
     
      FileModel model = null;
      recid = Integer.valueOf(req.getParameter("recid"));
      model= (FileModel) client.queryForObject("getModel",recid);
      if(model != null){
        List<DrawModel> draws = client.queryForList("getDraws",recid);
        model.setDraws(draws);
      }         
     
     
      ObjectOutputStream oos = new ObjectOutputStream(resp.getOutputStream());
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

 
  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    try {
      SqlMapClient client = null;
      ServletContext context = getServletContext();// ʹ��context���õ�ʵ�ʵ�file
                              // path.
      DataInputStream input = new DataInputStream(context
          .getResourceAsStream("SqlMapConfig.xml"));
      client = Utils.getSqlMapClient(input);
      //TODO ��δ�req��ȡ��FileModel�����IJ����أ�
      FileModel fileModel = null ;
      ObjectInputStream ois = new ObjectInputStream(req.getInputStream());
      fileModel = (FileModel)ois.readObject();
      ois.close();
      if(fileModel != null){
        System.out.println("UpdateModel#fileModel!=null");
      }else{
        System.out.println("UpdateModel#fileModel==null");
      }
      client.update("updateModel", fileModel);
      List<DrawModel> draws = fileModel.getDraws();
      for(int i = 0;i<draws.size();i++){
        client.update("updateDrawModel",draws.get(i));
      }         
     
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

    if (ObjectUtils.isEmpty(configLocations)) {
      throw new IllegalArgumentException("At least 1 'configLocation' entry is required");
    }

    SqlMapClient client = null;
    SqlMapConfigParser configParser = new SqlMapConfigParser();
    for (int i = 0; i < configLocations.length; i++) {
      InputStream is = configLocations[i].getInputStream();
      try {
        client = configParser.parse(is, properties);
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

* Default strategy for consuming messages for a route
*/
public class DefaultIBatisProcessingStategy implements IBatisProcessingStrategy {

    public void commit(IBatisEndpoint endpoint, Exchange exchange, Object data, String consumeStatements) throws Exception {
        SqlMapClient client = endpoint.getSqlMapClient();
        boolean useTrans = endpoint.isUseTransactions();
        String[] statements = consumeStatements.split(",");
        try {
            if (useTrans) {
                client.startTransaction(Connection.TRANSACTION_REPEATABLE_READ);
            }
            for (String statement : statements) {
                client.update(statement.trim(), data);
            }
            if (useTrans) {
                client.commitTransaction();
            }
        } finally {
            if (useTrans) {
                client.endTransaction();
            }
        }
    }
View Full Code Here

Examples of com.ibatis.sqlmap.client.SqlMapClient

            }
        }
    }

    public List poll(IBatisPollingConsumer 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

            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) {
            if (LOG.isTraceEnabled()) {
                LOG.trace("QueryForObject: " + in + "  using statement: " + statement);
            }
            result = client.queryForObject(statement, in);
        } else {
            if (LOG.isTraceEnabled()) {
                LOG.trace("QueryForObject using statement: " + statement);
            }
            result = client.queryForObject(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.