public class DefaultFieldLayoutManager extends AbstractFieldLayoutManager implements FieldLayoutManager
DESCRIPTION, FIELD_LAYOUT, fieldManager, i18nFactory, NAME, ofBizDelegator, SCHEME, SCHEME_ASSOCIATION, TYPE
TYPE_DEFAULT
Constructor and Description |
---|
DefaultFieldLayoutManager(FieldManager fieldManager,
OfBizDelegator ofBizDelegator,
ConstantsManager constantsManager,
SubTaskManager subTaskManager,
ProjectManager projectManager,
I18nHelper.BeanFactory i18nFactory,
NodeAssociationStore nodeAssociationStore,
com.atlassian.cache.CacheManager cacheManager,
com.atlassian.event.api.EventPublisher eventPublisher,
ApplicationProperties applicationProperties,
QueryDslAccessor queryDslAccessor) |
Modifier and Type | Method and Description |
---|---|
void |
addSchemeAssociation(org.ofbiz.core.entity.GenericValue project,
Long fieldLayoutSchemeId)
Associates a
FieldLayoutScheme to the project supplied. |
void |
addSchemeAssociation(Project project,
Long fieldLayoutSchemeId)
Associates a
FieldLayoutScheme to the project supplied. |
protected void |
clearCaches() |
FieldLayoutScheme |
copyFieldLayoutScheme(FieldLayoutScheme scheme,
String name,
String description)
Copies an existing field layout to a new one.
|
FieldLayoutScheme |
createFieldLayoutScheme(FieldLayoutScheme fieldLayoutScheme)
Persists a new field Layout scheme (i.e Field Configuration Scheme).
|
FieldLayoutScheme |
createFieldLayoutScheme(String name,
String description)
Persists a new field Layout scheme (i.e Field Configuration Scheme).
|
void |
createFieldLayoutSchemeEntity(FieldLayoutSchemeEntity fieldLayoutSchemeEntity)
Persists a new
FieldLayoutSchemeEntity for a particular FieldLayoutScheme . |
FieldLayoutSchemeEntity |
createFieldLayoutSchemeEntity(FieldLayoutScheme fieldLayoutScheme,
String issueTypeId,
Long fieldLayoutId)
Persists a new
FieldLayoutSchemeEntity for a particular FieldLayoutScheme . |
protected FieldLayoutSchemeEntity |
createFieldLayoutSchemeEntityNoEvent(FieldLayoutScheme fieldLayoutScheme,
String issueTypeId,
Long fieldLayoutId) |
void |
deleteFieldLayout(FieldLayout fieldLayout)
Deletes a custom
FieldLayout |
void |
deleteFieldLayoutScheme(FieldLayoutScheme fieldLayoutScheme)
Removes the
FieldLayoutScheme supplied. |
boolean |
fieldConfigurationSchemeExists(String schemeName)
Checks if a FieldConfigurationScheme with the given name exists.
|
protected List<String> |
getAllRelevantIssueTypeIds() |
EditableFieldLayout |
getEditableFieldLayout(Long id)
Returns an
EditableFieldLayout for the id supplied. |
List<EditableFieldLayout> |
getEditableFieldLayouts()
Retrieves editable (see
EditableFieldLayout versions of the field layouts. |
FieldConfigurationScheme |
getFieldConfigurationScheme(Long schemeId)
Retrieves a
FieldConfigurationScheme by id |
FieldConfigurationScheme |
getFieldConfigurationScheme(Project project)
Retrieves the Field Configuration Scheme associated with the supplied project.
|
FieldConfigurationScheme |
getFieldConfigurationSchemeForProject(Long projectId)
Retrieves the Field Configuration Scheme associated with the supplied project.
|
Collection<FieldConfigurationScheme> |
getFieldConfigurationSchemes(FieldLayout fieldLayout)
Returns a collection of
FieldConfigurationScheme s that include the given FieldLayout . |
FieldLayout |
getFieldLayout(org.ofbiz.core.entity.GenericValue issue)
Returns the fieldLayout for an issue.
|
FieldLayout |
getFieldLayout(Long id)
Used to retrieve
FieldLayout information when rendering a screen given the id
of the field layout. |
FieldLayout |
getFieldLayout(Long projectId,
String issueTypeId)
Find the FieldLayout for the given Project and IssueType.
|
FieldLayout |
getFieldLayout(Project project,
String issueTypeId) |
Collection<FieldLayoutSchemeEntity> |
getFieldLayoutSchemeEntities(FieldLayoutScheme fieldLayoutScheme)
Returns a collection of
FieldLayoutSchemeEntity s. |
List<FieldLayoutScheme> |
getFieldLayoutSchemes()
Retries Field Configuration Schemes.
|
FieldLayoutScheme |
getMutableFieldLayoutScheme(Long schemeId)
Retrieves a mutable
FieldLayoutScheme by id. |
Collection<org.ofbiz.core.entity.GenericValue> |
getProjects(FieldConfigurationScheme fieldConfigurationScheme)
Returns all projects that use the given FieldConfigurationScheme.
|
Collection<org.ofbiz.core.entity.GenericValue> |
getProjects(FieldLayoutScheme fieldLayoutScheme)
Returns all associated projects for the
FieldLayoutScheme supplied. |
Collection<Project> |
getProjectsUsing(FieldConfigurationScheme fieldConfigurationScheme)
Returns all projects that use the given FieldConfigurationScheme.
|
Collection<Project> |
getProjectsUsing(FieldLayout fieldLayout)
Finds all projects that use the given
FieldLayout (via the configured FieldConfigurationScheme ). |
Collection<Project> |
getProjectsUsing(FieldLayoutScheme fieldLayoutScheme)
Returns all projects that use the given FieldLayoutScheme.
|
Collection<org.ofbiz.core.entity.GenericValue> |
getRelatedProjects(FieldLayout fieldLayout)
Finds all projects that use the given
FieldLayout (via the configured FieldConfigurationScheme ). |
Set<FieldLayout> |
getUniqueFieldLayouts(Collection<Project> projects,
Collection<String> issueTypeIds)
Retrieves all the
FieldLayout 's for a collection of projects and issue types. |
Set<FieldLayout> |
getUniqueFieldLayouts(Project project)
Retrieves all the
FieldLayout 's for a project. |
boolean |
isFieldLayoutSchemesVisiblyEquivalent(Long fieldConfigurationSchemeId1,
Long fieldConfigurationSchemeId2)
Will determine whether or not two
FieldLayoutScheme s are
"visibly equivalent". |
boolean |
isFieldLayoutsVisiblyEquivalent(Long fieldLayoutId1,
Long fieldLayoutId2)
Will determine whether or not two
FieldLayout s are
"visibly equivalent". |
void |
onClearCache(ClearCacheEvent event) |
void |
refresh()
Clears all local caches.
|
void |
removeFieldLayoutScheme(FieldLayoutScheme fieldLayoutScheme) |
void |
removeFieldLayoutSchemeEntity(FieldLayoutSchemeEntity fieldLayoutSchemeEntity)
Removes a
FieldLayoutSchemeEntity |
protected void |
removeFieldLayoutSchemeEntityNoEvent(FieldLayoutSchemeEntity fieldLayoutSchemeEntity) |
void |
removeSchemeAssociation(org.ofbiz.core.entity.GenericValue project,
Long fieldLayoutSchemeId)
Removes an association between a particular project and field configuration scheme.
|
void |
removeSchemeAssociation(Project project,
Long fieldLayoutSchemeId)
Removes an association between a particular project and field configuration scheme.
|
void |
updateFieldLayoutItemAttributesForCustomField(CustomField customField,
String description,
boolean isRequired,
boolean isHidden)
Update the
description , isHidden and isRequired columns of all the
fieldlayoutitem rows associated with this custom field. |
void |
updateFieldLayoutScheme(FieldLayoutScheme fieldLayoutScheme)
Persists the
FieldLayoutScheme supplied. |
void |
updateFieldLayoutSchemeEntity(FieldLayoutSchemeEntity fieldLayoutSchemeEntity)
Updates a
FieldLayoutSchemeEntity . |
getDefaultDescription, getDefaultFieldLayoutItems, getEditableDefaultFieldLayout, getFieldLayout, getFieldLayout, getI18nHelper, getRelevantFieldLayout, hasDefaultFieldLayout, onCustomFieldUpdated, refreshCaches, refreshCacheWhenUpdateAllowUnassignedOption, restoreDefaultFieldLayout, restoreFieldLayout, storeAndReturnEditableFieldLayout, storeEditableDefaultFieldLayout, storeEditableFieldLayout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEditableDefaultFieldLayout, getFieldLayout, getFieldLayout, hasDefaultFieldLayout, restoreDefaultFieldLayout, storeAndReturnEditableFieldLayout, storeEditableDefaultFieldLayout, storeEditableFieldLayout
public DefaultFieldLayoutManager(FieldManager fieldManager, OfBizDelegator ofBizDelegator, ConstantsManager constantsManager, SubTaskManager subTaskManager, ProjectManager projectManager, I18nHelper.BeanFactory i18nFactory, NodeAssociationStore nodeAssociationStore, com.atlassian.cache.CacheManager cacheManager, com.atlassian.event.api.EventPublisher eventPublisher, ApplicationProperties applicationProperties, QueryDslAccessor queryDslAccessor)
@EventListener public void onClearCache(ClearCacheEvent event)
public FieldLayout getFieldLayout(org.ofbiz.core.entity.GenericValue issue)
FieldLayoutManager
getFieldLayout
in interface FieldLayoutManager
issue
- An issue GenericValue
FieldLayout
public FieldLayout getFieldLayout(Project project, String issueTypeId)
getFieldLayout
in interface FieldLayoutManager
project
- A projectissueTypeId
- The IssueType id of the issue.FieldLayout
FieldLayoutManager.getFieldLayout(Issue)
public FieldLayout getFieldLayout(@Nonnull Long projectId, @Nonnull String issueTypeId)
FieldLayoutManager
getFieldLayout
in interface FieldLayoutManager
projectId
- the projectissueTypeId
- the issue typepublic List<FieldLayoutScheme> getFieldLayoutSchemes()
FieldLayoutManager
getFieldLayoutSchemes
in interface FieldLayoutManager
FieldLayoutScheme
s.public Collection<org.ofbiz.core.entity.GenericValue> getRelatedProjects(FieldLayout fieldLayout)
FieldLayoutManager
FieldLayout
(via the configured FieldConfigurationScheme
).
NOTE: In the case of Standard & Professional, this simply returns ALL projects, as the only fieldlayout is the default field layout.
getRelatedProjects
in interface FieldLayoutManager
fieldLayout
- The FieldLayout.public Collection<Project> getProjectsUsing(FieldLayout fieldLayout)
FieldLayoutManager
FieldLayout
(via the configured FieldConfigurationScheme
).
NOTE: In the case of Standard & Professional, this simply returns ALL projects, as the only fieldlayout is the default field layout.
getProjectsUsing
in interface FieldLayoutManager
fieldLayout
- The FieldLayout.public List<EditableFieldLayout> getEditableFieldLayouts()
FieldLayoutManager
EditableFieldLayout
versions of the field layouts.
Note: For standard edition this simply returns an editable version of the default field
layout. (see EditableDefaultFieldLayout
)getEditableFieldLayouts
in interface FieldLayoutManager
EditableFieldLayout
and EditableDefaultFieldLayout
public EditableFieldLayout getEditableFieldLayout(Long id)
FieldLayoutManager
EditableFieldLayout
for the id supplied.getEditableFieldLayout
in interface FieldLayoutManager
id
- If the id is NULL, the default layout is returned.EditableFieldLayout
public void updateFieldLayoutScheme(FieldLayoutScheme fieldLayoutScheme)
FieldLayoutManager
FieldLayoutScheme
supplied.updateFieldLayoutScheme
in interface FieldLayoutManager
fieldLayoutScheme
- The FieldLayoutSchemepublic void deleteFieldLayoutScheme(FieldLayoutScheme fieldLayoutScheme)
FieldLayoutManager
FieldLayoutScheme
supplied.deleteFieldLayoutScheme
in interface FieldLayoutManager
fieldLayoutScheme
- The FieldLayoutSchemepublic void deleteFieldLayout(FieldLayout fieldLayout)
FieldLayoutManager
FieldLayout
deleteFieldLayout
in interface FieldLayoutManager
fieldLayout
- The FieldLayoutpublic Collection<FieldLayoutSchemeEntity> getFieldLayoutSchemeEntities(FieldLayoutScheme fieldLayoutScheme)
FieldLayoutManager
FieldLayoutSchemeEntity
s. These are used to
record mappings from IssueType
-> FieldLayout
for the FieldLayoutScheme
passed in.getFieldLayoutSchemeEntities
in interface FieldLayoutManager
fieldLayoutScheme
- The FieldLayoutSchemeFieldLayoutSchemeEntity
s.public void createFieldLayoutSchemeEntity(FieldLayoutSchemeEntity fieldLayoutSchemeEntity)
FieldLayoutManager
FieldLayoutSchemeEntity
for a particular FieldLayoutScheme
.
The appropriate scheme is retrieved using FieldLayoutSchemeEntity.getFieldLayoutScheme()
createFieldLayoutSchemeEntity
in interface FieldLayoutManager
fieldLayoutSchemeEntity
- The FieldLayoutSchemeEntitypublic void updateFieldLayoutSchemeEntity(FieldLayoutSchemeEntity fieldLayoutSchemeEntity)
FieldLayoutManager
FieldLayoutSchemeEntity
.updateFieldLayoutSchemeEntity
in interface FieldLayoutManager
fieldLayoutSchemeEntity
- The FieldLayoutSchemeEntityprotected void removeFieldLayoutSchemeEntityNoEvent(FieldLayoutSchemeEntity fieldLayoutSchemeEntity)
public void removeFieldLayoutSchemeEntity(FieldLayoutSchemeEntity fieldLayoutSchemeEntity)
FieldLayoutManager
FieldLayoutSchemeEntity
removeFieldLayoutSchemeEntity
in interface FieldLayoutManager
fieldLayoutSchemeEntity
- The FieldLayoutSchemeEntitypublic void removeFieldLayoutScheme(FieldLayoutScheme fieldLayoutScheme)
removeFieldLayoutScheme
in interface FieldLayoutManager
fieldLayoutScheme
- The FieldLayoutSchemepublic Collection<FieldConfigurationScheme> getFieldConfigurationSchemes(FieldLayout fieldLayout)
FieldLayoutManager
FieldConfigurationScheme
s that include the given FieldLayout
.
This is determined by retrieving all FieldLayoutSchemeEntity
s with the FieldLayout
and
calculating a set of FieldConfigurationScheme
s using these entities.
getFieldConfigurationSchemes
in interface FieldLayoutManager
fieldLayout
- The FieldLayout.FieldConfigurationScheme
spublic Collection<org.ofbiz.core.entity.GenericValue> getProjects(FieldConfigurationScheme fieldConfigurationScheme)
FieldLayoutManager
getProjects
in interface FieldLayoutManager
fieldConfigurationScheme
- the FieldConfigurationSchemepublic Collection<Project> getProjectsUsing(FieldConfigurationScheme fieldConfigurationScheme)
FieldLayoutManager
getProjectsUsing
in interface FieldLayoutManager
fieldConfigurationScheme
- the FieldConfigurationSchemepublic Collection<org.ofbiz.core.entity.GenericValue> getProjects(FieldLayoutScheme fieldLayoutScheme)
FieldLayoutManager
FieldLayoutScheme
supplied.getProjects
in interface FieldLayoutManager
fieldLayoutScheme
- the FieldLayoutSchemeGenericValue
spublic Collection<Project> getProjectsUsing(FieldLayoutScheme fieldLayoutScheme)
FieldLayoutManager
getProjectsUsing
in interface FieldLayoutManager
fieldLayoutScheme
- the FieldLayoutSchemepublic FieldLayoutScheme createFieldLayoutScheme(FieldLayoutScheme fieldLayoutScheme)
FieldLayoutManager
createFieldLayoutScheme
in interface FieldLayoutManager
fieldLayoutScheme
- The FieldLayoutScheme
to persist.FieldLayoutScheme
objectpublic FieldLayoutScheme createFieldLayoutScheme(@Nonnull String name, @Nullable String description)
FieldLayoutManager
createFieldLayoutScheme
in interface FieldLayoutManager
public FieldLayoutSchemeEntity createFieldLayoutSchemeEntity(@Nonnull FieldLayoutScheme fieldLayoutScheme, @Nullable String issueTypeId, @Nullable Long fieldLayoutId)
FieldLayoutManager
FieldLayoutSchemeEntity
for a particular FieldLayoutScheme
.
The appropriate scheme is retrieved using FieldLayoutSchemeEntity.getFieldLayoutScheme()
createFieldLayoutSchemeEntity
in interface FieldLayoutManager
fieldLayoutScheme
- the FieldLayoutSchemeissueTypeId
- the Issue TypefieldLayoutId
- the FieldConfigprotected FieldLayoutSchemeEntity createFieldLayoutSchemeEntityNoEvent(@Nonnull FieldLayoutScheme fieldLayoutScheme, @Nullable String issueTypeId, @Nullable Long fieldLayoutId)
public FieldLayoutScheme copyFieldLayoutScheme(@Nonnull FieldLayoutScheme scheme, @Nonnull String name, @Nullable String description)
FieldLayoutManager
copyFieldLayoutScheme
in interface FieldLayoutManager
public FieldConfigurationScheme getFieldConfigurationScheme(Long schemeId)
FieldLayoutManager
FieldConfigurationScheme
by idgetFieldConfigurationScheme
in interface FieldLayoutManager
schemeId
- FieldConfigurationScheme IDFieldConfigurationScheme
instancepublic FieldLayoutScheme getMutableFieldLayoutScheme(Long schemeId)
FieldLayoutManager
FieldLayoutScheme
by id.
This returns a new copy of the object from the DB, and so will incur some performance penalty.
Please use FieldLayoutManager.getFieldConfigurationScheme(Long)
for access to a cached immutable scheme object.
getMutableFieldLayoutScheme
in interface FieldLayoutManager
schemeId
- the scheme IDFieldLayoutScheme
instancepublic boolean fieldConfigurationSchemeExists(String schemeName)
FieldLayoutManager
fieldConfigurationSchemeExists
in interface FieldLayoutManager
schemeName
- The scheme nametrue
if a FieldConfigurationScheme with the given name exists.public Set<FieldLayout> getUniqueFieldLayouts(Project project)
FieldLayoutManager
FieldLayout
's for a project.getUniqueFieldLayouts
in interface FieldLayoutManager
project
- a project@Nonnull public Set<FieldLayout> getUniqueFieldLayouts(@Nonnull Collection<Project> projects, @Nonnull Collection<String> issueTypeIds)
FieldLayoutManager
FieldLayout
's for a collection of projects and issue types.getUniqueFieldLayouts
in interface FieldLayoutManager
projects
- a collection of projects.issueTypeIds
- An collection of issue type ids.public FieldConfigurationScheme getFieldConfigurationScheme(Project project)
FieldLayoutManager
getFieldConfigurationScheme
in interface FieldLayoutManager
project
- A projectFieldConfigurationScheme
or null if none exists.public FieldConfigurationScheme getFieldConfigurationSchemeForProject(@Nonnull Long projectId)
FieldLayoutManager
getFieldConfigurationSchemeForProject
in interface FieldLayoutManager
projectId
- The project IDFieldConfigurationScheme
or null if none exists.public void addSchemeAssociation(org.ofbiz.core.entity.GenericValue project, Long fieldLayoutSchemeId)
FieldLayoutManager
FieldLayoutScheme
to the project supplied.addSchemeAssociation
in interface FieldLayoutManager
project
- A project GenericValue
fieldLayoutSchemeId
- ID of the FieldLayoutSchemepublic void addSchemeAssociation(Project project, Long fieldLayoutSchemeId)
FieldLayoutManager
FieldLayoutScheme
to the project supplied.addSchemeAssociation
in interface FieldLayoutManager
project
- The projectfieldLayoutSchemeId
- ID of the FieldLayoutSchemepublic void removeSchemeAssociation(org.ofbiz.core.entity.GenericValue project, Long fieldLayoutSchemeId)
FieldLayoutManager
removeSchemeAssociation
in interface FieldLayoutManager
project
- A project GenericValue
fieldLayoutSchemeId
- The fieldLayoutScheme IDpublic void removeSchemeAssociation(Project project, Long fieldLayoutSchemeId)
FieldLayoutManager
removeSchemeAssociation
in interface FieldLayoutManager
project
- The projectfieldLayoutSchemeId
- The fieldLayoutScheme IDpublic FieldLayout getFieldLayout(Long id)
FieldLayoutManager
FieldLayout
information when rendering a screen given the id
of the field layout. If the ID is null, the default layout is returned.getFieldLayout
in interface FieldLayoutManager
id
- The FieldLayout ID.FieldLayout
public void refresh()
FieldLayoutManager
refresh
in interface FieldLayoutManager
refresh
in class AbstractFieldLayoutManager
protected void clearCaches()
public boolean isFieldLayoutSchemesVisiblyEquivalent(Long fieldConfigurationSchemeId1, Long fieldConfigurationSchemeId2)
FieldLayoutManager
FieldLayoutScheme
s are
"visibly equivalent".
This can be useful for determining if swapping one field layout scheme for another in a project will have any affect on the visibility of fields in the project's issues. For instance, this will let us know if we need to re-index or not.
Since a scheme is a mapping from issue types to field layouts, two schemes are visibly equivalent if:
Note that equivalence is reflexive - all the associations in scheme1 must have equivalent associations in scheme2, and vice versa.
isFieldLayoutSchemesVisiblyEquivalent
in interface FieldLayoutManager
fieldConfigurationSchemeId1
- the first scheme; can use null
for the system default schemefieldConfigurationSchemeId2
- the second scheme; can use null
for the system default schemepublic boolean isFieldLayoutsVisiblyEquivalent(Long fieldLayoutId1, Long fieldLayoutId2)
FieldLayoutManager
FieldLayout
s are
"visibly equivalent".
This can be useful for determining if swapping one field layout for another in a project will have any affect on the visibility of fields in the project's issues. For instance, this will let us know if we need to re-index or not.
Two field layouts are visibly equivalent if:
isFieldLayoutsVisiblyEquivalent
in interface FieldLayoutManager
fieldLayoutId1
- the first layout id; null signifies the default field layout in the systemfieldLayoutId2
- the second layout id; null signifies the default field layout in the systempublic void updateFieldLayoutItemAttributesForCustomField(@Nonnull CustomField customField, @Nonnull String description, boolean isRequired, boolean isHidden)
FieldLayoutManager
description
, isHidden
and isRequired
columns of all the
fieldlayoutitem
rows associated with this custom field.updateFieldLayoutItemAttributesForCustomField
in interface FieldLayoutManager
customField
- a CustomField which owns the affected fieldlayoutitemsdescription
- a String containing the new descriptionisRequired
- a boolean containing the new valueisHidden
- a boolean containing the new value.Copyright © 2002-2022 Atlassian. All Rights Reserved.