Package org.apache.commons.dbutils.handlers

Examples of org.apache.commons.dbutils.handlers.MapListHandler


   *
   */
  public static void loadParameters() {

      QueryRunner queryRunner = new QueryRunner(DataSourceHandler.getDataSource());
      ResultSetHandler rsh = new MapListHandler();
      String sql = "select * from parameter";
     
      try {
        parameterMap = (Map) queryRunner.query(sql, rsh);
      } catch (SQLException se) {
View Full Code Here


    String orderClause,
    String whereClause)
    throws ControllerException {

    QueryRunner queryRunner = new QueryRunner(dataSource);
    ResultSetHandler rsh = new MapListHandler();
    String sql = null;

    try {
      sql = "SELECT * FROM " + tableName;

View Full Code Here

   */
  public List findAllWhere(String tableName, String orderClause, String whereClause)
  throws ControllerException  {

    QueryRunner queryRunner = new QueryRunner();
    ResultSetHandler rsh = new MapListHandler();
    String sql = null;

    try {
      sql = "SELECT * FROM " + tableName;
     
View Full Code Here

   */
  public Map findWhere(String tableName, String whereClause)
  throws ControllerException, FinderException  {

    QueryRunner queryRunner = new QueryRunner();
    ResultSetHandler rsh = new MapListHandler();
    String sql = null;

    try {
      sql = "SELECT * FROM " + tableName;
     
View Full Code Here

    throws ControllerException  {
   
    List resultList = new ArrayList();
    Map titleMap;
    QueryRunner queryRunner = new QueryRunner(dataSource);
    ResultSetHandler rsh = new MapListHandler();
    String sql = null;

    try {
      sql = "select * from contact_detail, contact_type";
      sql += " where (";
View Full Code Here

   */
  public List findPayments(int invoiceID)
    throws ControllerException  {
   
    QueryRunner queryRunner = new QueryRunner(dataSource);
    ResultSetHandler rsh = new MapListHandler();
    String sql = null;

    try {
      // Get connection from the connection pool
      sql = "select * from payment, tender";
View Full Code Here

   */
  public List findInvoices(int clientID)
      throws ControllerException  {
   
    QueryRunner queryRunner = new QueryRunner(dataSource);
    ResultSetHandler mapListRsh = new MapListHandler();
    ResultSetHandler mapRsh = new MapHandler();
    String sql = null;
 
    try {
      // Get connection from the connection pool
View Full Code Here

    throws ControllerException  {
   
    List resultList = new ArrayList();
    Map roleMap;
    QueryRunner queryRunner = new QueryRunner(dataSource);
    ResultSetHandler rsh = new MapListHandler();
    String sql = null;

    try {
      // Get connection from the connection pool
      sql = "select * from person_role, role";
View Full Code Here

    DataSourceHandler.setPassword(passWordInPlainText);
    DataSource dataSource = DataSourceHandler.getDataSource();
   
    QueryRunner queryRunner = new QueryRunner(dataSource);
    ResultSetHandler rshMap = new MapHandler();
    ResultSetHandler rshList = new MapListHandler();

    try {
      String sql =
        "select * from person" + " where (" + " (user_name=?)" + " )";
      personMap = (Map) queryRunner.query(sql, userName, rshMap);
View Full Code Here

      addColumn("keelusers", "ldapname", "varchar(120)");

      updateColumnType("keelusers", "passwd", "varchar(255)");

      for (Map<String, Object> row : (List<Map<String, Object>>) query("SELECT uniqid, userName FROM keelusers",
              new MapListHandler()))
      {
        update("UPDATE keelusers SET passwd = '" + StringTools.digest(row.get("userName"))
                + "' WHERE uniqid = " + row.get("uniqid"));
      }

      for (Map<String, Object> row : (List<Map<String, Object>>) query("SELECT id, name FROM IritgoUser",
              new MapListHandler()))
      {
        update("UPDATE IritgoUser SET password = '" + StringTools.digest(row.get("name")) + "' WHERE id = "
                + row.get("id"));
      }

      for (Map<String, Object> row : (List<Map<String, Object>>) query("SELECT id, name FROM AktarioUser",
              new MapListHandler()))
      {
        update("UPDATE AktarioUser SET password = '" + StringTools.digest(row.get("name")) + "' WHERE id = "
                + row.get("id"));
      }

      currentVersion.setVersion("2.2.1");
    }

    if (currentVersion.lessThan("2.3.1"))
    {
      updateColumnType("keelusers", "uniqid", "int");

      renameIdColumn("AkteraGroup", "akteraGroupId", "id");
      updateColumnType("AkteraGroup", "name", "varchar(255)");
      addColumn("AkteraGroup", "visible", "boolean");
      addColumn("AkteraGroup", "title", "varchar(255)");

      update("UPDATE AkteraGroup SET visible = true");
      update("UPDATE AkteraGroup SET protect = false where protect is null");

      if (count("AkteraGroup", "name = '" + AkteraGroup.GROUP_NAME_ADMINISTRATOR + "'") == 0)
      {
        insert("AkteraGroup", "name", "'" + AkteraGroup.GROUP_NAME_ADMINISTRATOR + "'", "protect", "true",
                "visible", "false", "title", "'$Aktera:administrators'");

        long adminGroupId = NumberTools.toLong(selectString("AkteraGroup", "id", "name = '"
                + AkteraGroup.GROUP_NAME_ADMINISTRATOR + "'"), - 1);
        if (adminGroupId != - 1)
        {
          long adminUserId = NumberTools.toLong(selectString("keelusers", "uniqid", "username = '"
                  + AkteraUser.USER_NAME_ADMINISTRATOR + "'"), - 1);
          if (adminUserId != - 1)
          {
            insert("AkteraGroupEntry", "groupId", String.valueOf(adminGroupId), "userId", String
                    .valueOf(adminUserId), "position", "1");
          }
        }
      }

      if (count("AkteraGroup", "name = '" + AkteraGroup.GROUP_NAME_MANAGER + "'") == 0)
      {
        insert("AkteraGroup", "name", "'" + AkteraGroup.GROUP_NAME_MANAGER + "'", "protect", "true", "visible",
                "false", "title", "'$Aktera:managers'");

        long managerGroupId = NumberTools.toLong(selectString("AkteraGroup", "id", "name = '"
                + AkteraGroup.GROUP_NAME_MANAGER + "'"), - 1);
        if (managerGroupId != - 1)
        {
          long managerUserId = NumberTools.toLong(selectString("keelusers", "uniqid", "username = '"
                  + AkteraUser.USER_NAME_MANAGER + "'"), - 1);
          if (managerUserId != - 1)
          {
            insert("AkteraGroupEntry", "groupId", String.valueOf(managerGroupId), "userId", String
                    .valueOf(managerUserId), "position", "1");
          }
        }
      }

      if (count("AkteraGroup", "name = '" + AkteraGroup.GROUP_NAME_USER + "'") == 0)
      {
        insert("AkteraGroup", "name", "'" + AkteraGroup.GROUP_NAME_USER + "'", "protect", "true", "visible",
                "false", "title", "'$Aktera:users'");

        long userGroupId = NumberTools.toLong(selectString("AkteraGroup", "id", "name = '"
                + AkteraGroup.GROUP_NAME_USER + "'"), - 1);
        if (userGroupId != - 1)
        {
          int position = 1;
          for (Map<String, Object> row : (List<Map<String, Object>>) query(
                  "SELECT uniqid FROM keelusers WHERE uniqid > 2", new MapListHandler()))
          {
            insert("AkteraGroupEntry", "groupId", String.valueOf(userGroupId), "userId", String.valueOf(row
                    .get("uniqid")), "position", String.valueOf(position++));
          }
        }
View Full Code Here

TOP

Related Classes of org.apache.commons.dbutils.handlers.MapListHandler

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.