/** * PUBLIC: * Return if the descriptor defines inheritance and is a child. */ public boolean isChildDescriptor() { return hasInheritance() && getInheritancePolicy().isChildDescriptor(); }
/** * PUBLIC: * Return if the descriptor defines inheritance and is a child. */ public boolean isChildDescriptor() { return hasInheritance() && getInheritancePolicy().isChildDescriptor(); }
/** * PUBLIC: * Return if the descriptor defines inheritance and is a child. */ public boolean isChildDescriptor() { return hasInheritance() && getInheritancePolicy().isChildDescriptor(); }
/** * INTERNAL: * Post initialize the child descriptors */ protected void addClassIndicatorTypeToParent(Object indicator) { ClassDescriptor parentDescriptor = getDescriptor().getInheritancePolicy().getParentDescriptor(); if (parentDescriptor.getInheritancePolicy().isChildDescriptor()) { if (parentDescriptor.getInheritancePolicy().shouldReadSubclasses()) { parentDescriptor.getInheritancePolicy().getAllChildClassIndicators().add(indicator); } parentDescriptor.getInheritancePolicy().addClassIndicatorTypeToParent(indicator); } }
/** * INTERNAL: * Post initialize the child descriptors */ protected void addClassIndicatorTypeToParent(Object indicator) { ClassDescriptor parentDescriptor = getDescriptor().getInheritancePolicy().getParentDescriptor(); if (parentDescriptor.getInheritancePolicy().isChildDescriptor()) { if (parentDescriptor.getInheritancePolicy().shouldReadSubclasses()) { parentDescriptor.getInheritancePolicy().getAllChildClassIndicators().addElement(indicator); } parentDescriptor.getInheritancePolicy().addClassIndicatorTypeToParent(indicator); } }
/** * INTERNAL: * Post initialize the child descriptors */ protected void addClassIndicatorTypeToParent(Object indicator) { ClassDescriptor parentDescriptor = getDescriptor().getInheritancePolicy().getParentDescriptor(); if (parentDescriptor.getInheritancePolicy().isChildDescriptor()) { if (parentDescriptor.getInheritancePolicy().shouldReadSubclasses()) { parentDescriptor.getInheritancePolicy().getAllChildClassIndicators().add(indicator); } parentDescriptor.getInheritancePolicy().addClassIndicatorTypeToParent(indicator); } }
/** * INTERNAL: * Setup the default classExtractionMethod, or if one was specified by the user make sure it is valid. */ protected void initializeClassExtractor(AbstractSession session) throws DescriptorException { if (getClassExtractor() == null) { if (isChildDescriptor()) { setClassExtractor(getParentDescriptor().getInheritancePolicy().getClassExtractor()); } } else { getClassExtractor().initialize(getDescriptor(), session); } }
/** * INTERNAL: * Setup the default classExtractionMethod, or if one was specified by the user make sure it is valid. */ protected void initializeClassExtractor(AbstractSession session) throws DescriptorException { if (getClassExtractor() == null) { if (isChildDescriptor()) { setClassExtractor(getParentDescriptor().getInheritancePolicy().getClassExtractor()); } } else { getClassExtractor().initialize(getDescriptor(), session); } }
/** * INTERNAL: * Setup the default classExtractionMethod, or if one was specified by the user make sure it is valid. */ protected void initializeClassExtractor(AbstractSession session) throws DescriptorException { if (getClassExtractor() == null) { if (isChildDescriptor()) { setClassExtractor(getParentDescriptor().getInheritancePolicy().getClassExtractor()); } } else { getClassExtractor().initialize(getDescriptor(), session); } }
/** * INTERNAL: * Used to initialize a remote descriptor. */ public void remoteInitialization(DistributedSession session) { if (isChildDescriptor()) { if (session.hasCorrespondingDescriptor(getParentDescriptor())) { setParentDescriptor(session.getDescriptor(getParentClass())); } else { session.privilegedAddDescriptor(getParentDescriptor()); getParentDescriptor().remoteInitialization(session); } } Vector tempChildren = new Vector(getChildDescriptors().size()); for (ClassDescriptor childDescriptor : getChildDescriptors()) { if (session.hasCorrespondingDescriptor(childDescriptor)) { tempChildren.addElement(session.getDescriptor(childDescriptor.getJavaClass())); } else { session.privilegedAddDescriptor(childDescriptor); childDescriptor.remoteInitialization(session); tempChildren.addElement(childDescriptor); } } setChildDescriptors(tempChildren); }
/** * INTERNAL: * Initialize the expression to use for queries to the class and its subclasses. */ protected void initializeWithAllSubclassesExpression() throws DescriptorException { if (getWithAllSubclassesExpression() == null) { if (hasClassExtractor()) { return; } if (isChildDescriptor() && shouldReadSubclasses()) { setWithAllSubclassesExpression(new ExpressionBuilder().getField(getClassIndicatorField()).in(getAllChildClassIndicators())); } } }
/** * INTERNAL: * Initialize the expression to use for queries to the class and its subclasses. */ protected void initializeWithAllSubclassesExpression() throws DescriptorException { if (getWithAllSubclassesExpression() == null) { if (hasClassExtractor()) { return; } if (isChildDescriptor() && shouldReadSubclasses()) { setWithAllSubclassesExpression(new ExpressionBuilder().getField(getClassIndicatorField()).in(getAllChildClassIndicators())); } } }
/** * INTERNAL: * Initialize the expression to use for queries to the class and its subclasses. */ protected void initializeWithAllSubclassesExpression() throws DescriptorException { if (getWithAllSubclassesExpression() == null) { if (hasClassExtractor()) { return; } if (isChildDescriptor() && shouldReadSubclasses()) { setWithAllSubclassesExpression(new ExpressionBuilder().getField(getClassIndicatorField()).in(getAllChildClassIndicators())); } } }
/** * INTERNAL: * Recursively adds fields to all the parents */ protected void addFieldsToParent(Vector fields) { if (isChildDescriptor()) { if (getParentDescriptor().isInvalid()) { return; } ClassDescriptor parentDescriptor = getParentDescriptor(); if (parentDescriptor.getInheritancePolicy().shouldReadSubclasses()) { Helper.addAllUniqueToVector(parentDescriptor.getAllFields(), fields); } parentDescriptor.getInheritancePolicy().addFieldsToParent(fields); } }
/** * INTERNAL: * Recursively adds fields to all the parents */ protected void addFieldsToParent(Vector fields) { if (isChildDescriptor()) { if (getParentDescriptor().isInvalid()) { return; } ClassDescriptor parentDescriptor = getParentDescriptor(); if (parentDescriptor.getInheritancePolicy().shouldReadSubclasses()) { Helper.addAllUniqueToVector(parentDescriptor.getAllFields(), fields); } parentDescriptor.getInheritancePolicy().addFieldsToParent(fields); } }
/** * INTERNAL: * Recursively adds fields to all the parents */ protected void addFieldsToParent(Vector fields) { if (isChildDescriptor()) { if (getParentDescriptor().isInvalid()) { return; } ClassDescriptor parentDescriptor = getParentDescriptor(); if (parentDescriptor.getInheritancePolicy().shouldReadSubclasses()) { Helper.addAllUniqueToVector(parentDescriptor.getAllFields(), fields); } parentDescriptor.getInheritancePolicy().addFieldsToParent(fields); } }
/** * INTERNAL: * For an aggregate mapping the reference descriptor is cloned. * If the reference descriptor is involved in an inheritance tree, * all the parent and child descriptors are cloned also. * The cloned descriptors are then assigned primary keys and * table names before initialize. * This is a very specific behavior for aggregate mappings. */ public void initializeParentInheritance(ClassDescriptor parentDescriptor, ClassDescriptor childDescriptor, AbstractSession session) throws DescriptorException { ClassDescriptor clonedParentDescriptor = (ClassDescriptor)parentDescriptor.clone(); //recursive call to the further parent descriptors if (clonedParentDescriptor.getInheritancePolicy().isChildDescriptor()) { ClassDescriptor parentToParentDescriptor = session.getDescriptor(clonedParentDescriptor.getJavaClass()); initializeParentInheritance(parentToParentDescriptor, parentDescriptor, session); } initializeReferenceDescriptor(clonedParentDescriptor, session); Vector children = org.eclipse.persistence.internal.helper.NonSynchronizedVector.newInstance(1); children.addElement(childDescriptor); clonedParentDescriptor.getInheritancePolicy().setChildDescriptors(children); clonedParentDescriptor.preInitialize(session); clonedParentDescriptor.initialize(session); translateFields(clonedParentDescriptor, session); }
public Expression getTypeClause() { if (typeExpression == null) { if (getDescriptor() !=null && isDowncast()) { InheritancePolicy ip = this.getDescriptor().getInheritancePolicy(); if (ip.isChildDescriptor()) {//or use the isDowncast flag. Don't need to do anything if its not a downcast //equivalent to typeExpressionBase.type().in(this.getDescriptor().getInheritancePolicy().getChildClasses()) typeExpression = ip.getWithAllSubclassesExpression(); if (typeExpression == null ) { typeExpression = typeExpressionBase.type().equal(this.getDescriptor().getJavaClass()); } else { typeExpression = this.typeExpressionBase.twist(typeExpression, typeExpressionBase); } } } else { typeExpression = this.getBuilder();//equivalent to an empty expression. } } return typeExpression; }
public Expression getTypeClause() { if (typeExpression == null) { if (getDescriptor() !=null && isDowncast()) { InheritancePolicy ip = this.getDescriptor().getInheritancePolicy(); if (ip.isChildDescriptor()) {//or use the isDowncast flag. Don't need to do anything if its not a downcast //equivalent to typeExpressionBase.type().in(this.getDescriptor().getInheritancePolicy().getChildClasses()) typeExpression = ip.getWithAllSubclassesExpression(); if (typeExpression == null ) { typeExpression = typeExpressionBase.type().equal(this.getDescriptor().getJavaClass()); } else { typeExpression = this.typeExpressionBase.twist(typeExpression, typeExpressionBase); } } } else { typeExpression = this.getBuilder();//equivalent to an empty expression. } } return typeExpression; }
/** * INTERNAL: * Initialized the inheritance properties that cannot be initialized * until after the mappings have been. */ public void postInitialize(AbstractSession session) { if (isChildDescriptor()) { ClassDescriptor parent = getParentDescriptor(); if (getDescriptor().shouldAcquireCascadedLocks()){ parent.setShouldAcquireCascadedLocks(true); } if (getDescriptor().hasRelationships()){ parent.setHasRelationships(true); } while (parent != null) { if (parent.hasMultipleTableConstraintDependecy()) { getDescriptor().setHasMultipleTableConstraintDependecy(true); break; } parent = parent.getInheritancePolicy().getParentDescriptor(); } } }