com.atlassian.jira.issue.fields
Class DefaultFieldManager

java.lang.Object
  extended by com.atlassian.jira.issue.fields.DefaultFieldManager
All Implemented Interfaces:
Startable, FieldAccessor, FieldManager

public class DefaultFieldManager
extends Object
implements FieldManager, Startable


Field Summary
 
Fields inherited from interface com.atlassian.jira.issue.fields.FieldManager
CUSTOM_FIELD_PREFIX
 
Constructor Summary
DefaultFieldManager(com.atlassian.event.api.EventPublisher eventPublisher)
           
 
Method Summary
 Set<NavigableField> getAllAvailableNavigableFields()
          Returns a set of Fields that are NOT hidden in AT LEAST ONE project in the system.
 Set<SearchableField> getAllSearchableFields()
          Return all the searchable fields in the system.
 Set<CustomField> getAvailableCustomFields(com.atlassian.crowd.embedded.api.User remoteUser, Issue issue)
          Retrieves custom fields in scope for the given issue
 Set<NavigableField> getAvailableNavigableFields(com.atlassian.crowd.embedded.api.User remoteUser)
          Returns a set of Fields that are NOT hidden in AT LEAST ONE project that the remote user can see (has Permissions.BROWSE permission for).
 Set<NavigableField> getAvailableNavigableFieldsWithScope(com.atlassian.crowd.embedded.api.User user)
          Gets all the available fields that the user can see, this is providing no context scope.
 Set<NavigableField> getAvailableNavigableFieldsWithScope(com.atlassian.crowd.embedded.api.User remoteUser, QueryContext queryContext)
          Gets all the available fields within the defined scope of the QueryContext.
 ColumnLayoutManager getColumnLayoutManager()
          Deprecated. Declare your dependency and let PicoContainer resolve it instead
 ConfigurableField getConfigurableField(String id)
           
 CustomField getCustomField(String key)
          Get a CustomField by its text key (eg 'customfield_10000').
 Field getField(String id)
          Get a field by its id.
 FieldLayoutManager getFieldLayoutManager()
          Deprecated. Declare your dependency and let PicoContainer resolve it instead
 HideableField getHideableField(String id)
           
 IssueTypeField getIssueTypeField()
          Retrieve the IssueType system Field.
 NavigableField getNavigableField(String id)
           
 Set<NavigableField> getNavigableFields()
           
 OrderableField getOrderableField(String id)
           
 Set<OrderableField> getOrderableFields()
           
 ProjectField getProjectField()
          Retrieve the Project system Field.
 RequirableField getRequiredField(String id)
           
 Set<SearchableField> getSystemSearchableFields()
          Return all the searchable systems fields.
 Set<Field> getUnavailableFields()
           
 boolean isCustomField(Field field)
           
 boolean isCustomField(String key)
           
 boolean isFieldHidden(com.atlassian.crowd.embedded.api.User remoteUser, Field field)
           
 boolean isFieldHidden(com.atlassian.crowd.embedded.api.User remoteUser, String fieldId)
          Determines whether the field with id of fieldId is NOT hidden in AT LEAST one FieldLayout that the user can see (assigned to projects for which the user has the Permissions.BROWSE permission).
 boolean isHideableField(Field field)
           
 boolean isHideableField(String id)
           
 boolean isMandatoryField(Field field)
           
 boolean isMandatoryField(String id)
           
 boolean isNavigableField(Field field)
           
 boolean isNavigableField(String id)
           
 boolean isOrderableField(Field field)
           
 boolean isOrderableField(String id)
           
 boolean isRenderableField(Field field)
           
 boolean isRenderableField(String id)
           
 boolean isRequirableField(Field field)
           
 boolean isRequirableField(String id)
           
protected  boolean isSubTasksOn()
           
 boolean isTimeTrackingOn()
           
 boolean isUnscreenableField(Field field)
           
 boolean isUnscreenableField(String id)
           
protected  boolean isVotingOn()
           
