Package com.sas.metadata.remote

# Interface ForeignKey

All Superinterfaces:
  `CMetadata`, `Key`, `MdObjectBase`, `MdObjectBaseUtil`, `MdObjectBaseXML`, `Remote`, `Root`, `SecondaryType`

public interface ForeignKey extends Key
Represents the fact that a table contains a foreign key to another table.

Attributes of ForeignKey are:

Associations of ForeignKey are:

- `KeyAssociations`
- `PartnerUniqueKey`
- `Table`

## Usage

To create an instance of this ForeignKey, use the `factory` create methods.
Example: create a ForeignKey with name "ForeignKey_Object", in repository "AAAAAAAA".

     // create a store to contain your objects for this change. If you do not have an existing object
     // or store to use.  You may obtain the store from another object by using Object.getObjectStore().
     MdFactory factory; //where "factory" is a valid MdFactory instance
     MdObjectStore objectStore = factory.createObjectStore();
     ForeignKey myObject = (ForeignKey) factory.createComplexMetadataObject(objectStore, "ForeignKey_Object", MetadataObjects.FOREIGNKEY, "AAAAAAAA");
     myObject.updateMetadataAll();  // Write object to server
     objectStore.dispose();  // dispose of the object store if it is no longer needed

## Behavior

- Attributes and associations for this object can be retrieved by using the methods in `MdOMIUtil`.
- When changes are made to the object, either by setting an attribute or adding objects to a particular association, they can be persisted to the metadata server with the `updateMetadataAll` method.
- If an object needs to be deleted, the `delete` method can be used. This will flag the object as being deleted on the client, and will require an update call to persist the change to the server.

## Dependencies

This class depends on objects being contained in an MdObjectStore. Object stores should be disposed of when they are no longer needed as this will help clean up memory. Disposing an object store will dispose of all objects contained within that store.

