com.atlassian.greenhopper.model.rapid
Class StatisticsFieldInstance

java.lang.Object
  extended by com.atlassian.greenhopper.model.rapid.StatisticsFieldInstance
All Implemented Interfaces:
StatisticsField

public class StatisticsFieldInstance
extends java.lang.Object
implements StatisticsField

Represents an instance of a StatisticsFieldConfig for a RapidView. This should be used when "resolving" the configuration of the Statistics Field in a request which requires real knowledge of how that configuration works at run-time. Specifically, if a StatisticsFieldConfig has type StatisticsFieldConfig.Type.JIRA_FIELD, the configuration will only tell you the ID of the field used, but this object will allow you to resolve the proper name of that configuration, provided that the field is still around at this point.

See Also:
StatisticsFieldService, StatisticsFieldConfig

Method Summary
static StatisticsFieldInstance forJiraField(StatisticsFieldConfig config, com.atlassian.jira.issue.fields.Field field)
           
static StatisticsFieldInstance forJiraFieldWithName(StatisticsFieldConfig config, com.atlassian.jira.issue.fields.Field field, java.lang.String nameKey)
           
static StatisticsFieldInstance forJiraFieldWithNameWithDocumentId(StatisticsFieldConfig config, com.atlassian.jira.issue.fields.Field field, java.lang.String nameKey, java.lang.String documentId)
           
static StatisticsFieldInstance forNonField(StatisticsFieldConfig config, java.lang.String nameKey)
           
 StatisticsFieldConfig getConfig()
          Returns the configuration associated with this instance.
 java.lang.String getDisplayName(I18n2 i18n)
          Get the display name of this instance
 java.lang.String getDocumentId()
          Note: behaviour is only determined for this method when StatisticsField.isValid() is true.
 com.atlassian.jira.issue.fields.Field getField()
          Returns the field that the configuration refers to, if it is still available at this time.
 java.lang.String getName(I18n2 i18n)
           
 boolean isEnabled()
          Note: this method cannot return true if StatisticsField.isValid() is false.
 boolean isFieldBased()
           
 boolean isValid()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

forNonField

public static StatisticsFieldInstance forNonField(StatisticsFieldConfig config,
                                                  java.lang.String nameKey)

forJiraField

public static StatisticsFieldInstance forJiraField(StatisticsFieldConfig config,
                                                   com.atlassian.jira.issue.fields.Field field)

forJiraFieldWithName

public static StatisticsFieldInstance forJiraFieldWithName(StatisticsFieldConfig config,
                                                           com.atlassian.jira.issue.fields.Field field,
                                                           java.lang.String nameKey)

forJiraFieldWithNameWithDocumentId

public static StatisticsFieldInstance forJiraFieldWithNameWithDocumentId(StatisticsFieldConfig config,
                                                                         com.atlassian.jira.issue.fields.Field field,
                                                                         java.lang.String nameKey,
                                                                         java.lang.String documentId)

getConfig

public StatisticsFieldConfig getConfig()
Description copied from interface: StatisticsField
Returns the configuration associated with this instance.

Specified by:
getConfig in interface StatisticsField
Returns:
the config; never null.

getDisplayName

public java.lang.String getDisplayName(I18n2 i18n)
Description copied from interface: StatisticsField
Get the display name of this instance

Specified by:
getDisplayName in interface StatisticsField
Parameters:
i18n - the i18n bean
Returns:
the name; possibly blank

isFieldBased

public boolean isFieldBased()
Specified by:
isFieldBased in interface StatisticsField
Returns:
Does this statistic field use a field

getName

public java.lang.String getName(I18n2 i18n)

getField

public com.atlassian.jira.issue.fields.Field getField()
Description copied from interface: StatisticsField
Returns the field that the configuration refers to, if it is still available at this time.

Specified by:
getField in interface StatisticsField
Returns:
the field; null if there is no field for the configuration or it is not available.

isValid

public boolean isValid()
Specified by:
isValid in interface StatisticsField
Returns:
does this instance refer to a valid configuration?

isEnabled

public boolean isEnabled()
Description copied from interface: StatisticsField
Note: this method cannot return true if StatisticsField.isValid() is false.

Specified by:
isEnabled in interface StatisticsField
Returns:
does this configuration refer to a Statistic for which there is "work to be done".

getDocumentId

public java.lang.String getDocumentId()
Description copied from interface: StatisticsField
Note: behaviour is only determined for this method when StatisticsField.isValid() is true.

Specified by:
getDocumentId in interface StatisticsField
Returns:
the ID by which this field is referred to in Lucene documents.


Copyright © 2007-2013 Atlassian. All Rights Reserved.