if (inheritancePolicy == null || inheritancePolicy.getParentClass() == null) { return false; Class superClass = inheritancePolicy.getParentClass();
/** * INTERNAL: * This initialized method is used exclusively for inheritance. It passes in * true if the child descriptor is isolated. * * This is needed by regular aggregate descriptors (because they require review); * but not by SDK aggregate descriptors. */ public void initializeAggregateInheritancePolicy(AbstractSession session) { ClassDescriptor parentDescriptor = session.getDescriptor(getInheritancePolicy().getParentClass()); parentDescriptor.getInheritancePolicy().addChildDescriptor(this); }
/** * INTERNAL: * This initialized method is used exclusively for inheritance. It passes in * true if the child descriptor is isolated. * * This is needed by regular aggregate descriptors (because they require review); * but not by SDK aggregate descriptors. */ public void initializeAggregateInheritancePolicy(AbstractSession session) { ClassDescriptor parentDescriptor = session.getDescriptor(getInheritancePolicy().getParentClass()); parentDescriptor.getInheritancePolicy().addChildDescriptor(this); }
/** * INTERNAL: * This initialized method is used exclusively for inheritance. It passes in * true if the child descriptor is isolated. * * This is needed by regular aggregate descriptors (because they require review); * but not by SDK aggregate descriptors. */ public void initializeAggregateInheritancePolicy(AbstractSession session) { ClassDescriptor parentDescriptor = session.getDescriptor(getInheritancePolicy().getParentClass()); parentDescriptor.getInheritancePolicy().addChildDescriptor(this); }
private void setMultipleTableConstraintDependency(MetaClass metaClass, ClassDescriptor desc) { InheritancePolicy policy = desc.getInheritancePolicyOrNull(); if (policy != null && policy.isJoinedStrategy() && policy.getParentClass() != null) { boolean hasOneToMany = metaClass.getOwnProperties().stream().anyMatch(metaProperty -> metadata.getTools().isPersistent(metaProperty) && metaProperty.getRange().isClass() && metaProperty.getRange().getCardinality() == Range.Cardinality.ONE_TO_MANY); if (hasOneToMany) { desc.setHasMultipleTableConstraintDependecy(true); } } }
/** * Hook together the inheritance policy tree. */ protected void preInitializeInheritancePolicy(AbstractSession session) throws DescriptorException { if (isChildDescriptor() && (requiresInitialization())) { if (getInheritancePolicy().getParentClass().equals(getJavaClass())) { setInterfaceInitializationStage(ERROR); throw DescriptorException.parentClassIsSelf(this); } ClassDescriptor parentDescriptor = session.getDescriptor(getInheritancePolicy().getParentClass()); parentDescriptor.getInheritancePolicy().addChildDescriptor(this); getInheritancePolicy().setParentDescriptor(parentDescriptor); parentDescriptor.preInitialize(session); } }
/** * Hook together the inheritance policy tree. */ protected void preInitializeInheritancePolicy(AbstractSession session) throws DescriptorException { if (isChildDescriptor() && (requiresInitialization(session))) { if (getInheritancePolicy().getParentClass().equals(getJavaClass())) { setInterfaceInitializationStage(ERROR); throw DescriptorException.parentClassIsSelf(this); } ClassDescriptor parentDescriptor = session.getDescriptor(getInheritancePolicy().getParentClass()); parentDescriptor.getInheritancePolicy().addChildDescriptor(this); getInheritancePolicy().setParentDescriptor(parentDescriptor); parentDescriptor.preInitialize(session); } }
/** * Hook together the inheritance policy tree. */ protected void preInitializeInheritancePolicy(AbstractSession session) throws DescriptorException { if (isChildDescriptor() && (requiresInitialization(session))) { if (getInheritancePolicy().getParentClass().equals(getJavaClass())) { setInterfaceInitializationStage(ERROR); throw DescriptorException.parentClassIsSelf(this); } ClassDescriptor parentDescriptor = session.getDescriptor(getInheritancePolicy().getParentClass()); parentDescriptor.getInheritancePolicy().addChildDescriptor(this); getInheritancePolicy().setParentDescriptor(parentDescriptor); parentDescriptor.preInitialize(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()); Enumeration childEnum = getChildDescriptors().elements(); while (childEnum.hasMoreElements()) { ClassDescriptor childDescriptor = (ClassDescriptor)childEnum.nextElement(); if (session.hasCorrespondingDescriptor(childDescriptor)) { tempChildren.addElement(session.getDescriptor(childDescriptor.getJavaClass())); } else { session.privilegedAddDescriptor(childDescriptor); childDescriptor.remoteInitialization(session); tempChildren.addElement(childDescriptor); } } setChildDescriptors(tempChildren); }
/** * 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: * 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: * Verify that an aggregate descriptor's inheritance tree * is full of aggregate descriptors. */ public void checkInheritanceTreeAggregateSettings(AbstractSession session, AggregateMapping mapping) throws DescriptorException { if (!this.hasInheritance()) { return; } if (this.isChildDescriptor()) { Class parentClass = this.getInheritancePolicy().getParentClass(); if (parentClass == this.getJavaClass()) { throw DescriptorException.parentClassIsSelf(this); } // recurse up the inheritance tree to the root descriptor session.getDescriptor(parentClass).checkInheritanceTreeAggregateSettings(session, mapping); } else { // we have a root descriptor, now verify it and all its children, grandchildren, etc. this.checkInheritanceTreeAggregateSettingsForChildren(session, mapping); } }
/** * INTERNAL: * Verify that an aggregate descriptor's inheritance tree * is full of aggregate descriptors. */ public void checkInheritanceTreeAggregateSettings(AbstractSession session, AggregateMapping mapping) throws DescriptorException { if (!this.hasInheritance()) { return; } if (this.isChildDescriptor()) { Class parentClass = this.getInheritancePolicy().getParentClass(); if (parentClass == this.getJavaClass()) { throw DescriptorException.parentClassIsSelf(this); } // recurse up the inheritance tree to the root descriptor session.getDescriptor(parentClass).checkInheritanceTreeAggregateSettings(session, mapping); } else { // we have a root descriptor, now verify it and all its children, grandchildren, etc. this.checkInheritanceTreeAggregateSettingsForChildren(session, mapping); } }
/** * INTERNAL: * Verify that an aggregate descriptor's inheritance tree * is full of aggregate descriptors. */ public void checkInheritanceTreeAggregateSettings(AbstractSession session, AggregateMapping mapping) throws DescriptorException { if (!this.hasInheritance()) { return; } if (this.isChildDescriptor()) { Class parentClass = this.getInheritancePolicy().getParentClass(); if (parentClass == this.getJavaClass()) { throw DescriptorException.parentClassIsSelf(this); } // recurse up the inheritance tree to the root descriptor session.getDescriptor(parentClass).checkInheritanceTreeAggregateSettings(session, mapping); } else { // we have a root descriptor, now verify it and all its children, grandchildren, etc. this.checkInheritanceTreeAggregateSettingsForChildren(session, mapping); } }
ClassDescriptor newDescriptor = getOwnerSession().getDescriptor(parentDescriptor.getInheritancePolicy().getParentClass());
/** * INTERNAL: * Validate that the descriptor's non-mapping attribute are defined correctly. */ protected void selfValidationBeforeInitialization(AbstractSession session) throws DescriptorException { if (isChildDescriptor()) { ClassDescriptor parentDescriptor = session.getDescriptor(getInheritancePolicy().getParentClass()); if (parentDescriptor == null) { session.getIntegrityChecker().handleError(DescriptorException.parentDescriptorNotSpecified(getInheritancePolicy().getParentClass().getName(), this)); } } else { if (getTables().isEmpty() && (!isAggregateDescriptor())) { session.getIntegrityChecker().handleError(DescriptorException.tableNotSpecified(this)); } } if (!isChildDescriptor() && !isDescriptorTypeAggregate()) { if (getPrimaryKeyFieldNames().isEmpty()) { session.getIntegrityChecker().handleError(DescriptorException.primaryKeyFieldsNotSepcified(this)); } } if ((getIdentityMapClass() == ClassConstants.NoIdentityMap_Class) && (getQueryManager().getDoesExistQuery().shouldCheckCacheForDoesExist())) { session.getIntegrityChecker().handleError(DescriptorException.identityMapNotSpecified(this)); } if (((getSequenceNumberName() != null) && (getSequenceNumberField() == null)) || ((getSequenceNumberName() == null) && (getSequenceNumberField() != null))) { session.getIntegrityChecker().handleError(DescriptorException.sequenceNumberPropertyNotSpecified(this)); } }
/** * INTERNAL: * Validate that the descriptor's non-mapping attribute are defined correctly. */ protected void selfValidationBeforeInitialization(AbstractSession session) throws DescriptorException { if (isChildDescriptor()) { ClassDescriptor parentDescriptor = session.getDescriptor(getInheritancePolicy().getParentClass()); if (parentDescriptor == null) { session.getIntegrityChecker().handleError(DescriptorException.parentDescriptorNotSpecified(getInheritancePolicy().getParentClass().getName(), this)); } } else { if (getTables().isEmpty() && (!isAggregateDescriptor())) { session.getIntegrityChecker().handleError(DescriptorException.tableNotSpecified(this)); } } if (!isChildDescriptor() && !isAggregateDescriptor() && !isAggregateCollectionDescriptor()) { if (getPrimaryKeyFieldNames().isEmpty()) { session.getIntegrityChecker().handleError(DescriptorException.primaryKeyFieldsNotSepcified(this)); } } if ((getIdentityMapClass() == ClassConstants.NoIdentityMap_Class) && (getQueryManager().getDoesExistQuery().shouldCheckCacheForDoesExist())) { session.getIntegrityChecker().handleError(DescriptorException.identityMapNotSpecified(this)); } if (((getSequenceNumberName() != null) && (getSequenceNumberField() == null)) || ((getSequenceNumberName() == null) && (getSequenceNumberField() != null))) { session.getIntegrityChecker().handleError(DescriptorException.sequenceNumberPropertyNotSpecified(this)); } }
/** * INTERNAL: * Validate that the descriptor's non-mapping attribute are defined correctly. */ protected void selfValidationBeforeInitialization(AbstractSession session) throws DescriptorException { if (isChildDescriptor()) { ClassDescriptor parentDescriptor = session.getDescriptor(getInheritancePolicy().getParentClass()); if (parentDescriptor == null) { session.getIntegrityChecker().handleError(DescriptorException.parentDescriptorNotSpecified(getInheritancePolicy().getParentClass().getName(), this)); } } else { if (getTables().isEmpty() && (!isAggregateDescriptor())) { session.getIntegrityChecker().handleError(DescriptorException.tableNotSpecified(this)); } } if (!isChildDescriptor() && !isDescriptorTypeAggregate()) { if (getPrimaryKeyFieldNames().isEmpty()) { session.getIntegrityChecker().handleError(DescriptorException.primaryKeyFieldsNotSepcified(this)); } } if ((getIdentityMapClass() == ClassConstants.NoIdentityMap_Class) && (getQueryManager().getDoesExistQuery().shouldCheckCacheForDoesExist())) { session.getIntegrityChecker().handleError(DescriptorException.identityMapNotSpecified(this)); } if (((getSequenceNumberName() != null) && (getSequenceNumberField() == null)) || ((getSequenceNumberName() == null) && (getSequenceNumberField() != null))) { session.getIntegrityChecker().handleError(DescriptorException.sequenceNumberPropertyNotSpecified(this)); } }
if (inheritancePolicy != null && inheritancePolicy.getParentClass() != null) { extension = new Extension(); extension.setBaseType(desc.getSchemaReference().getSchemaContextAsQName(workingSchema.getNamespaceResolver()).getLocalPart());
ClassDescriptor parentDescriptor = session.getDescriptor(clonedDescriptor.getInheritancePolicy().getParentClass()); initializeParentInheritance(parentDescriptor, clonedDescriptor, session);