Class FavoritesFactory

java.lang.Object
com.sas.services.information.metadata.favorites.FavoritesFactory
All Implemented Interfaces:
RemoteSessionContextStateChangedListener, Remote, EventListener

public class FavoritesFactory extends Object implements RemoteSessionContextStateChangedListener
Factory class used for creating new favorites folders.
Since:
9.3
  • Method Details

    • getInstance

      public static FavoritesFactory getInstance(SessionContextInterface session) throws ServiceException, RemoteException
      Returns the factory instance for a given session context.
      Parameters:
      session - the users's session context
      Returns:
      favorites factory instance
      Throws:
      ServiceException
      RemoteException
    • getSession

      public SessionContextInterface getSession()
      Returns the session associated with this factory instance.
      Returns:
      session context
    • createFavoritesFolder

      public FavoritesFolder createFavoritesFolder(String name, FolderInterface folder) throws ServiceException, RemoteException
      Creates a new favorites folder. Callers should ensure the name being used to create the object is unique within the parent folder. See Folder.hasDuplicate(String, String).
      Parameters:
      name - the name of the object
      folder - the parent folder to associate this favorites folder to
      Returns:
      a new favorites folder or null if one could not be created
      Throws:
      ServiceException
      RemoteException
    • createFavoritesGroup

      public FavoritesGroup createFavoritesGroup(String name, FavoritesContainer container) throws ServiceException, RemoteException
      Creates a new favorites group within an owning container. Callers should ensure the name being used to create the object is unique within the container. See FavoritesContainer.hasDuplicateFavoritesGroup(String).
      Parameters:
      name - the name of the object
      container - the parent container to associate this favorites group to
      Returns:
      a new favorites group or null if one could not be created
      Throws:
      ServiceException
      RemoteException
    • getUserFavorites

      public FavoritesFolder getUserFavorites() throws ServiceException, RemoteException
      Returns the Favorites folder for the user currently logged in. The favorites folders reside in a user's Application Data folder, for example:
        /User Folders/user-name/Application Data/My Favorites(FavoritesFolder)
       
      If the favorites folder does not exist, this method will attempt to create it along with its parent folders if necessary. Meaning, the method will first retrieve the user's Application Data folder, and will create it if necessary. And finally, the Favorites favorites folder itself is retrieved, or created.
      Returns:
      the user's favorites folder, or null if for some reason the favorites folder could not be created.
      Throws:
      ServiceException
      RemoteException
    • getApplicationFavorites

      public FavoritesFolder getApplicationFavorites(String contextName) throws ServiceException, RemoteException
      Returns the Favorites folder for a given context. A context is typically the name of the calling application, but it can represent a shared value if multiple applications want to display the same set of favorites. The favorites folders reside in a user's Application Data folder, for example:
        /User Folders/user-name/Application Data/context-name/Favorites(FavoritesFolder)
       
      If the favorites folder does not exist, this method will attempt to create it along with its parent folders if necessary. Meaning, the method will first retrieve the user's Application Data folder, and will create it if necessary. Next, the context specific subfolder will be retrieved, or created if necessary. And finally, the Favorites favorites folder itself is retrieved, or created.
      Parameters:
      contextName - the context name to create the favorites folder under
      Returns:
      the context specific favorites folder, or null if for some reason the favorites folder could not be created.
      Throws:
      ServiceException
      RemoteException
    • getApplicationHistory

      public FavoritesFolder getApplicationHistory(String applicationName) throws ServiceException, RemoteException
      Returns the History favorites folder for a given application. History folders reside in a user's Application Data folder, for example:
        /User Folders/user-name/Application Data/application-name/History(FavoritesFolder)
       
      If the favorites folder does not exist, this method will attempt to create it along with its parent folders if necessary. Meaning, the method will first retrieve the user's Application Data folder, and will create it if necessary. Next, the application specific subfolder will be retrieved, or created if necessary. And finally, the History favorites folder itself is retrieved, or created.

      To set the number maximum number of objects contained within the history, see FavoritesContainer.setMaxCapacity(int).

      Parameters:
      applicationName - the context name to create the favorites folder under
      Returns:
      the application specific favorites folder, or null if for some reason the favorites folder could not be created.
      Throws:
      ServiceException
      RemoteException
    • contextStateChanged

      public void contextStateChanged(SessionContextStateChangedEvent event) throws RemoteException
      Description copied from interface: RemoteSessionContextStateChangedListener
      Notifies the object that its state has changed within the session context. Currently, this is when the object is removed from the session context or when the session context is destroyed. If an object added to the session context with SessionContextInterface.setAttribute(Object) implements this interface, the session context will invoke this method when the object is removed from the session context or when the session context is destroyed.
      Specified by:
      contextStateChanged in interface RemoteSessionContextStateChangedListener
      Parameters:
      event - The event that identifies the bound object, the name of the bound object, the session context, and an identifier that indicates the type of state change that occurred.
      Throws:
      RemoteException - If a network anomaly is encountered.