public boolean isCollectionMapping() { return mapping.isCollectionMapping(); }
/** */ public boolean isCollectionAttribute() { DatabaseMapping mapping = getMapping(); return (mapping != null) && mapping.isCollectionMapping(); }
/** * INTERNAL * (): * Answer true if the node has a left and right, and the right represents * a collection mapping. */ public boolean endsWithCollectionField(GenerationContext context) { DatabaseMapping mapping = resolveMapping(context); return (mapping != null) && mapping.isCollectionMapping(); }
/** * INTERNAL * (): * Answer true if the node has a left and right, and the right represents * a collection mapping. */ public boolean endsWithCollectionField(GenerationContext context) { DatabaseMapping mapping = resolveMapping(context); return (mapping != null) && mapping.isCollectionMapping(); }
/** * INTERNAL * (): * Answer true if the node has a left and right, and the right represents * a collection mapping. */ public boolean endsWithCollectionField(GenerationContext context) { DatabaseMapping mapping = resolveMapping(context); return (mapping != null) && mapping.isCollectionMapping(); }
/** * Is the attribute collection-valued. * @return boolean indicating whether attribute is * collection-valued.<p> * This will be true for the mappings CollectionMapping, AbstractCompositeCollectionMapping, * AbstractCompositeDirectCollectionMapping and their subclasses * */ public boolean isCollection() { return getMapping().isCollectionMapping(); }
/** * INTERNAL: * Return any additional tables that belong to this expression * An example of how this method is used is to return any tables that belong to the map key * when this expression traverses a mapping that uses a Map */ public List<DatabaseTable> getAdditionalTables(){ if (mapping != null && mapping.isCollectionMapping()){ return ((CollectionMapping)mapping).getContainerPolicy().getAdditionalTablesForJoinQuery(); } return null; }
/** */ public boolean isCollectionAttribute() { DatabaseMapping mapping = getMapping(); return ((mapping != null) && mapping.isCollectionMapping()) || (attributeQueryKey != null && attributeQueryKey.isCollectionQueryKey()); }
/** */ public boolean isCollectionAttribute() { DatabaseMapping mapping = getMapping(); return ((mapping != null) && mapping.isCollectionMapping()) || (attributeQueryKey != null && attributeQueryKey.isCollectionQueryKey()); }
/** * INTERNAL: * Return any additional tables that belong to this expression * An example of how this method is used is to return any tables that belong to the map key * when this expression traverses a mapping that uses a Map */ @Override public List<DatabaseTable> getAdditionalTables() { if (mapping != null && mapping.isCollectionMapping()){ return ((CollectionMapping)mapping).getContainerPolicy().getAdditionalTablesForJoinQuery(); } return null; }
/** * INTERNAL: * Return any additional tables that belong to this expression * An example of how this method is used is to return any tables that belong to the map key * when this expression traverses a mapping that uses a Map */ @Override public List<DatabaseTable> getAdditionalTables() { if (mapping != null && mapping.isCollectionMapping()){ return ((CollectionMapping)mapping).getContainerPolicy().getAdditionalTablesForJoinQuery(); } return null; }
/** Returns the type of the map key for the mapping on ownerClass named attribute * Returns null if that mapping does not exist or does not contain a map key */ public Object resolveMapKey(Object ownerClass, String attribute) { Object type = null; DatabaseMapping mapping = resolveAttributeMapping(ownerClass, attribute); if (mapping.isCollectionMapping()){ ContainerPolicy cp = ((CollectionMapping)mapping).getContainerPolicy(); type = cp.getKeyType(); } return type; }
/** Returns the type of the map key for the mapping on ownerClass named attribute * Returns null if that mapping does not exist or does not contain a map key */ public Object resolveMapKey(Object ownerClass, String attribute) { Object type = null; DatabaseMapping mapping = resolveAttributeMapping(ownerClass, attribute); if (mapping.isCollectionMapping()){ ContainerPolicy cp = ((CollectionMapping)mapping).getContainerPolicy(); type = cp.getKeyType(); } return type; }
/** Returns the type of the map key for the mapping on ownerClass named attribute * Returns null if that mapping does not exist or does not contain a map key */ public Object resolveMapKey(Object ownerClass, String attribute) { Object type = null; DatabaseMapping mapping = resolveAttributeMapping(ownerClass, attribute); if (mapping.isCollectionMapping()){ ContainerPolicy cp = ((CollectionMapping)mapping).getContainerPolicy(); type = cp.getKeyType(); } return type; }
/** * INTERNAL: * Return if the expression if for a map key mapping where the key is a OneToOne. */ public boolean isMapKeyObjectRelationship() { if (getMapping() != null) { return getMapping().isCollectionMapping() && ((CollectionMapping)getMapping()).isMapKeyObjectRelationship(); } else { return false; } }
/** * INTERNAL: * Return if the expression if for a map key mapping where the key is a OneToOne. */ public boolean isMapKeyObjectRelationship() { if (getMapping() != null) { return getMapping().isCollectionMapping() && ((CollectionMapping)getMapping()).isMapKeyObjectRelationship(); } else { return false; } }
@SuppressWarnings({ "rawtypes", "unchecked" }) protected void setMappingValueInObject(Object object, Object attributeValue, DatabaseMapping mapping, DatabaseMapping partner) { if (mapping.isObjectReferenceMapping()) { ((ObjectReferenceMapping) mapping).getIndirectionPolicy().setRealAttributeValueInObject(object, attributeValue, true); if (partner != null) { setMappingValueInObject(attributeValue, object, partner, null); } } else if (mapping.isCollectionMapping()) { ((Collection) mapping.getAttributeValueFromObject(object)).add(attributeValue); if (partner != null) { setMappingValueInObject(attributeValue, object, partner, null); } } }
@SuppressWarnings({ "rawtypes", "unchecked" }) protected void setMappingValueInObject(Object object, Object attributeValue, DatabaseMapping mapping, DatabaseMapping partner) { if (mapping.isObjectReferenceMapping()) { ((ObjectReferenceMapping) mapping).getIndirectionPolicy().setRealAttributeValueInObject(object, attributeValue, true); if (partner != null) { setMappingValueInObject(attributeValue, object, partner, null); } } else if (mapping.isCollectionMapping()) { ((Collection) mapping.getAttributeValueFromObject(object)).add(attributeValue); if (partner != null) { setMappingValueInObject(attributeValue, object, partner, null); } } }
private Property buildProperty(PersistenceContext context, DatabaseMapping mapping) { if (mapping.isCollectionMapping()) { final Property property = new Property(); property.setType("array"); property.setItems(buildProperty(context, getCollectionGenericClass(mapping))); return property; } else if (mapping.isForeignReferenceMapping()) { final ForeignReferenceMapping foreignReferenceMapping = (ForeignReferenceMapping)mapping; final String href = HrefHelper.buildEntityMetadataHref(context, foreignReferenceMapping.getReferenceClass().getSimpleName() + "#"); return new Property(href); } else { return buildProperty(context, mapping.getAttributeClassification()); } }
private Property buildProperty(PersistenceContext context, DatabaseMapping mapping) { if (mapping.isCollectionMapping()) { final Property property = new Property(); property.setType("array"); property.setItems(buildProperty(context, getCollectionGenericClass(mapping))); return property; } else if (mapping.isForeignReferenceMapping()) { final ForeignReferenceMapping foreignReferenceMapping = (ForeignReferenceMapping)mapping; final String href = HrefHelper.buildEntityMetadataHref(context, foreignReferenceMapping.getReferenceClass().getSimpleName() + "#"); return new Property(href); } else { return buildProperty(context, mapping.getAttributeClassification()); } }