protected  boolean isWatchingOn()
           
 void onClearCache(ClearCacheEvent event)
           
 void refresh()
           
 void start()
          This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFieldManager

public DefaultFieldManager(com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail

start

public void start()
           throws Exception
Description copied from interface: Startable
This method wil be called after the plugin system is fully initialised and all components added to the dependency injection framework.

Specified by:
start in interface Startable
Throws:
Exception - Allows implementations to throw an Exception.

onClearCache

@EventListener
public void onClearCache(ClearCacheEvent event)

getField

public Field getField(String id)
Description copied from interface: FieldManager
Get a field by its id.

Specified by:
getField in interface FieldAccessor
Specified by:
getField in interface FieldManager
Parameters:
id - An IssueFieldConstants constant, or custom field key (eg. "customfield_10010")
Returns:
the Field

getAllAvailableNavigableFields

public Set<NavigableField> getAllAvailableNavigableFields()
                                                   throws FieldException
Returns a set of Fields that are NOT hidden in AT LEAST ONE project in the system.

NOTE: This method is used in the Admin interface, as admins should be able to configure the default ColumnLayouts irrespective of their permissions. They should be able to see all fields that are not hidden in at least one FieldLayout in the system

Specified by:
getAllAvailableNavigableFields in interface FieldAccessor
Specified by:
getAllAvailableNavigableFields in interface FieldManager
Throws:
FieldException - if cannot retrieve the projects the user can see, or if cannot retrieve the field layouts for the viewable projects

getAvailableNavigableFields

public Set<NavigableField> getAvailableNavigableFields(com.atlassian.crowd.embedded.api.User remoteUser)
                                                throws FieldException
Returns a set of Fields that are NOT hidden in AT LEAST ONE project that the remote user can see (has Permissions.BROWSE permission for).

The returned set of fields contains all custom fields that are not hidden in AT LEAST one FieldLayout that the user can see.

NOTE: This method is primarily used for configuring user's ColumnLayout, as the user should be able to add any field (including custom field) to it that they can see in the system. THe scope of custom fields is ignored here as the user configures the ColumnLayout outside of scope.

Specified by:
getAvailableNavigableFields in interface FieldAccessor
Specified by:
getAvailableNavigableFields in interface FieldManager
Parameters:
remoteUser - the remote user
Throws:
FieldException - if cannot retrieve the projects the user can see, or if cannot retrieve the field layouts for the viewable projects

getAllSearchableFields

public Set<SearchableField> getAllSearchableFields()
Description copied from interface: FieldManager
Return all the searchable fields in the system. This set will included all defined custom fields.

Specified by:
getAllSearchableFields in interface FieldAccessor
Specified by:
getAllSearchableFields in interface FieldManager
Returns:
the set of all searchable fields in the system.

getSystemSearchableFields

public Set<SearchableField> getSystemSearchableFields()
Description copied from interface: FieldManager
Return all the searchable systems fields. This set will *NOT* include defined custom fields.

Specified by:
getSystemSearchableFields in interface FieldAccessor
Specified by:
getSystemSearchableFields in interface FieldManager
Returns:
the set of all searchable systems fields defined.

getIssueTypeField

public IssueTypeField getIssueTypeField()
Description copied from interface: FieldManager
Retrieve the IssueType system Field.

Specified by:
getIssueTypeField in interface FieldAccessor
Specified by:
getIssueTypeField in interface FieldManager
Returns:
the IssueType system Field.

getProjectField

public ProjectField getProjectField()
Description copied from interface: FieldManager
Retrieve the Project system Field.

Specified by:
getProjectField in interface FieldAccessor
Specified by:
getProjectField in interface FieldManager
Returns:
the Project system Field.

getAvailableNavigableFieldsWithScope

public Set<NavigableField> getAvailableNavigableFieldsWithScope(com.atlassian.crowd.embedded.api.User user)
                                                         throws FieldException
Description copied from interface: FieldManager
Gets all the available fields that the user can see, this is providing no context scope.

Specified by:
getAvailableNavigableFieldsWithScope in interface FieldAccessor
Specified by:
getAvailableNavigableFieldsWithScope in interface FieldManager
Parameters:
user - the remote user.
Returns:
a set of NavigableFields that can be show because their visibility/configuration fall within what the user can see.
Throws:
FieldException - thrown if there is a problem looking up the fields

getAvailableNavigableFieldsWithScope

public Set<NavigableField> getAvailableNavigableFieldsWithScope(com.atlassian.crowd.embedded.api.User remoteUser,
                                                                QueryContext queryContext)
                                                         throws FieldException
Description copied from interface: FieldManager
Gets all the available fields within the defined scope of the QueryContext.

Specified by:
getAvailableNavigableFieldsWithScope in interface FieldAccessor
Specified by:
getAvailableNavigableFieldsWithScope in interface FieldManager
Parameters:
remoteUser - the user making the request
queryContext - the context of the search request.
Returns:
a set of NavigableFields that can be show because their visibility/configuration fall within the specified context
Throws:
FieldException - thrown if there is a problem looking up the fields

getAvailableCustomFields

public Set<CustomField> getAvailableCustomFields(com.atlassian.crowd.embedded.api.User remoteUser,
                                                 Issue issue)
                                          throws FieldException
Description copied from interface: FieldManager
Retrieves custom fields in scope for the given issue

Specified by:
getAvailableCustomFields in interface FieldAccessor
Specified by:
getAvailableCustomFields in interface FieldManager
Parameters:
remoteUser - Remote User
issue - Issue
Returns:
custom fields in scope for the given issue
Throws:
FieldException - if cannot retrieve the projects the user can see, or if cannot retrieve the field layouts for the viewable projects

isFieldHidden

public boolean isFieldHidden(com.atlassian.crowd.embedded.api.User remoteUser,
                             String fieldId)
Description copied from interface: FieldManager
Determines whether the field with id of fieldId is NOT hidden in AT LEAST one FieldLayout that the user can see (assigned to projects for which the user has the Permissions.BROWSE permission).

Specified by:
isFieldHidden in interface FieldAccessor
Specified by:
isFieldHidden in interface FieldManager
Parameters:
remoteUser - the remote user.
fieldId - The Field ID
Returns:
true if this field is hidden from the given user

isFieldHidden

public boolean isFieldHidden(com.atlassian.crowd.embedded.api.User remoteUser,
                             Field field)
Specified by:
isFieldHidden in interface FieldAccessor
Specified by:
isFieldHidden in interface FieldManager

isCustomField

public boolean isCustomField(String key)
Specified by:
isCustomField in interface FieldAccessor
Specified by:
isCustomField in interface FieldManager

isCustomField

public boolean isCustomField(Field field)
Specified by:
isCustomField in interface FieldAccessor
Specified by:
isCustomField in interface FieldManager

getCustomField

public CustomField getCustomField(String key)
Description copied from interface: FieldManager
Get a CustomField by its text key (eg 'customfield_10000').

Specified by:
getCustomField in interface FieldAccessor
Specified by:
getCustomField in interface FieldManager
Parameters:
key - Eg. 'customfield_10000'
Returns:
The CustomField or null if not found.

isHideableField

public boolean isHideableField(String id)
Specified by:
isHideableField in interface FieldAccessor
Specified by:
isHideableField in interface FieldManager

isHideableField

public boolean isHideableField(Field field)
Specified by:
isHideableField in interface FieldAccessor
Specified by:
isHideableField in interface FieldManager

getHideableField

public HideableField getHideableField(String id)
Specified by:
getHideableField in interface FieldAccessor
Specified by:
getHideableField in interface FieldManager

isOrderableField

public boolean isOrderableField(String id)
Specified by:
isOrderableField in interface FieldAccessor
Specified by:
isOrderableField in interface FieldManager

isOrderableField

public boolean isOrderableField(Field field)
Specified by:
isOrderableField in interface FieldAccessor
Specified by:
isOrderableField in interface FieldManager

getOrderableField

public OrderableField getOrderableField(String id)
Specified by:
getOrderableField in interface FieldAccessor
Specified by:
getOrderableField in interface FieldManager

getConfigurableField

public ConfigurableField getConfigurableField(String id)
Specified by:
getConfigurableField in interface FieldAccessor
Specified by:
getConfigurableField in interface FieldManager

getOrderableFields

public Set<OrderableField> getOrderableFields()
Specified by:
getOrderableFields in interface FieldAccessor
Specified by:
getOrderableFields in interface FieldManager

getNavigableFields

public Set<NavigableField> getNavigableFields()
Specified by:
getNavigableFields in interface FieldAccessor
Specified by:
getNavigableFields in interface FieldManager

isNavigableField

public boolean isNavigableField(String id)
Specified by:
isNavigableField in interface FieldAccessor
Specified by:
isNavigableField in interface FieldManager

isNavigableField

public boolean isNavigableField(Field field)
Specified by:
isNavigableField in interface FieldAccessor
Specified by:
isNavigableField in interface FieldManager

getNavigableField

public NavigableField getNavigableField(String id)
Specified by:
getNavigableField in interface FieldAccessor
Specified by:
getNavigableField in interface FieldManager

isRequirableField

public boolean isRequirableField(String id)
Specified by:
isRequirableField in interface FieldAccessor
Specified by:
isRequirableField in interface FieldManager

isRequirableField

public boolean isRequirableField(Field field)
Specified by:
isRequirableField in interface FieldAccessor
Specified by:
isRequirableField in interface FieldManager

isMandatoryField

public boolean isMandatoryField(String id)
Specified by:
isMandatoryField in interface FieldAccessor
Specified by:
isMandatoryField in interface FieldManager

isMandatoryField

public boolean isMandatoryField(Field field)
Specified by:
isMandatoryField in interface FieldAccessor
Specified by:
isMandatoryField in interface FieldManager

isRenderableField

public boolean isRenderableField(String id)
Specified by:
isRenderableField in interface FieldAccessor
Specified by:
isRenderableField in interface FieldManager

isRenderableField

public boolean isRenderableField(Field field)
Specified by:
isRenderableField in interface FieldAccessor
Specified by:
isRenderableField in interface FieldManager

isUnscreenableField

public boolean isUnscreenableField(String id)
Specified by:
isUnscreenableField in interface FieldAccessor
Specified by:
isUnscreenableField in interface FieldManager

isUnscreenableField

public boolean isUnscreenableField(Field field)
Specified by:
isUnscreenableField in interface FieldAccessor
Specified by:
isUnscreenableField in interface FieldManager

getRequiredField

public RequirableField getRequiredField(String id)
Specified by:
getRequiredField in interface FieldAccessor
Specified by:
getRequiredField in interface FieldManager

getFieldLayoutManager

@Deprecated
public FieldLayoutManager getFieldLayoutManager()
Deprecated. Declare your dependency and let PicoContainer resolve it instead

Specified by:
getFieldLayoutManager in interface FieldManager
Returns:
FieldLayoutManager

getColumnLayoutManager

@Deprecated
public ColumnLayoutManager getColumnLayoutManager()
Deprecated. Declare your dependency and let PicoContainer resolve it instead

Specified by:
getColumnLayoutManager in interface FieldManager
Returns:
ColumnLayoutManager

refresh

public void refresh()
Specified by:
refresh in interface FieldManager

isTimeTrackingOn

public boolean isTimeTrackingOn()
Specified by:
isTimeTrackingOn in interface FieldAccessor
Specified by:
isTimeTrackingOn in interface FieldManager

isVotingOn

protected boolean isVotingOn()

isWatchingOn

protected boolean isWatchingOn()

isSubTasksOn

protected boolean isSubTasksOn()

getUnavailableFields

public Set<Field> getUnavailableFields()
Specified by:
getUnavailableFields in interface FieldAccessor
Specified by:
getUnavailableFields in interface FieldManager


Copyright © 2002-2012 Atlassian. All Rights Reserved.