/** * Return true if and only if the end of the path is a reference . * @return the end-is-reference flag */ public boolean endIsReference() { if (endFld == null) { return false; } return endFld.isReference(); }
/** * Return true if and only if the end of the path is a reference . * @return the end-is-reference flag */ public boolean endIsReference() { if (endFld == null) { return false; } return endFld.isReference(); }
/** * Gets all ReferenceDescriptors for this class - i.e. including those from superclass. * * @return a Set of references (but not CollectionDescriptors) for this Class */ public Set<ReferenceDescriptor> getAllReferenceDescriptors() { Set<ReferenceDescriptor> set = new LinkedHashSet<ReferenceDescriptor>(); for (FieldDescriptor fd : getAllFieldDescriptors()) { if (fd.isReference()) { set.add((ReferenceDescriptor) fd); } } return set; }
/** * Gets all ReferenceDescriptors for this class - i.e. including those from superclass. * * @return a Set of references (but not CollectionDescriptors) for this Class */ public Set<ReferenceDescriptor> getAllReferenceDescriptors() { Set<ReferenceDescriptor> set = new LinkedHashSet<ReferenceDescriptor>(); for (FieldDescriptor fd : getAllFieldDescriptors()) { if (fd.isReference()) { set.add((ReferenceDescriptor) fd); } } return set; }
FieldDescriptor fieldDescriptor = elementClassDescriptors.get(i) .getFieldDescriptorByName(fieldName); if (fieldDescriptor.isReference() || fieldDescriptor.isCollection()) { String referencedClassName = ((ReferenceDescriptor) fieldDescriptor).getReferencedClassName();
FieldDescriptor fieldDescriptor = elementClassDescriptors.get(i) .getFieldDescriptorByName(fieldName); if (fieldDescriptor.isReference() || fieldDescriptor.isCollection()) { String referencedClassName = ((ReferenceDescriptor) fieldDescriptor).getReferencedClassName();
/** * Returns whether this primary key can be fetched now. * * @param pk the PrimaryKey * @param cld the ClassDescriptor that the PrimaryKey is in * @param pksNotDone a Map of pks not yet fetched * @return a boolean */ protected boolean canDoPkNow(PrimaryKey pk, ClassDescriptor cld, Map<PrimaryKey, ClassDescriptor> pksNotDone) { boolean canDoPkNow = true; Iterator<String> fieldNameIter = pk.getFieldNames().iterator(); while (fieldNameIter.hasNext() && canDoPkNow) { String fieldName = fieldNameIter.next(); FieldDescriptor fd = cld.getFieldDescriptorByName(fieldName); if (fd.isReference()) { Iterator<ClassDescriptor> otherCldIter = pksNotDone.values().iterator(); while (otherCldIter.hasNext() && canDoPkNow) { ClassDescriptor otherCld = otherCldIter.next(); Class<? extends FastPathObject> fieldClass = ((ReferenceDescriptor) fd) .getReferencedClassDescriptor().getType(); if (otherCld.getType().isAssignableFrom(fieldClass) || fieldClass.isAssignableFrom(otherCld.getType())) { canDoPkNow = false; } } } } return canDoPkNow; }
/** * Returns whether this primary key can be fetched now. * * @param pk the PrimaryKey * @param cld the ClassDescriptor that the PrimaryKey is in * @param pksNotDone a Map of pks not yet fetched * @return a boolean */ protected boolean canDoPkNow(PrimaryKey pk, ClassDescriptor cld, Map<PrimaryKey, ClassDescriptor> pksNotDone) { boolean canDoPkNow = true; Iterator<String> fieldNameIter = pk.getFieldNames().iterator(); while (fieldNameIter.hasNext() && canDoPkNow) { String fieldName = fieldNameIter.next(); FieldDescriptor fd = cld.getFieldDescriptorByName(fieldName); if (fd.isReference()) { Iterator<ClassDescriptor> otherCldIter = pksNotDone.values().iterator(); while (otherCldIter.hasNext() && canDoPkNow) { ClassDescriptor otherCld = otherCldIter.next(); Class<? extends FastPathObject> fieldClass = ((ReferenceDescriptor) fd) .getReferencedClassDescriptor().getType(); if (otherCld.getType().isAssignableFrom(fieldClass) || fieldClass.isAssignableFrom(otherCld.getType())) { canDoPkNow = false; } } } } return canDoPkNow; }
+ fD.getName() + "$_^'||NEW." + getDBName(fD.getName()) + "; END IF;\n"); } else if (fD.isReference()) { body.append("IF ( NEW." + fD.getName() + "id IS NOT NULL ) THEN objectText := objectText || " + "'$_^r"
+ fD.getName() + "$_^'||NEW." + getDBName(fD.getName()) + "; END IF;\n"); } else if (fD.isReference()) { body.append("IF ( NEW." + fD.getName() + "id IS NOT NULL ) THEN objectText := objectText || " + "'$_^r"
+ fD.getName() + "$_^'||NEW." + getDBName(fD.getName()) + "; END IF;\n"); } else if (fD.isReference()) { body.append("IF ( NEW." + fD.getName() + "id IS NOT NULL ) THEN objectText := objectText || " + "'$_^r"
+ fD.getName() + "$_^'||NEW." + getDBName(fD.getName()) + "; END IF;\n"); } else if (fD.isReference()) { body.append("IF ( NEW." + fD.getName() + "id IS NOT NULL ) THEN objectText := objectText || " + "'$_^r"
if (fd.isReference()) { qRef = new QueryObjectReference(qcEnd, refName); } else { if (fd.isReference()) { qRef = new QueryObjectReference(qcStart, refName); } else {
if (fd.isReference()) { qRef = new QueryObjectReference(qcEnd, refName); } else { if (fd.isReference()) { qRef = new QueryObjectReference(qcStart, refName); } else {
/** * Attach the model. Throws IllegalArgumentExceptions if node doesn't map onto the model. * * @param model model to attach * @throws IllegalArgumentException if class or field are not found in the model */ public void setModel(Model model) { ClassDescriptor cld = model.getClassDescriptorByName(getParentType()); if (cld == null) { throw new IllegalArgumentException("No class '" + getParentType() + "' found in model '" + model.getName() + "'."); } fd = cld.getFieldDescriptorByName(fieldName); if (fd == null) { throw new IllegalArgumentException("Class '" + cld.getName() + "' does not have field '" + fieldName + "'."); } type = TypeUtil.unqualifiedName(fd.isAttribute() ? ((AttributeDescriptor) fd).getType() : ((ReferenceDescriptor) fd) .getReferencedClassDescriptor().getName()); attribute = fd.isAttribute(); reference = fd.isReference(); collection = fd.isCollection(); this.model = model; }
/** * Attach the model. Throws IllegalArgumentExceptions if node doesn't map onto the model. * * @param model model to attach * @throws IllegalArgumentException if class or field are not found in the model */ public void setModel(Model model) { ClassDescriptor cld = model.getClassDescriptorByName(getParentType()); if (cld == null) { throw new IllegalArgumentException("No class '" + getParentType() + "' found in model '" + model.getName() + "'."); } fd = cld.getFieldDescriptorByName(fieldName); if (fd == null) { throw new IllegalArgumentException("Class '" + cld.getName() + "' does not have field '" + fieldName + "'."); } type = TypeUtil.unqualifiedName(fd.isAttribute() ? ((AttributeDescriptor) fd).getType() : ((ReferenceDescriptor) fd) .getReferencedClassDescriptor().getName()); attribute = fd.isAttribute(); reference = fd.isReference(); collection = fd.isCollection(); this.model = model; }
if (fD.isAttribute()) { commonFields.add(fD.getName()); } else if (fD.isReference()) { commonFields.add(fD.getName() + "id");
/** * If the last element in the path is a reference or collection return the ClassDescriptor that * the reference or collection references. If the path has one element (eg. "Employee"), * return its ClassDescriptor. If the last element in the path is an attribute, return null. * @return the ClassDescriptor */ public ClassDescriptor getEndClassDescriptor() { if (getEndFieldDescriptor() == null) { return getStartClassDescriptor(); } if (!getEndFieldDescriptor().isAttribute()) { if (getEndFieldDescriptor().isCollection()) { CollectionDescriptor collDesc = (CollectionDescriptor) getEndFieldDescriptor(); return collDesc.getReferencedClassDescriptor(); } if (getEndFieldDescriptor().isReference()) { ReferenceDescriptor refDesc = (ReferenceDescriptor) getEndFieldDescriptor(); return refDesc.getReferencedClassDescriptor(); } } return null; }
/** * If the last element in the path is a reference or collection return the ClassDescriptor that * the reference or collection references. If the path has one element (eg. "Employee"), * return its ClassDescriptor. If the last element in the path is an attribute, return null. * @return the ClassDescriptor */ public ClassDescriptor getEndClassDescriptor() { if (getEndFieldDescriptor() == null) { return getStartClassDescriptor(); } if (!getEndFieldDescriptor().isAttribute()) { if (getEndFieldDescriptor().isCollection()) { CollectionDescriptor collDesc = (CollectionDescriptor) getEndFieldDescriptor(); return collDesc.getReferencedClassDescriptor(); } if (getEndFieldDescriptor().isReference()) { ReferenceDescriptor refDesc = (ReferenceDescriptor) getEndFieldDescriptor(); return refDesc.getReferencedClassDescriptor(); } } return null; }
"org.intermine.model.testmodel.Company").getAllFieldDescriptors()) { if (fd.isReference()) { ReferenceDescriptor ref = (ReferenceDescriptor) fd; DisplayReference dr = new DisplayReference(null, ref, webConfig, im.getClassKeys(), null);