Class ViewSettings
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAssociatedViewis a record of a view association withinViewSettings.static classView settings builder allows to construct instances ofViewSettingsand serialize them into JSON format. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Set<StructurePage>static final ViewSettingsstatic final Set<StructurePage>static final Set<StructurePage> -
Method Summary
Modifier and TypeMethodDescriptionbooleanRetrieves a default view ID for a given page.inthashCode()booleanChecks 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.booleantoString()
-
Field Details
-
NO_PAGES
-
ALL_PAGES
-
PAGES_WITH_DEFAULT_VIEW
-
EMPTY_SETTINGS
-
-
Method Details
-
isDefined
public boolean isDefined()- Returns:
trueif the view settings are defined,falsemeans "use default settings"
-
getAssociatedViews
- Returns:
- a list of associated views, or an empty list if settings are not defined
-
getDefaultViewForPage
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
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
-
equals
-
hashCode
public int hashCode()
-