/** * Return whether the source key is specified. * It will be empty when #setTargetForeignKeyFieldName(String) is used. */ protected boolean isSourceKeySpecified() { return !this.getSourceKeyFields().isEmpty(); }
/** * PUBLIC: * Return the source key field names associated with the mapping. * These are in-order with the targetForeignKeyFieldNames. */ public Vector getSourceKeyFieldNames() { Vector fieldNames = new Vector(getSourceKeyFields().size()); for (Enumeration fieldsEnum = getSourceKeyFields().elements(); fieldsEnum.hasMoreElements();) { fieldNames.addElement(((DatabaseField)fieldsEnum.nextElement()).getQualifiedName()); } return fieldNames; }
/** * INTERNAL: * Add the associated fields to the appropriate collections. */ public void addTargetForeignKeyField(DatabaseField targetForeignKeyField, DatabaseField sourceKeyField) { this.getTargetForeignKeyFields().addElement(targetForeignKeyField); this.getSourceKeyFields().addElement(sourceKeyField); }
if (this.getTargetForeignKeyFields().size() != this.getSourceKeyFields().size()) { throw DescriptorException.targetForeignKeysSizeMismatch(this); for (Enumeration keys = this.getSourceKeyFields().elements(); keys.hasMoreElements();) { this.getDescriptor().buildField((DatabaseField)keys.nextElement()); Enumeration<DatabaseField> sourceKeys = this.getSourceKeyFields().elements(); while (targetForeignKeys.hasMoreElements()) { DatabaseField targetForeignKey = targetForeignKeys.nextElement();
/** * This method would allow customers to get the potential selection criteria for a mapping * prior to initialization. This would allow them to more easily create an ammendment method * that would ammend the SQL for the join. * * CR#3922 - This method is almost the same as buildDefaultSelectionCriteria() the difference * is that TargetForeignKeysToSourceKeys contains more information after login then SourceKeyFields * contains before login. */ public Expression buildSelectionCriteria() { //CR3922 Expression selectionCriteria = null; Expression builder = new ExpressionBuilder(); Enumeration sourceKeys = this.getSourceKeyFields().elements(); for (Enumeration targetForeignKeys = this.getTargetForeignKeyFields().elements(); targetForeignKeys.hasMoreElements();) { DatabaseField targetForeignKey = (DatabaseField)targetForeignKeys.nextElement(); DatabaseField sourceKey = (DatabaseField)sourceKeys.nextElement(); Expression partialSelectionCriteria = builder.getField(targetForeignKey).equal(builder.getParameter(sourceKey)); selectionCriteria = partialSelectionCriteria.and(selectionCriteria); } return selectionCriteria; }