/** * {@inheritDoc} */ @Override public String toString() { return left.toString() + " " + op.toString() + " " + right.toString(); }
/** * {@inheritDoc} */ @Override public String toString() { return left.toString() + " " + op.toString() + " " + right.toString(); }
/** * Get the JSON prefix common to all constraints. * @param constraint the constraint to format. * @param code The constraint code. * @return The prefix */ protected String getCommonJsonConstraintPrefix(String code, PathConstraint constraint) { String path = constraint.getPath(); String op = constraint.getOp().toString(); return "{\"path\":\"" + path + "\",\"op\":\"" + op + "\",\"code\":\"" + code + "\""; }
/** * Get the JSON prefix common to all constraints. * @param constraint the constraint to format. * @param code The constraint code. * @return The prefix */ protected String getCommonJsonConstraintPrefix(String code, PathConstraint constraint) { String path = constraint.getPath(); String op = constraint.getOp().toString(); return "{\"path\":\"" + path + "\",\"op\":\"" + op + "\",\"code\":\"" + code + "\""; }
public void testToString() { assertEquals("=", ConstraintOp.EQUALS.toString()); } }
throws UnhandledFeatureException { String className = TypeUtil.unqualifiedName(pc.getClass().toString()); String op = pc.getOp().toString(); String start = INDENT + opCode + " = ";
throws UnhandledFeatureException { String className = TypeUtil.unqualifiedName(pc.getClass().toString()); String op = pc.getOp().toString(); String value = PathConstraint.getValue(pc); String extraValue = PathConstraint.getExtraValue(pc);
throws UnhandledFeatureException { String className = TypeUtil.unqualifiedName(pc.getClass().toString()); String op = pc.getOp().toString(); String value = PathConstraint.getValue(pc); String extraValue = PathConstraint.getExtraValue(pc);
/** * Converts a SimpleConstraint object into a String suitable for putting in an SQL query. * * @param state the current SqlGenerator state * @param buffer the StringBuffer to place text into * @param c the SimpleConstraint object * @param q the Query * @throws ObjectStoreException if something goes wrong */ protected static void simpleConstraintToString(State state, StringBuffer buffer, SimpleConstraint c, Query q) throws ObjectStoreException { queryEvaluableToString(buffer, c.getArg1(), q, state); buffer.append(" " + c.getOp().toString()); if (c.getArg2() != null) { buffer.append(" "); queryEvaluableToString(buffer, c.getArg2(), q, state); } }
/** * Converts a SimpleConstraint object into a String suitable for putting in an SQL query. * * @param state the current SqlGenerator state * @param buffer the StringBuffer to place text into * @param c the SimpleConstraint object * @param q the Query * @throws ObjectStoreException if something goes wrong */ protected static void simpleConstraintToString(State state, StringBuffer buffer, SimpleConstraint c, Query q) throws ObjectStoreException { queryEvaluableToString(buffer, c.getArg1(), q, state); buffer.append(" " + c.getOp().toString()); if (c.getArg2() != null) { buffer.append(" "); queryEvaluableToString(buffer, c.getArg2(), q, state); } }
String key1 = pc.getOp().toString().toLowerCase().replace(" ", "_"); String val1 = null; String key2 = null;
String key1 = pc.getOp().toString().toLowerCase().replace(" ", "_"); String val1 = null; String key2 = null;
String op = qq(pc.getOp().toString());
String op = qq(pc.getOp().toString());
/** * A static method for accessing values without having to handle * the subclasses manually. * @param con The constraint. * @return A string representing the value. */ public static String getValue(PathConstraint con) { if (con instanceof PathConstraintAttribute) { return ((PathConstraintAttribute) con).getValue(); } else if (con instanceof PathConstraintBag) { return ((PathConstraintBag) con).getBag(); } else if (con instanceof PathConstraintLookup) { return ((PathConstraintLookup) con).getValue(); } else if (con instanceof PathConstraintSubclass) { return ((PathConstraintSubclass) con).getType(); } else if (con instanceof PathConstraintLoop) { return ((PathConstraintLoop) con).getLoopPath(); } else if (con instanceof PathConstraintNull) { return ((PathConstraintNull) con).getOp().toString(); } return null; }
/** * A static method for accessing values without having to handle * the subclasses manually. * @param con The constraint. * @return A string representing the value. */ public static String getValue(PathConstraint con) { if (con instanceof PathConstraintAttribute) { return ((PathConstraintAttribute) con).getValue(); } else if (con instanceof PathConstraintBag) { return ((PathConstraintBag) con).getBag(); } else if (con instanceof PathConstraintLookup) { return ((PathConstraintLookup) con).getValue(); } else if (con instanceof PathConstraintSubclass) { return ((PathConstraintSubclass) con).getType(); } else if (con instanceof PathConstraintLoop) { return ((PathConstraintLoop) con).getLoopPath(); } else if (con instanceof PathConstraintNull) { return ((PathConstraintNull) con).getOp().toString(); } return null; }
/** * Converts a SubqueryConstraint object into a String suitable for putting in an SQL query. * * @param state the current SqlGenerator state * @param buffer the StringBuffer to place text into * @param c the SubqueryConstraint object * @param q the Query * @param schema the DatabaseSchema in which to look up metadata * @throws ObjectStoreException if something goes wrong */ protected static void subqueryConstraintToString(State state, StringBuffer buffer, SubqueryConstraint c, Query q, DatabaseSchema schema) throws ObjectStoreException { Query subQ = c.getQuery(); QueryEvaluable qe = c.getQueryEvaluable(); QueryClass cls = c.getQueryClass(); if (qe != null) { queryEvaluableToString(buffer, qe, q, state); } else { queryClassToString(buffer, cls, q, schema, QUERY_SUBQUERY_CONSTRAINT, state); } buffer.append(" " + c.getOp().toString() + " (" + generate(subQ, schema, state.getDb(), null, QUERY_SUBQUERY_CONSTRAINT, state.getBagTableNames()) + ")"); }
/** * Converts a SubqueryConstraint object into a String suitable for putting in an SQL query. * * @param state the current SqlGenerator state * @param buffer the StringBuffer to place text into * @param c the SubqueryConstraint object * @param q the Query * @param schema the DatabaseSchema in which to look up metadata * @throws ObjectStoreException if something goes wrong */ protected static void subqueryConstraintToString(State state, StringBuffer buffer, SubqueryConstraint c, Query q, DatabaseSchema schema) throws ObjectStoreException { Query subQ = c.getQuery(); QueryEvaluable qe = c.getQueryEvaluable(); QueryClass cls = c.getQueryClass(); if (qe != null) { queryEvaluableToString(buffer, qe, q, state); } else { queryClassToString(buffer, cls, q, schema, QUERY_SUBQUERY_CONSTRAINT, state); } buffer.append(" " + c.getOp().toString() + " (" + generate(subQ, schema, state.getDb(), null, QUERY_SUBQUERY_CONSTRAINT, state.getBagTableNames()) + ")"); }
/** * Converts a ClassConstraint object into a String suitable for putting in an SQL query. * * @param state the current SqlGenerator state * @param buffer the StringBuffer to place text into * @param c the ClassConstraint object * @param q the Query * @param schema the DatabaseSchema in which to look up metadata * @throws ObjectStoreException if something goes wrong */ protected static void classConstraintToString(State state, StringBuffer buffer, ClassConstraint c, Query q, DatabaseSchema schema) throws ObjectStoreException { QueryClass arg1 = c.getArg1(); QueryClass arg2QC = c.getArg2QueryClass(); InterMineObject arg2O = c.getArg2Object(); queryClassToString(buffer, arg1, q, schema, ID_ONLY, state); buffer.append(" " + c.getOp().toString() + " "); if (arg2QC != null) { queryClassToString(buffer, arg2QC, q, schema, ID_ONLY, state); } else if (arg2O.getId() != null) { objectToString(buffer, arg2O); } else { throw new ObjectStoreException("ClassConstraint cannot contain an InterMineObject" + " without an ID set"); } }
/** * Converts a ClassConstraint object into a String suitable for putting in an SQL query. * * @param state the current SqlGenerator state * @param buffer the StringBuffer to place text into * @param c the ClassConstraint object * @param q the Query * @param schema the DatabaseSchema in which to look up metadata * @throws ObjectStoreException if something goes wrong */ protected static void classConstraintToString(State state, StringBuffer buffer, ClassConstraint c, Query q, DatabaseSchema schema) throws ObjectStoreException { QueryClass arg1 = c.getArg1(); QueryClass arg2QC = c.getArg2QueryClass(); InterMineObject arg2O = c.getArg2Object(); queryClassToString(buffer, arg1, q, schema, ID_ONLY, state); buffer.append(" " + c.getOp().toString() + " "); if (arg2QC != null) { queryClassToString(buffer, arg2QC, q, schema, ID_ONLY, state); } else if (arg2O.getId() != null) { objectToString(buffer, arg2O); } else { throw new ObjectStoreException("ClassConstraint cannot contain an InterMineObject" + " without an ID set"); } }