use of org.eclipse.persistence.mappings.structures.ArrayMapping in project eclipselink by eclipse-ee4j.
the class ArrayAccessor method process.
/**
* INTERNAL:
* Process the ArrayMapping or ObjectArrayMapping.
*/
@Override
public void process() {
if (isDirectEmbeddableCollection()) {
ObjectArrayMapping mapping = new ObjectArrayMapping();
// Add the mapping to the descriptor.
setMapping(mapping);
// Set the reference class name.
mapping.setReferenceClassName(getReferenceClassName());
// Set the attribute name.
mapping.setAttributeName(getAttributeName());
// Will check for PROPERTY access
setAccessorMethods(mapping);
mapping.setStructureName(getDatabaseType());
// Process the @Column or column element if there is one.
// A number of methods depend on this field so it must be
// initialized before any further processing can take place.
mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));
} else {
ArrayMapping mapping = new ArrayMapping();
// Add the mapping to the descriptor.
setMapping(mapping);
// Set the attribute name.
mapping.setAttributeName(getAttributeName());
// Will check for PROPERTY access
setAccessorMethods(mapping);
mapping.setStructureName(getDatabaseType());
// Process the @Column or column element if there is one.
// A number of methods depend on this field so it must be
// initialized before any further processing can take place.
mapping.setField(new ObjectRelationalDatabaseField(getDatabaseField(getDescriptor().getPrimaryTable(), MetadataLogger.COLUMN)));
}
}
use of org.eclipse.persistence.mappings.structures.ArrayMapping in project eclipselink by eclipse-ee4j.
the class ORDescriptorTestSuite method tbl2Asserts.
protected void tbl2Asserts(ClassDescriptor tbl2Descriptor) {
assertTrue("Wrong Java class name. Expected [" + TBL2_DESCRIPTOR_JAVACLASSNAME + "] but was [" + tbl2Descriptor.getJavaClassName() + "]", tbl2Descriptor.getJavaClassName().equals(TBL2_DESCRIPTOR_JAVACLASSNAME));
Vector<DatabaseMapping> mappings = tbl2Descriptor.getMappings();
assertTrue("Wrong number of mappings. Expected [1] but was [" + mappings.size() + "]", mappings.size() == 1);
DatabaseMapping mapping = mappings.get(0);
assertTrue("Incorrect mapping attribute name. Expected [" + BaseDBWSBuilderHelper.ITEMS_MAPPING_ATTRIBUTE_NAME + "] but was [" + mapping.getAttributeName() + "]", mapping.getAttributeName().equals(BaseDBWSBuilderHelper.ITEMS_MAPPING_ATTRIBUTE_NAME));
assertTrue("Incorrect mapping field name. Expected [" + BaseDBWSBuilderHelper.ITEMS_MAPPING_FIELD_NAME + "] but was [" + mapping.getField().getName() + "]", mapping.getField().getName().equals(BaseDBWSBuilderHelper.ITEMS_MAPPING_FIELD_NAME));
assertTrue("Incorrect mapping type. Expected [AbstractCompositeDirectCollection mapping], but was [" + mapping.getClass().getName() + "]", mapping.isAbstractCompositeDirectCollectionMapping());
ArrayMapping arrayMapping = (ArrayMapping) mapping;
assertTrue("Wrong structure name for mapping. Expected [" + TBL2_COMPATIBLETYPE + "] but was [" + arrayMapping.getStructureName() + "]", arrayMapping.getStructureName().equals(TBL2_COMPATIBLETYPE));
}
use of org.eclipse.persistence.mappings.structures.ArrayMapping in project eclipselink by eclipse-ee4j.
the class ORDescriptorTestSuite method tbl1Asserts.
// ASSERT METHODS
protected void tbl1Asserts(ClassDescriptor tbl1Descriptor) {
assertTrue("Wrong Java class name. Expected [" + TBL1_DESCRIPTOR_JAVACLASSNAME + "] but was [" + tbl1Descriptor.getJavaClassName() + "]", tbl1Descriptor.getJavaClassName().equals(TBL1_DESCRIPTOR_JAVACLASSNAME));
Vector<DatabaseMapping> mappings = tbl1Descriptor.getMappings();
assertTrue("Wrong number of mappings. Expected [1] but was [" + mappings.size() + "]", mappings.size() == 1);
DatabaseMapping mapping = mappings.get(0);
assertTrue("Incorrect mapping attribute name. Expected [" + BaseDBWSBuilderHelper.ITEMS_MAPPING_ATTRIBUTE_NAME + "] but was [" + mapping.getAttributeName() + "]", mapping.getAttributeName().equals(BaseDBWSBuilderHelper.ITEMS_MAPPING_ATTRIBUTE_NAME));
assertTrue("Incorrect mapping field name. Expected [" + BaseDBWSBuilderHelper.ITEMS_MAPPING_FIELD_NAME + "] but was [" + mapping.getField().getName() + "]", mapping.getField().getName().equals(BaseDBWSBuilderHelper.ITEMS_MAPPING_FIELD_NAME));
assertTrue("Incorrect mapping type. Expected [AbstractCompositeDirectCollection mapping], but was [" + mapping.getClass().getName() + "]", mapping.isAbstractCompositeDirectCollectionMapping());
ArrayMapping arrayMapping = (ArrayMapping) mapping;
assertTrue("Wrong structure name for mapping. Expected [" + TBL1_COMPATIBLETYPE + "] but was [" + arrayMapping.getStructureName() + "]", arrayMapping.getStructureName().equals(TBL1_COMPATIBLETYPE));
}
use of org.eclipse.persistence.mappings.structures.ArrayMapping in project eclipselink by eclipse-ee4j.
the class OracleHelper method buildAndAddArrayMapping.
/**
* Build an ArrayMapping based on a given attribute name, field name and structure
* name. The newly created mapping will be added to the given OR descriptor.
*/
protected ArrayMapping buildAndAddArrayMapping(ObjectRelationalDataTypeDescriptor orDesc, String attributeName, String fieldName, String structureName) {
ArrayMapping arrayMapping = buildArrayMapping(attributeName, fieldName, structureName);
orDesc.addMapping(arrayMapping);
return arrayMapping;
}
use of org.eclipse.persistence.mappings.structures.ArrayMapping in project eclipselink by eclipse-ee4j.
the class OracleHelper method buildArrayMapping.
/**
* Build an ArrayMapping based on a given attribute name, field name and structure
* name.
*/
protected ArrayMapping buildArrayMapping(String attributeName, String fieldName, String structureName) {
ArrayMapping arrayMapping = new ArrayMapping();
arrayMapping.setAttributeName(attributeName);
arrayMapping.setFieldName(fieldName);
arrayMapping.setStructureName(structureName);
arrayMapping.useCollectionClass(ArrayList.class);
return arrayMapping;
}
Aggregations