org.eclipse.jpt.jpa.core.context.orm
Interface OrmPersistentType

All Superinterfaces:
AccessHolder, org.eclipse.core.runtime.IAdaptable, IResourcePart, JpaContextNode, JpaNode, JpaStructureNode, Model, PersistentType, PersistentType.Owner, ReadOnlyAccessHolder, XmlContextNode
All Known Subinterfaces:
OrmPersistentType2_0

public interface OrmPersistentType
extends PersistentType, PersistentType.Owner, XmlContextNode

orm.xml persistent type

Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

Since:
2.0
Version:
3.0

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.jpt.jpa.core.context.PersistentType
PersistentType.Owner
 
Field Summary
static java.lang.String JAVA_PERSISTENT_TYPE_PROPERTY
           
static java.lang.String SPECIFIED_ATTRIBUTES_LIST
           
static java.lang.String VIRTUAL_ATTRIBUTES_LIST
           
 
Fields inherited from interface org.eclipse.jpt.jpa.core.context.PersistentType
MAPPING_PROPERTY, NAME_PROPERTY, SUPER_PERSISTENT_TYPE_PROPERTY
 
Fields inherited from interface org.eclipse.jpt.jpa.core.context.AccessHolder
DEFAULT_ACCESS_PROPERTY, SPECIFIED_ACCESS_PROPERTY
 
Method Summary
 OrmPersistentAttribute addSpecifiedAttribute(java.lang.String mappingKey, java.lang.String attributeName)
           
 java.util.ListIterator<OrmReadOnlyPersistentAttribute> attributes()
          Return a combination of the persistent type's specified and virtual attributes.
 void changeMapping(OrmPersistentAttribute ormPersistentAttribute, OrmAttributeMapping oldMapping, OrmAttributeMapping newMapping)
          This is called whenever the specified persistent attribute's mapping is changed as specified.
 boolean contains(int textOffset)
           
 OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute)
          Add the specified persistent attribute to the orm.xml.
 OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute, java.lang.String mappingKey)
          Add the specified persistent attribute to the orm.xml with the specified mapping.
 OrmReadOnlyPersistentAttribute convertAttributeToVirtual(OrmPersistentAttribute specifiedAttribute)
          Convert the specified attribute to a virtual attribute.
 java.lang.Iterable<org.eclipse.text.edits.DeleteEdit> createDeleteTypeEdits(org.eclipse.jdt.core.IType type)
          If this PersistentType.isFor(String) the given IType, create a text DeleteEdit for deleting the type mapping element and any text that precedes it.
 java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createMoveTypeEdits(org.eclipse.jdt.core.IType originalType, org.eclipse.jdt.core.IPackageFragment newPackage)
          Create ReplaceEdits for moving any references to the originalType to the newPackage.
 java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createRenamePackageEdits(org.eclipse.jdt.core.IPackageFragment originalPackage, java.lang.String newName)
          Create ReplaceEdits for renaming any references to the originalPackage to the newName.
 java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createRenameTypeEdits(org.eclipse.jdt.core.IType originalType, java.lang.String newName)
          Create ReplaceEdits for renaming any references to the originalType to the newName.
 OrmReadOnlyPersistentAttribute getAttributeNamed(java.lang.String attributeName)
          Return the persistent attribute with the specified name, if it exists locally on the persistent type (as opposed to in its inheritance hierarchy).
 java.lang.String getDefaultPackage()
          Return the persistent type's default package, as set in its entity mappings.
 JavaPersistentType getJavaPersistentType()
          Return the Java persistent type that is referred to by the orm.xml persistent type.
 OrmTypeMapping getMapping()
          Return the persistent type's mapping.
 EntityMappings getParent()
          Return the JPA node's parent.
 void mappingClassChanged(java.lang.String oldClass, java.lang.String newClass)
          This is called by the persistent type's mapping when its class (name) changes.
 java.util.ListIterator<OrmPersistentAttribute> specifiedAttributes()
          Return the persistent type's specified attributes.
 int specifiedAttributesSize()
          Return the number of the persistent type's specified attributes.
 java.util.ListIterator<OrmReadOnlyPersistentAttribute> virtualAttributes()
          Return virtual orm.xml persistent attributes.
 int virtualAttributesSize()
          Return the number of virtual orm.xml persistent attributes.
 
