/** Get the declaring table. This method is provided as part of * the implementation of the ReferenceKey interface but should only * be used when a ReferenceKey object is used or by the runtime. * @return the table that owns this reference key element, or * <code>null</code> if the element is not attached to any table */ public TableElement getDeclaringTable () { ArrayList locals = getReferencingKey(); if ((locals != null) && (locals.size() > 0)) { String absoluteName = NameUtil.getAbsoluteMemberName( getDeclaringClass().getDatabaseRoot(), locals.get(0).toString()); return TableElement.forName(NameUtil.getTableName(absoluteName)); } return null; }
/** Get the declaring table. This method is provided as part of * the implementation of the ReferenceKey interface but should only * be used when a ReferenceKey object is used or by the runtime. * @return the table that owns this reference key element, or * <code>null</code> if the element is not attached to any table */ public TableElement getDeclaringTable () { ArrayList locals = getReferencingKey(); if ((locals != null) && (locals.size() > 0)) { String absoluteName = NameUtil.getAbsoluteMemberName( getDeclaringClass().getDatabaseRoot(), locals.get(0).toString()); return TableElement.forName(NameUtil.getTableName(absoluteName)); } return null; }
/** Get all column pairs in this holder. * @return the column pairs */ public ColumnPairElement[] getColumnPairs () { ArrayList pairNames = getColumnPairNames(); TableElement table = getDeclaringTable(); int i, count = ((pairNames != null) ? pairNames.size() : 0); ColumnPairElement[] pairs = new ColumnPairElement[count]; String databaseRoot = getDeclaringClass().getDatabaseRoot(); for (i = 0; i < count; i++) { String absoluteName = NameUtil.getAbsoluteMemberName( databaseRoot, (String)pairNames.get(i)); pairs[i] = (ColumnPairElement)table.getMember( DBIdentifier.create(absoluteName)); } return pairs; }
/** Get all column pairs in this holder. * @return the column pairs */ public ColumnPairElement[] getColumnPairs () { ArrayList pairNames = getColumnPairNames(); TableElement table = getDeclaringTable(); int i, count = ((pairNames != null) ? pairNames.size() : 0); ColumnPairElement[] pairs = new ColumnPairElement[count]; String databaseRoot = getDeclaringClass().getDatabaseRoot(); for (i = 0; i < count; i++) { String absoluteName = NameUtil.getAbsoluteMemberName( databaseRoot, (String)pairNames.get(i)); pairs[i] = (ColumnPairElement)table.getMember( DBIdentifier.create(absoluteName)); } return pairs; }
/** Set the mapping table for this referencing key to the supplied table * without firing any property change events. * @param table mapping table element to be used with this key. * @exception ModelException if impossible */ private void setTableInternal (MappingTableElement table) throws ModelException { if (table == null) { throw new ModelException(I18NHelper.getMessage(getMessages(), "mapping.element.null_argument")); // NOI18N } _table = table; if (null == getDeclaringClass()) _declaringClass = table.getDeclaringClass(); if (null == getName()) _name = table.getName(); }
/** Set the mapping table for this referencing key to the supplied table * without firing any property change events. * @param table mapping table element to be used with this key. * @exception ModelException if impossible */ private void setTableInternal (MappingTableElement table) throws ModelException { if (table == null) { throw new ModelException(I18NHelper.getMessage(getMessages(), "mapping.element.null_argument")); // NOI18N } _table = table; if (null == getDeclaringClass()) _declaringClass = table.getDeclaringClass(); if (null == getName()) _name = table.getName(); }
/** Find a column pair by name. * @param name the name of the column pair for which to look * @return the column pair or <code>null</code> if not found */ public ColumnPairElement getColumnPair (DBIdentifier name) { ColumnPairElement[] myPairs = getColumnPairs(); int count = ((myPairs != null) ? myPairs.length : 0); String databaseRoot = getDeclaringClass().getDatabaseRoot(); if (count > 0) { String absoluteTableName = NameUtil.getAbsoluteTableName( databaseRoot, getTable().getName()); ColumnPairElement searchPair = (ColumnPairElement) TableElement.forName(absoluteTableName).getMember(name); int i; for (i = 0; i < count; i++) { if (myPairs[i].equals(searchPair)) return searchPair; } } return null; }
/** Find a column pair by name. * @param name the name of the column pair for which to look * @return the column pair or <code>null</code> if not found */ public ColumnPairElement getColumnPair (DBIdentifier name) { ColumnPairElement[] myPairs = getColumnPairs(); int count = ((myPairs != null) ? myPairs.length : 0); String databaseRoot = getDeclaringClass().getDatabaseRoot(); if (count > 0) { String absoluteTableName = NameUtil.getAbsoluteTableName( databaseRoot, getTable().getName()); ColumnPairElement searchPair = (ColumnPairElement) TableElement.forName(absoluteTableName).getMember(name); int i; for (i = 0; i < count; i++) { if (myPairs[i].equals(searchPair)) return searchPair; } } return null; }