/** Adds a column to the list of columns mapped by this mapping field. * Call this method instead of <code>addColumn</code> when mapping join * tables. This method is used to map between the local column and the * join table, while <code>addAssociatedColumn</code> is used to * map between the join table and the foreign table. * @param column column pair element to be added to the mapping * @exception ModelException if impossible * @see MappingFieldElement#addColumn * @see #addAssociatedColumn */ public void addLocalColumn (ColumnPairElement column) throws ModelException { // can't call addColumn in this class because there will be an // exception since the associated columns will be (legally) populated super.addColumn(column); }
fireVetoableChange(PROP_COLUMNS, null, null); if (!getColumns().remove(columnName)) I18NHelper.getMessage(getMessages(), "mapping.element.element_not_removed", // NOI18N columnName)); firePropertyChange(PROP_COLUMNS, null, null);
final PersistenceFieldElement getPersistenceFieldElement () { return ((MappingClassElementImpl)getDeclaringClass()). getPersistenceElement().getField(getName()); }
/** Set the fetch group of this field element. * @param group - an integer indicating the fetch group, one of: * {@link #GROUP_DEFAULT}, {@link #GROUP_NONE}, or anything less than or * equal to {@link #GROUP_INDEPENDENT} * @exception ModelException if impossible */ public void setFetchGroup (int group) throws ModelException { Integer old = new Integer(getFetchGroup()); Integer newGroup = new Integer(group); try { fireVetoableChange(PROP_FETCH_GROUP, old, newGroup); setFetchGroupInternal(group); firePropertyChange(PROP_FETCH_GROUP, old, newGroup); } catch (PropertyVetoException e) { throw new ModelVetoException(e); } }
/** Set whether this field element is read only or not. * @param flag - if <code>true</code>, the field element is marked as * read only; otherwise, it is not * @exception ModelException if impossible */ public void setReadOnly (boolean flag) throws ModelException { Boolean old = JavaTypeHelper.valueOf(isReadOnly()); Boolean newFlag = JavaTypeHelper.valueOf(flag); try { fireVetoableChange(PROP_READ_ONLY, old, newFlag); setProperty(flag, READ_ONLY); firePropertyChange(PROP_READ_ONLY, old, newFlag); } catch (PropertyVetoException e) { throw new ModelVetoException(e); } }
/** Set whether this field element is in a concurrency check or not. * @param flag - if <code>true</code>, the field element is marked as * being in a concurrency check; otherwise, it is not * @exception ModelException if impossible */ public void setInConcurrencyCheck (boolean flag) throws ModelException { Boolean old = JavaTypeHelper.valueOf(isInConcurrencyCheck()); Boolean newFlag = JavaTypeHelper.valueOf(flag); try { fireVetoableChange(PROP_IN_CONCURRENCY_CHECK, old, newFlag); setProperty(flag, IN_CONCURRENCY_CHECK); firePropertyChange(PROP_IN_CONCURRENCY_CHECK, old, newFlag); } catch (PropertyVetoException e) { throw new ModelVetoException(e); } }
println(tabs+1, "name = " + mfe.getName()); //NOI18N println(tabs+1, "fetchGroup = " + mfe.getFetchGroup()); //NOI18N println(tabs+1, "columns = " + mfe.getColumns()); //NOI18N println(tabs+1, "columnObjects = " + mfe.getColumnObjects()); //NOI18N
/** Set whether this field element is a version field or not. * @param flag - if <code>true</code>, the field element is marked * as a version field; otherwise, it is not * @exception ModelException if impossible */ public void setVersion (boolean flag) throws ModelException { Boolean old = JavaTypeHelper.valueOf(isVersion()); Boolean newFlag = JavaTypeHelper.valueOf(flag); try { fireVetoableChange(PROP_VERSION_FIELD, old, newFlag); _isVersion = flag; firePropertyChange(PROP_VERSION_FIELD, old, newFlag); } catch (PropertyVetoException e) { throw new ModelVetoException(e); } }
(MappingFieldElementImpl)iterator.next(); if (mappingField.isMappedToTable(table)) fieldsToRemove.add(mappingField); mappingField = new MappingFieldElementImpl( mappingField.getName(), this); mappingField.setVersion(true);
private MappingFieldElement createMappingField(MappingClassElement mce, String fieldName, ColumnElement col) throws ModelException { MappingFieldElement mfe = new MappingFieldElementImpl(fieldName, mce); mce.addField(mfe); if (col != null) mfe.addColumn(col); return mfe; } }
/** Returns the list of columns (ColumnElements) to which this mapping * field is mapped. This method should only be used by the runtime. * @return the columns mapped by this mapping field */ public ArrayList getColumnObjects () { //@olsen: compute objects on access if (_columnObjects == null) { //@olsen: calculate the column objects based on // the column names as stored in _columns //_columnObjects = new ArrayList(); _columnObjects = MappingClassElementImpl.toColumnObjects( getDeclaringClass().getDatabaseRoot(), getColumns()); } return _columnObjects; }
protected boolean isMappedToTable (MappingTableElement table) { String tableName = table.getName(); Iterator iterator = getColumns().iterator(); while (iterator.hasNext()) { String columnName = iterator.next().toString(); if (NameUtil.getTableName(columnName).equals(tableName)) return true; } return false; }
/** Set whether this field element is read only or not. * @param flag - if <code>true</code>, the field element is marked as * read only; otherwise, it is not * @exception ModelException if impossible */ public void setReadOnly (boolean flag) throws ModelException { Boolean old = JavaTypeHelper.valueOf(isReadOnly()); Boolean newFlag = JavaTypeHelper.valueOf(flag); try { fireVetoableChange(PROP_READ_ONLY, old, newFlag); setProperty(flag, READ_ONLY); firePropertyChange(PROP_READ_ONLY, old, newFlag); } catch (PropertyVetoException e) { throw new ModelVetoException(e); } }
/** Set whether this field element is in a concurrency check or not. * @param flag - if <code>true</code>, the field element is marked as * being in a concurrency check; otherwise, it is not * @exception ModelException if impossible */ public void setInConcurrencyCheck (boolean flag) throws ModelException { Boolean old = JavaTypeHelper.valueOf(isInConcurrencyCheck()); Boolean newFlag = JavaTypeHelper.valueOf(flag); try { fireVetoableChange(PROP_IN_CONCURRENCY_CHECK, old, newFlag); setProperty(flag, IN_CONCURRENCY_CHECK); firePropertyChange(PROP_IN_CONCURRENCY_CHECK, old, newFlag); } catch (PropertyVetoException e) { throw new ModelVetoException(e); } }
/** Set the fetch group of this field element. * @param group - an integer indicating the fetch group, one of: * {@link #GROUP_DEFAULT}, {@link #GROUP_NONE}, or anything less than or * equal to {@link #GROUP_INDEPENDENT} * @exception ModelException if impossible */ public void setFetchGroup (int group) throws ModelException { Integer old = new Integer(getFetchGroup()); Integer newGroup = new Integer(group); try { fireVetoableChange(PROP_FETCH_GROUP, old, newGroup); setFetchGroupInternal(group); firePropertyChange(PROP_FETCH_GROUP, old, newGroup); } catch (PropertyVetoException e) { throw new ModelVetoException(e); } }
println(tabs+1, "name = " + mfe.getName()); //NOI18N println(tabs+1, "fetchGroup = " + mfe.getFetchGroup()); //NOI18N println(tabs+1, "columns = " + mfe.getColumns()); //NOI18N println(tabs+1, "columnObjects = " + mfe.getColumnObjects()); //NOI18N
/** Set whether this field element is a version field or not. * @param flag - if <code>true</code>, the field element is marked * as a version field; otherwise, it is not * @exception ModelException if impossible */ public void setVersion (boolean flag) throws ModelException { Boolean old = JavaTypeHelper.valueOf(isVersion()); Boolean newFlag = JavaTypeHelper.valueOf(flag); try { fireVetoableChange(PROP_VERSION_FIELD, old, newFlag); _isVersion = flag; firePropertyChange(PROP_VERSION_FIELD, old, newFlag); } catch (PropertyVetoException e) { throw new ModelVetoException(e); } }
(MappingFieldElementImpl)iterator.next(); if (mappingField.isMappedToTable(table)) fieldsToRemove.add(mappingField); mappingField = new MappingFieldElementImpl( mappingField.getName(), this); mappingField.setVersion(true);
/** * Create mapping field and add to mapping class * @param fieldName a String for field name * @param mappingClass mapping class object that field belong to * @return mapping field object * @throws ModelException */ private MappingFieldElement createAndAttachMappingField( String fieldName, MappingClassElement mappingClass, ColumnElement column) throws ModelException { MappingFieldElement mappingField = new MappingFieldElementImpl(fieldName, mappingClass); mappingClass.addField(mappingField); mappingField.addColumn(column); if (column.isBlobType()) { mappingField.setFetchGroup(MappingFieldElement.GROUP_NONE); } else { mappingField.setFetchGroup(MappingFieldElement.GROUP_DEFAULT); } return mappingField; }
/** Returns the list of columns (ColumnElements) to which this mapping * field is mapped. This method should only be used by the runtime. * @return the columns mapped by this mapping field */ public ArrayList getColumnObjects () { //@olsen: compute objects on access if (_columnObjects == null) { //@olsen: calculate the column objects based on // the column names as stored in _columns //_columnObjects = new ArrayList(); _columnObjects = MappingClassElementImpl.toColumnObjects( getDeclaringClass().getDatabaseRoot(), getColumns()); } return _columnObjects; }