Methods inherited from interface org.eclipse.jpt.jpa.core.context.PersistentType
allAttributeNames, allAttributes, ancestors, attributeNames, attributesSize, getMappingKey, getName, getOwnerDefaultAccess, getOwnerOverrideAccess, getSimpleName, getSuperPersistentType, getValidationTextRange, inheritanceHierarchy, isFor, isIn, isMapped, resolveAttribute, setMappingKey, validate
 
Methods inherited from interface org.eclipse.jpt.jpa.core.JpaStructureNode
dispose, getId, getResourceType, getSelectionTextRange, getStructureNode
 
Methods inherited from interface org.eclipse.jpt.jpa.core.context.AccessHolder
getDefaultAccess, getSpecifiedAccess, setSpecifiedAccess
 
Methods inherited from interface org.eclipse.jpt.jpa.core.context.ReadOnlyAccessHolder
getAccess
 
Methods inherited from interface org.eclipse.jpt.jpa.core.context.PersistentType.Owner
getDefaultPersistentTypeAccess, getOverridePersistentTypeAccess
 
Methods inherited from interface org.eclipse.jpt.jpa.core.context.XmlContextNode
getValidationTextRange, validate
 
Methods inherited from interface org.eclipse.jpt.jpa.core.context.JpaContextNode
getContextDefaultDbCatalog, getContextDefaultDbSchema, getContextDefaultDbSchemaContainer, getMappingFileRoot, getPersistenceUnit, getResourceType, synchronizeWithResourceModel, update
 
Methods inherited from interface org.eclipse.jpt.jpa.core.JpaNode
getJpaProject, stateChanged
 
Methods inherited from interface org.eclipse.jpt.common.utility.model.Model
addChangeListener, addCollectionChangeListener, addListChangeListener, addPropertyChangeListener, addStateChangeListener, addTreeChangeListener, removeChangeListener, removeCollectionChangeListener, removeListChangeListener, removePropertyChangeListener, removeStateChangeListener, removeTreeChangeListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.jpt.common.core.IResourcePart
getResource
 

Field Detail

SPECIFIED_ATTRIBUTES_LIST

static final java.lang.String SPECIFIED_ATTRIBUTES_LIST
See Also:
Constant Field Values

VIRTUAL_ATTRIBUTES_LIST

static final java.lang.String VIRTUAL_ATTRIBUTES_LIST
See Also:
Constant Field Values

JAVA_PERSISTENT_TYPE_PROPERTY

static final java.lang.String JAVA_PERSISTENT_TYPE_PROPERTY
See Also:
Constant Field Values
Method Detail

getParent

EntityMappings getParent()
Description copied from interface: JpaNode
Return the JPA node's parent. The JPA project will not have a parent.

Specified by:
getParent in interface JpaNode

getMapping

OrmTypeMapping getMapping()
Description copied from interface: PersistentType
Return the persistent type's mapping. Set the mapping via PersistentType.setMappingKey(String).

Specified by:
getMapping in interface PersistentType

attributes

java.util.ListIterator<OrmReadOnlyPersistentAttribute> attributes()
Return a combination of the persistent type's specified and virtual attributes. The specified attributes are those explicitly listed in the orm.xml file; while the virtual attributes are those derived from the corresponding Java persistent type.

Specified by:
attributes in interface PersistentType

getAttributeNamed

OrmReadOnlyPersistentAttribute getAttributeNamed(java.lang.String attributeName)
Description copied from interface: PersistentType
Return the persistent attribute with the specified name, if it exists locally on the persistent type (as opposed to in its inheritance hierarchy).

Specified by:
getAttributeNamed in interface PersistentType

specifiedAttributes

java.util.ListIterator<OrmPersistentAttribute> specifiedAttributes()
Return the persistent type's specified attributes.