Since:
  9.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ASSOCIATION_KEYASSOCIATIONS_NAME`
  Constant used for the name of the KeyAssociations association.
  `static final String`
  `ASSOCIATION_PARTNERUNIQUEKEY_NAME`
  Constant used for the name of the PartnerUniqueKey association.
  `static final String`
  `ASSOCIATION_TABLE_NAME`
  Constant used for the name of the Table association.

  ### Fields inherited from interface com.sas.metadata.remote.Key

  `ASSOCIATION_DISPLAYCOLUMNS_NAME, ASSOCIATION_KEYEDCOLUMNS_NAME`

  ### Fields inherited from interface com.sas.metadata.remote.MdObjectBase

  `ATTRIBUTE_DESC_NAME, ATTRIBUTE_ID_NAME, ATTRIBUTE_METADATACREATED_NAME, ATTRIBUTE_METADATAUPDATED_NAME, ATTRIBUTE_NAME_NAME`

  ### Fields inherited from interface com.sas.metadata.remote.Root

  `ASSOCIATION_ACCESSCONTROLS_NAME, ASSOCIATION_CHANGES_NAME, ASSOCIATION_CUSTOMASSOCIATIONS_NAME, ASSOCIATION_DOCUMENTS_NAME, ASSOCIATION_EXTENSIONS_NAME, ASSOCIATION_EXTERNALIDENTITIES_NAME, ASSOCIATION_GROUPS_NAME, ASSOCIATION_IMPLEMENTORS_NAME, ASSOCIATION_KEYWORDS_NAME, ASSOCIATION_LOCALIZEDATTRIBUTES_NAME, ASSOCIATION_NOTES_NAME, ASSOCIATION_PRIMARYPROPERTYGROUP_NAME, ASSOCIATION_PROMPTS_NAME, ASSOCIATION_PROPERTIES_NAME, ASSOCIATION_PROPERTYSETS_NAME, ASSOCIATION_REFERENCEDOBJECTS_NAME, ASSOCIATION_RESPONSIBLEPARTIES_NAME, ASSOCIATION_SOURCETRANSFORMATIONS_NAME, ASSOCIATION_SPECSOURCETRANSFORMATIONS_NAME, ASSOCIATION_SPECTARGETTRANSFORMATIONS_NAME, ASSOCIATION_TARGETTRANSFORMATIONS_NAME, ASSOCIATION_TIMESTAMPS_NAME, ASSOCIATION_TREES_NAME, ASSOCIATION_TSOBJECTNAMESPACE_NAME, ASSOCIATION_USEDBYPROTOTYPES_NAME, ASSOCIATION_USINGPROTOTYPE_NAME, ASSOCIATION_VARIABLES_NAME, ATTRIBUTE_CHANGESTATE_NAME, ATTRIBUTE_LOCKEDBY_NAME, ATTRIBUTE_USAGEVERSION_NAME`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AssociationList`
  `getKeyAssociations()`
  Gets the AssociationList of `KeyAssociations`
  `AssociationList`
  `getKeyAssociations(boolean fGoToServer)`
  Gets the Associationlist of `KeyAssociations`
  `UniqueKey`
  `getPartnerUniqueKey()`
  Gets the `UniqueKey` for `PartnerUniqueKey`
  `AssociationList`
  `getPartnerUniqueKeys()`
  Gets the AssociationList of `PartnerUniqueKeys`
  `AssociationList`
  `getPartnerUniqueKeys(boolean fGoToServer)`
  Gets the Associationlist of `PartnerUniqueKeys`
  `DataTable`
  `getTable()`
  Gets the `DataTable` for `Table`
  `AssociationList`
  `getTables()`
  Gets the Association list of `Tables`
  `AssociationList`
  `getTables(boolean fGoToServer)`
  Gets the Associationlist of `Tables`
  `void`
  `initializePredObjects()`
  (S) Adds the Associated objects to the predObjects which are:
  `KeyAssociations`
  `PartnerUniqueKey`
  `void`
  `initializeRequiredObjects()`
  (S) This initializes the Required Objects(Roles) which are:
  `Table`
  `void`
  `setKeyAssociations(AssociationList list)`
  Sets the `KeyAssociations` list to be `list`.
  `void`
  `setKeyAssociations(AssociationList inObjects, int state)`
  Sets the entire AssociationList to match the passed in Vector, sets the state of the AssociationList
  `void`
  `setPartnerUniqueKey(UniqueKey inObject)`
  Sets the `PartnerUniqueKeys` list 0th element to be `inObject`.
  `void`
  `setPartnerUniqueKeys(AssociationList list)`
  Sets the `PartnerUniqueKeys` list to be `list`.
  `void`
  `setPartnerUniqueKeys(AssociationList list, int state)`
  Sets the `PartnerUniqueKeys` list to be `list`.
  `void`
  `setTable(DataTable inObject)`
  Sets the `Tables` list 0th element to be `inObject`.
  `void`
  `setTables(AssociationList list)`
  Sets the `Tables` list to be `list`.
  `void`
  `setTables(AssociationList list, int state)`
  Sets the `Tables` list to be `list`.

  ### Methods inherited from interface com.sas.metadata.remote.Key

  `getDisplayColumns, getDisplayColumns, getKeyedColumns, getKeyedColumns, setDisplayColumns, setDisplayColumns, setKeyedColumns, setKeyedColumns`

  ### Methods inherited from interface com.sas.metadata.remote.MdObjectBase

  `addElementToChangeList, clearChangeList, getChangeList, getCMetadataType, getDesc, getDescMaxLength, getDescState, getFQID, getId, getIdState, getMetadataCreated, getMetadataCreatedState, getMetadataUpdated, getMetadataUpdatedState, getName, getNameMaxLength, getNameState, getObjectStore, getPredAssociations, getRepositoryID, getRequiredAssociations, getState, isAssociationRequired, isNewObject, isPredAssociation, removeElementFromChangeList, resetObject, resetState, resetStates, setCMetadataType, setDesc, setDesc, setDescState, setFQID, setFQID, setId, setId, setIdState, setMetadataCreated, setMetadataCreated, setMetadataCreatedState, setMetadataUpdated, setMetadataUpdated, setMetadataUpdatedState, setName, setName, setNameState, setObjectStore, setState`

  ### Methods inherited from interface com.sas.metadata.remote.MdObjectBaseUtil

  `addMdObjectListener, delete, dispose, fireMdObjectModified, getAssociatedObjects, getAssociatedObjects, getAssociatedObjects, getAssociationNames, getAssocs, getAssocsWA, getAttributeNames, getAttrs, getAttrsStates, getAuthorizationUtil, getChangeManagementState, getChgMgtExternalIdentityImportType, getClientSideOnlyObject, getMdObjectAssociation, getPopulatedAssocs, getUpdatedAttrs, getViewList, isCheckedOut, isLocked, objectModified, removeMdObjectListener, setAttrs, setChangeManagementTargetRepository, setChgMgtExternalIdentityImportType, setClientSideOnlyObject, setMdObjectAssociation, touch, updateAssnsIds`

  ### Methods inherited from interface com.sas.metadata.remote.MdObjectBaseXML

  `closeUpdateMetadataXML, createEmptyXML, createObjectRefreshXML, createObjectXML, createObjectXML, createUpdateAssociationXML, createUpdateAssociationXML, createUpdateSimpleXML, doCreateUpdateXML, getUpdateSimpleSubstring, updateMetadataAll`

  ### Methods inherited from interface com.sas.metadata.remote.Root

  `getAccessControls, getAccessControls, getChanges, getChanges, getChangeState, getChangeStateMaxLength, getChangeStateState, getCustomAssociations, getCustomAssociations, getDocuments, getDocuments, getExtensions, getExtensions, getExternalIdentities, getExternalIdentities, getGroups, getGroups, getImplementors, getImplementors, getKeywords, getKeywords, getLocalizedAttributes, getLocalizedAttributes, getLockedBy, getLockedByMaxLength, getLockedByState, getNotes, getNotes, getPrimaryPropertyGroup, getPrimaryPropertyGroups, getPrimaryPropertyGroups, getPrompts, getPrompts, getProperties, getProperties, getPropertySets, getPropertySets, getReferencedObjects, getReferencedObjects, getResponsibleParties, getResponsibleParties, getSourceTransformations, getSourceTransformations, getSpecSourceTransformations, getSpecSourceTransformations, getSpecTargetTransformations, getSpecTargetTransformations, getTargetTransformations, getTargetTransformations, getTimestamps, getTimestamps, getTrees, getTrees, getTSObjectNamespace, getTSObjectNamespaces, getTSObjectNamespaces, getUsageVersion, getUsageVersionState, getUsedByPrototypes, getUsedByPrototypes, getUsingPrototype, getUsingPrototypes, getUsingPrototypes, getVariables, getVariables, setAccessControls, setAccessControls, setChanges, setChanges, setChangeState, setChangeState, setChangeStateState, setCustomAssociations, setCustomAssociations, setDocuments, setDocuments, setExtensions, setExtensions, setExternalIdentities, setExternalIdentities, setGroups, setGroups, setImplementors, setImplementors, setKeywords, setKeywords, setLocalizedAttributes, setLocalizedAttributes, setLockedBy, setLockedBy, setLockedByState, setNotes, setNotes, setPrimaryPropertyGroup, setPrimaryPropertyGroups, setPrimaryPropertyGroups, setPrompts, setPrompts, setProperties, setProperties, setPropertySets, setPropertySets, setReferencedObjects, setReferencedObjects, setResponsibleParties, setResponsibleParties, setSourceTransformations, setSourceTransformations, setSpecSourceTransformations, setSpecSourceTransformations, setSpecTargetTransformations, setSpecTargetTransformations, setTargetTransformations, setTargetTransformations, setTimestamps, setTimestamps, setTrees, setTrees, setTSObjectNamespace, setTSObjectNamespaces, setTSObjectNamespaces, setUsageVersion, setUsageVersion, setUsageVersion, setUsageVersion, setUsageVersionState, setUsedByPrototypes, setUsedByPrototypes, setUsingPrototype, setUsingPrototypes, setUsingPrototypes, setVariables, setVariables`

