public class MockFieldLayoutManager extends Object implements FieldLayoutManager
MockFieldLayoutManager
.TYPE_DEFAULT
Constructor and Description |
---|
MockFieldLayoutManager() |
Modifier and Type | Method and Description |
---|---|
MockFieldLayout |
addLayoutItem(Issue issue) |
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. |
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 fieldConfigurationId)
Persists a new
FieldLayoutSchemeEntity for a particular FieldLayoutScheme . |
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.
|
EditableDefaultFieldLayout |
getEditableDefaultFieldLayout()
Returns the default
EditableDefaultFieldLayout . |
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()
Used to retrieve
FieldLayout information when rendering a screen. |
FieldLayout |
getFieldLayout(org.ofbiz.core.entity.GenericValue issue)
Returns the fieldLayout for an issue.
|
FieldLayout |
getFieldLayout(Issue 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 |
hasDefaultFieldLayout()
Checks to see if a
FieldLayout entity with type FieldLayoutManager.TYPE_DEFAULT exists |
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 |
refresh()
Clears all local caches.
|
void |
removeFieldLayoutScheme(FieldLayoutScheme fieldLayoutScheme) |
void |
removeFieldLayoutSchemeEntity(FieldLayoutSchemeEntity fieldLayoutSchemeEntity)
Removes a
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 |
restoreDefaultFieldLayout()
This method can be used to rollback any changes to the default field configuration.
|
MockFieldLayoutManager |
setFieldConfigurationScheme(Long id,
FieldConfigurationScheme fieldConfigurationScheme) |
MockFieldLayoutManager |
setFieldConfigurationScheme(Project project,
FieldConfigurationScheme fieldConfigurationScheme) |
MockFieldLayoutManager |
setFieldLayout(Long id,
FieldLayout fieldLayout) |
MockFieldLayoutManager |
setFieldLayout(Project project,
String issueTypeId,
FieldLayout fieldLayout) |
MockFieldLayoutManager |
setFieldLayoutSchemes(List<FieldLayoutScheme> fieldLayoutSchemes) |
EditableFieldLayout |
storeAndReturnEditableFieldLayout(EditableFieldLayout editableFieldLayout)
Persists the
EditableFieldLayout provided and returns a new instance as stored
in the database. |
void |
storeEditableDefaultFieldLayout(EditableDefaultFieldLayout editableDefaultFieldLayout)
Persist the given default
EditableDefaultFieldLayout |
void |
storeEditableFieldLayout(EditableFieldLayout editableFieldLayout)
Persists the
EditableFieldLayout provided. |
String |
toString() |
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 . |
public MockFieldLayout addLayoutItem(Issue issue)
public 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 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 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 List<FieldLayoutScheme> getFieldLayoutSchemes()
FieldLayoutManager
getFieldLayoutSchemes
in interface FieldLayoutManager
FieldLayoutScheme
s.public MockFieldLayoutManager setFieldLayoutSchemes(List<FieldLayoutScheme> fieldLayoutSchemes)
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 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 MockFieldLayoutManager setFieldConfigurationScheme(Project project, FieldConfigurationScheme fieldConfigurationScheme)
public MockFieldLayoutManager setFieldConfigurationScheme(Long id, FieldConfigurationScheme fieldConfigurationScheme)
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 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 removeSchemeAssociation(org.ofbiz.core.entity.GenericValue project, Long fieldLayoutSchemeId)
FieldLayoutManager
removeSchemeAssociation
in interface FieldLayoutManager
project
- A project GenericValue
fieldLayoutSchemeId
- The fieldLayoutScheme IDpublic 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(Project project, Long fieldLayoutSchemeId)
FieldLayoutManager
removeSchemeAssociation
in interface FieldLayoutManager
project
- The projectfieldLayoutSchemeId
- The fieldLayoutScheme IDpublic FieldLayout getFieldLayout()
FieldLayoutManager
FieldLayout
information when rendering a screen.getFieldLayout
in interface FieldLayoutManager
public 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 MockFieldLayoutManager setFieldLayout(Long id, FieldLayout fieldLayout)
public FieldLayout getFieldLayout(org.ofbiz.core.entity.GenericValue issue)
FieldLayoutManager
getFieldLayout
in interface FieldLayoutManager
issue
- An issue GenericValue
FieldLayout
public FieldLayout getFieldLayout(Issue issue)
FieldLayoutManager
getFieldLayout
in interface FieldLayoutManager
issue
- An Issue
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 MockFieldLayoutManager setFieldLayout(Project project, String issueTypeId, FieldLayout fieldLayout)
public EditableDefaultFieldLayout getEditableDefaultFieldLayout()
FieldLayoutManager
EditableDefaultFieldLayout
.getEditableDefaultFieldLayout
in interface FieldLayoutManager
EditableDefaultFieldLayout
.public void storeEditableDefaultFieldLayout(EditableDefaultFieldLayout editableDefaultFieldLayout)
FieldLayoutManager
EditableDefaultFieldLayout
storeEditableDefaultFieldLayout
in interface FieldLayoutManager
editableDefaultFieldLayout
- The EditableDefaultFieldLayout.public void storeEditableFieldLayout(EditableFieldLayout editableFieldLayout)
FieldLayoutManager
EditableFieldLayout
provided.storeEditableFieldLayout
in interface FieldLayoutManager
editableFieldLayout
- the EditableFieldLayout.public EditableFieldLayout storeAndReturnEditableFieldLayout(EditableFieldLayout editableFieldLayout)
FieldLayoutManager
EditableFieldLayout
provided and returns a new instance as stored
in the database.storeAndReturnEditableFieldLayout
in interface FieldLayoutManager
editableFieldLayout
- the EditableFieldLayout.public void restoreDefaultFieldLayout()
FieldLayoutManager
restoreDefaultFieldLayout
in interface FieldLayoutManager
public boolean hasDefaultFieldLayout()
FieldLayoutManager
FieldLayout
entity with type FieldLayoutManager.TYPE_DEFAULT
existshasDefaultFieldLayout
in interface FieldLayoutManager
FieldLayout
exists, false otherwise.public 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 void refresh()
FieldLayoutManager
refresh
in interface FieldLayoutManager
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 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 FieldLayoutSchemeEntity createFieldLayoutSchemeEntity(FieldLayoutScheme fieldLayoutScheme, String issueTypeId, Long fieldConfigurationId)
FieldLayoutManager
FieldLayoutSchemeEntity
for a particular FieldLayoutScheme
.
The appropriate scheme is retrieved using FieldLayoutSchemeEntity.getFieldLayoutScheme()
createFieldLayoutSchemeEntity
in interface FieldLayoutManager
fieldLayoutScheme
- the FieldLayoutSchemeissueTypeId
- the Issue TypefieldConfigurationId
- the FieldConfigpublic void updateFieldLayoutSchemeEntity(FieldLayoutSchemeEntity fieldLayoutSchemeEntity)
FieldLayoutManager
FieldLayoutSchemeEntity
.updateFieldLayoutSchemeEntity
in interface FieldLayoutManager
fieldLayoutSchemeEntity
- The FieldLayoutSchemeEntitypublic 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> 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 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(CustomField customField, 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-2019 Atlassian. All Rights Reserved.