specifiedAttributesSize

int specifiedAttributesSize()
Return the number of the persistent type's specified attributes.


addSpecifiedAttribute

OrmPersistentAttribute addSpecifiedAttribute(java.lang.String mappingKey,
                                             java.lang.String attributeName)

virtualAttributes

java.util.ListIterator<OrmReadOnlyPersistentAttribute> virtualAttributes()
Return virtual orm.xml persistent attributes. These are attributes that exist in the corresponding Java class, but are not specified in the orm.xml.


virtualAttributesSize

int virtualAttributesSize()
Return the number of virtual orm.xml persistent attributes.

See Also:
virtualAttributes()

convertAttributeToVirtual

OrmReadOnlyPersistentAttribute convertAttributeToVirtual(OrmPersistentAttribute specifiedAttribute)
Convert the specified attribute to a virtual attribute. Remove the attribute from the type's list of specified attributes and remove it from the orm.xml file. Return the new (virtual) attribute. Return null if the specified attribute does not correspond to an attribute in the Java persistent type.

Throw an IllegalArgumentException if the attribute is already virtual.

See Also:
OrmPersistentAttribute.convertToVirtual()

convertAttributeToSpecified

OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute)
Add the specified persistent attribute to the orm.xml. The attribute will be added to the orm.xml and moved from the list of virtual attributes to the list of specified attributes. It will keep the same mapping it had, either specified in a Java annotation or the default.

Throw an IllegalArgumentException if the attribute is already specified.

See Also:
OrmReadOnlyPersistentAttribute.convertToSpecified()

convertAttributeToSpecified

OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute,
                                                   java.lang.String mappingKey)
Add the specified persistent attribute to the orm.xml with the specified mapping. The attribute will be added to the orm.xml and moved from the list of virtual attributes to the list of specified attributes.

Throw an IllegalArgumentException if the attribute is already specified.

See Also:
OrmReadOnlyPersistentAttribute.convertToSpecified(String)

changeMapping

void changeMapping(OrmPersistentAttribute ormPersistentAttribute,
                   OrmAttributeMapping oldMapping,
                   OrmAttributeMapping newMapping)
This is called whenever the specified persistent attribute's mapping is changed as specified.


createDeleteTypeEdits

java.lang.Iterable<org.eclipse.text.edits.DeleteEdit> createDeleteTypeEdits(org.eclipse.jdt.core.IType type)
If this PersistentType.isFor(String) the given IType, create a text DeleteEdit for deleting the type mapping element and any text that precedes it. Otherwise return an EmptyIterable. Though this will contain 1 or 0 DeleteEdits, using an Iterable for ease of use with other createDeleteEdit API.


createRenameTypeEdits

java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createRenameTypeEdits(org.eclipse.jdt.core.IType originalType,
                                                                             java.lang.String newName)
Create ReplaceEdits for renaming any references to the originalType to the newName. The originalType has not yet been renamed, the newName is the new short name.


createMoveTypeEdits

java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createMoveTypeEdits(org.eclipse.jdt.core.IType originalType,
                                                                           org.eclipse.jdt.core.IPackageFragment newPackage)
Create ReplaceEdits for moving any references to the originalType to the newPackage. The originalType has not yet been moved.


createRenamePackageEdits

java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createRenamePackageEdits(org.eclipse.jdt.core.IPackageFragment originalPackage,
                                                                                java.lang.String newName)
Create ReplaceEdits for renaming any references to the originalPackage to the newName. The originalPackage has not yet been renamed.


contains

boolean contains(int textOffset)

mappingClassChanged

void mappingClassChanged(java.lang.String oldClass,
                         java.lang.String newClass)
This is called by the persistent type's mapping when its class (name) changes.


getJavaPersistentType

JavaPersistentType getJavaPersistentType()
Return the Java persistent type that is referred to by the orm.xml persistent type. Return null if it is missing.


getDefaultPackage

java.lang.String getDefaultPackage()
Return the persistent type's default package, as set in its entity mappings.