Package edu.uga.galileo.voci.db

Examples of edu.uga.galileo.voci.db.QueryParser


      sql.append(" insert into role2user ");
      sql.append(" ( user_id, role_id ) ");
      sql.append(" values ");
      sql.append(" ( ?, ?) ");
   
      QueryParser qp = new QueryParser(sql.toString());
      qp.addPreparedStmtElementDefinition(user.getUserId());
      qp.addPreparedStmtElementDefinition( roleIds[i]);
 
      try
      {
        Configuration.getConnectionPool().executeInsertOrUpdate(qp);
      }
View Full Code Here


    StringBuffer userRoles = new StringBuffer();
    StringBuffer sql = new StringBuffer();
    sql.append(" select name, role_id from roles where role_id in ");
    sql.append(" (select role_id from role2user where user_id=?) order by name ");
   
    QueryParser qp = new QueryParser(sql.toString());
    qp.addPreparedStmtElementDefinition(userId);
    ArrayList<String> roleList = null;
    try
    {
      Configuration.getConnectionPool().executeQuery(qp);
      roleList = qp.getResults(String.class, "name");
     
      if( roleList == null )
      {
        throw new NoUserRolesException("Database errors prevented retrieval of role names for user");
      }
     
      for( int i = 0; i < qp.getResultCount(); i++)
      {
        ArrayList results = qp.getRowResults(i);
        userRoles.append( results.get(0).toString() + " (" + results.get(1).toString() + ")|" );       
      }
      /*for( String role: roleList )
      {
        userRoles.append( role + "|" );
View Full Code Here

    sql.append(" select DISTINCT name, role_id ");
    sql.append(" from roles where role_id in (select role_id from role2project where project_id =? ) ");
   
    //String description = "";

    QueryParser qp = new QueryParser(sql.toString());
    qp.addPreparedStmtElementDefinition(projectId);
    try
    {
      Configuration.getConnectionPool().executeQuery(qp);     
      for( int i = 0; i < qp.getResultCount(); i++)
      {
        ArrayList results = qp.getRowResults(i);
        roleNames.add( results.get(0).toString() + " (" + results.get(1).toString() + ")" );       
      }         
    }
    catch( SQLException e )
    {
View Full Code Here

    StringBuffer sql = new StringBuffer();
    sql.append(" select * ");
    sql.append(" from roles ");
    sql.append(" where role_id=? ");

    QueryParser qp = new QueryParser(sql.toString());
    qp.addPreparedStmtElementDefinition(roleId);

    try
    {
      Configuration.getConnectionPool().executeQuery(qp);
      if (qp.getResultCount() > 0)
      {
        role = createObjectFromQueryParser(Role.class, qp);
      }
      else
      {
View Full Code Here

    if( parentRoleId > 0 )
    {
      sql.append(" and parent_role_id=?");
    }

    QueryParser qp = new QueryParser(sql.toString());
    qp.addPreparedStmtElementDefinition(roleName);
    qp.addPreparedStmtElementDefinition(QueryParserElement.BOOLEAN, isManager);
    if( parentRoleId > 0 )
    {
      qp.addPreparedStmtElementDefinition(parentRoleId);
    }
   
    try
    {
      Configuration.getConnectionPool().executeQuery(qp);
      if (qp.getResultCount() > 0)
      {
        isRole = true;
      }     
    }
    catch( SQLException e1 )
View Full Code Here

    sql.append(" (select name from roles  ");
    sql.append(" where role_id in  ");
    sql.append(" ( select role_id from role2project  ");
    sql.append(" where project_id=? ) ) order by name ");

    QueryParser qp = new QueryParser(sql.toString());
    qp.addPreparedStmtElementDefinition(projectId);

    try
    {
      Configuration.getConnectionPool().executeQuery(qp);
      if (qp.getResultCount() == 0)
      {
        roleList = null;
      }
      else
      {
View Full Code Here

    sql.append(" name='bundles' or ");
    sql.append(" name='items' or ");
    sql.append(" name='import' or ");
    sql.append(" name='workflow')");
     
    QueryParser qp = new QueryParser(sql.toString());
    qp.addPreparedStmtElementDefinition(roleId);
    int counter = -1;
    try
    {
      Configuration.getConnectionPool().executeQuery(qp);
      counter = qp.getResult(Integer.class, "counter").intValue();
     
      if ( counter > 0 )
      {
        // its ok to delete
        qp = null;
        sql = new StringBuffer();
        sql.append(" delete from roles where role_id =?");
        qp = new QueryParser(sql.toString());
        qp.addPreparedStmtElementDefinition(roleId);
        try
        {
          Configuration.getConnectionPool().executeInsertOrUpdate(qp);
        }
        catch( SQLException e )
View Full Code Here

      sql.append(" parent_role_id=?,  ");
    }       
    sql.append(" name=?, description=?, manager=?, can_edit_xrefs=? ");
    sql.append(" where role_id=?");

    QueryParser qp = new QueryParser(sql.toString());
    // only update parentId if greater than 0
    if( role.getParentRoleId() > 0 )
    {
      qp.addPreparedStmtElementDefinition(role.getParentRoleId());
    }
    qp.addPreparedStmtElementDefinition(role.getName());
    qp.addPreparedStmtElementDefinition(role.getDescription());
    qp.addPreparedStmtElementDefinition(QueryParserElement.BOOLEAN, role.isManager());
    qp.addPreparedStmtElementDefinition(QueryParserElement.BOOLEAN, role.canEditXrefs());
    qp.addPreparedStmtElementDefinition(role.getRoleId());

    try
    {
      Configuration.getConnectionPool().executeInsertOrUpdate(qp);
    }
View Full Code Here

    sql.append(" insert into roles ");
    sql.append(" ( name, description, manager, can_edit_xrefs) ");
    sql.append(" values ");
    sql.append(" ( ?, ?, ?, ?) ");
 
    QueryParser qp = new QueryParser(sql.toString());
    qp.addPreparedStmtElementDefinition(role.getName());
    qp.addPreparedStmtElementDefinition(role.getDescription());
    qp.addPreparedStmtElementDefinition(role.isManager());
    qp.addPreparedStmtElementDefinition(QueryParserElement.BOOLEAN,  role.canEditXrefs());

    try
    {
      Configuration.getConnectionPool().executeInsertOrUpdate(qp);
    }
View Full Code Here

    sql.append(" insert into roles ");
    sql.append(" (parent_role_id, name, description, manager, can_edit_xrefs) ");
    sql.append(" values ");
    sql.append(" (?, ?, ?, ?, ?) ");
 
    QueryParser qp = new QueryParser(sql.toString());
    qp.addPreparedStmtElementDefinition(role.getParentRoleId());
    qp.addPreparedStmtElementDefinition(role.getName());
    qp.addPreparedStmtElementDefinition(role.getDescription());
    qp.addPreparedStmtElementDefinition(role.isManager());
    qp.addPreparedStmtElementDefinition(QueryParserElement.BOOLEAN,  role.canEditXrefs());

    try
    {
      Configuration.getConnectionPool().executeInsertOrUpdate(qp);
    }
View Full Code Here

TOP

Related Classes of edu.uga.galileo.voci.db.QueryParser

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.