Methods Summary |
---|
public abstract java.util.List | getCascadeTypes()INTERNAL:
Return the cascade types for this accessor. This method is supported by
all relational accessors.
|
public java.util.ArrayList | getCascadeTypes(javax.persistence.CascadeType[] cascadeTypes)INTERNAL:
WIP: Probably should make cascade types into its own object eventually.
ArrayList<String> cTypes = new ArrayList<String>();
for (CascadeType cascadeType : cascadeTypes) {
cTypes.add(cascadeType.name());
}
return cTypes;
|
protected oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns.MetadataJoinColumns | getJoinColumns()INTERNAL: (Overridden in XMLOneToOneAccessor, XMLManyToManyAccessor and XMLOneToManyAccessor)
Process the @JoinColumns and @JoinColumn.
JoinColumn joinColumn = getAnnotation(JoinColumn.class);
JoinColumns joinColumns = getAnnotation(JoinColumns.class);
return new MetadataJoinColumns(joinColumns, joinColumn);
|
protected abstract java.lang.String | getLoggingContext()INTERNAL:
Return the logging context for this accessor.
|
public java.lang.String | getMappedBy()INTERNAL:
Subclasses that support processing a mapped by should override this
method, otherwise a runtime development exception is thrown for those
accessors who call this method and don't implement it themselves.
throw new RuntimeException("Development exception. The accessor: [" + this + "] should not call the getMappedBy method unless it overrides it.");
|
protected oracle.toplink.essentials.mappings.DatabaseMapping | getOwningMapping()INTERNAL:
Method to return an owner mapping. It will tell the owner class to
process itself if it hasn't already done so.
String ownerAttributeName = getMappedBy();
MetadataDescriptor ownerDescriptor = getReferenceDescriptor();
DatabaseMapping mapping = ownerDescriptor.getMappingForAttributeName(ownerAttributeName, this);
// If no mapping was found, there is an error in the mappedBy field,
// therefore, throw an exception.
if (mapping == null) {
m_validator.throwNoMappedByAttributeFound(ownerDescriptor.getJavaClass(), ownerAttributeName, getJavaClass(), getAttributeName());
}
return mapping;
|
public oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor | getReferenceDescriptor()INTERNAL:
Return the reference metadata descriptor for this accessor.
This method does additional checks to make sure that the target
entity is indeed an entity class.
MetadataDescriptor descriptor;
try {
descriptor = super.getReferenceDescriptor();
} catch (Exception exception) {
descriptor = null;
}
if (descriptor == null || descriptor.isEmbeddable() || descriptor.isEmbeddableCollection()) {
m_validator.throwNonEntityTargetInRelationship(getJavaClass(), getReferenceClass(), getAnnotatedElement());
}
return descriptor;
|
public abstract java.lang.Class | getTargetEntity()INTERNAL:
Return the target entity for this accessor. This method is supported by
all relational accessors.
|
public boolean | hasJoinColumn()INTERNAL:
Method to check if an annotated element has a @JoinColumn.
return isAnnotationPresent(JoinColumn.class);
|
public boolean | hasJoinColumns()INTERNAL:
Method to check if an annotated element has a @JoinColumns.
return isAnnotationPresent(JoinColumns.class);
|
public boolean | hasPrimaryKeyJoinColumns()INTERNAL: (Overridden in XMLOneToOneAccessor)
Method to check if an annotated element has a @PrimaryKeyJoinColumns or
at the very least a @PrimaryKeyJoinColumn.
return isAnnotationPresent(PrimaryKeyJoinColumns.class) || isAnnotationPresent(PrimaryKeyJoinColumn.class);
|
public boolean | isOneToOnePrimaryKeyRelationship()INTERNAL:
Return true if this accessor represents a 1-1 primary key relationship.
return isOneToOne() && hasPrimaryKeyJoinColumns();
|
protected void | processCascadeTypes(oracle.toplink.essentials.mappings.ForeignReferenceMapping mapping)INTERNAL:
for (String cascadeType : getCascadeTypes()) {
setCascadeType(cascadeType, mapping);
}
// Apply the persistence unit default cascade-persist if necessary.
if (m_descriptor.isCascadePersist() && ! mapping.isCascadePersist()) {
setCascadeType(CascadeType.PERSIST.name(), mapping);
}
|
protected java.util.List | processJoinColumns()INTERNAL:
Process a @JoinColumns or @JoinColumn. Will look for association
overrides.
if (m_descriptor.hasAssociationOverrideFor(getAttributeName())) {
return processJoinColumns(m_descriptor.getAssociationOverrideFor(getAttributeName()), getReferenceDescriptor());
} else {
return processJoinColumns(getJoinColumns(), getReferenceDescriptor());
}
|
protected java.util.List | processJoinColumns(oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns.MetadataJoinColumns joinColumns, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Process MetadataJoinColumns.
// This call will add any defaulted columns as necessary.
List<MetadataJoinColumn> jColumns = joinColumns.values(descriptor);
if (descriptor.hasCompositePrimaryKey()) {
// The number of join columns should equal the number of primary key fields.
if (jColumns.size() != descriptor.getPrimaryKeyFields().size()) {
m_validator.throwIncompleteJoinColumnsSpecified(getJavaClass(), getAnnotatedElement());
}
// All the primary and foreign key field names should be specified.
for (MetadataJoinColumn jColumn : jColumns) {
if (jColumn.isPrimaryKeyFieldNotSpecified() || jColumn.isForeignKeyFieldNotSpecified()) {
m_validator.throwIncompleteJoinColumnsSpecified(getJavaClass(), getAnnotatedElement());
}
}
} else {
if (jColumns.size() > 1) {
m_validator.throwExcessiveJoinColumnsSpecified(getJavaClass(), getAnnotatedElement());
}
}
return jColumns;
|
public void | processRelationship()INTERNAL:
Front end validation before actually processing the relationship
accessor. The process() method should not be called directly.
// The processing of this accessor may have been fast tracked through a
// non-owning relationship. If so, no processing is required.
if (! isProcessed()) {
if (m_descriptor.hasMappingForAttributeName(getAttributeName())) {
// Only true if there is one that came from Project.xml
m_logger.logWarningMessage(m_logger.IGNORE_MAPPING, this);
} else {
// If a @Column is specified then throw an exception.
if (hasColumn()) {
m_validator.throwRelationshipHasColumnSpecified(getJavaClass(), getAttributeName());
}
// Process the relationship accessor only if the target entity
// is not a ValueHolderInterface.
if (getTargetEntity() == ValueHolderInterface.class || (getTargetEntity() == void.class && getReferenceClass() == ValueHolderInterface.class)) {
// do nothing ... I'm too lazy (or too stupid) to do the negation of this expression :-)
} else {
process();
}
}
// Set its processing completed flag to avoid double processing.
setIsProcessed();
}
|
protected void | setCascadeType(java.lang.String type, oracle.toplink.essentials.mappings.ForeignReferenceMapping mapping)INTERNAL:
Set the cascade type on a mapping.
if (type.equals(MetadataConstants.CASCADE_ALL) || type.equals(CascadeType.ALL.name())) {
mapping.setCascadeAll(true);
} else if (type.equals(MetadataConstants.CASCADE_MERGE) || type.equals(CascadeType.MERGE.name())) {
mapping.setCascadeMerge(true);
} else if (type.equals(MetadataConstants.CASCADE_PERSIST) || type.equals(CascadeType.PERSIST.name())) {
mapping.setCascadePersist(true);
} else if (type.equals(MetadataConstants.CASCADE_REFRESH) || type.equals(CascadeType.REFRESH.name())) {
mapping.setCascadeRefresh(true);
} else if (type.equals(MetadataConstants.CASCADE_REMOVE) || type.equals(CascadeType.REMOVE.name())) {
mapping.setCascadeRemove(true);
}
|