Package org.apache.ws.jaxme.sqls

Examples of org.apache.ws.jaxme.sqls.BooleanConstraint


    parts.add(result);
    return result;
  }

  public BooleanConstraint createLIKE() {
    BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.LIKE);
    parts.add(result);
    return result;
  }
View Full Code Here


    parts.add(result);
    return result;
  }

  public BooleanConstraint createISNULL() {
    BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.ISNULL);
    parts.add(result);
    return result;
  }
View Full Code Here

    parts.add(result);
    return result;
  }

  public BooleanConstraint createIN() {
    BooleanConstraint result = new BooleanConstraintImpl(this, BooleanConstraint.Type.IN);
    parts.add(result);
    return result;
  }
View Full Code Here

    parts.add(result);
    return result;
  }

  public void createEXISTS(SelectStatement pStatement) {
    BooleanConstraint bc = new BooleanConstraintImpl(this, BooleanConstraint.Type.EXISTS);
    parts.add(bc);
    bc.addPart(pStatement);
  }
View Full Code Here

    if (!pTableReference.getStatement().equals(getConstrainedStatement())) {
      throw new IllegalStateException("The statement of the table reference is not the same as this constraints statement.");
    }
    for (Iterator iter = pSet.getColumns();  iter.hasNext()) {
      Column column = (Column) iter.next();
      BooleanConstraint eq = createEQ();
      eq.addPart(new ColumnReferenceImpl(pTableReference, column));
      eq.addPlaceholder();
    }
  }
View Full Code Here

      throw new IllegalStateException("The statement of the referenced table is not the same as this constraints statement.");
    }

    for (Iterator iter = pKey.getColumnLinks();  iter.hasNext()) {
      ForeignKey.ColumnLink columnReference = (ForeignKey.ColumnLink) iter.next();
      BooleanConstraint eq = createEQ();
      eq.addPart(new ColumnReferenceImpl(pReferencingTable, columnReference.getLocalColumn()));
      eq.addPart(new ColumnReferenceImpl(pReferencedTable, columnReference.getReferencedColumn()));
    }
  }
View Full Code Here

        Column referencingColumn = (Column) iter.next();
        if (!referencedIter.hasNext()) {
           throw new IllegalStateException("The size of the referencing and referenced column sets doesn't match.");
        }
        Column referencedColumn = (Column) referencedIter.next();
        BooleanConstraint eq = createEQ();
        eq.addPart(pReferencingTable.newColumnReference(referencingColumn));
        eq.addPart(pReferencedTable.newColumnReference(referencedColumn));
     }
  }
View Full Code Here

        } else {
          throw new IllegalArgumentException("Invalid part: " + o.getClass().getName());
        }
      }
    } else if (pConstraint instanceof BooleanConstraint) {
      BooleanConstraint source = (BooleanConstraint) pConstraint;
      BooleanConstraint target;
      BooleanConstraint.Type sourceType = source.getType();
      if (BooleanConstraint.Type.EQ.equals(sourceType)) {
        target = createEQ();
      } else if (BooleanConstraint.Type.NE.equals(sourceType)) {
        target = createNE();
      } else if (BooleanConstraint.Type.GT.equals(sourceType)) {
        target = createGT();
      } else if (BooleanConstraint.Type.LT.equals(sourceType)) {
        target = createLT();
      } else if (BooleanConstraint.Type.GE.equals(sourceType)) {
        target = createGE();
      } else if (BooleanConstraint.Type.LE.equals(sourceType)) {
        target = createLE();
      } else if (BooleanConstraint.Type.LIKE.equals(sourceType)) {
        target = createLIKE();
      else if (BooleanConstraint.Type.ISNULL.equals(sourceType)) {
        target = createISNULL();
      } else if (BooleanConstraint.Type.IN.equals(sourceType)) {
        target = createIN();
      } else {
        throw new IllegalArgumentException("Invalid boolean constraint type: " + sourceType);
      }
      for (Iterator iter = source.getParts();  iter.hasNext()) {
        Object o = iter.next();
        if (o instanceof Value) {
          target.addPart((Value) o);
        } else if (o instanceof ColumnReference) {
           ColumnReference colRef = (ColumnReference) o;
           TableReference tableRef = (TableReference) pMap.get(colRef.getTableReference());
           if (tableRef == null) {
             throw new IllegalStateException("Unknown reference to table " + colRef.getTableReference().getTable().getQName());
           }
           target.addPart(tableRef.newColumnReference(colRef.getColumn()));
        } else {
           throw new IllegalStateException("Unknown part type: " + o.getClass().getName());
        }
      }
    } else {
View Full Code Here

     TableReference refRef = tableReference.getRightJoinedTableReference();

     joinReference.getOn().addJoin((ForeignKey) otherTable.getForeignKeys().next(),
                                   refLocal, refRef);
     CombinedConstraint cc = statement.getWhere();
     BooleanConstraint bc = cc.createEQ();
     bc.addPart(tableReference.newColumnReference("MyIndex"));
     bc.addPlaceholder();

     SQLGenerator generator = getSQLGenerator();
     generator.setLineTerminator("\n");
     String got = generator.getQuery(statement);
     String expect = getTestJoinResult();
View Full Code Here

     TableReference refRef = tableReference.getRightJoinedTableReference();

     joinReference.getOn().addJoin((ForeignKey) otherTable.getForeignKeys().next(),
                                   refLocal, refRef);
     CombinedConstraint cc = statement.getWhere();
     BooleanConstraint bc = cc.createEQ();
     bc.addPart(tableReference.newColumnReference("MyIndex"));
     bc.addPlaceholder();

     SQLGenerator generator = getSQLGenerator();
     generator.setLineTerminator("\n");
     String got = generator.getQuery(statement);
     String expect = getTestLeftOuterJoinResult();
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.sqls.BooleanConstraint

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.