com.atlassian.jira.config.managedconfiguration
Interface ManagedConfigurationItemService

All Known Implementing Classes:
DefaultManagedConfigurationItemService

@PublicApi
public interface ManagedConfigurationItemService

This provides an API for plugin developers and for JIRA internally to restrict the administration of certain configuration items. Often, a plugin developer will want to configure JIRA programmatically and rely on that configuration being unchanged. Using this API, the developer can register their desired items as "managed" or "locked" configuration items. This will prevent administrators from changing the configuration and invalidating the plugin's needs.

There are a few different states a ManagedConfigurationItem can be in. These are determined by the properties ManagedConfigurationItem.isManaged() and ManagedConfigurationItem.getConfigurationItemAccessLevel():

For a list of which JIRA configuration items can be managed, see ManagedConfigurationItemType.

Each configuration item can only have one ManagedConfigurationItem describing it.

Since:
v5.2
See Also:
ManagedConfigurationItem, ManagedConfigurationItemBuilder, ManagedConfigurationItemType, ConfigurationItemAccessLevel

Field Summary
static String SOURCE_PREFIX_PLUGIN
          Denotes the prefix used in the ManagedConfigurationItem.getSourceId() field when items are managed by a plugin.
 
Method Summary
 boolean doesUserHavePermission(com.atlassian.crowd.embedded.api.User user, ConfigurationItemAccessLevel configurationItemAccessLevel)
          Determine if the specified User would have permission to edit an ManagedConfigurationItem with the specified level.
 boolean doesUserHavePermission(com.atlassian.crowd.embedded.api.User user, ManagedConfigurationItem item)
          Determine if the specified User would have permission to edit the ManagedConfigurationItem.
 Collection<ManagedConfigurationItem> getManagedConfigurationItems(ManagedConfigurationItemType type)
          Retrieves all of the ManagedConfigurationItems of the specified type which are currently "available" (meaning their owner is currently available).
 ManagedConfigurationItem getManagedCustomField(CustomField customField)
          Given the CustomField, attempt to retrieve the ManagedConfigurationItem that describes it.
 ManagedConfigurationItem getManagedWorkflow(JiraWorkflow workflow)
          Given the JiraWorkflow, attempt to retrieve the ManagedConfigurationItem that describes it.
 ManagedConfigurationItem getManagedWorkflowScheme(Long schemeId)
          Given the workflow scheme ID, attempt to retrieve the ManagedConfigurationItem that describes it.
 ManagedConfigurationItem getManagedWorkflowScheme(WorkflowScheme workflowScheme)
          Given the WorkflowScheme, attempt to retrieve the ManagedConfigurationItem that describes it.
 ServiceOutcome<Void> removeManagedConfigurationItem(ManagedConfigurationItem item)
          Remove the registration of this ManagedConfigurationItem.
 ServiceOutcome<ManagedConfigurationItem> updateManagedConfigurationItem(ManagedConfigurationItem item)
          Update the registration of this ManagedConfigurationItem.
 

Field Detail

SOURCE_PREFIX_PLUGIN

static final String SOURCE_PREFIX_PLUGIN
Denotes the prefix used in the ManagedConfigurationItem.getSourceId() field when items are managed by a plugin.

See Also:
Constant Field Values
Method Detail

getManagedCustomField

@Nonnull
ManagedConfigurationItem getManagedCustomField(@Nonnull
                                                       CustomField customField)
Given the CustomField, attempt to retrieve the ManagedConfigurationItem that describes it. If it does not exist, a default implementation will be returned.

If the manager of this item is no longer available (e.g. if a plugin manages a JIRA custom field and the plugin is disabled) then the item can not be considered managed.

Parameters:
customField - the custom field
Returns:
the item's representation

getManagedWorkflow

@Nonnull
ManagedConfigurationItem getManagedWorkflow(@Nonnull
                                                    JiraWorkflow workflow)
Given the JiraWorkflow, attempt to retrieve the ManagedConfigurationItem that describes it. If it does not exist, a default implementation will be returned.

If the manager of this item is no longer available (e.g. if a plugin manages a workflow and the plugin is disabled) then the item can not be considered managed.

Parameters:
workflow - the workflow
Returns:
the item's representation

getManagedWorkflowScheme

@Nonnull
ManagedConfigurationItem getManagedWorkflowScheme(@Nonnull
                                                          WorkflowScheme workflowScheme)
Given the WorkflowScheme, attempt to retrieve the ManagedConfigurationItem that describes it. If it does not exist, a default implementation will be returned.

If the manager of this item is no longer available (e.g. if a plugin manages a workflow scheme and the plugin is disabled) then the item can not be considered managed.

Parameters:
workflowScheme - the workflow scheme
Returns:
the item's representation
See Also:
getManagedWorkflowScheme(Long)

getManagedWorkflowScheme

@Nonnull
ManagedConfigurationItem getManagedWorkflowScheme(@Nonnull
                                                          Long schemeId)
Given the workflow scheme ID, attempt to retrieve the ManagedConfigurationItem that describes it. If it does not exist, a default implementation will be returned.

If the manager of this item is no longer available (e.g. if a plugin manages a workflow scheme and the plugin is disabled) then the item can not be considered managed.

Parameters:
schemeId - the workflow scheme ID
Returns:
the item's representation
See Also:
getManagedWorkflowScheme(WorkflowScheme)

updateManagedConfigurationItem

@Nonnull
ServiceOutcome<ManagedConfigurationItem> updateManagedConfigurationItem(@Nonnull
                                                                                ManagedConfigurationItem item)
Update the registration of this ManagedConfigurationItem. If the item was not previously managed, it will now be managed.

Parameters:
item - the item to manage
Returns:
the result; errors if saving the item failed

removeManagedConfigurationItem

@Nonnull
ServiceOutcome<Void> removeManagedConfigurationItem(@Nonnull
                                                            ManagedConfigurationItem item)
Remove the registration of this ManagedConfigurationItem. If the item was not previously managed, an error will be returned.

Parameters:
item - the item to stop managing
Returns:
the result; errors if saving the item failed

getManagedConfigurationItems

@Nonnull
Collection<ManagedConfigurationItem> getManagedConfigurationItems(@Nonnull
                                                                          ManagedConfigurationItemType type)
Retrieves all of the ManagedConfigurationItems of the specified type which are currently "available" (meaning their owner is currently available).

Parameters:
type - the type to retrieve
Returns:
the items

doesUserHavePermission

boolean doesUserHavePermission(com.atlassian.crowd.embedded.api.User user,
                               @Nonnull
                               ManagedConfigurationItem item)
Determine if the specified User would have permission to edit the ManagedConfigurationItem.

Parameters:
user - the user
item - the item
Returns:
the result

doesUserHavePermission

boolean doesUserHavePermission(com.atlassian.crowd.embedded.api.User user,
                               @Nonnull
                               ConfigurationItemAccessLevel configurationItemAccessLevel)
Determine if the specified User would have permission to edit an ManagedConfigurationItem with the specified level.

Parameters:
user - the user
configurationItemAccessLevel - the level
Returns:
the result


Copyright © 2002-2014 Atlassian. All Rights Reserved.