com.atlassian.jira.issue.fields.config.persistence
Class FieldConfigSchemePersisterImpl

java.lang.Object
  extended by com.atlassian.jira.issue.fields.config.persistence.FieldConfigSchemePersisterImpl
All Implemented Interfaces:
FieldConfigSchemePersister
Direct Known Subclasses:
CachedFieldConfigSchemePersister

public class FieldConfigSchemePersisterImpl
extends Object
implements FieldConfigSchemePersister


Field Summary
static String ENTITY_CONFIG_ID
           
static String ENTITY_DESCRIPTION
           
static String ENTITY_FIELD
           
static String ENTITY_ID
           
static String ENTITY_ISSUE_TYPE
           
static String ENTITY_NAME
           
static String ENTITY_RELATED_TABLE_NAME
           
static String ENTITY_SCHEME_ID
           
static String ENTITY_TABLE_NAME
           
static String FK_RELATED_CONFIGS
           
 
Constructor Summary
FieldConfigSchemePersisterImpl(OfBizDelegator delegator, ConstantsManager constantsManager, FieldConfigPersister fieldConfigPersister, FieldConfigContextPersister contextPersister)
           
 
Method Summary
 FieldConfigScheme create(FieldConfigScheme configScheme, ConfigurableField field)
           
 FieldConfigScheme createWithDefaultValues(ConfigurableField field, Map<String,FieldConfig> configs)
           
 FieldConfigScheme getConfigSchemeForFieldConfig(FieldConfig fieldConfig)
          Finds the FieldConfigScheme that contains the FieldConfig
 List<Long> getConfigSchemeIdsForCustomFieldId(String customFieldId)
          Retrieves the ids of the field config schemes for the specified customfield id.
 List<FieldConfigScheme> getConfigSchemesForCustomField(ConfigurableField field)
           
 FieldConfigScheme getFieldConfigScheme(Long configSchemeId)
           
 Collection<FieldConfigScheme> getInvalidFieldConfigSchemeAfterIssueTypeRemoval(IssueType issueType)
          Returns a collection of the FieldConfigSchemes that will be made invalid if the issueType is removed (that is the FieldConfigScheme would no longer be bound to ANY issue types).
 void init()
           
 void remove(Long fieldConfigSchemeId)
           
 void removeByIssueType(IssueType issueType)
          Removes FieldConfigScheme associations for the given issue type.
 FieldConfigScheme update(FieldConfigScheme configScheme)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENTITY_TABLE_NAME

public static final String ENTITY_TABLE_NAME
See Also:
Constant Field Values

ENTITY_ID

public static final String ENTITY_ID
See Also:
Constant Field Values

ENTITY_NAME

public static final String ENTITY_NAME
See Also:
Constant Field Values

ENTITY_DESCRIPTION

public static final String ENTITY_DESCRIPTION
See Also:
Constant Field Values

ENTITY_FIELD

public static final String ENTITY_FIELD
See Also:
Constant Field Values

ENTITY_RELATED_TABLE_NAME

public static final String ENTITY_RELATED_TABLE_NAME
See Also:
Constant Field Values

ENTITY_ISSUE_TYPE

public static final String ENTITY_ISSUE_TYPE
See Also:
Constant Field Values

ENTITY_SCHEME_ID

public static final String ENTITY_SCHEME_ID
See Also:
Constant Field Values

ENTITY_CONFIG_ID

public static final String ENTITY_CONFIG_ID
See Also:
Constant Field Values

FK_RELATED_CONFIGS

public static final String FK_RELATED_CONFIGS
See Also:
Constant Field Values
Constructor Detail

FieldConfigSchemePersisterImpl

public FieldConfigSchemePersisterImpl(OfBizDelegator delegator,
                                      ConstantsManager constantsManager,
                                      FieldConfigPersister fieldConfigPersister,
                                      FieldConfigContextPersister contextPersister)
Method Detail

create

