Search in sources :

Example 6 with ObjectTypeConverter

use of org.eclipse.persistence.mappings.converters.ObjectTypeConverter in project eclipselink by eclipse-ee4j.

the class ObjectPersistenceRuntimeXMLProject method buildPessimisticLockingPolicyDescriptor.

protected ClassDescriptor buildPessimisticLockingPolicyDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(PessimisticLockingPolicy.class);
    descriptor.setDefaultRootElement("pessimistic-locking-policy");
    XMLDirectMapping lockingModeMapping = new XMLDirectMapping();
    lockingModeMapping.setXPath(getPrimaryNamespaceXPath() + "locking-mode/text()");
    lockingModeMapping.setAttributeName("lockingMode");
    lockingModeMapping.setGetMethodName("getLockingMode");
    lockingModeMapping.setSetMethodName("setLockingMode");
    ObjectTypeConverter lockingModeConverter = new ObjectTypeConverter();
    lockingModeConverter.addConversionValue("wait", ObjectLevelReadQuery.LOCK);
    lockingModeConverter.addConversionValue("no-wait", ObjectLevelReadQuery.LOCK_NOWAIT);
    lockingModeMapping.setConverter(lockingModeConverter);
    descriptor.addMapping(lockingModeMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) ObjectTypeConverter(org.eclipse.persistence.mappings.converters.ObjectTypeConverter)

Example 7 with ObjectTypeConverter

use of org.eclipse.persistence.mappings.converters.ObjectTypeConverter in project eclipselink by eclipse-ee4j.

the class ObjectPersistenceRuntimeXMLProject_11_1_1 method buildManyToManyMappingMappingDescriptor.

