Package com.orchestranetworks.ui.perspective

# Class PerspectiveHandler

java.lang.Object
com.orchestranetworks.ui.perspective.PerspectiveHandler

public final class PerspectiveHandler extends Object
An instance of this class offers methods to retrieve the perspectives defined in the current repository.

Since:
  6.0.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<Perspective>`
  `getActivatedPerspectives()`
  Returns all activated perspectives.
  `Perspective`
  `getAdvancedPerspective()`
  Returns the advanced perspective.
  `List<Perspective>`
  `getAllPerspectives()`
  Returns a list of all defined perspectives.
  `Perspective`
  `getCurrentPerspective(boolean lookupInParentSession)`
  Returns the perspective applied in the current session, or recursively in parent if lookupInParentSession is true.
  `Perspective`
  `getFavoritePerspective(UserReference aUser)`
  Returns the favorite perspective for a given user.
  `Perspective`
  `getPerspective(String aPerspectiveName)`
  Returns the perspective for the given name.
  `List<Perspective>`
  `getPerspectives(Profile aProfile)`
  Returns all activated and allowed perspectives for a given profile.
  `Perspective`
  `getPerspectiveToApply(UserReference aUser)`
  Returns the perspective to apply.
  `Perspective`
  `getRecommendedPerspective(UserReference aUser)`
  Returns the recommended perspective for a given user.
  `static PerspectiveHandler`
  `newInstance(Repository repository, Session aSession)`
  Returns a new instance of the perspective handler.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### newInstance

    public static PerspectiveHandler newInstance(Repository repository, Session aSession)
    Returns a new instance of the perspective handler.

  - ### getAllPerspectives

    public List<Perspective> getAllPerspectives()
    Returns a list of all defined perspectives.
    - If session's locale exists, the list will be sorted by localized label.
    - If session's locale is null, returns a non-sorted list.

  - ### getActivatedPerspectives

    public List<Perspective> getActivatedPerspectives()
    Returns all activated perspectives.

  - ### getPerspectives

    public List<Perspective> getPerspectives(Profile aProfile)
    Returns all activated and allowed perspectives for a given profile.
    Parameters:
      `aProfile` - identifies a user profile.

  - ### getRecommendedPerspective

    public Perspective getRecommendedPerspective(UserReference aUser)
    Returns the recommended perspective for a given user. Returns `null` if:
    - The user has no recommended perspective.
    - The recommended perspective is disabled for the user.
    - The recommended perspective is not allowed for the user's profile.
    Parameters:
      `aUser` - identifies a specific user.

  - ### getFavoritePerspective

    public Perspective getFavoritePerspective(UserReference aUser)
    Returns the favorite perspective for a given user. Returns `null` if:
    - The user has no favorite perspective.
    - the user's favorite perspective is disabled.
    - the user's favorite perspective is not allowed for their profile.
    Parameters:
      `aUser` - identifies a specific user.

  - ### getPerspectiveToApply

    public Perspective getPerspectiveToApply(UserReference aUser)
    Returns the perspective to apply.
    - Returns the favorite perspective for a given user.
    - If the user has no favorite perspective, returns the recommended perspective.
    - If there is no recommended perspective for a given user, returns the first available perspective for the given user.
    Parameters:
      `aUser` - identifies a specific user.
    See Also:
      - `getRecommendedPerspective(UserReference)`
      - `getFavoritePerspective(UserReference)`
      - `getPerspectives(Profile)`

  - ### getAdvancedPerspective

    public Perspective getAdvancedPerspective()
    Returns the advanced perspective.

  - ### getPerspective

    public Perspective getPerspective(String aPerspectiveName)
    Returns the perspective for the given name. Returns `null` if no perspective is found.

  - ### getCurrentPerspective

    public Perspective getCurrentPerspective(boolean lookupInParentSession)
    Returns the perspective applied in the current session, or recursively in parent if lookupInParentSession is true.
    - If the current session is the root session, always returns a perspective. As a last resort, the advanced perspective may be returned even if the user is not allowed to access it.
    - If the current session is a sub session and lookupInParentSession is true, always returns a perspective. As a last resort, the advanced perspective may be returned even if the user is not allowed to access it.
    - If the current session is a sub-session and `lookupInParentSession` is false, may return `null`.