org.eclipse.jpt.jpa.core.context.persistence
Interface MappingFileRef

All Superinterfaces:
org.eclipse.core.runtime.IAdaptable, IResourcePart, JpaContextNode, JpaNode, JpaStructureNode, Model, PersistentTypeContainer, XmlContextNode

public interface MappingFileRef
extends XmlContextNode, JpaStructureNode, PersistentTypeContainer

Context model corresponding to the XML resource model XmlMappingFileRef, which corresponds to the mapping-file element in the persistence.xml file.

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

Field Summary
static java.lang.String FILE_NAME_PROPERTY
          String constant associated with changes to the file name.
static java.lang.String MAPPING_FILE_PROPERTY
          String constant associated with changes to the mapping file.
 
Fields inherited from interface org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer
TRANSFORMER
 
Method Summary
 boolean containsOffset(int textOffset)
          Return whether the specified text offset is within the text representation of the mapping file.
 java.lang.Iterable<org.eclipse.text.edits.DeleteEdit> createDeleteMappingFileEdits(org.eclipse.core.resources.IFile file)
          If this isFor(IFile) the given IFile, create a text DeleteEdit for deleting the mapping file element and any text that precedes it from the persistence.xml.
 java.lang.Iterable<org.eclipse.text.edits.DeleteEdit> createDeleteTypeEdits(org.eclipse.jdt.core.IType type)
          Create DeleteEdits for deleting any references to the given type that is about to be deleted.
 java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createMoveFolderEdits(org.eclipse.core.resources.IFolder originalFolder, org.eclipse.core.runtime.IPath runtimeDestination)
          Create ReplaceEdits for moving any references to the originalFolder to the runtimeDestination.
 java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createMoveMappingFileEdits(org.eclipse.core.resources.IFile originalFile, org.eclipse.core.runtime.IPath runtineDestination)
          If this isFor(IFile) the given IFile create a text ReplaceEdit for moving the originalFile to the destination.
 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> createRenameFolderEdits(org.eclipse.core.resources.IFolder originalFolder, java.lang.String newName)
          Create ReplaceEdits for renaming any references to the originalFolder to the newName.
 java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createRenameMappingFileEdits(org.eclipse.core.resources.IFile originalFile, java.lang.String newName)
          If this isFor(IFile) the given IFile, create a text ReplaceEdit for renaming the mapping file element to the new name.
 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.
 java.lang.String getFileName()
          Return the file name of the mapping file ref.
 MappingFile getMappingFile()
          Return mapping file corresponding to the mapping file ref's file name.
 PersistenceUnit getParent()
          Covariant override.
 MappingFilePersistenceUnitMetadata getPersistenceUnitMetadata()
          Return the mapping file's persistence unit metadata.
 XmlMappingFileRef getXmlMappingFileRef()
          Return the mapping file ref's corresponding resource mapping file ref.
 boolean isFor(org.eclipse.core.resources.IFile file)
          Return whether the mapping file ref is a reference to the specified file.
 boolean isImplied()
          Return whether the mapping file ref is "implied" by, or explicitly specified in, the persistence.xml.
 boolean persistenceUnitMetadataExists()
          Return whether the mapping file's persistence unit metadata exist.
 void setFileName(java.lang.String fileName)
          Set the file name of the mapping file ref.
 
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
 
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.persistence.PersistentTypeContainer
getPersistentType, getPersistentTypes
 

Field Detail

FILE_NAME_PROPERTY

static final java.lang.String FILE_NAME_PROPERTY
String constant associated with changes to the file name.

See Also:
Constant Field Values

MAPPING_FILE_PROPERTY

static final java.lang.String MAPPING_FILE_PROPERTY
String constant associated with changes to the mapping file.

See Also:
Constant Field Values
Method Detail

getParent

PersistenceUnit getParent()
Covariant override.

Specified by:
getParent in interface JpaNode

getFileName

java.lang.String getFileName()
Return the file name of the mapping file ref.


setFileName

void setFileName(java.lang.String fileName)
Set the file name of the mapping file ref.


isFor

boolean isFor(org.eclipse.core.resources.IFile file)
Return whether the mapping file ref is a reference to the specified file.


getMappingFile

MappingFile getMappingFile()
Return mapping file corresponding to the mapping file ref's file name. This can be null if the file name is invalid.


getPersistenceUnitMetadata

MappingFilePersistenceUnitMetadata getPersistenceUnitMetadata()
Return the mapping file's persistence unit metadata.


persistenceUnitMetadataExists

boolean persistenceUnitMetadataExists()
Return whether the mapping file's persistence unit metadata exist.


getXmlMappingFileRef

XmlMappingFileRef getXmlMappingFileRef()
Return the mapping file ref's corresponding resource mapping file ref.


isImplied

boolean isImplied()
Return whether the mapping file ref is "implied" by, or explicitly specified in, the persistence.xml.


containsOffset

boolean containsOffset(int textOffset)
Return whether the specified text offset is within the text representation of the mapping file.


createDeleteTypeEdits

java.lang.Iterable<org.eclipse.text.edits.DeleteEdit> createDeleteTypeEdits(org.eclipse.jdt.core.IType type)
Create DeleteEdits for deleting any references to the given type that is about to be deleted. Return an EmptyIterable if there are not any references to the given type.


createDeleteMappingFileEdits

java.lang.Iterable<org.eclipse.text.edits.DeleteEdit> createDeleteMappingFileEdits(org.eclipse.core.resources.IFile file)
If this isFor(IFile) the given IFile, create a text DeleteEdit for deleting the mapping file element and any text that precedes it from the persistence.xml. 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.


createRenameFolderEdits

java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createRenameFolderEdits(org.eclipse.core.resources.IFolder originalFolder,
                                                                               java.lang.String newName)
Create ReplaceEdits for renaming any references to the originalFolder to the newName. The originalFolder has not yet been renamed.


createRenameMappingFileEdits

java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createRenameMappingFileEdits(org.eclipse.core.resources.IFile originalFile,
                                                                                    java.lang.String newName)
If this isFor(IFile) the given IFile, create a text ReplaceEdit for renaming the mapping file element to the new name. Otherwise return an EmptyIterable. Though this will contain 1 or 0 ReplaceEdits, using an Iterable for ease of use with other createReplaceMappingFileEdits API.


createMoveMappingFileEdits

java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createMoveMappingFileEdits(org.eclipse.core.resources.IFile originalFile,
                                                                                  org.eclipse.core.runtime.IPath runtineDestination)
If this isFor(IFile) the given IFile create a text ReplaceEdit for moving the originalFile to the destination. Otherwise return an EmptyIterable. The originalFile has not been moved yet.


createMoveFolderEdits

java.lang.Iterable<org.eclipse.text.edits.ReplaceEdit> createMoveFolderEdits(org.eclipse.core.resources.IFolder originalFolder,
                                                                             org.eclipse.core.runtime.IPath runtimeDestination)
Create ReplaceEdits for moving any references to the originalFolder to the runtimeDestination. The runtimeDestination already includes the original folder name.