@Override
protected ClassDescriptor buildManyToManyMappingMappingDescriptor() {
    XMLDescriptor descriptor = (XMLDescriptor) super.buildManyToManyMappingMappingDescriptor();
    XMLDirectMapping joinFetchMapping = new XMLDirectMapping();
    joinFetchMapping.setAttributeName("joinFetch");
    joinFetchMapping.setXPath(getPrimaryNamespaceXPath() + "join-fetch/text()");
    ObjectTypeConverter joinFetchConverter = new ObjectTypeConverter();
    joinFetchConverter.addConversionValue("inner-join", ForeignReferenceMapping.INNER_JOIN);
    joinFetchConverter.addConversionValue("outer-join", ForeignReferenceMapping.OUTER_JOIN);
    joinFetchConverter.addConversionValue("none", ForeignReferenceMapping.NONE);
    joinFetchMapping.setConverter(joinFetchConverter);
    joinFetchMapping.setNullValue(ForeignReferenceMapping.NONE);
    descriptor.addMapping(joinFetchMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) ObjectTypeConverter(org.eclipse.persistence.mappings.converters.ObjectTypeConverter)

Example 8 with ObjectTypeConverter

use of org.eclipse.persistence.mappings.converters.ObjectTypeConverter in project eclipselink by eclipse-ee4j.

the class ObjectPersistenceRuntimeXMLProject_11_1_1 method buildOneToOneMappingDescriptor.

@Override
protected ClassDescriptor buildOneToOneMappingDescriptor() {
    XMLDescriptor descriptor = (XMLDescriptor) super.buildOneToOneMappingDescriptor();
    descriptor.removeMappingForAttributeName("joinFetch");
    XMLDirectMapping joinFetchMapping = new XMLDirectMapping();
    joinFetchMapping.setAttributeName("joinFetch");
    joinFetchMapping.setXPath(getPrimaryNamespaceXPath() + "join-fetch/text()");
    ObjectTypeConverter joinFetchConverter = new ObjectTypeConverter();
    joinFetchConverter.addConversionValue("inner-join", ForeignReferenceMapping.INNER_JOIN);
    joinFetchConverter.addConversionValue("outer-join", ForeignReferenceMapping.OUTER_JOIN);
    joinFetchConverter.addConversionValue("none", ForeignReferenceMapping.NONE);
    joinFetchMapping.setConverter(joinFetchConverter);
    joinFetchMapping.setNullValue(ForeignReferenceMapping.NONE);
    descriptor.addMapping(joinFetchMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) ObjectTypeConverter(org.eclipse.persistence.mappings.converters.ObjectTypeConverter)

Example 9 with ObjectTypeConverter

use of org.eclipse.persistence.mappings.converters.ObjectTypeConverter in project eclipselink by eclipse-ee4j.

the class ObjectPersistenceRuntimeXMLProject_11_1_1 method buildDirectCollectionMappingDescriptor.

@Override
protected ClassDescriptor buildDirectCollectionMappingDescriptor() {
    XMLDescriptor descriptor = (XMLDescriptor) super.buildDirectCollectionMappingDescriptor();
    XMLDirectMapping joinFetchMapping = new XMLDirectMapping();
    joinFetchMapping.setAttributeName("joinFetch");
    joinFetchMapping.setXPath(getPrimaryNamespaceXPath() + "join-fetch/text()");
    ObjectTypeConverter joinFetchConverter = new ObjectTypeConverter();
    joinFetchConverter.addConversionValue("inner-join", ForeignReferenceMapping.INNER_JOIN);
    joinFetchConverter.addConversionValue("outer-join", ForeignReferenceMapping.OUTER_JOIN);
    joinFetchConverter.addConversionValue("none", ForeignReferenceMapping.NONE);
    joinFetchMapping.setConverter(joinFetchConverter);
    joinFetchMapping.setNullValue(ForeignReferenceMapping.NONE);
    descriptor.addMapping(joinFetchMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) ObjectTypeConverter(org.eclipse.persistence.mappings.converters.ObjectTypeConverter)

Example 10 with ObjectTypeConverter

use of org.eclipse.persistence.mappings.converters.ObjectTypeConverter in project eclipselink by eclipse-ee4j.

the class XMLSessionConfigProject method buildDatabaseLoginConfigDescriptor.

public ClassDescriptor buildDatabaseLoginConfigDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(DatabaseLoginConfig.class);
    descriptor.getInheritancePolicy().setParentClass(LoginConfig.class);
    XMLDirectMapping driverClassMapping = new XMLDirectMapping();
    driverClassMapping.setAttributeName("m_driverClass");
    driverClassMapping.setGetMethodName("getDriverClass");
    driverClassMapping.setSetMethodName("setDriverClass");
    driverClassMapping.setXPath("driver-class/text()");
    descriptor.addMapping(driverClassMapping);
    XMLDirectMapping connectionURLMapping = new XMLDirectMapping();
    connectionURLMapping.setAttributeName("m_connectionURL");
    connectionURLMapping.setGetMethodName("getConnectionURL");
    connectionURLMapping.setSetMethodName("setConnectionURL");
    connectionURLMapping.setXPath("connection-url/text()");
    descriptor.addMapping(connectionURLMapping);
    XMLDirectMapping datasourceMapping = new XMLDirectMapping();
    datasourceMapping.setAttributeName("m_datasource");
    datasourceMapping.setGetMethodName("getDatasource");
    datasourceMapping.setSetMethodName("setDatasource");
    datasourceMapping.setXPath("datasource/text()");
    descriptor.addMapping(datasourceMapping);
    XMLDirectMapping lookupTypeMapping = new XMLDirectMapping();
    lookupTypeMapping.setAttributeName("m_lookupType");
    lookupTypeMapping.setGetMethodName("getLookupType");
    lookupTypeMapping.setSetMethodName("setLookupType");
    lookupTypeMapping.setNullValue(DATASOURCE_LOOKUP_TYPE_DEFAULT);
    ObjectTypeConverter converter = new ObjectTypeConverter();
    converter.addConversionValue("string", JNDIConnector.STRING_LOOKUP);
    converter.addConversionValue("composite-name", JNDIConnector.COMPOSITE_NAME_LOOKUP);
    converter.addConversionValue("compound-name", JNDIConnector.COMPOUND_NAME_LOOKUP);
    lookupTypeMapping.setConverter(converter);
    lookupTypeMapping.setXPath("datasource/@lookup");
    descriptor.addMapping(lookupTypeMapping);
    XMLDirectMapping bindAllParametersMapping = new XMLDirectMapping();
    bindAllParametersMapping.setAttributeName("m_bindAllParameters");
    bindAllParametersMapping.setGetMethodName("getBindAllParameters");
    bindAllParametersMapping.setSetMethodName("setBindAllParameters");
    bindAllParametersMapping.setXPath("bind-all-parameters/text()");
    bindAllParametersMapping.setNullValue(Boolean.FALSE);
    descriptor.addMapping(bindAllParametersMapping);
    XMLDirectMapping cacheAllStatementsMapping = new XMLDirectMapping();
    cacheAllStatementsMapping.setAttributeName("m_cacheAllStatements");
    cacheAllStatementsMapping.setGetMethodName("getCacheAllStatements");
    cacheAllStatementsMapping.setSetMethodName("setCacheAllStatements");
    cacheAllStatementsMapping.setXPath("cache-all-statements/text()");
    cacheAllStatementsMapping.setNullValue(Boolean.FALSE);
    descriptor.addMapping(cacheAllStatementsMapping);
    XMLDirectMapping byteArrayBindingMapping = new XMLDirectMapping();
    byteArrayBindingMapping.setAttributeName("m_byteArrayBinding");
    byteArrayBindingMapping.setGetMethodName("getByteArrayBinding");
    byteArrayBindingMapping.setSetMethodName("setByteArrayBinding");
    byteArrayBindingMapping.setXPath("byte-array-binding/text()");
    byteArrayBindingMapping.setNullValue(Boolean.TRUE);
    descriptor.addMapping(byteArrayBindingMapping);
    XMLDirectMapping stringBindingMapping = new XMLDirectMapping();
    stringBindingMapping.setAttributeName("m_stringBinding");
    stringBindingMapping.setGetMethodName("getStringBinding");
    stringBindingMapping.setSetMethodName("setStringBinding");
    stringBindingMapping.setXPath("string-binding/text()");
    stringBindingMapping.setNullValue(Boolean.FALSE);
    descriptor.addMapping(stringBindingMapping);
    XMLDirectMapping streamsForBindingMapping = new XMLDirectMapping();
    streamsForBindingMapping.setAttributeName("m_streamsForBinding");
    streamsForBindingMapping.setGetMethodName("getStreamsForBinding");
    streamsForBindingMapping.setSetMethodName("setStreamsForBinding");
    streamsForBindingMapping.setXPath("streams-for-binding/text()");
    streamsForBindingMapping.setNullValue(Boolean.FALSE);
    descriptor.addMapping(streamsForBindingMapping);
    XMLDirectMapping forceFieldNamesToUppercaseMapping = new XMLDirectMapping();
    forceFieldNamesToUppercaseMapping.setAttributeName("m_forceFieldNamesToUppercase");
    forceFieldNamesToUppercaseMapping.setGetMethodName("getForceFieldNamesToUppercase");
    forceFieldNamesToUppercaseMapping.setSetMethodName("setForceFieldNamesToUppercase");
    forceFieldNamesToUppercaseMapping.setXPath("force-field-names-to-upper-case/text()");
    forceFieldNamesToUppercaseMapping.setNullValue(Boolean.FALSE);
    descriptor.addMapping(forceFieldNamesToUppercaseMapping);
    XMLDirectMapping optimizeDataConversionMapping = new XMLDirectMapping();
    optimizeDataConversionMapping.setAttributeName("m_optimizeDataConversion");
    optimizeDataConversionMapping.setGetMethodName("getOptimizeDataConversion");
    optimizeDataConversionMapping.setSetMethodName("setOptimizeDataConversion");
    optimizeDataConversionMapping.setXPath("optimize-data-conversion/text()");
    optimizeDataConversionMapping.setNullValue(Boolean.TRUE);
    descriptor.addMapping(optimizeDataConversionMapping);
    XMLDirectMapping trimStringsMapping = new XMLDirectMapping();
    trimStringsMapping.setAttributeName("m_trimStrings");
    trimStringsMapping.setGetMethodName("getTrimStrings");
    trimStringsMapping.setSetMethodName("setTrimStrings");
    trimStringsMapping.setXPath("trim-strings/text()");
    trimStringsMapping.setNullValue(Boolean.TRUE);
    descriptor.addMapping(trimStringsMapping);
    XMLDirectMapping batchWritingMapping = new XMLDirectMapping();
    batchWritingMapping.setAttributeName("m_batchWriting");
    batchWritingMapping.setGetMethodName("getBatchWriting");
    batchWritingMapping.setSetMethodName("setBatchWriting");
    batchWritingMapping.setXPath("batch-writing/text()");
    batchWritingMapping.setNullValue(Boolean.FALSE);
    descriptor.addMapping(batchWritingMapping);
    XMLDirectMapping jdbc20BatchWritingMapping = new XMLDirectMapping();
    jdbc20BatchWritingMapping.setAttributeName("m_jdbcBatchWriting");
    jdbc20BatchWritingMapping.setGetMethodName("getJdbcBatchWriting");
    jdbc20BatchWritingMapping.setSetMethodName("setJdbcBatchWriting");
    jdbc20BatchWritingMapping.setXPath("jdbc-batch-writing/text()");
    jdbc20BatchWritingMapping.setNullValue(Boolean.TRUE);
    descriptor.addMapping(jdbc20BatchWritingMapping);
    XMLDirectMapping maxBatchWritingSizeMapping = new XMLDirectMapping();
    maxBatchWritingSizeMapping.setAttributeName("m_maxBatchWritingSize");
    maxBatchWritingSizeMapping.setGetMethodName("getMaxBatchWritingSize");
    maxBatchWritingSizeMapping.setSetMethodName("setMaxBatchWritingSize");
    maxBatchWritingSizeMapping.setXPath("max-batch-writing-size/text()");
    maxBatchWritingSizeMapping.setNullValue(MAX_BATCH_WRITING_SIZE_DEFAULT);
    descriptor.addMapping(maxBatchWritingSizeMapping);
    XMLDirectMapping nativeSQLMapping = new XMLDirectMapping();
    nativeSQLMapping.setAttributeName("m_nativeSQL");
    nativeSQLMapping.setGetMethodName("getNativeSQL");
    nativeSQLMapping.setSetMethodName("setNativeSQL");
    nativeSQLMapping.setXPath("native-sql/text()");
    nativeSQLMapping.setNullValue(Boolean.FALSE);
    descriptor.addMapping(nativeSQLMapping);
    XMLCompositeObjectMapping structConverterConfigMapping = new XMLCompositeObjectMapping();
    structConverterConfigMapping.setReferenceClass(StructConverterConfig.class);
    structConverterConfigMapping.setAttributeName("m_structConverterConfig");
    structConverterConfigMapping.setGetMethodName("getStructConverterConfig");
    structConverterConfigMapping.setSetMethodName("setStructConverterConfig");
    structConverterConfigMapping.setXPath("struct-converters");
    descriptor.addMapping(structConverterConfigMapping);
    return descriptor;
}
Also used : XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) XMLDirectMapping(org.eclipse.persistence.oxm.mappings.XMLDirectMapping) ObjectTypeConverter(org.eclipse.persistence.mappings.converters.ObjectTypeConverter) XMLCompositeObjectMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)

