/** * INTERNAL: * Return the container policy for the mapping. */ protected ContainerPolicy getContainerPolicy() { if (this.containerPolicy == null) { this.containerPolicy = getCollectionMapping().getContainerPolicy(); } return this.containerPolicy; }
/** * INTERNAL: * Update a ChangeRecord to replace the ChangeSet for the old entity with the changeSet for the new Entity. This is * used when an Entity is merged into itself and the Entity reference new or detached entities. */ public void updateChangeRecordForSelfMerge(ChangeRecord changeRecord, Object source, Object target, UnitOfWorkChangeSet parentUOWChangeSet, UnitOfWorkImpl unitOfWork){ getContainerPolicy().updateChangeRecordForSelfMerge(changeRecord, source, target, this, parentUOWChangeSet, unitOfWork); }
/** * INTERNAL: * Return the container policy for the mapping. */ protected ContainerPolicy getContainerPolicy() { if (this.containerPolicy == null) { this.containerPolicy = getCollectionMapping().getContainerPolicy(); } return this.containerPolicy; }
/** * INTERNAL: * Update a ChangeRecord to replace the ChangeSet for the old entity with the changeSet for the new Entity. This is * used when an Entity is merged into itself and the Entity reference new or detached entities. */ public void updateChangeRecordForSelfMerge(ChangeRecord changeRecord, Object source, Object target, UnitOfWorkChangeSet parentUOWChangeSet, UnitOfWorkImpl unitOfWork){ getContainerPolicy().updateChangeRecordForSelfMerge(changeRecord, source, target, this, parentUOWChangeSet, unitOfWork); }
/** * INTERNAL: * Return the container policy for the mapping. */ protected ContainerPolicy getContainerPolicy() { if (this.containerPolicy == null) { this.containerPolicy = getCollectionMapping().getContainerPolicy(); } return this.containerPolicy; }
/** * INTERNAL: * Return whether the collection type is appropriate for the indirection policy. * In this case, the type MUST be a Vector (or, in the case of jdk1.2, * Collection or Map). */ protected boolean collectionTypeIsValid(Class collectionType) { return getCollectionMapping().getContainerPolicy().isValidContainerType(collectionType); }
/** * INTERNAL: * Return whether the collection type is appropriate for the indirection policy. * In this case, the type MUST be a Vector (or, in the case of jdk1.2, * Collection or Map). */ protected boolean collectionTypeIsValid(Class collectionType) { return getCollectionMapping().getContainerPolicy().isValidContainerType(collectionType); }
/** * 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; }
/** * 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 if descriptor for the map key mapping where the key is a OneToOne. */ public ClassDescriptor getMapKeyDescriptor() { return ((CollectionMapping)getMapping()).getContainerPolicy().getDescriptorForMapKey(); }
/** * INTERNAL: * Return whether the collection type is appropriate for the indirection policy. * In this case, the type MUST be a Vector (or, in the case of jdk1.2, * Collection or Map). */ protected boolean collectionTypeIsValid(Class collectionType) { return getCollectionMapping().getContainerPolicy().isValidContainerType(collectionType); }
/** * INTERNAL: * Return if descriptor for the map key mapping where the key is a OneToOne. */ public ClassDescriptor getMapKeyDescriptor() { return ((CollectionMapping)getMapping()).getContainerPolicy().getDescriptorForMapKey(); }
/** * 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: * Verify that attributeType is an appropriate collection type for the * indirection policy. If it is incorrect, add an exception to the integrity checker. * In this case, the type MUST be a Vector (or, in the case of jdk1.2, * Collection or Map). */ public void validateDeclaredAttributeTypeForCollection(Class attributeType, IntegrityChecker checker) throws DescriptorException { super.validateDeclaredAttributeTypeForCollection(attributeType, checker); if (!this.collectionTypeIsValid(attributeType)) { InterfaceContainerPolicy policy = (InterfaceContainerPolicy)getCollectionMapping().getContainerPolicy(); checker.handleError(DescriptorException.attributeTypeNotValid(this.getCollectionMapping(), policy.getInterfaceType())); } }
/** * INTERNAL: * Verify that attributeType is an appropriate collection type for the * indirection policy. If it is incorrect, add an exception to the integrity checker. * In this case, the type MUST be a Vector (or, in the case of jdk1.2, * Collection or Map). */ public void validateDeclaredAttributeTypeForCollection(Class attributeType, IntegrityChecker checker) throws DescriptorException { super.validateDeclaredAttributeTypeForCollection(attributeType, checker); if (!this.collectionTypeIsValid(attributeType)) { InterfaceContainerPolicy policy = (InterfaceContainerPolicy)getCollectionMapping().getContainerPolicy(); checker.handleError(DescriptorException.attributeTypeNotValid(this.getCollectionMapping(), policy.getInterfaceType())); } }
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; }