public FieldConfigScheme create(FieldConfigScheme configScheme,
                                ConfigurableField field)
Specified by:
create in interface FieldConfigSchemePersister

createWithDefaultValues

public FieldConfigScheme createWithDefaultValues(ConfigurableField field,
                                                 Map<String,FieldConfig> configs)
Specified by:
createWithDefaultValues in interface FieldConfigSchemePersister

getInvalidFieldConfigSchemeAfterIssueTypeRemoval

public Collection<FieldConfigScheme> getInvalidFieldConfigSchemeAfterIssueTypeRemoval(IssueType issueType)
Description copied from interface: FieldConfigSchemePersister
Returns a collection of the FieldConfigSchemes that will be made invalid if the issueType is removed (that is the FieldConfigScheme would no longer be bound to ANY issue types). If there are still any other issue types that a FieldConfigScheme will be bound to after the removal then it will not be included in the collection returned.

Specified by:
getInvalidFieldConfigSchemeAfterIssueTypeRemoval in interface FieldConfigSchemePersister
Parameters:
issueType - to be removed
Returns:
A collection of FieldConfigSchemes or an empty collection.

removeByIssueType

public void removeByIssueType(IssueType issueType)
Description copied from interface: FieldConfigSchemePersister
Removes FieldConfigScheme associations for the given issue type. Please note that this method call on it's own is NOT safe. it removes rows from a many-to-many table without considering other entities in the many-to-many relationship. What this means is that if there's only one row left in the table, this method may remove it, and you'll end up with orphaned values. Only use this in conjunction with FieldConfigSchemePersister.getInvalidFieldConfigSchemeAfterIssueTypeRemoval(com.atlassian.jira.issue.issuetype.IssueType). Also see FieldConfigSchemeManagerImpl.removeInvalidFieldConfigSchemesForIssueType(com.atlassian.jira.issue.issuetype.IssueType) for correct usage.

Specified by:
removeByIssueType in interface FieldConfigSchemePersister
Parameters:
issueType - the issue type to remove the associations for

init

public void init()
Specified by:
init in interface FieldConfigSchemePersister

update

public FieldConfigScheme update(FieldConfigScheme configScheme)
Specified by:
update in interface FieldConfigSchemePersister

remove

public void remove(Long fieldConfigSchemeId)
Specified by:
remove in interface FieldConfigSchemePersister

getFieldConfigScheme

public FieldConfigScheme getFieldConfigScheme(Long configSchemeId)
Specified by:
getFieldConfigScheme in interface FieldConfigSchemePersister

getConfigSchemesForCustomField

public List<FieldConfigScheme> getConfigSchemesForCustomField(ConfigurableField field)
Specified by:
getConfigSchemesForCustomField in interface FieldConfigSchemePersister

getConfigSchemeForFieldConfig

public FieldConfigScheme getConfigSchemeForFieldConfig(FieldConfig fieldConfig)
Description copied from interface: FieldConfigSchemePersister
Finds the FieldConfigScheme that contains the FieldConfig

Specified by:
getConfigSchemeForFieldConfig in interface FieldConfigSchemePersister
Parameters:
fieldConfig - the config to find the containing FieldConfigScheme of; cannot be null.
Returns:
the first scheme that contains the FieldConfig. Not Null.

getConfigSchemeIdsForCustomFieldId

public List<Long> getConfigSchemeIdsForCustomFieldId(String customFieldId)
Description copied from interface: FieldConfigSchemePersister
Retrieves the ids of the field config schemes for the specified customfield id. This method should be used when full FieldConfigScheme domain objects are not required, for example when removing them from the system.

Specified by:
getConfigSchemeIdsForCustomFieldId in interface FieldConfigSchemePersister
Parameters:
customFieldId - the id of the customfield
Returns:
a list of ids of the FieldConfigScheme objects associated with this customfield. Should not be null.


Copyright © 2002-2012 Atlassian. All Rights Reserved.