/** * INTERNAL: * Return all the fields */ public Vector getFields() { Vector result = new Vector(1); result.addElement(getField()); return result; }
/** * INTERNAL: called from SQLSelectStatement.writeFieldsFromExpression(...) */ @Override public void writeFields(ExpressionSQLPrinter printer, Vector newFields, SQLSelectStatement statement) { DatabaseField field = getField(); if (field != null) { newFields.addElement(field); writeField(printer, field, statement); } }
/** * INTERNAL: * If there are any fields associated with this expression, return them */ public DatabaseField getClonedField() { return getField().clone(); }
/** * INTERNAL: * Used to print a debug form of the expression tree. */ public void writeDescriptionOn(BufferedWriter writer) throws IOException { writer.write(getField().toString()); }
/** * INTERNAL: called from SQLSelectStatement.writeFieldsFromExpression(...) */ @Override public void writeFields(ExpressionSQLPrinter printer, Vector newFields, SQLSelectStatement statement) { DatabaseField field = getField(); if (field != null) { newFields.addElement(field); writeField(printer, field, statement); } }
/** * INTERNAL: */ public Expression existingDerivedField(DatabaseField field) { if (this.derivedFields == null) { return null; } for (Expression exp : this.derivedFields) { if (((FieldExpression)exp).getField().equals(field)) { return exp; } } return null; }
/** * INTERNAL: * If there are any fields associated with this expression, return them */ public Vector getClonedFields() { Vector result = new Vector(1); result.addElement(getField().clone()); return result; }
/** * INTERNAL: * If there are any fields associated with this expression, return them */ public DatabaseField getClonedField() { return (DatabaseField)getField().clone(); }
/** * INTERNAL: * If there are any fields associated with this expression, return them */ public Vector getClonedFields() { Vector result = new Vector(1); result.addElement(getField().clone()); return result; }
/** * INTERNAL: * If there are any fields associated with this expression, return them */ public DatabaseField getClonedField() { return getField().clone(); }
/** * Do any required validation for this node. Throw an exception if it's incorrect. */ public void validateNode() { DataExpression base = (DataExpression)getBaseExpression(); if (getField().getTable().hasName()) { List<DatabaseTable> tables = base.getOwnedTables(); if ((tables != null) && (!tables.contains((getField().getTable())))) { throw QueryException.invalidTableForFieldInExpression(getField()); } } }
/** * INTERNAL: * Provide for conversion of the passed object's value, based on the referenced field value. */ @Override public Object getFieldValue(Object value, AbstractSession session) { // Bug 418705 if (getField() != null && value != null && (value.getClass() != getField().getType()) && !(value instanceof Collection) && !(value instanceof Enum)) { try { return session.getDatasourcePlatform().convertObject(value, getField().getType()); } catch (ConversionException c) {} } return super.getFieldValue(value, session); }
/** * Do any required validation for this node. Throw an exception if it's incorrect. */ public void validateNode() { DataExpression base = (DataExpression)getBaseExpression(); if (getField().getTable().hasName()) { List<DatabaseTable> tables = base.getOwnedTables(); if ((tables != null) && (!tables.contains((getField().getTable())))) { throw QueryException.invalidTableForFieldInExpression(getField()); } } }
/** * Do any required validation for this node. Throw an exception if it's incorrect. */ public void validateNode() { DataExpression base = (DataExpression)getBaseExpression(); if (getField().getTable().hasName()) { Vector tables = base.getOwnedTables(); if ((tables != null) && (!tables.contains((getField().getTable())))) { throw QueryException.invalidTableForFieldInExpression(getField()); } } }
/** * INTERNAL: * Rebuild myself against the base, with the values of parameters supplied by the context * expression. This is used for transforming a standalone expression (e.g. the join criteria of a mapping) * into part of some larger expression. You normally would not call this directly, instead calling twist * See the comment there for more details" */ public Expression twistedForBaseAndContext(Expression newBase, Expression context) { Expression twistedBase = getBaseExpression().twistedForBaseAndContext(newBase, context); return twistedBase.getField(getField()); }
/** * INTERNAL: * Print java for project class generation */ public void printJava(ExpressionJavaPrinter printer) { getBaseExpression().printJava(printer); printer.printString(".getField(\"" + getField().getQualifiedName() + "\")"); }
/** * INTERNAL: * Print java for project class generation */ public void printJava(ExpressionJavaPrinter printer) { getBaseExpression().printJava(printer); printer.printString(".getField(\"" + getField().getQualifiedName() + "\")"); }
public void printNull(ConstantExpression nullValueExpression) { if(session.getPlatform().shouldBindLiterals()) { DatabaseField field = null; Expression localBase = nullValueExpression.getLocalBase(); if(localBase.isFieldExpression()) { field = ((FieldExpression)localBase).getField(); } else if(localBase.isQueryKeyExpression()) { field = ((QueryKeyExpression)localBase).getField(); } session.getPlatform().appendLiteralToCall(getCall(), getWriter(), field); } else { session.getPlatform().appendLiteralToCall(getCall(), getWriter(), null); } }