/** * Method "getPrimaryKeys". * * @param table a table * @return a list of all primary keys of the given table * @deprecated use getPrimaryKey() instead */ @Deprecated public static List<PrimaryKey> getPrimaryKeys(Table table) { List<PrimaryKey> primarykeys = new ArrayList<PrimaryKey>(); EList<ModelElement> ownedElements = table.getOwnedElement(); for (ModelElement modelElement : ownedElements) { PrimaryKey pk = SwitchHelpers.PRIMARY_KEY_SWITCH.doSwitch(modelElement); if (pk != null) { primarykeys.add(pk); } } return primarykeys; }
/** * return the primary key associated with this table or null if there is none * * @param table to search in for a PK * @return the PK found or null */ public static PrimaryKey getPrimaryKey(TdTable table) { PrimaryKey result = null; EList<ModelElement> ownedElements = table.getOwnedElement(); // look for the first primaryKey in the owned element list for (ModelElement modelElement : ownedElements) { PrimaryKey pk = SwitchHelpers.PRIMARY_KEY_SWITCH.doSwitch(modelElement); if (pk != null) { result = pk; break; } } return result; }