/** * 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()); } }
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; }
/** * 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()); } }
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; }
/** * 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()); } }
/** * INTERNAL: */ @Override public DatabaseField getField() { if (!isAttribute()) { return null; } DatabaseField field = getInterfaceContainerPolicy().getDirectKeyField(getMapping()); return field; }
/** * INTERNAL: */ @Override public DatabaseField getField() { if (!isAttribute()) { return null; } DatabaseField field = getInterfaceContainerPolicy().getDirectKeyField(getMapping()); return field; }
/** * INTERNAL: */ public DatabaseField getField() { if (!isAttribute()) { return null; } DatabaseField field = getInterfaceContainerPolicy().getDirectKeyField(getMapping()); return field; }
@Override public ClassDescriptor getDescriptor() { if (isAttribute()) { return null; } if (descriptor == null) { // Look first for query keys, then mappings. Ultimately we should have query keys // for everything and can dispense with the mapping part. ForeignReferenceQueryKey queryKey = (ForeignReferenceQueryKey)getQueryKeyOrNull(); if (queryKey != null) { descriptor = getSession().getDescriptor(queryKey.getReferenceClass()); return descriptor; } if (getMapping() == null) { throw QueryException.invalidQueryKeyInExpression(this); } // We assume this is either a foreign reference or an aggregate mapping descriptor = getMapping().getContainerPolicy().getDescriptorForMapKey(); if (getMapping().isVariableOneToOneMapping()) { throw QueryException.cannotQueryAcrossAVariableOneToOneMapping(getMapping(), descriptor); } } return descriptor; }
public ClassDescriptor getDescriptor() { if (isAttribute()) { return null; } if (descriptor == null) { // Look first for query keys, then mappings. Ultimately we should have query keys // for everything and can dispense with the mapping part. ForeignReferenceQueryKey queryKey = (ForeignReferenceQueryKey)getQueryKeyOrNull(); if (queryKey != null) { descriptor = getSession().getDescriptor(queryKey.getReferenceClass()); return descriptor; } if (getMapping() == null) { throw QueryException.invalidQueryKeyInExpression(this); } // We assume this is either a foreign reference or an aggregate mapping descriptor = getMapping().getContainerPolicy().getDescriptorForMapKey(); if (getMapping().isVariableOneToOneMapping()) { throw QueryException.cannotQueryAcrossAVariableOneToOneMapping(getMapping(), descriptor); } } return descriptor; }
@Override public ClassDescriptor getDescriptor() { if (isAttribute()) { return null; } if (descriptor == null) { // Look first for query keys, then mappings. Ultimately we should have query keys // for everything and can dispense with the mapping part. ForeignReferenceQueryKey queryKey = (ForeignReferenceQueryKey)getQueryKeyOrNull(); if (queryKey != null) { descriptor = getSession().getDescriptor(queryKey.getReferenceClass()); return descriptor; } if (getMapping() == null) { throw QueryException.invalidQueryKeyInExpression(this); } // We assume this is either a foreign reference or an aggregate mapping descriptor = getMapping().getContainerPolicy().getDescriptorForMapKey(); if (getMapping().isVariableOneToOneMapping()) { throw QueryException.cannotQueryAcrossAVariableOneToOneMapping(getMapping(), descriptor); } } return descriptor; }
/** * 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: * 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: */ @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 */ @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; }