Methods Summary |
---|
public void | addAssociatedColumn(ColumnPairElement column)Adds a column to the list of associated columns mapped by this mapping
field. Call this method instead of addColumn when mapping
join tables. This method is used to map between the join table column
and the foreign table column, while addLocalColumn is used
to map between the local table and the join table.
if (column != null)
{
ArrayList columns = getAssociatedColumns();
String columnName = NameUtil.getRelativeMemberName(
column.getName().getFullName());
// double check that this pair is not already in the column list
if (!columns.contains(columnName))
{
try
{
fireVetoableChange(PROP_ASSOCIATED_COLUMNS, null, null);
columns.add(columnName);
firePropertyChange(PROP_ASSOCIATED_COLUMNS, null, null);
// sync up runtime's object list too
_associatedColumnObjects = null;
}
catch (PropertyVetoException e)
{
throw new ModelVetoException(e);
}
}
else
{
throw new ModelException(I18NHelper.getMessage(getMessages(),
"mapping.column.column_defined", columnName)); // NOI18N
}
}
else
{
throw new ModelException(I18NHelper.getMessage(getMessages(),
"mapping.element.null_argument")); // NOI18N
}
|
public void | addColumn(DBMemberElement column)Adds a column to the list of columns mapped by this mapping
relationship. This method overrides the one in MappingFieldElement to
check that the argument is a ColumnPairElement.
if (column instanceof ColumnPairElement)
{
if (!getAssociatedColumns().isEmpty())
{
throw new ModelException(I18NHelper.getMessage(getMessages(),
"mapping.column.associated_columns_defined", // NOI18N
NameUtil.getRelativeMemberName(
column.getName().getFullName())));
}
super.addColumn(column);
}
else
{
throw new ModelException(I18NHelper.getMessage(getMessages(),
"mapping.column.column_invalid", // NOI18N
NameUtil.getRelativeMemberName(
column.getName().getFullName())));
}
|
public void | addLocalColumn(ColumnPairElement column)Adds a column to the list of columns mapped by this mapping field.
Call this method instead of addColumn when mapping join
tables. This method is used to map between the local column and the
join table, while addAssociatedColumn is used to
map between the join table and the foreign table.
// can't call addColumn in this class because there will be an
// exception since the associated columns will be (legally) populated
super.addColumn(column);
|
public java.util.ArrayList | getAssociatedColumnObjects()Returns the list of associated columns (ColumnPairElements) to
which this mapping field is mapped. This is used for join tables.
This method should only be used by the runtime.
if (_associatedColumnObjects == null)
{
_associatedColumnObjects = MappingClassElementImpl.
toColumnObjects(getDeclaringClass().getDatabaseRoot(),
getAssociatedColumns());
}
return _associatedColumnObjects;
|
public java.util.ArrayList | getAssociatedColumns()Returns the list of associated column names to which this
mapping field is mapped. This is used for join tables.
if (_associatedColumns == null)
_associatedColumns = new ArrayList();
return _associatedColumns;
|
public int | getDeleteAction()Get the delete action for this relationship element.
return getRelationshipElement().getDeleteAction();
|
public java.lang.String | getElementClass()Get the element class for this relationship element. If primitive
types are supported, you can use wrapperclass.TYPE
to specify them.
return getRelationshipElement().getElementClass();
|
public int | getLowerBound()Get the lower cardinality bound for this relationship element.
return getRelationshipElement().getLowerBound();
|
final com.sun.jdo.api.persistence.model.jdo.RelationshipElement | getRelationshipElement()
return ((MappingClassElementImpl)getDeclaringClass()).
getPersistenceElement().getRelationship(getName());
|
public int | getUpdateAction()Get the update action for this relationship element.
return getRelationshipElement().getUpdateAction();
|
public int | getUpperBound()Get the upper cardinality bound for this relationship element. Returns
{@link java.lang.Integer#MAX_VALUE} for n
return getRelationshipElement().getUpperBound();
|
public void | removeColumn(java.lang.String columnName)Removes a column from the list of columns mapped by this mapping field.
This method overrides the one in MappingFieldElement to
remove the argument from the associated columns if necessary.
try
{
super.removeColumn(columnName);
}
catch (ModelException e) // not found in regular columns
{
try
{
fireVetoableChange(PROP_ASSOCIATED_COLUMNS, null, null);
if (!getAssociatedColumns().remove(columnName))
{
throw new ModelException(
I18NHelper.getMessage(getMessages(),
"mapping.element.element_not_removed", // NOI18N
columnName));
}
firePropertyChange(PROP_ASSOCIATED_COLUMNS, null, null);
// sync up runtime's object list too
_associatedColumnObjects = null;
}
catch (PropertyVetoException ve)
{
throw new ModelVetoException(ve);
}
}
|
public void | setAssociatedColumns(java.util.ArrayList associatedColumns)Set the list of associated column names to which this mapping field is
mapped. This method should only be used internally and for cloning
and archiving.
_associatedColumns = associatedColumns;
|
protected void | stripSchemaName()Boston to Pilsen conversion.
This method converts the absolute column names to relative names.
// call super to handle the columns stored in _columns
super.stripSchemaName();
// handle _associatedColumns
if (_associatedColumns != null)
{
// Use ListIterator here, because I want to replace the value
// stored in the ArrayList. The ListIterator returned by
// ArrayList.listIterator() supports the set method.
ListIterator i = _associatedColumns.listIterator();
while (i.hasNext())
i.set(NameUtil.getRelativeMemberName((String)i.next()));
}
|