Class ViewSettings

Object
ViewSettings

@PublicApi public class ViewSettings extends Object

View settings define a structure's parameters with regards to views - which views are associated with the structure and which views are default on which pages.

ViewSettings class contains a list of ViewSettings.AssociatedView records, with each record referencing a view by ID. Additionally, the record has "menu" markers, while define on which "structured" pages is the view offered to the user, and "default" markers, which define on which pages it is the default view.

View settings can be set for a specific structure with StructureViewManager.setViewSettings(java.lang.Long, com.almworks.jira.structure.api.view.ViewSettings). If per-structure view settings are not defined, then the global default view settings are in effect for that structure. Global view settings can be modified with StructureViewManager.setDefaultViewSettings(com.almworks.jira.structure.api.view.ViewSettings).

To get the current view settings for a structure, use StructureViewManager.getViewSettings(java.lang.Long). To construct a menu of views for the user, you would usually want to use StructureViewManager.getMenuItems(java.lang.Long, com.almworks.jira.structure.api.settings.StructurePage).

An instance of ViewSettings may be "undefined", which for the per-structure view settings means "use default".

Note that views are referenced in ViewSettings by view ID. It is not guaranteed that a view with that ID exists, or that it is visible to the user. So before using the information from ViewSettings, check that the view is accessible.

ViewSettings instance is immutable and thread-safe. To construct a new instance, use ViewSettings.Builder.

Author:
Igor Sereda
  • Field Details

  • Method Details

    • isDefined

      public boolean isDefined()
      Returns:
      true if the view settings are defined, false means "use default settings"
    • getAssociatedViews

      @NotNull public List<ViewSettings.AssociatedView> getAssociatedViews()
      Returns:
      a list of associated views, or an empty list if settings are not defined
    • getDefaultViewForPage

      @Nullable public Long getDefaultViewForPage(StructurePage page)
      Retrieves a default view ID for a given page. If any of the associated views has a view that is marked as the default for the specified page, the view ID is returned.
      Parameters:
      page - structure page for which default is needed
      Returns:
      default view ID, or null if the view settings do not define the default for that page
    • hasView

      public boolean hasView(Long viewId)
      Checks if the view settings contain a record for the specified view ID - that is, if the view is associated with the structure that is represented by this view settings instance.
      Parameters:
      viewId - the ID of the view
      Returns:
      true if this view settings instance includes the specified view
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object