Package org.molgenis.framework.db

Examples of org.molgenis.framework.db.DatabaseException


    {
      PrintWriter out = response.getWriter();
      response.getWriter().print("{exception: '" + e.getMessage() + "'}");
      out.close();
      e.printStackTrace();
      throw new DatabaseException(e);
    }
  }
View Full Code Here


      // return connection id
      return connId;
    }
    catch (Exception e)
    {
      throw new DatabaseException(e);
    }
  }
View Full Code Here

      {
        // close the connection and check if it really was closed
        connections.get(connId).close();
        if (!connections.get(connId).isClosed())
        {
          throw new DatabaseException("ERROR: connection was not closed!");
        }
      }
      catch (SQLException sqle)
      {
        throw new DatabaseException(sqle);
      }

      // remove from list (does not happen if Exception was thrown)
      connections.remove(connId);
View Full Code Here

                addOr = true;
              }
            }
            catch (Exception e)
            {
              throw new DatabaseException(e);
            }

            // add to rules
            where_clause.append("(");
            where_clause.append(createWhereSql(mapper, true, false,
                searchRules.toArray(new QueryRule[searchRules.size()])));
            where_clause.append(")");

          }
          else if (rule.getOperator() == QueryRule.Operator.NESTED
              || (rule.getOperator() == QueryRule.Operator.NOT && rule.getNestedRules() != null && rule
                  .getNestedRules().length > 0))
          {
            QueryRule[] nestedrules = rule.getNestedRules();
            if (nestedrules.length > 0)
            {
              if (where_clause.length() > 0)
              {
                if (previousRule != null && Operator.OR.equals(previousRule.getOperator()))
                {
                  where_clause.append(" OR ");
                }
                else
                {
                  where_clause.append(" AND ");
                }
              }

              if (rule.getOperator() == QueryRule.Operator.NOT)
              {
                where_clause.append("NOT");
              }
              where_clause.append("(");
              where_clause.append(createWhereSql(mapper, true, false, nestedrules));
              where_clause.append(")");
            }
          }
          // experimental: subqery
          else if (rule.getOperator() == QueryRule.Operator.IN_SUBQUERY)
          {
            if (where_clause.length() > 0)
            {
              if (previousRule != null && Operator.OR.equals(previousRule.getOperator()))
              {
                where_clause.append(" OR ");
              }
              else
              {
                where_clause.append(" AND ");
              }
            }
            where_clause.append(rule.getField() + " IN(" + rule.getValue() + ")");
          }
          else if (rule.getOperator() == QueryRule.Operator.IN)
          {
            // only add if nonempty condition???
            if (rule.getValue() == null
                || (rule.getValue() instanceof List<?> && ((List<?>) rule.getValue()).size() == 0)
                || (rule.getValue() instanceof Object[] && ((Object[]) rule.getValue()).length == 0)) throw new DatabaseException(
                "empty 'in' clause for rule " + rule);
            {
              if (where_clause.length() > 0)
              {
                if (previousRule != null && Operator.OR.equals(previousRule.getOperator()))
View Full Code Here

TOP

Related Classes of org.molgenis.framework.db.DatabaseException

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.