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 LongcountAllProjectsVariables()Count all project variables.intcountDeploymentEnvironmentVariables(long environmentId)Count list of environment variables associated with a given deployment environment@NotNull VariableContextBuildercreateVariableContextBuilder()voiddeleteVariableDefinition(@NotNull VariableDefinition variableDefinition)Delete variable definitionvoiddeleteVariablesForPlan(@NotNull Plan plan)Removes variable definitions form specified plan@NotNull List<Long>findAllProjectsIdsUsingProjectVariables()Get list of all project variables@Nullable VariableDefinitionfindVariableDefinition(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 VariableDefinitiongetGlobalVariableByKey(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 VariableDefinitiongetPlanVariableByKey(@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 mapvoidremove(VariableDefinition variableDefinition)voidsave(VariableDefinition variableDefinition)voidsaveVariableDefinition(@NotNull VariableDefinition variableDefinition)Save variable definitionvoidsaveVariableDefinition(@NotNull VariableDefinition variableDefinition, @Nullable String previousValue)Save variable definitionvoidsaveVariableDefinitions(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:VariableDefinitionAccessorFind variable definition of specified id- Specified by:
findVariableDefinitionin 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:VariableDefinitionManagerSave variable definition- Specified by:
saveVariableDefinitionin interfaceVariableDefinitionManager- Parameters:
variableDefinition- variable definition to be saved
-
saveVariableDefinition
public void saveVariableDefinition(@NotNull @NotNull VariableDefinition variableDefinition, @Nullable @Nullable String previousValue)Description copied from interface:VariableDefinitionManagerSave variable definition- Specified by:
saveVariableDefinitionin interfaceVariableDefinitionManager- Parameters:
variableDefinition- variable definition to be savedpreviousValue- previous variable value
-
deleteVariableDefinition
public void deleteVariableDefinition(@NotNull @NotNull VariableDefinition variableDefinition)Description copied from interface:VariableDefinitionManagerDelete variable definition- Specified by:
deleteVariableDefinitionin interfaceVariableDefinitionManager- Parameters:
variableDefinition- variable definition to be deleted
-
deleteVariablesForPlan
public void deleteVariablesForPlan(@NotNull @NotNull Plan plan)Description copied from interface:VariableDefinitionManagerRemoves variable definitions form specified plan- Specified by:
deleteVariablesForPlanin interfaceVariableDefinitionManager
-
getGlobalVariables
@NotNull public @NotNull List<VariableDefinition> getGlobalVariables()
Description copied from interface:VariableDefinitionAccessorGet list of all global variables- Specified by:
getGlobalVariablesin interfaceVariableDefinitionAccessor- Returns:
- sorted list of all global variables
-
getGlobalVariableByKey
@Nullable public @Nullable VariableDefinition getGlobalVariableByKey(String key)
Description copied from interface:VariableDefinitionAccessorRetrieves a specific global variable by key.- Specified by:
getGlobalVariableByKeyin 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:VariableDefinitionAccessorRetrieves a specific variable for the plan with the given key- Specified by:
getPlanVariableByKeyin 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:VariableDefinitionAccessorGet list of plan variables associated with a given plan- Specified by:
getPlanVariablesin 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:VariableDefinitionAccessorGet list of environment variables associated with a given project- Specified by:
getProjectVariablesin interfaceVariableDefinitionAccessor- Parameters:
projectId- id of a Project- Returns:
- sorted list of variables
-
findAllProjectsIdsUsingProjectVariables
@NotNull public @NotNull List<Long> findAllProjectsIdsUsingProjectVariables()
Description copied from interface:VariableDefinitionAccessorGet list of all project variables- Specified by:
findAllProjectsIdsUsingProjectVariablesin interfaceVariableDefinitionAccessor- Returns:
- sorted list of all project variables
-
countAllProjectsVariables
@NotNull public @NotNull Long countAllProjectsVariables()
Description copied from interface:VariableDefinitionAccessorCount all project variables.- Specified by:
countAllProjectsVariablesin interfaceVariableDefinitionAccessor- Returns:
- Long count of project variables.
-
countDeploymentEnvironmentVariables
public int countDeploymentEnvironmentVariables(long environmentId)
Description copied from interface:VariableDefinitionAccessorCount list of environment variables associated with a given deployment environment- Specified by:
countDeploymentEnvironmentVariablesin interfaceVariableDefinitionAccessor- Parameters:
environmentId- id of Deployment environment- Returns:
-
getDeploymentEnvironmentVariables
@NotNull public @NotNull List<VariableDefinition> getDeploymentEnvironmentVariables(long environmentId)
Description copied from interface:VariableDefinitionAccessorGet list of environment variables associated with a given deployment environment- Specified by:
getDeploymentEnvironmentVariablesin 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:VariableDefinitionAccessorGet list of environment variables associated with a given deployment version- Specified by:
getDeploymentVersionVariablesin 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:VariableDefinitionAccessorGet list of all global variables that are not overridden by plan or project variables for a given plan- Specified by:
getGlobalNotOverriddenVariablesin 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:VariableDefinitionAccessorGet list of all variables that are inherited by plan, that is all global, project and (in case of branches) default plan variables.- Specified by:
getInheritedVariablesin interfaceVariableDefinitionAccessor- Returns:
- sorted list of global and project variables
-
getInheritedNotOverriddenVariables
@NotNull public @NotNull List<VariableDefinition> getInheritedNotOverriddenVariables(@NotNull @NotNull PlanIdentifier plan)
Description copied from interface:VariableDefinitionAccessorGet 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:
getInheritedNotOverriddenVariablesin 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:VariableDefinitionAccessorGet list of all global variables that are not overridden by project variables for a given project- Specified by:
getGlobalNotOverriddenVariablesin 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:
getGlobalNotOverriddenEnvironmentVariablesin interfaceVariableDefinitionAccessor
-
getSimpleVariableMapByType
@NotNull public @NotNull Map<String,String> getSimpleVariableMapByType(@NotNull @NotNull VariableContext variableContext, @NotNull @NotNull VariableType variableType)
Description copied from interface:VariableDefinitionAccessorFilter variable context by variable type and return as simple key/value map- Specified by:
getSimpleVariableMapByTypein interfaceVariableDefinitionAccessor- Returns:
-
createVariableContextBuilder
@NotNull public @NotNull VariableContextBuilder createVariableContextBuilder()
- Specified by:
createVariableContextBuilderin interfaceVariableDefinitionManager
-
remove
public void remove(VariableDefinition variableDefinition)
-
save
public void save(VariableDefinition variableDefinition)
-
saveVariableDefinitions
public void saveVariableDefinitions(List<VariableDefinition> variableDefinitions)
Description copied from interface:VariableDefinitionManagerSave all variable definitions on the list- Specified by:
saveVariableDefinitionsin interfaceVariableDefinitionManager
-
-