Package com.sas.services.information.metadata.favorites

# Interface FavoritesContainer

All Superinterfaces:
  `MetadataInterface`, `PublicObjectContainerInterface`, `PublicObjectInterface`, `Remote`

All Known Subinterfaces:
  `FavoritesFolder`, `FavoritesGroup`

public interface FavoritesContainer extends MetadataInterface, PublicObjectContainerInterface
Base interface used for any favorites container object, such as a FavoritesFolder or a FavoritesGroup. This interface contains the common methods used by these containers.

Since:
  9.3

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `CAPACITY_UNLIMITED`
  Constant used to indicate that the container can hold an unlimited number of favorites.

  ### Fields inherited from interface com.sas.services.information.metadata.MetadataInterface

  `METADATA_STATE_DELETED, METADATA_STATE_DESTROYED, METADATA_STATE_NEW, METADATA_STATE_NORMAL, PERMISSION_READMETADATA, PERMISSION_WRITEMETADATA`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addFavorite(MetadataInterface favorite)`
  Adds a new item to the list of favorites.
  `void`
  `addFavoritesGroup(FavoritesGroup subGroup)`
  Adds a new child group to this container.
  `boolean`
  `containsFavorite(MetadataInterface favorite)`
  Returns true if the specified object is a direct member of this container.
  `int`
  `getFavoriteCount()`
  Returns the number of favorites in this container.
  `int`
  `getFavoriteIndex(MetadataInterface favorite)`
  Returns the index of the specified favorite, or -1 if the favorite does not exist within this container.
  `List<MetadataInterface>`
  `getFavorites()`
  Returns the list of all favorites contained within this container.
  `List<MetadataInterface>`
  `getFavorites(SortOrder[] order)`
  Deprecated.
  should not be used
  `int`
  `getFavoritesGroupIndex(FavoritesGroup subGroup)`
  Returns the index of the specified favorites group, or -1 if the group does not exist within this container.
  `List<FavoritesGroup>`
  `getFavoritesGroups()`
  Returns the list of all favorites groups contained within this container.
  `int`
  `getMaxCapacity()`
  Returns the maximum number of favorites allowed under this container.
  `int`
  `getTotalFavoriteCount()`
  Returns the number of favorites in this container, as well as any nested favorites groups, recursively.
  `boolean`
  `hasDuplicateFavoritesGroup(String name)`
  Check if there's a duplicate favorites group in this container with the same name.
  `void`
  `insertFavorite(MetadataInterface favorite, int index)`
  Inserts a new item to the list of favorites at the specified index.
  `void`
  `insertFavoritesGroup(FavoritesGroup subGroup, int index)`
  Inserts a new child group to this container at the specified index.
  `boolean`
  `isEmpty()`
  Returns true if this container has no elements, either favorites or child favorite groups.
  `void`
  `moveFavorite(MetadataInterface favorite, int newPosition)`
  Deprecated.
  use `removeFavorite(MetadataInterface)` and `insertFavorite(MetadataInterface, int)`
  `void`
  `removeAll()`
  Clears the container by removing all favorites and favorites groups, recursively.
  `void`
  `removeAllFavorites()`
  Removes all existing favorites from this particular container.
  `void`
  `removeAllFavoritesGroups()`
  Removes all existing child favorite groups from this particular container.
  `void`
  `removeFavorite(MetadataInterface favorite)`
  Removes the specified object from the list of favorites.
  `void`
  `removeFavoritesGroup(FavoritesGroup subGroup)`
  Removes the specified object from the list favorites groups.
  `void`
  `setMaxCapacity(int capacity)`
  Sets the maximum number of favorites allowed to be contained within this folder at a given time.

  ### Methods inherited from interface com.sas.services.information.metadata.MetadataInterface

  `add, addAccessControl, addAttribute, addAttributes, addDocument, addExtension, addGroup, addImplementor, addKeyword, addNoteTextStore, addNoteTextStore, addObjectProperty, addObjectProperty, addPermissions, addPrompt, addPropertySet, addRemark, addResponsibleParty, addTransactionListener, addUsedByPrototype, checkin, checkout, commit, copyTo, countAssociatedObjects, delete, deleteAttribute, deleteAttributes, destroy, getAccessControls, getAttribute, getAttributes, getAuthorizationUtil, getCreateDate, getCreatedBy, getDescription, getDocuments, getEntityKey, getEntityURL, getExtensions, getGroups, getGUID, getIdentities, getImplementors, getKeywords, getLockedBy, getModifiedBy, getModifyDate, getNoteTextStore, getNoteTextStores, getNoteTextStoresByRole, getObjectProperties, getParent, getParentPath, getParents, getPath, getPaths, getPermission, getPermissions, getPermissions, getPreviousVersionNames, getPrimaryPropertyGroup, getPrompt, getPrompts, getPropertyBag, getPropertySets, getRemarksList, getReposId, getRepository, getRepositoryEntity, getRepositoryName, getReposKey, getResponsibleParties, getState, getTrackingId, getType, getUsageVersion, getUsedByPrototypes, getUsingPrototype, getVersion, isAuthorized, isCompatible, isDeleted, isDestroyed, isObjectAlive, isReadCompatible, mapNameToFilesystem, mapUrlToFilesystem, moveTo, newServiceObject, refresh, removeAccessControl, removeDocument, removeExtension, removeGroup, removeImplementor, removeKeyword, removeNoteTextStore, removeObjectProperty, removePermissions, removePrompt, removePropertySet, removeResponsibleParty, removeResponsiblePartyByIdentity, removeUsedByPrototype, rollback, setAttribute, setAttributes, setDeleted, setDescription, setDocuments, setExtensions, setGroups, setGUID, setKeywords, setName, setNoteTextStores, setObjectProperties, setPermission, setPrimaryPropertyGroup, setPrompt, setPrompts, setRemarksList, setRepository, setUsingPrototype, startTransaction, toByteArray, transactionEvent, uncheckout, update, updateFromBag, version`

  ### Methods inherited from interface com.sas.services.information.publicobject.PublicObjectContainerInterface

  `getChildAt, getChildCount, getChildren, getChildren, newChild`

  ### Methods inherited from interface com.sas.services.information.publicobject.PublicObjectInterface

  `addProcessorInterface, getContainer, getIdentifier, getName, getObjectURI, getPathUrl, getProcessorInterface, getTypeDescriptor`

- ## Field Details

  - ### CAPACITY_UNLIMITED

    static final int CAPACITY_UNLIMITED
    Constant used to indicate that the container can hold an unlimited number of favorites.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### getFavorites

    List<MetadataInterface> getFavorites() throws ServiceException, RemoteException
    Returns the list of all favorites contained within this container. An empty list is returned if this container contains no favorites.
    Returns:
      list of favorites
    Throws:
      `ServiceException`
      `RemoteException`

  - ### getFavorites

    List<MetadataInterface> getFavorites(SortOrder[] order) throws ServiceException, RemoteException
    Deprecated.
    should not be used
    Returns the list of all favorites contained within this folder, and sorted in the proper order. If a `null` value is passed in for the order, a default order will be applied (sorting by name then type). An empty list will be returned if this folder contains no favorites.
    Parameters:
      `order` -
    Returns:
      list of favorites sorted in the appropriate order
    Throws:
      `ServiceException`
      `RemoteException`

  - ### getFavoriteIndex

    int getFavoriteIndex(MetadataInterface favorite) throws ServiceException, RemoteException
    Returns the index of the specified favorite, or -1 if the favorite does not exist within this container.
    Parameters:
      `favorite` - the favorite to search for
    Returns:
      the index of the favorite, or -1 if not found
    Throws:
      `ServiceException`
      `RemoteException`

  - ### getFavoriteCount

    int getFavoriteCount() throws ServiceException, RemoteException
    Returns the number of favorites in this container. This method returns the total count of this specific container, and does not include the count of any nested favorites groups, if applicable. Any child favorites groups are also not included in this count.
    Returns:
      the number of favorites
    Throws:
      `ServiceException`
      `RemoteException`

  - ### getTotalFavoriteCount

    int getTotalFavoriteCount() throws ServiceException, RemoteException
    Returns the number of favorites in this container, as well as any nested favorites groups, recursively. Use `getFavoriteCount()` if a recursive search is not needed. The returned count only includes objects that have been added as favorites. Nested favorites groups are not included.
    Returns:
      the number of favorites
    Throws:
      `ServiceException`
      `RemoteException`

  - ### containsFavorite

    boolean containsFavorite(MetadataInterface favorite) throws ServiceException, RemoteException
    Returns true if the specified object is a direct member of this container. Note, this method does not search within any nested favorites groups to determine if the object is contained or not.
    Parameters:
      `favorite` - the favorite item
    Returns:
      true if contained within the folder, false otherwise
    Throws:
      `ServiceException`
      `RemoteException`

  - ### isEmpty

    boolean isEmpty() throws ServiceException, RemoteException
    Returns true if this container has no elements, either favorites or child favorite groups.
    Returns:
      true if this container is empty
    Throws:
      `ServiceException`
      `RemoteException`

  - ### addFavorite

    void addFavorite(MetadataInterface favorite) throws ServiceException, RemoteException
    Adds a new item to the list of favorites. If the object is already contained within the list, it will not be re-added.
    Parameters:
      `favorite` - the favorite item
    Throws:
      `ServiceException`
      `RemoteException`

  - ### insertFavorite

    void insertFavorite(MetadataInterface favorite, int index) throws ServiceException, RemoteException
    Inserts a new item to the list of favorites at the specified index. If the object is already contained within the list, it will not be re-added.
    Parameters:
      `favorite` - the favorite item
      `index` - the index where the favorite should be added
    Throws:
      `ServiceException`
      `RemoteException`

  - ### removeFavorite

    void removeFavorite(MetadataInterface favorite) throws ServiceException, RemoteException
    Removes the specified object from the list of favorites.
    Parameters:
      `favorite` - the favorite item
    Throws:
      `ServiceException`
      `RemoteException`

  - ### removeAllFavorites

    void removeAllFavorites() throws ServiceException, RemoteException
    Removes all existing favorites from this particular container.
    Throws:
      `ServiceException`
      `RemoteException`

  - ### getFavoritesGroups

    List<FavoritesGroup> getFavoritesGroups() throws ServiceException, RemoteException
    Returns the list of all favorites groups contained within this container. An empty list is returned if this container contains no child groups.
    Returns:
      list of favorites groups
    Throws:
      `ServiceException`
      `RemoteException`

  - ### getFavoritesGroupIndex

    int getFavoritesGroupIndex(FavoritesGroup subGroup) throws ServiceException, RemoteException
    Returns the index of the specified favorites group, or -1 if the group does not exist within this container.
    Parameters:
      `subGroup` - the favorites group to search for
    Returns:
      the index of the child group, or -1 if not found
    Throws:
      `ServiceException`
      `RemoteException`

  - ### addFavoritesGroup

    void addFavoritesGroup(FavoritesGroup subGroup) throws ServiceException, RemoteException
    Adds a new child group to this container. If the object is already contained within the list, it will not be re-added.
    Parameters:
      `subGroup` - the child favorites group
    Throws:
      `ServiceException`
      `RemoteException`

  - ### insertFavoritesGroup

    void insertFavoritesGroup(FavoritesGroup subGroup, int index) throws ServiceException, RemoteException
    Inserts a new child group to this container at the specified index. If the object is already contained within the list, it will not be re-added.
    Parameters:
      `subGroup` - the child favorites group
      `index` - the index where the group should be added
    Throws:
      `ServiceException`
      `RemoteException`

  - ### removeFavoritesGroup

    void removeFavoritesGroup(FavoritesGroup subGroup) throws ServiceException, RemoteException
    Removes the specified object from the list favorites groups.

    Important: Removing the favorites group will remove the object from its association with its parent container. This will essentially leave the group orphaned, but it will not delete it from the metadata server. The group will need to be either deleted or re-added to another (or same) favorites container.

    Parameters:
      `subGroup` - the child favorites group
    Throws:
      `ServiceException`
      `RemoteException`

  - ### removeAllFavoritesGroups

    void removeAllFavoritesGroups() throws ServiceException, RemoteException
    Removes all existing child favorite groups from this particular container.

    Important: Removing the favorites group will remove the object from its association with its parent container. This will essentially leave the group orphaned, but it will not delete it from the metadata server. The group will need to be either deleted or re-added to another (or same) favorites container.

    Throws:
      `ServiceException`
      `RemoteException`

  - ### removeAll

    void removeAll() throws ServiceException, RemoteException
    Clears the container by removing all favorites and favorites groups, recursively.
    Throws:
      `ServiceException`
      `RemoteException`

  - ### hasDuplicateFavoritesGroup

    boolean hasDuplicateFavoritesGroup(String name) throws ServiceException, RemoteException
    Check if there's a duplicate favorites group in this container with the same name.
    Parameters:
      `name` - the name to check for.
    Returns:
      true if this container has a favorites group with the given name, false otherwise.
    Throws:
      `ServiceException`
      `RemoteException`

  - ### setMaxCapacity

    void setMaxCapacity(int capacity) throws ServiceException, RemoteException
    Sets the maximum number of favorites allowed to be contained within this folder at a given time. This method is typically used for favorites containers that are used in a history based context.

    If an object is added as a favorite such that it exceeds the capacity settings, the favorites container will remove the oldest value. This way the container will never contain more objects than what's specified by the capacity. If the capacity is set to a lesser value than the current number of favorites, the list of favorites will be trimmed (by removing the oldest favorite) until the size matches the maximum capacity.

    Parameters:
      `capacity` - the maximum capacity of favorites allowed in this container
    Throws:
      `ServiceException`
      `RemoteException`

  - ### getMaxCapacity

    int getMaxCapacity() throws ServiceException, RemoteException
    Returns the maximum number of favorites allowed under this container.
    Returns:
      the maximum capactiy of favorites.
    Throws:
      `ServiceException`
      `RemoteException`

  - ### moveFavorite

    void moveFavorite(MetadataInterface favorite, int newPosition) throws ServiceException, RemoteException
    Deprecated.
    use `removeFavorite(MetadataInterface)` and `insertFavorite(MetadataInterface, int)`
    Moves an existing favorite to the specified location.
    Parameters:
      `favorite` - the favorite item
      `newPosition` - the new position to move the item to
    Throws:
      `IllegalArgumentException` - if the object does not exist within this container
      `ServiceException`
      `RemoteException`