Aggregations

ObjectTypeConverter (org.eclipse.persistence.mappings.converters.ObjectTypeConverter)35 XMLDirectMapping (org.eclipse.persistence.oxm.mappings.XMLDirectMapping)26 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)25 XMLCompositeObjectMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping)10 DirectToFieldMapping (org.eclipse.persistence.mappings.DirectToFieldMapping)8 RelationalDescriptor (org.eclipse.persistence.descriptors.RelationalDescriptor)6 XMLField (org.eclipse.persistence.oxm.XMLField)5 XMLCompositeCollectionMapping (org.eclipse.persistence.oxm.mappings.XMLCompositeCollectionMapping)5 ArrayList (java.util.ArrayList)4 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)4 AttributeAccessor (org.eclipse.persistence.mappings.AttributeAccessor)4 OneToOneMapping (org.eclipse.persistence.mappings.OneToOneMapping)4 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 List (java.util.List)2 Map (java.util.Map)2 Vector (java.util.Vector)2 VersionLockingPolicy (org.eclipse.persistence.descriptors.VersionLockingPolicy)2 CacheIdentityMap (org.eclipse.persistence.internal.identitymaps.CacheIdentityMap)2 FullIdentityMap (org.eclipse.persistence.internal.identitymaps.FullIdentityMap)2