Package com.atlassian.bamboo.variable
Class VariableDefinitionManagerImpl
- java.lang.Object
-
- com.atlassian.bamboo.variable.VariableDefinitionManagerImpl
-
- All Implemented Interfaces:
VariableDefinitionAccessor
,VariableDefinitionManager
public class VariableDefinitionManagerImpl extends Object implements VariableDefinitionManager
On the fly encoding/decoding. All the decoding methods will return objects not attached to Hibernate session.
-
-
Constructor Summary
Constructors Constructor Description VariableDefinitionManagerImpl(VariableDefinitionDao variableDefinitionDao, AuditLogService auditLogService, EncryptedVariableDefinitionAccessor encryptedVariableDefinitionAccessor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull Long
countAllProjectsVariables()
Count all project variables.int
countDeploymentEnvironmentVariables(long environmentId)
Count list of environment variables associated with a given deployment environment@NotNull VariableContextBuilder
createVariableContextBuilder()
void
deleteVariableDefinition(@NotNull VariableDefinition variableDefinition)
Delete variable definitionvoid
deleteVariablesForPlan(@NotNull Plan plan)
Removes variable definitions form specified plan@NotNull List<Long>
findAllProjectsIdsUsingProjectVariables()
Get list of all project variables@Nullable VariableDefinition
findVariableDefinition(long id)
Find variable definition of specified id@NotNull List<VariableDefinition>
getDeploymentEnvironmentVariables(long environmentId)
Get list of environment variables associated with a given deployment environment@NotNull List<VariableDefinition>
getDeploymentVersionVariables(long deploymentVersionId)
Get list of environment variables associated with a given deployment version@NotNull List<VariableDefinition>
getGlobalNotOverriddenEnvironmentVariables(long environmentId)
@NotNull List<VariableDefinition>
getGlobalNotOverriddenVariables(@org.jetbrains.annotations.NotNull long projectId)
Get list of all global variables that are not overridden by project variables for a given project@NotNull List<VariableDefinition>
getGlobalNotOverriddenVariables(@NotNull PlanIdentifier plan)
Get list of all global variables that are not overridden by plan or project variables for a given plan@Nullable VariableDefinition
getGlobalVariableByKey(String key)
Retrieves a specific global variable by key.@NotNull List<VariableDefinition>
getGlobalVariables()
Get list of all global variables@NotNull List<VariableDefinition>
getInheritedNotOverriddenVariables(@NotNull PlanIdentifier plan)
Get list of all variables that are inherited by plan, that is all global, project and (in case of branches) default plan variables that are not overridden by a plan or plan branch.@NotNull List<VariableDefinition>
getInheritedVariables(@NotNull PlanIdentifier plan)
Get list of all variables that are inherited by plan, that is all global, project and (in case of branches) default plan variables.@Nullable VariableDefinition
getPlanVariableByKey(@NotNull PlanIdentifier plan, @NotNull String key)
Retrieves a specific variable for the plan with the given key@NotNull List<VariableDefinition>
getPlanVariables(@NotNull PlanIdentifier plan)
Get list of plan variables associated with a given plan@NotNull List<VariableDefinition>
getProjectVariables(long projectId)
Get list of environment variables associated with a given project@NotNull Map<String,String>
getSimpleVariableMapByType(@NotNull VariableContext variableContext, @NotNull VariableType variableType)
Filter variable context by variable type and return as simple key/value mapvoid
remove(VariableDefinition variableDefinition)
void
save(VariableDefinition variableDefinition)
void
saveVariableDefinition(@NotNull VariableDefinition variableDefinition)
Save variable definitionvoid
saveVariableDefinition(@NotNull VariableDefinition variableDefinition, @Nullable String previousValue)
Save variable definitionvoid
saveVariableDefinitions(List<VariableDefinition> variableDefinitions)
Save all variable definitions on the list
-
-
-
Constructor Detail
-
VariableDefinitionManagerImpl
public VariableDefinitionManagerImpl(VariableDefinitionDao variableDefinitionDao, AuditLogService auditLogService, EncryptedVariableDefinitionAccessor encryptedVariableDefinitionAccessor)
-
-
Method Detail
-
findVariableDefinition
@Nullable public @Nullable VariableDefinition findVariableDefinition(long id)
Description copied from interface:VariableDefinitionAccessor
Find variable definition of specified id- Specified by:
findVariableDefinition
in interfaceVariableDefinitionAccessor
- Parameters:
id
- id of variable definition- Returns:
- variable definition of specified id or null if not found
-
saveVariableDefinition
public void saveVariableDefinition(@NotNull @NotNull VariableDefinition variableDefinition)
Description copied from interface:VariableDefinitionManager
Save variable definition- Specified by:
saveVariableDefinition
in interfaceVariableDefinitionManager
- Parameters:
variableDefinition
- variable definition to be saved
-
saveVariableDefinition
public void saveVariableDefinition(@NotNull @NotNull VariableDefinition variableDefinition, @Nullable @Nullable String previousValue)
Description copied from interface:VariableDefinitionManager
Save variable definition- Specified by:
saveVariableDefinition
in interfaceVariableDefinitionManager
- Parameters:
variableDefinition
- variable definition to be savedpreviousValue
- previous variable value
-
deleteVariableDefinition
public void deleteVariableDefinition(@NotNull @NotNull VariableDefinition variableDefinition)
Description copied from interface:VariableDefinitionManager
Delete variable definition- Specified by:
deleteVariableDefinition
in interfaceVariableDefinitionManager
- Parameters:
variableDefinition
- variable definition to be deleted
-
deleteVariablesForPlan
public void deleteVariablesForPlan(@NotNull @NotNull Plan plan)
Description copied from interface:VariableDefinitionManager
Removes variable definitions form specified plan- Specified by:
deleteVariablesForPlan
in interfaceVariableDefinitionManager
-
getGlobalVariables
@NotNull public @NotNull List<VariableDefinition> getGlobalVariables()
Description copied from interface:VariableDefinitionAccessor
Get list of all global variables- Specified by:
getGlobalVariables
in interfaceVariableDefinitionAccessor
- Returns:
- sorted list of all global variables
-
getGlobalVariableByKey
@Nullable public @Nullable VariableDefinition getGlobalVariableByKey(String key)
Description copied from interface:VariableDefinitionAccessor
Retrieves a specific global variable by key.- Specified by:
getGlobalVariableByKey
in interfaceVariableDefinitionAccessor
- Parameters:
key
- of the variable- Returns:
- global variable with specified key or null if none found.
-
getPlanVariableByKey
@Nullable public @Nullable VariableDefinition getPlanVariableByKey(@NotNull @NotNull PlanIdentifier plan, @NotNull @NotNull String key)
Description copied from interface:VariableDefinitionAccessor
Retrieves a specific variable for the plan with the given key- Specified by:
getPlanVariableByKey
in interfaceVariableDefinitionAccessor
- Parameters:
plan
- variable belongs tokey
- of variable- Returns:
- plan variable with specified key or null if none found.
-
getPlanVariables
@NotNull public @NotNull List<VariableDefinition> getPlanVariables(@NotNull @NotNull PlanIdentifier plan)
Description copied from interface:VariableDefinitionAccessor
Get list of plan variables associated with a given plan- Specified by:
getPlanVariables
in interfaceVariableDefinitionAccessor
- Parameters:
plan
- Plan whose associated variables should be returned- Returns:
- sorted list of plan variables
-
getProjectVariables
@NotNull public @NotNull List<VariableDefinition> getProjectVariables(long projectId)
Description copied from interface:VariableDefinitionAccessor
Get list of environment variables associated with a given project- Specified by:
getProjectVariables
in interfaceVariableDefinitionAccessor
- Parameters:
projectId
- id of a Project- Returns:
- sorted list of variables
-
findAllProjectsIdsUsingProjectVariables
@NotNull public @NotNull List<Long> findAllProjectsIdsUsingProjectVariables()
Description copied from interface:VariableDefinitionAccessor
Get list of all project variables- Specified by:
findAllProjectsIdsUsingProjectVariables
in interfaceVariableDefinitionAccessor
- Returns:
- sorted list of all project variables
-
countAllProjectsVariables
@NotNull public @NotNull Long countAllProjectsVariables()
Description copied from interface:VariableDefinitionAccessor
Count all project variables.- Specified by:
countAllProjectsVariables
in interfaceVariableDefinitionAccessor
- Returns:
- Long count of project variables.
-
countDeploymentEnvironmentVariables
public int countDeploymentEnvironmentVariables(long environmentId)
Description copied from interface:VariableDefinitionAccessor
Count list of environment variables associated with a given deployment environment- Specified by:
countDeploymentEnvironmentVariables
in interfaceVariableDefinitionAccessor
- Parameters:
environmentId
- id of Deployment environment- Returns:
-
getDeploymentEnvironmentVariables
@NotNull public @NotNull List<VariableDefinition> getDeploymentEnvironmentVariables(long environmentId)
Description copied from interface:VariableDefinitionAccessor
Get list of environment variables associated with a given deployment environment- Specified by:
getDeploymentEnvironmentVariables
in interfaceVariableDefinitionAccessor
- Parameters:
environmentId
- id of Deployment environment- Returns:
- sorted list of variables
-
getDeploymentVersionVariables
@NotNull public @NotNull List<VariableDefinition> getDeploymentVersionVariables(long deploymentVersionId)
Description copied from interface:VariableDefinitionAccessor
Get list of environment variables associated with a given deployment version- Specified by:
getDeploymentVersionVariables
in interfaceVariableDefinitionAccessor
- Parameters:
deploymentVersionId
- id of Deployment environment- Returns:
- sorted list of variables
-
getGlobalNotOverriddenVariables
@NotNull public @NotNull List<VariableDefinition> getGlobalNotOverriddenVariables(@NotNull @NotNull PlanIdentifier plan)
Description copied from interface:VariableDefinitionAccessor
Get list of all global variables that are not overridden by plan or project variables for a given plan- Specified by:
getGlobalNotOverriddenVariables
in interfaceVariableDefinitionAccessor
- Parameters:
plan
- Plan whose associated variables should be used- Returns:
- sorted list of global only variables
-
getInheritedVariables
@NotNull public @NotNull List<VariableDefinition> getInheritedVariables(@NotNull @NotNull PlanIdentifier plan)
Description copied from interface:VariableDefinitionAccessor
Get list of all variables that are inherited by plan, that is all global, project and (in case of branches) default plan variables.- Specified by:
getInheritedVariables
in interfaceVariableDefinitionAccessor
- Returns:
- sorted list of global and project variables
-
getInheritedNotOverriddenVariables
@NotNull public @NotNull List<VariableDefinition> getInheritedNotOverriddenVariables(@NotNull @NotNull PlanIdentifier plan)
Description copied from interface:VariableDefinitionAccessor
Get list of all variables that are inherited by plan, that is all global, project and (in case of branches) default plan variables that are not overridden by a plan or plan branch.- Specified by:
getInheritedNotOverriddenVariables
in interfaceVariableDefinitionAccessor
- Returns:
- sorted list of global and project variables
-
getGlobalNotOverriddenVariables
@NotNull public @NotNull List<VariableDefinition> getGlobalNotOverriddenVariables(@NotNull @org.jetbrains.annotations.NotNull long projectId)
Description copied from interface:VariableDefinitionAccessor
Get list of all global variables that are not overridden by project variables for a given project- Specified by:
getGlobalNotOverriddenVariables
in interfaceVariableDefinitionAccessor
- Parameters:
projectId
- id of a project- Returns:
- sorted list of global only variables
-
getGlobalNotOverriddenEnvironmentVariables
@NotNull public @NotNull List<VariableDefinition> getGlobalNotOverriddenEnvironmentVariables(long environmentId)
- Specified by:
getGlobalNotOverriddenEnvironmentVariables
in interfaceVariableDefinitionAccessor
-
getSimpleVariableMapByType
@NotNull public @NotNull Map<String,String> getSimpleVariableMapByType(@NotNull @NotNull VariableContext variableContext, @NotNull @NotNull VariableType variableType)
Description copied from interface:VariableDefinitionAccessor
Filter variable context by variable type and return as simple key/value map- Specified by:
getSimpleVariableMapByType
in interfaceVariableDefinitionAccessor
- Returns:
-
createVariableContextBuilder
@NotNull public @NotNull VariableContextBuilder createVariableContextBuilder()
- Specified by:
createVariableContextBuilder
in interfaceVariableDefinitionManager
-
remove
public void remove(VariableDefinition variableDefinition)
-
save
public void save(VariableDefinition variableDefinition)
-
saveVariableDefinitions
public void saveVariableDefinitions(List<VariableDefinition> variableDefinitions)
Description copied from interface:VariableDefinitionManager
Save all variable definitions on the list- Specified by:
saveVariableDefinitions
in interfaceVariableDefinitionManager
-
-