Refine search
/** * 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(); }
/** * PUBLIC: * This method returns the root descriptor for for this descriptor's class heirarchy. * If the user is not using inheritance then the root class will be this class. */ public ClassDescriptor getRootDescriptor(){ if (this.hasInheritance()){ return this.getInheritancePolicy().getRootParentDescriptor(); } return this; }
/** * PUBLIC: * This method returns the root descriptor for for this descriptor's class heirarchy. * If the user is not using inheritance then the root class will be this class. */ public ClassDescriptor getRootDescriptor(){ if (this.hasInheritance()){ return this.getInheritancePolicy().getRootParentDescriptor(); } return this; }
/** * PUBLIC: * This method returns the root descriptor for for this descriptor's class heirarchy. * If the user is not using inheritance then the root class will be this class. */ public ClassDescriptor getRootDescriptor(){ if (this.hasInheritance()){ return this.getInheritancePolicy().getRootParentDescriptor(); } return this; }
public Vector withAllSubclasses(CommitOrderDependencyNode node) { Vector results = new Vector(); results.addElement(node); if (node.getDescriptor().hasInheritance()) { InheritancePolicy p = node.getDescriptor().getInheritancePolicy(); // For bug 3019934 replace getChildDescriptors with getAllChildDescriptors. for (Enumeration e = p.getAllChildDescriptors().elements(); e.hasMoreElements();) { results.addElement(getOwner().nodeFor((ClassDescriptor)e.nextElement())); } } return results; } }
/** * PUBLIC: * Return true if this descriptor should using an additional join expresison. */ public boolean shouldUseAdditionalJoinExpression() { // Return true, if the query manager has an additional join expression // and this descriptor is not part of an inheritance hierarchy using a // view (CR#3701077) return ((getQueryManager().getAdditionalJoinExpression() != null) && ! (hasInheritance() && getInheritancePolicy().hasView())); }
@Override public boolean addClassIndicatorFieldToRow(AbstractMarshalRecord abstractMarshalRecord) { if (descriptor.hasInheritance() && !xPathObjectBuilder.isXsiTypeIndicatorField()) { InheritanceRecord inheritanceRecord = new InheritanceRecord(abstractMarshalRecord); descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(inheritanceRecord); return true; } return false; }
/** * PUBLIC: * Return true if this descriptor should using an additional join expresison. */ public boolean shouldUseAdditionalJoinExpression() { // Return true, if the query manager has an additional join expression // and this descriptor is not part of an inheritance hierarchy using a // view (CR#3701077) return ((getQueryManager().getAdditionalJoinExpression() != null) && ! (hasInheritance() && getInheritancePolicy().hasView())); }
@Override public boolean addClassIndicatorFieldToRow(AbstractMarshalRecord abstractMarshalRecord) { if (descriptor.hasInheritance() && !xPathObjectBuilder.isXsiTypeIndicatorField()) { InheritanceRecord inheritanceRecord = new InheritanceRecord(abstractMarshalRecord); descriptor.getInheritancePolicy().addClassIndicatorFieldToRow(inheritanceRecord); return true; } return false; }
/** * Return all of the objects of the class and all of its subclasses. * The session is needed because there is no other way to find all subclasses. */ public Vector getAllObjectsForAbstractClass(Class objectsClass, AbstractSession session) { ClassDescriptor descriptor = session.getDescriptor(objectsClass); Vector allObjects = new Vector(); addAllObjectsForClass(objectsClass, allObjects); if (descriptor.hasInheritance()) { for (Enumeration enumeration = descriptor.getInheritancePolicy().getChildDescriptors().elements(); enumeration.hasMoreElements();) { addAllObjectsForClass(((ClassDescriptor)enumeration.nextElement()).getJavaClass(), allObjects); } } return allObjects; }
public Vector withAllSubclasses(CommitOrderDependencyNode node) { Vector results = new Vector(); results.addElement(node); if (node.getDescriptor().hasInheritance()) { InheritancePolicy policy = node.getDescriptor().getInheritancePolicy(); // For bug 3019934 replace getChildDescriptors with getAllChildDescriptors. List<ClassDescriptor> childDescriptors = new ArrayList<ClassDescriptor>(); childDescriptors.addAll(policy.getAllChildDescriptors()); // Sort Child Descriptors before adding them to related nodes. Collections.sort(childDescriptors, new DescriptorCompare()); for (ClassDescriptor child : childDescriptors) { results.add(getOwner().nodeFor(child)); } } return results; } }
public Vector withAllSubclasses(CommitOrderDependencyNode node) { Vector results = new Vector(); results.addElement(node); if (node.getDescriptor().hasInheritance()) { InheritancePolicy policy = node.getDescriptor().getInheritancePolicy(); // For bug 3019934 replace getChildDescriptors with getAllChildDescriptors. List<ClassDescriptor> childDescriptors = new ArrayList<ClassDescriptor>(); childDescriptors.addAll(policy.getAllChildDescriptors()); // Sort Child Descriptors before adding them to related nodes. Collections.sort(childDescriptors, new DescriptorCompare()); for (ClassDescriptor child : childDescriptors) { results.add(getOwner().nodeFor(child)); } } return results; } }
/** * INTERNAL * This method returns the inheritance field value for an object to conform in an in-memory query. * Similar to getFieldValue, but deals with an instance rather than a Class object directly */ public Object typeValueFromObject(Object object, AbstractSession session) { // get the descriptor directly from the object, and use it to find the Java class ClassDescriptor objectDescriptor = session.getClassDescriptor(object); if (!objectDescriptor.hasInheritance() || objectDescriptor.getInheritancePolicy().shouldUseClassNameAsIndicator() || objectDescriptor.getInheritancePolicy().hasClassExtractor() ) { return (objectDescriptor.getJavaClassName()); } else { return objectDescriptor.getInheritancePolicy().getClassIndicatorMapping().get(objectDescriptor.getJavaClass()); } }
/** * INTERNAL: */ public DatabaseField getField() { if (field == null) { ClassDescriptor descriptor = getContainingDescriptor(); if (!descriptor.hasInheritance() || descriptor.getInheritancePolicy().hasClassExtractor()){ throw QueryException.invalidTypeExpression(descriptor.getJavaClassName()); } field = descriptor.getInheritancePolicy().getClassIndicatorField(); } return field; }
public <T> Expression<T> as(Class<T> type) { Project project = ((MetamodelImpl)metamodel).getProject(); if (project != null){ ClassDescriptor descriptor = project.getClassDescriptor(javaType); if (descriptor != null && descriptor.hasInheritance()){ descriptor = descriptor.getInheritancePolicy().getSubclassDescriptor(type); if (descriptor != null){ return buildExpressionForAs(type); } } } return (Expression<T>) this; }
/** * INTERNAL * This method returns the inheritance field value for an object to conform in an in-memory query. * Similar to getFieldValue, but deals with an instance rather than a Class object directly */ public Object typeValueFromObject(Object object, AbstractSession session) { // get the descriptor directly from the object, and use it to find the Java class ClassDescriptor objectDescriptor = session.getClassDescriptor(object); if (!objectDescriptor.hasInheritance() || objectDescriptor.getInheritancePolicy().shouldUseClassNameAsIndicator() || objectDescriptor.getInheritancePolicy().hasClassExtractor() ) { return (objectDescriptor.getJavaClassName()); } else { return objectDescriptor.getInheritancePolicy().getClassIndicatorMapping().get(objectDescriptor.getJavaClass()); } }
/** * INTERNAL: */ @Override public DatabaseField getField() { if (field == null) { ClassDescriptor descriptor = getContainingDescriptor(); if (!descriptor.hasInheritance() || descriptor.getInheritancePolicy().hasClassExtractor()){ throw QueryException.invalidTypeExpression(descriptor.getJavaClassName()); } field = descriptor.getInheritancePolicy().getClassIndicatorField(); } return field; }
/** * INTERNAL: */ public DatabaseField getField() { if (field == null) { ClassDescriptor descriptor = getContainingDescriptor(); if (!descriptor.hasInheritance() || descriptor.getInheritancePolicy().hasClassExtractor()){ throw QueryException.invalidTypeExpression(descriptor.getJavaClassName()); } field = descriptor.getInheritancePolicy().getClassIndicatorField(); } return field; }