use of org.eclipse.persistence.oxm.XMLDescriptor in project eclipselink by eclipse-ee4j.
the class PersistenceXMLMappings method buildPersistenceXMLDescriptor.
/**
* INTERNAL:
*/
private static XMLDescriptor buildPersistenceXMLDescriptor(NamespaceResolver resolver) {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setNamespaceResolver(resolver);
descriptor.setJavaClass(PersistenceXML.class);
descriptor.setDefaultRootElement("persistence");
XMLCompositeCollectionMapping puMapping = new XMLCompositeCollectionMapping();
puMapping.setAttributeName("persistenceUnitInfos");
puMapping.setReferenceClass(SEPersistenceUnitInfo.class);
puMapping.setXPath("persistence-unit");
descriptor.addMapping(puMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.XMLDescriptor in project eclipselink by eclipse-ee4j.
the class PersistenceXMLMappings method buildPUInfoDescriptor.
/**
* INTERNAL:
*/
private static XMLDescriptor buildPUInfoDescriptor(NamespaceResolver resolver) {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setNamespaceResolver(resolver);
descriptor.setJavaClass(SEPersistenceUnitInfo.class);
descriptor.addDirectMapping("persistenceUnitName", "@name");
// For the canonical model generation we don't exclude the unlisted
// classes unless explicitly set by the user.
XMLDirectMapping mapping = new XMLDirectMapping();
mapping.setAttributeName("excludeUnlistedClasses");
mapping.setXPath("exclude-unlisted-classes/text()");
mapping.setNullValue(false);
descriptor.addMapping(mapping);
XMLCompositeDirectCollectionMapping classesMapping = new XMLCompositeDirectCollectionMapping();
classesMapping.setAttributeName("managedClassNames");
classesMapping.setXPath("class/text()");
descriptor.addMapping(classesMapping);
XMLCompositeDirectCollectionMapping mappingFilesMapping = new XMLCompositeDirectCollectionMapping();
mappingFilesMapping.setAttributeName("mappingFiles");
mappingFilesMapping.setXPath("mapping-file/text()");
descriptor.addMapping(mappingFilesMapping);
XMLCompositeCollectionMapping persistenceUnitPropertiesMapping = new XMLCompositeCollectionMapping();
persistenceUnitPropertiesMapping.setAttributeName("persistenceUnitProperties");
persistenceUnitPropertiesMapping.setGetMethodName("getPersistenceUnitProperties");
persistenceUnitPropertiesMapping.setSetMethodName("setPersistenceUnitProperties");
persistenceUnitPropertiesMapping.setReferenceClass(SEPersistenceUnitProperty.class);
persistenceUnitPropertiesMapping.setXPath("properties/property");
descriptor.addMapping(persistenceUnitPropertiesMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.XMLDescriptor in project eclipselink by eclipse-ee4j.
the class XMLEntityMappingsMappingProject method buildEntityMappingsDescriptor.
/**
* INTERNAL:
* XSD: entity-mappings
*/
protected ClassDescriptor buildEntityMappingsDescriptor(String xsdLocation) {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setDefaultRootElement("orm:entity-mappings");
descriptor.setJavaClass(XMLEntityMappings.class);
descriptor.setSchemaReference(new XMLSchemaClassPathReference(xsdLocation));
descriptor.addMapping(getDescriptionMapping());
XMLCompositeObjectMapping persistenceUnitMetadataMapping = new XMLCompositeObjectMapping();
persistenceUnitMetadataMapping.setAttributeName("m_persistenceUnitMetadata");
persistenceUnitMetadataMapping.setGetMethodName("getPersistenceUnitMetadata");
persistenceUnitMetadataMapping.setSetMethodName("setPersistenceUnitMetadata");
persistenceUnitMetadataMapping.setReferenceClass(XMLPersistenceUnitMetadata.class);
persistenceUnitMetadataMapping.setXPath("orm:persistence-unit-metadata");
descriptor.addMapping(persistenceUnitMetadataMapping);
XMLDirectMapping packageMapping = new XMLDirectMapping();
packageMapping.setAttributeName("m_package");
packageMapping.setGetMethodName("getPackage");
packageMapping.setSetMethodName("setPackage");
packageMapping.setXPath("orm:package/text()");
descriptor.addMapping(packageMapping);
descriptor.addMapping(getSchemaMapping());
descriptor.addMapping(getCatalogMapping());
descriptor.addMapping(getAccessMapping());
descriptor.addMapping(getAccessMethodsMapping());
descriptor.addMapping(getTenantDiscriminatorColumnsMapping());
descriptor.addMapping(getMixedConverterMapping());
descriptor.addMapping(getTypeConverterMapping());
descriptor.addMapping(getObjectTypeConverterMapping());
descriptor.addMapping(getSerializedConverterMapping());
descriptor.addMapping(getStructConverterMapping());
XMLCompositeCollectionMapping sequenceGeneratorsMapping = new XMLCompositeCollectionMapping();
sequenceGeneratorsMapping.setAttributeName("m_sequenceGenerators");
sequenceGeneratorsMapping.setGetMethodName("getSequenceGenerators");
sequenceGeneratorsMapping.setSetMethodName("setSequenceGenerators");
sequenceGeneratorsMapping.setReferenceClass(SequenceGeneratorMetadata.class);
sequenceGeneratorsMapping.setXPath("orm:sequence-generator");
descriptor.addMapping(sequenceGeneratorsMapping);
XMLCompositeCollectionMapping tableGeneratorsMapping = new XMLCompositeCollectionMapping();
tableGeneratorsMapping.setAttributeName("m_tableGenerators");
tableGeneratorsMapping.setGetMethodName("getTableGenerators");
tableGeneratorsMapping.setSetMethodName("setTableGenerators");
tableGeneratorsMapping.setReferenceClass(TableGeneratorMetadata.class);
tableGeneratorsMapping.setXPath("orm:table-generator");
descriptor.addMapping(tableGeneratorsMapping);
XMLCompositeCollectionMapping uuidGeneratorsMapping = new XMLCompositeCollectionMapping();
uuidGeneratorsMapping.setAttributeName("m_uuidGenerators");
uuidGeneratorsMapping.setGetMethodName("getUuidGenerators");
uuidGeneratorsMapping.setSetMethodName("setUuidGenerators");
uuidGeneratorsMapping.setReferenceClass(UuidGeneratorMetadata.class);
uuidGeneratorsMapping.setXPath("orm:uuid-generator");
descriptor.addMapping(uuidGeneratorsMapping);
XMLCompositeCollectionMapping partitioningMapping = new XMLCompositeCollectionMapping();
partitioningMapping.setAttributeName("m_partitioning");
partitioningMapping.setGetMethodName("getPartitioning");
partitioningMapping.setSetMethodName("setPartitioning");
partitioningMapping.setReferenceClass(PartitioningMetadata.class);
partitioningMapping.setXPath("orm:partitioning");
descriptor.addMapping(partitioningMapping);
partitioningMapping = new XMLCompositeCollectionMapping();
partitioningMapping.setAttributeName("m_replicationPartitioning");
partitioningMapping.setGetMethodName("getReplicationPartitioning");
partitioningMapping.setSetMethodName("setReplicationPartitioning");
partitioningMapping.setReferenceClass(ReplicationPartitioningMetadata.class);
partitioningMapping.setXPath("orm:replication-partitioning");
descriptor.addMapping(partitioningMapping);
partitioningMapping = new XMLCompositeCollectionMapping();
partitioningMapping.setAttributeName("m_roundRobinPartitioning");
partitioningMapping.setGetMethodName("getRoundRobinPartitioning");
partitioningMapping.setSetMethodName("setRoundRobinPartitioning");
partitioningMapping.setReferenceClass(RoundRobinPartitioningMetadata.class);
partitioningMapping.setXPath("orm:round-robin-partitioning");
descriptor.addMapping(partitioningMapping);
partitioningMapping = new XMLCompositeCollectionMapping();
partitioningMapping.setAttributeName("m_pinnedPartitioning");
partitioningMapping.setGetMethodName("getPinnedPartitioning");
partitioningMapping.setSetMethodName("setPinnedPartitioning");
partitioningMapping.setReferenceClass(PinnedPartitioningMetadata.class);
partitioningMapping.setXPath("orm:pinned-partitioning");
descriptor.addMapping(partitioningMapping);
partitioningMapping = new XMLCompositeCollectionMapping();
partitioningMapping.setAttributeName("m_rangePartitioning");
partitioningMapping.setGetMethodName("getRangePartitioning");
partitioningMapping.setSetMethodName("setRangePartitioning");
partitioningMapping.setReferenceClass(RangePartitioningMetadata.class);
partitioningMapping.setXPath("orm:range-partitioning");
descriptor.addMapping(partitioningMapping);
partitioningMapping = new XMLCompositeCollectionMapping();
partitioningMapping.setAttributeName("m_valuePartitioning");
partitioningMapping.setGetMethodName("getValuePartitioning");
partitioningMapping.setSetMethodName("setValuePartitioning");
partitioningMapping.setReferenceClass(ValuePartitioningMetadata.class);
partitioningMapping.setXPath("orm:value-partitioning");
descriptor.addMapping(partitioningMapping);
partitioningMapping = new XMLCompositeCollectionMapping();
partitioningMapping.setAttributeName("m_hashPartitioning");
partitioningMapping.setGetMethodName("getHashPartitioning");
partitioningMapping.setSetMethodName("setHashPartitioning");
partitioningMapping.setReferenceClass(HashPartitioningMetadata.class);
partitioningMapping.setXPath("orm:hash-partitioning");
descriptor.addMapping(partitioningMapping);
partitioningMapping = new XMLCompositeCollectionMapping();
partitioningMapping.setAttributeName("m_unionPartitioning");
partitioningMapping.setGetMethodName("getUnionPartitioning");
partitioningMapping.setSetMethodName("setUnionPartitioning");
partitioningMapping.setReferenceClass(UnionPartitioningMetadata.class);
partitioningMapping.setXPath("orm:union-partitioning");
descriptor.addMapping(partitioningMapping);
descriptor.addMapping(getNamedQueryMapping());
descriptor.addMapping(getNamedNativeQueryMapping());
descriptor.addMapping(getNamedStoredProcedureQueryMapping());
descriptor.addMapping(getNamedStoredFunctionQueryMapping());
descriptor.addMapping(getNamedPLSQLStoredProcedureQueryMapping());
descriptor.addMapping(getNamedPLSQLStoredFunctionQueryMapping());
descriptor.addMapping(getOracleObjectTypeMapping());
descriptor.addMapping(getOracleArrayTypeMapping());
descriptor.addMapping(getPLSQLRecordMapping());
descriptor.addMapping(getPLSQLTableMapping());
descriptor.addMapping(getResultSetMappingMapping());
XMLCompositeCollectionMapping mappedSuperclassMapping = new XMLCompositeCollectionMapping();
mappedSuperclassMapping.setAttributeName("m_mappedSuperclasses");
mappedSuperclassMapping.setGetMethodName("getMappedSuperclasses");
mappedSuperclassMapping.setSetMethodName("setMappedSuperclasses");
mappedSuperclassMapping.setReferenceClass(MappedSuperclassAccessor.class);
mappedSuperclassMapping.setXPath("orm:mapped-superclass");
descriptor.addMapping(mappedSuperclassMapping);
XMLCompositeCollectionMapping entityMapping = new XMLCompositeCollectionMapping();
entityMapping.setAttributeName("m_entities");
entityMapping.setGetMethodName("getEntities");
entityMapping.setSetMethodName("setEntities");
entityMapping.setReferenceClass(EntityAccessor.class);
entityMapping.setXPath("orm:entity");
descriptor.addMapping(entityMapping);
XMLCompositeCollectionMapping embeddableMapping = new XMLCompositeCollectionMapping();
embeddableMapping.setAttributeName("m_embeddables");
embeddableMapping.setGetMethodName("getEmbeddables");
embeddableMapping.setSetMethodName("setEmbeddables");
embeddableMapping.setReferenceClass(EmbeddableAccessor.class);
embeddableMapping.setXPath("orm:embeddable");
descriptor.addMapping(embeddableMapping);
// What about the version attribute???
XMLDirectMapping versionMapping = new XMLDirectMapping();
versionMapping.setAttributeName("m_version");
versionMapping.setGetMethodName("getVersion");
versionMapping.setSetMethodName("setVersion");
versionMapping.setXPath("@version");
descriptor.addMapping(versionMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.XMLDescriptor in project eclipselink by eclipse-ee4j.
the class XMLEntityMappingsMappingProject method buildEntityResultDescriptor.
/**
* INTERNAL:
* XSD: entity-result
*/
protected ClassDescriptor buildEntityResultDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(EntityResultMetadata.class);
XMLCompositeCollectionMapping fieldResultMapping = new XMLCompositeCollectionMapping();
fieldResultMapping.setAttributeName("m_fieldResults");
fieldResultMapping.setGetMethodName("getFieldResults");
fieldResultMapping.setSetMethodName("setFieldResults");
fieldResultMapping.setReferenceClass(FieldResultMetadata.class);
fieldResultMapping.setXPath("orm:field-result");
descriptor.addMapping(fieldResultMapping);
XMLDirectMapping entityClassMapping = new XMLDirectMapping();
entityClassMapping.setAttributeName("m_entityClassName");
entityClassMapping.setGetMethodName("getEntityClassName");
entityClassMapping.setSetMethodName("setEntityClassName");
entityClassMapping.setXPath("@entity-class");
descriptor.addMapping(entityClassMapping);
XMLDirectMapping discriminatorColumnMapping = new XMLDirectMapping();
discriminatorColumnMapping.setAttributeName("m_discriminatorColumn");
discriminatorColumnMapping.setGetMethodName("getDiscriminatorColumn");
discriminatorColumnMapping.setSetMethodName("setDiscriminatorColumn");
discriminatorColumnMapping.setXPath("@discriminator-column");
descriptor.addMapping(discriminatorColumnMapping);
return descriptor;
}
use of org.eclipse.persistence.oxm.XMLDescriptor in project eclipselink by eclipse-ee4j.
the class XMLEntityMappingsMappingProject method buildCascadeTypeDescriptor.
/**
* INTERNAL:
* XSD: cascade-type
*/
protected ClassDescriptor buildCascadeTypeDescriptor() {
XMLDescriptor descriptor = new XMLDescriptor();
descriptor.setJavaClass(CascadeMetadata.class);
XMLDirectMapping cascadeAllMapping = new XMLDirectMapping();
cascadeAllMapping.setAttributeName("m_cascadeAll");
cascadeAllMapping.setGetMethodName("getCascadeAll");
cascadeAllMapping.setSetMethodName("setCascadeAll");
cascadeAllMapping.setConverter(new EmptyElementConverter());
IsSetNullPolicy cascadeAllPolicy = new IsSetNullPolicy("isCascadeAll");
cascadeAllPolicy.setMarshalNullRepresentation(XMLNullRepresentationType.EMPTY_NODE);
cascadeAllMapping.setNullPolicy(cascadeAllPolicy);
cascadeAllMapping.setXPath("orm:cascade-all");
descriptor.addMapping(cascadeAllMapping);
descriptor.addMapping(getCascadePersistMapping());
XMLDirectMapping cascadeMergeMapping = new XMLDirectMapping();
cascadeMergeMapping.setAttributeName("m_cascadeMerge");
cascadeMergeMapping.setGetMethodName("getCascadeMerge");
cascadeMergeMapping.setSetMethodName("setCascadeMerge");
cascadeMergeMapping.setConverter(new EmptyElementConverter());
IsSetNullPolicy cascadeMergePolicy = new IsSetNullPolicy("isCascadeMerge");
cascadeMergePolicy.setMarshalNullRepresentation(XMLNullRepresentationType.EMPTY_NODE);
cascadeMergeMapping.setNullPolicy(cascadeMergePolicy);
cascadeMergeMapping.setXPath("orm:cascade-merge");
descriptor.addMapping(cascadeMergeMapping);
XMLDirectMapping cascadeRemoveMapping = new XMLDirectMapping();
cascadeRemoveMapping.setAttributeName("m_cascadeRemove");
cascadeRemoveMapping.setGetMethodName("getCascadeRemove");
cascadeRemoveMapping.setSetMethodName("setCascadeRemove");
cascadeRemoveMapping.setConverter(new EmptyElementConverter());
IsSetNullPolicy cascadeRemovePolicy = new IsSetNullPolicy("isCascadeRemove");
cascadeRemovePolicy.setMarshalNullRepresentation(XMLNullRepresentationType.EMPTY_NODE);
cascadeRemoveMapping.setNullPolicy(cascadeRemovePolicy);
cascadeRemoveMapping.setXPath("orm:cascade-remove");
descriptor.addMapping(cascadeRemoveMapping);
XMLDirectMapping cascadeRefreshMapping = new XMLDirectMapping();
cascadeRefreshMapping.setAttributeName("m_cascadeRefresh");
cascadeRefreshMapping.setGetMethodName("getCascadeRefresh");
cascadeRefreshMapping.setSetMethodName("setCascadeRefresh");
cascadeRefreshMapping.setConverter(new EmptyElementConverter());
IsSetNullPolicy cascadeRefreshPolicy = new IsSetNullPolicy("isCascadeRefresh");
cascadeRefreshPolicy.setMarshalNullRepresentation(XMLNullRepresentationType.EMPTY_NODE);
cascadeRefreshMapping.setNullPolicy(cascadeRefreshPolicy);
cascadeRefreshMapping.setXPath("orm:cascade-refresh");
descriptor.addMapping(cascadeRefreshMapping);
XMLDirectMapping cascadeDetachMapping = new XMLDirectMapping();
cascadeDetachMapping.setAttributeName("m_cascadeDetach");
cascadeDetachMapping.setGetMethodName("getCascadeDetach");
cascadeDetachMapping.setSetMethodName("setCascadeDetach");
cascadeDetachMapping.setConverter(new EmptyElementConverter());
IsSetNullPolicy cascadeDetachPolicy = new IsSetNullPolicy("isCascadeDetach");
cascadeDetachPolicy.setMarshalNullRepresentation(XMLNullRepresentationType.EMPTY_NODE);
cascadeDetachMapping.setNullPolicy(cascadeDetachPolicy);
cascadeDetachMapping.setXPath("orm:cascade-detach");
descriptor.addMapping(cascadeDetachMapping);
return descriptor;
}
Aggregations