protected void copyMainFrom(ReturningPolicy policy) { Collection[][] mainToCopy = policy.main; for (int operation = INSERT; operation <= UPDATE; operation++) { for (int state = RETURN_ONLY; state < MAIN_SIZE; state++) { addCollectionToMain(operation, state, mainToCopy[operation][state]); } } }
/** * PUBLIC: * Define that the field will be returned from an insert operation. */ public void addFieldForInsert(DatabaseField field) { addField(field, true, false, false); }
/** * PUBLIC: * Define that the field will be returned from an insert operation. * The type may be required to bind the output parameter if not known by the mapping. */ public void addFieldForInsert(String qualifiedName, Class type) { addFieldForInsert(createField(qualifiedName, type)); }
/** * PUBLIC: * Define that the field will be returned from an update operation. * The type may be required to bind the output parameter if not known by the mapping. */ public void addFieldForUpdate(String qualifiedName, Class type) { addFieldForUpdate(createField(qualifiedName, type)); }
/** * PUBLIC: * Define that the field will be returned from an insert operation. * A field added with addFieldForInsertReturnOnly method * is excluded from INSERT clause during SQL generation. * The type may be required to bind the output parameter if not known by the mapping. */ public void addFieldForInsertReturnOnly(String qualifiedName, Class type) { addFieldForInsertReturnOnly(createField(qualifiedName, type)); }
/** * INTERNAL: * Used for testing only */ public boolean hasEqualFieldInfos(List<Info> infosToCompare) { return areCollectionsEqualAsSets(getFieldInfos(), infosToCompare); }
clearInitialization(); main = new Collection[NUM_OPERATIONS][MAIN_SIZE]; if (getDescriptor().isChildDescriptor()) { ClassDescriptor parentDescriptor = getDescriptor().getInheritancePolicy().getParentDescriptor(); if (parentDescriptor.hasReturningPolicy()) { copyMainFrom(parentDescriptor.getReturningPolicy()); Hashtable infoHashtable = removeDuplicateAndValidateInfos(session); Hashtable infoHashtableUnmapped = (Hashtable)infoHashtable.clone(); for (Enumeration fields = getDescriptor().getFields().elements(); fields.hasMoreElements();) { DatabaseField field = (DatabaseField)fields.nextElement(); if (info != null) { infoHashtableUnmapped.remove(field); if (verifyFieldAndMapping(session, field)) { if (info.getField().getType() == null) { addMappedFieldToMain(field, info); } else { addMappedFieldToMain(info.getField(), info); fieldIsNotFromDescriptor(info.getField()); DatabaseField field = (DatabaseField)fields.nextElement(); Info info = (Info)infoHashtableUnmapped.get(field); if (verifyField(session, field, getDescriptor())) { if (field.getType() != null) { addUnmappedFieldToMain(field, info); fieldIsNotFromDescriptor(field);
protected void addMappedFieldToMain(DatabaseField field, Info info) { for (int operation = INSERT; operation <= UPDATE; operation++) { for (int state = RETURN_ONLY; state <= WRITE_RETURN; state++) { if (info.is(operation, state)) { addFieldToMain(operation, state, field); addFieldToMain(operation, MAPPED, field); addFieldToMain(operation, ALL, field); } } } }
/** * PUBLIC: * Define that the field will be returned from an insert operation. * A field added with addFieldForInsertReturnOnly method * is excluded from INSERT clause during SQL generation. */ public void addFieldForInsertReturnOnly(String qualifiedName) { addFieldForInsertReturnOnly(qualifiedName, null); }
/** * PUBLIC: */ public void addFieldForInsert(String qualifiedName) { addFieldForInsert(qualifiedName, null); }
/** * PUBLIC: * Define that the field will be returned from an update operation. */ public void addFieldForUpdate(String qualifiedName) { addFieldForUpdate(qualifiedName, null); }
/** * INTERNAL: */ protected ReturningPolicy getReturningPolicy() { if (! m_descriptor.hasReturningPolicy()) { m_descriptor.setReturningPolicy(new ReturningPolicy()); } return m_descriptor.getReturningPolicy(); }
clearInitialization(); main = new Collection[NUM_OPERATIONS][MAIN_SIZE]; if (getDescriptor().isChildDescriptor()) { ClassDescriptor parentDescriptor = getDescriptor().getInheritancePolicy().getParentDescriptor(); if (parentDescriptor.hasReturningPolicy()) { copyMainFrom(parentDescriptor.getReturningPolicy()); Hashtable infoHashtable = removeDuplicateAndValidateInfos(session); Hashtable infoHashtableUnmapped = (Hashtable)infoHashtable.clone(); for (Enumeration fields = getDescriptor().getFields().elements(); fields.hasMoreElements();) { DatabaseField field = (DatabaseField)fields.nextElement(); if (info != null) { infoHashtableUnmapped.remove(field); if (verifyFieldAndMapping(session, field)) { if (info.getField().getType() == null) { addMappedFieldToMain(field, info); } else { addMappedFieldToMain(info.getField(), info); fieldIsNotFromDescriptor(info.getField()); DatabaseField field = (DatabaseField)fields.nextElement(); Info info = (Info)infoHashtableUnmapped.get(field); if (verifyField(session, field, getDescriptor())) { if (field.getType() != null) { addUnmappedFieldToMain(field, info); fieldIsNotFromDescriptor(field);
/** * PUBLIC: */ public void addFieldForUpdate(String qualifiedName, Class type) { addFieldForUpdate(createField(qualifiedName, type)); }
/** * PUBLIC: * Define that the field will be returned from an insert operation. * A field added with addFieldForInsertReturnOnly method * is excluded from INSERT clause during SQL generation. * The type may be required to bind the output parameter if not known by the mapping. */ public void addFieldForInsertReturnOnly(String qualifiedName, Class type) { addFieldForInsertReturnOnly(createField(qualifiedName, type)); }
/** * INTERNAL: * Used for testing only */ public boolean hasEqualFieldInfos(Vector infosToCompare) { return areCollectionsEqualAsSets(getFieldInfos(), infosToCompare); }
protected void addMappedFieldToMain(DatabaseField field, Info info) { for (int operation = INSERT; operation <= UPDATE; operation++) { for (int state = RETURN_ONLY; state <= WRITE_RETURN; state++) { if (info.is(operation, state)) { addFieldToMain(operation, state, field); addFieldToMain(operation, MAPPED, field); addFieldToMain(operation, ALL, field); } } } }
/** * PUBLIC: * Define that the field will be returned from an insert operation. * A field added with addFieldForInsertReturnOnly method * is excluded from INSERT clause during SQL generation. */ public void addFieldForInsertReturnOnly(String qualifiedName) { addFieldForInsertReturnOnly(qualifiedName, null); }
/** * PUBLIC: * Define that the field will be returned from an insert operation. */ public void addFieldForInsert(String qualifiedName) { addFieldForInsert(qualifiedName, null); }
/** * PUBLIC: * Define that the field will be returned from an update operation. */ public void addFieldForUpdate(String qualifiedName) { addFieldForUpdate(qualifiedName, null); }