- ## Field Details

  - ### ASSOCIATION_KEYASSOCIATIONS_NAME

    static final String ASSOCIATION_KEYASSOCIATIONS_NAME
    Constant used for the name of the KeyAssociations association.

    KeyAssociations: The list of association objects that associate a column in this foreign key to a column in the unique key.

    See Also:
      - Constant Field Values

  - ### ASSOCIATION_PARTNERUNIQUEKEY_NAME

    static final String ASSOCIATION_PARTNERUNIQUEKEY_NAME
    Constant used for the name of the PartnerUniqueKey association.

    PartnerUniqueKey: The unique key associated with this foreign key.

    See Also:
      - Constant Field Values

  - ### ASSOCIATION_TABLE_NAME

    static final String ASSOCIATION_TABLE_NAME
    Constant used for the name of the Table association.

    Table: The table that contains this foreign key.

    See Also:
      - Constant Field Values

- ## Method Details

  - ### initializeRequiredObjects

    void initializeRequiredObjects() throws RemoteException
    (S) This initializes the Required Objects(Roles) which are:
    `Table`
    Specified by:
      `initializeRequiredObjects` in interface `Key`
    Specified by:
      `initializeRequiredObjects` in interface `MdObjectBaseUtil`
    Specified by:
      `initializeRequiredObjects` in interface `Root`
    Specified by:
      `initializeRequiredObjects` in interface `SecondaryType`
    Throws:
      `RemoteException` - If error connecting/communicating to/with remote object.

  - ### initializePredObjects

    void initializePredObjects() throws RemoteException
    (S) Adds the Associated objects to the predObjects which are:
    `KeyAssociations`
    `PartnerUniqueKey`
    Specified by:
      `initializePredObjects` in interface `Key`
    Specified by:
      `initializePredObjects` in interface `MdObjectBase`
    Specified by:
      `initializePredObjects` in interface `Root`
    Specified by:
      `initializePredObjects` in interface `SecondaryType`
    Throws:
      `RemoteException` - If error connecting/communicating to/with remote object.

  - ### getKeyAssociations

    AssociationList getKeyAssociations() throws RemoteException, MdException
    Gets the AssociationList of `KeyAssociations`
    Returns:
      Returns the AssociationList of `KeyAssociations` which can be of type:
      KeyAssociation
    Throws:
      `RemoteException` - If error connecting/communicating to/with remote object.
      `MdException` - If error getting/setting part of the object.

  - ### getPartnerUniqueKeys

    AssociationList getPartnerUniqueKeys() throws RemoteException, MdException
    Gets the AssociationList of `PartnerUniqueKeys`
    Returns:
      Returns the AssociationList of `PartnerUniqueKeys` which can be of type:
      UniqueKey
    Throws:
      `RemoteException` - If error connecting/communicating to/with remote object.
      `MdException`

  - ### getPartnerUniqueKey

    UniqueKey getPartnerUniqueKey() throws RemoteException, MdException
    Gets the `UniqueKey` for `PartnerUniqueKey`
    Returns:
      The `UniqueKey` ( `null` if not set) of `PartnerUniqueKey`which can be of type:
      UniqueKey
    Throws:
      `RemoteException` - If error connecting/communicating to/with remote object.
      `MdException` - If error getting/setting part of the object.

  - ### getTables

    AssociationList getTables() throws RemoteException, MdException
    Gets the Association list of `Tables`
    Returns:
      The AssociationList of `Tables` which can be of type:
      DataTable
      ExternalTable
      RelationalTable
      PhysicalTable
      WorkTable
      SecuredTable
      QueryTable
      JoinTable
      TableCollection
    Throws:
      `RemoteException` - If error connecting/communicating to/with remote object.
      `MdException` - If error getting/setting part of the object.

  - ### getTable

    DataTable getTable() throws RemoteException, MdException
    Gets the `DataTable` for `Table`
    Returns:
      The `DataTable` ( `null` if not set ) of `Table` which can be of type:
      DataTable
      ExternalTable
      RelationalTable
      PhysicalTable
      WorkTable
      SecuredTable
      QueryTable
      JoinTable
      TableCollection
    Throws:
      `RemoteException` - If error connecting/communicating to/with remote object.
      `MdException` - If error getting/setting part of the object.

  - ### getKeyAssociations

    AssociationList getKeyAssociations(boolean fGoToServer) throws RemoteException, MdException
    Gets the Associationlist of `KeyAssociations`
    Parameters:
      `fGoToServer` - boolean Get the value from the server.
    Returns:
      Returns the AssociationList of `KeyAssociations` which can be of type:
      KeyAssociation
    Throws:
      `RemoteException` - If error connecting/communicating to/with remote object.
      `MdException` - If error getting/setting part of the object.

  - ### getPartnerUniqueKeys

    AssociationList getPartnerUniqueKeys(boolean fGoToServer) throws RemoteException, MdException
    Gets the Associationlist of `PartnerUniqueKeys`
    Parameters:
      `fGoToServer` - boolean Get the value from the server.
    Returns:
      Returns the AssociationList of `PartnerUniqueKeys` which can be of type:
      UniqueKey
    Throws:
      `RemoteException` - If error connecting/communicating to/with remote object.
      `MdException` - If error getting/setting part of the object.

  - ### getTables

    AssociationList getTables(boolean fGoToServer) throws RemoteException, MdException
    Gets the Associationlist of `Tables`
    Parameters:
      `fGoToServer` - boolean Get the value from the server.
    Returns:
      Returns the `Tables` which can be of type:
      DataTable
      ExternalTable
      RelationalTable
      PhysicalTable
      WorkTable
      SecuredTable
      QueryTable
      JoinTable
      TableCollection
    Throws:
      `RemoteException` - If error connecting/communicating to/with remote object.
      `MdException` - If error getting/setting part of the object.

  - ### setKeyAssociations

    void setKeyAssociations(AssociationList list) throws RemoteException
    Sets the `KeyAssociations` list to be `list`. Objects of which can be of type:
    KeyAssociation
    Parameters:
      `list` - AssociationList
    Throws:
      `RemoteException` - If error communicating with remote object.

  - ### setKeyAssociations

    void setKeyAssociations(AssociationList inObjects, int state) throws RemoteException
    Sets the entire AssociationList to match the passed in Vector, sets the state of the AssociationList
    Parameters:
      `inObjects` - AssociationList
      `state` - int
    Throws:
      `RemoteException` - If error communicating with remote object.

  - ### setPartnerUniqueKeys

    void setPartnerUniqueKeys(AssociationList list) throws RemoteException
    Sets the `PartnerUniqueKeys` list to be `list`. Object of which can be of type:
    UniqueKey
    Parameters:
      `list` - AssociationList
    Throws:
      `RemoteException` - If error communicating with remote object.

  - ### setPartnerUniqueKeys

    void setPartnerUniqueKeys(AssociationList list, int state) throws RemoteException
    Sets the `PartnerUniqueKeys` list to be `list`. Object of which can be of type:
    UniqueKey
    Parameters:
      `list` - AssociationList
      `state` - int
    Throws:
      `RemoteException` - If error communicating with remote object.

  - ### setPartnerUniqueKey

    void setPartnerUniqueKey(UniqueKey inObject) throws RemoteException
    Sets the `PartnerUniqueKeys` list 0th element to be `inObject`.
    Parameters:
      `inObject` - UniqueKey
    Throws:
      `RemoteException` - If error communicating with remote object.

  - ### setTables

    void setTables(AssociationList list) throws RemoteException
    Sets the `Tables` list to be `list`. Objects of which can be of type:
    DataTable
    ExternalTable
    RelationalTable
    PhysicalTable
    WorkTable
    SecuredTable
    QueryTable
    JoinTable
    TableCollection
    Parameters:
      `list` - AssociationList
    Throws:
      `RemoteException` - If error communicating with remote object.

  - ### setTables

    void setTables(AssociationList list, int state) throws RemoteException
    Sets the `Tables` list to be `list`. Objects of which can be of type:
    DataTable
    ExternalTable
    RelationalTable
    PhysicalTable
    WorkTable
    SecuredTable
    QueryTable
    JoinTable
    TableCollection
    Parameters:
      `list` - AssociationList
      `state` - int
    Throws:
      `RemoteException` - If error communicating with remote object.

  - ### setTable

    void setTable(DataTable inObject) throws RemoteException
    Sets the `Tables` list 0th element to be `inObject`.
    Parameters:
      `inObject` - DataTable
    Throws:
      `RemoteException` - If error communicating with remote object.