/** * INTERNAL: * Find the alias for a given table. A TableEntry is a place holder and its base expression holds * all the relevant information. Get the alias from the baseExpression */ @Override public DatabaseTable aliasForTable(DatabaseTable table) { return ((DataExpression)getBaseExpression()).aliasForTable(table); }
/** * INTERNAL: * Find the alias for a given table. A TableEntry is a place holder and its base expression holds * all the relevant information. Get the alias from the baseExpression */ public DatabaseTable aliasForTable(DatabaseTable table) { return ((DataExpression)getBaseExpression()).aliasForTable(table); }
@Override public CollectionMapping getMapping() { return (CollectionMapping)((QueryKeyExpression)getBaseExpression()).getMapping(); }
/** * INTERNAL: * Find the alias for a given table. A TableEntry is a place holder and its base expression holds * all the relevant information. Get the alias from the baseExpression */ @Override public DatabaseTable aliasForTable(DatabaseTable table) { return ((DataExpression)getBaseExpression()).aliasForTable(table); }
public CollectionMapping getMapping() { return (CollectionMapping)((QueryKeyExpression)getBaseExpression()).getMapping(); }
@Override public CollectionMapping getMapping() { return (CollectionMapping)((QueryKeyExpression)getBaseExpression()).getMapping(); }
private InterfaceContainerPolicy getInterfaceContainerPolicy(){ DatabaseMapping mapping = getMapping(); if (mapping == null) { throw QueryException.noMappingForMapEntryExpression(getBaseExpression()); } if (!mapping.isCollectionMapping()){ throw QueryException.mapEntryExpressionForNonCollection(getBaseExpression(), getMapping()); } InterfaceContainerPolicy cp = null; try{ cp = (InterfaceContainerPolicy)getMapping().getContainerPolicy(); } catch (ClassCastException e){ throw QueryException.mapEntryExpressionForNonMap(getBaseExpression(), getMapping()); } return cp; }
private InterfaceContainerPolicy getInterfaceContainerPolicy(){ DatabaseMapping mapping = getMapping(); if (mapping == null) { throw QueryException.noMappingForMapEntryExpression(getBaseExpression()); } if (!mapping.isCollectionMapping()){ throw QueryException.mapEntryExpressionForNonCollection(getBaseExpression(), getMapping()); } InterfaceContainerPolicy cp = null; try{ cp = (InterfaceContainerPolicy)((CollectionMapping)getMapping()).getContainerPolicy(); } catch (ClassCastException e){ throw QueryException.mapEntryExpressionForNonMap(getBaseExpression(), getMapping()); } return cp; }
private InterfaceContainerPolicy getInterfaceContainerPolicy(){ DatabaseMapping mapping = getMapping(); if (mapping == null) { throw QueryException.noMappingForMapEntryExpression(getBaseExpression()); } if (!mapping.isCollectionMapping()){ throw QueryException.mapEntryExpressionForNonCollection(getBaseExpression(), getMapping()); } InterfaceContainerPolicy cp = null; try{ cp = (InterfaceContainerPolicy)getMapping().getContainerPolicy(); } catch (ClassCastException e){ throw QueryException.mapEntryExpressionForNonMap(getBaseExpression(), getMapping()); } return cp; }
/** * INTERNAL: */ @Override public List<DatabaseField> getSelectionFields(ReadQuery query) { ArrayList<DatabaseField> result = new ArrayList<DatabaseField>(); InterfaceContainerPolicy icp = getInterfaceContainerPolicy(); // if this is a map entry get all the fields for both the key and the value if (returnMapEntry || !icp.isMappedKeyMapPolicy()){ result.addAll(getBaseExpression().getSelectionFields(query)); } else if (isAttribute()) { DatabaseField field = getField(); if (field != null) { result.add(field); } } else { result.addAll(getInterfaceContainerPolicy().getAdditionalFieldsForJoin(getMapping())); } return result; }
/** * INTERNAL: */ @Override public List<DatabaseField> getSelectionFields(ReadQuery query) { ArrayList<DatabaseField> result = new ArrayList<DatabaseField>(); InterfaceContainerPolicy icp = getInterfaceContainerPolicy(); // if this is a map entry get all the fields for both the key and the value if (returnMapEntry || !icp.isMappedKeyMapPolicy()){ result.addAll(getBaseExpression().getSelectionFields(query)); } else if (isAttribute()) { DatabaseField field = getField(); if (field != null) { result.add(field); } } else { result.addAll(getInterfaceContainerPolicy().getAdditionalFieldsForJoin(getMapping())); } return result; }
/** * INTERNAL: * Return all the fields */ public Vector getFields() { Vector result = new Vector(); InterfaceContainerPolicy icp = getInterfaceContainerPolicy(); // if this is a map entry get all the fields for both the key and the value if (returnMapEntry || !icp.isMappedKeyMapPolicy()){ result.addAll(getBaseExpression().getFields()); } else if (isAttribute()) { DatabaseField field = getField(); if (field != null) { result.addElement(field); } } else { result.addAll(getInterfaceContainerPolicy().getAllFieldsForMapKey(getMapping())); } return result; }
/** * INTERNAL: * Return all the fields */ @Override public Vector getFields() { Vector result = new Vector(); InterfaceContainerPolicy icp = getInterfaceContainerPolicy(); // if this is a map entry get all the fields for both the key and the value if (returnMapEntry || !icp.isMappedKeyMapPolicy()){ result.addAll(getBaseExpression().getFields()); } else if (isAttribute()) { DatabaseField field = getField(); if (field != null) { result.add(field); } } else { result.addAll(getInterfaceContainerPolicy().getAdditionalFieldsForJoin(getMapping())); } return result; }
/** * INTERNAL: * This expression is built on a different base than the one we want. Rebuild it and * return the root of the new tree * @Override */ public Expression rebuildOn(Expression newBase) { Expression newLocalBase = getBaseExpression().rebuildOn(newBase); Expression result = null; if (returnMapEntry){ result = newLocalBase.mapEntry(); } else { result = newLocalBase.mapKey(); } result.setSelectIfOrderedBy(selectIfOrderedBy()); return result; }
/** * INTERNAL: * This expression is built on a different base than the one we want. Rebuild it and * return the root of the new tree */ @Override public Expression rebuildOn(Expression newBase) { Expression newLocalBase = getBaseExpression().rebuildOn(newBase); Expression result = null; if (returnMapEntry){ result = newLocalBase.mapEntry(); } else { result = newLocalBase.mapKey(); } result.setSelectIfOrderedBy(selectIfOrderedBy()); return result; }
/** * INTERNAL: * This expression is built on a different base than the one we want. Rebuild it and * return the root of the new tree */ @Override public Expression rebuildOn(Expression newBase) { Expression newLocalBase = getBaseExpression().rebuildOn(newBase); Expression result = null; if (returnMapEntry){ result = newLocalBase.mapEntry(); } else { result = newLocalBase.mapKey(); } result.setSelectIfOrderedBy(selectIfOrderedBy()); return result; }
/** * INTERNAL: * A special version of rebuildOn where the newBase need not be a new * ExpressionBuilder but any expression. * <p> * For nested joined attributes, the joined attribute query must have * its joined attributes rebuilt relative to it. */ @Override public Expression rebuildOn(Expression oldBase, Expression newBase) { if (this == oldBase) { return newBase; } Expression newLocalBase = ((QueryKeyExpression)getBaseExpression()).rebuildOn(oldBase, newBase); Expression result = null; if (returnMapEntry){ result = newLocalBase.mapEntry(); } else { result = newLocalBase.mapKey(); } result.setSelectIfOrderedBy(selectIfOrderedBy()); return result; }
/** * Do any required validation for this node. Throw an exception if it's incorrect. */ @Override public void validateNode() { if ((getQueryKeyOrNull() == null) && (getMapping() == null)) { throw QueryException.invalidQueryKeyInExpression(getName()); } if (!getMapping().isCollectionMapping()) { throw QueryException.mapEntryExpressionForNonCollection(getBaseExpression(), getMapping()); } ContainerPolicy cp = getMapping().getContainerPolicy(); if ((cp == null) || !cp.isMapPolicy()) { throw QueryException.mapEntryExpressionForNonMap(getBaseExpression(), getMapping()); } }
/** * Do any required validation for this node. Throw an exception if it's incorrect. */ @Override public void validateNode() { if ((getQueryKeyOrNull() == null) && (getMapping() == null)) { throw QueryException.invalidQueryKeyInExpression(getName()); } if (!getMapping().isCollectionMapping()) { throw QueryException.mapEntryExpressionForNonCollection(getBaseExpression(), getMapping()); } ContainerPolicy cp = getMapping().getContainerPolicy(); if ((cp == null) || !cp.isMapPolicy()) { throw QueryException.mapEntryExpressionForNonMap(getBaseExpression(), getMapping()); } }
/** * Do any required validation for this node. Throw an exception if it's incorrect. */ public void validateNode() { if ((getQueryKeyOrNull() == null) && (getMapping() == null)) { throw QueryException.invalidQueryKeyInExpression(getName()); } if (!getMapping().isCollectionMapping()){ throw QueryException.mapEntryExpressionForNonCollection(getBaseExpression(), getMapping()); } ContainerPolicy cp = getMapping().getContainerPolicy(); if ((cp == null) || !(cp.isMapPolicy() || cp.isDirectMapPolicy())){ throw QueryException.mapEntryExpressionForNonMap(getBaseExpression(), getMapping()); } }