@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
.
Modifier and Type | Class and Description |
---|---|
static class |
ViewSettings.AssociatedView
AssociatedView is a record of a view association within ViewSettings . |
static class |
ViewSettings.Builder
View settings builder allows to construct instances of
ViewSettings and serialize them
into JSON format. |
Modifier and Type | Field and Description |
---|---|
static Set<StructurePage> |
ALL_PAGES |
static ViewSettings |
EMPTY_SETTINGS |
static Set<StructurePage> |
NO_PAGES |
static Set<StructurePage> |
PAGES_WITH_DEFAULT_VIEW |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
List<ViewSettings.AssociatedView> |
getAssociatedViews() |
Long |
getDefaultViewForPage(StructurePage page)
Retrieves a default view ID for a given page.
|
int |
hashCode() |
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.
|
boolean |
isDefined() |
String |
toString() |
public static final Set<StructurePage> NO_PAGES
public static final Set<StructurePage> ALL_PAGES
public static final Set<StructurePage> PAGES_WITH_DEFAULT_VIEW
public static final ViewSettings EMPTY_SETTINGS
public boolean isDefined()
true
if the view settings are defined, false
means "use default settings"@NotNull public List<ViewSettings.AssociatedView> getAssociatedViews()
@Nullable public Long getDefaultViewForPage(StructurePage page)
page
- structure page for which default is neededpublic boolean hasView(Long viewId)
viewId
- the ID of the viewCopyright © 2024 Tempo Software. All Rights Reserved.