com.atlassian.bamboo.variable
Interface VariableContext

All Superinterfaces:
Serializable
All Known Implementing Classes:
VariableContextImpl

@PublicApi
public interface VariableContext
extends Serializable

A bag for all variable related data inside CommonContext


Method Summary
 void addLocalVariable(String key, String value)
          Add generated local (a.k.a CUSTOM) variable to this context.
 void addResultVariable(String key, String value)
          Add generated result variable to this context.
 Map<String,VariableDefinitionContext> getDefinitions()
          Deprecated. since 5.7
 Map<String,VariableDefinitionContext> getEffectiveVariables()
          Effective state of the variables.
 Map<String,VariableDefinitionContext> getOriginalVariables()
          The original state of variables in this context, that is, the state as it was when execution of job (environment) started.
 Iterable<VariableDefinitionContext> getPasswordVariables()
          Get all variables in current context that are considered "password" variables, i.e.
 Map<String,VariableDefinitionContext> getResultVariables()
           
 Map<String,VariableSubstitutionContext> getSubstitutions()
           
 

Method Detail

getDefinitions

@Deprecated
@NotNull
Map<String,VariableDefinitionContext> getDefinitions()
Deprecated. since 5.7

Returns:
available variable definitions

getOriginalVariables

@NotNull
Map<String,VariableDefinitionContext> getOriginalVariables()
The original state of variables in this context, that is, the state as it was when execution of job (environment) started.

Returns:
immutable state of the variables as it was when this object was created

getEffectiveVariables

@NotNull
Map<String,VariableDefinitionContext> getEffectiveVariables()
Effective state of the variables. This is calculated according to the following rules: - result variables hide variables from original state - local variables hide all other variables

Returns:
immutable map containing effective state of variables in this context
Since:
5.7

getResultVariables

@NotNull
Map<String,VariableDefinitionContext> getResultVariables()
Returns:
immutable map containing all result variables in this context
Since:
5.7

addLocalVariable

void addLocalVariable(@NotNull
                      String key,
                      @NotNull
                      String value)
Add generated local (a.k.a CUSTOM) variable to this context. Local variables are only accessible from this context and are not persisted. Local variables hide any existing variables (but their value is not changed). However if you define a result variable with the same key after defining local variable, local variable will be removed. Calling this method second time with the same key assigns new value to the variable.

Since:
5.7

addResultVariable

void addResultVariable(@NotNull
                       String key,
                       @NotNull
                       String value)
Add generated result variable to this context. Result variables are persisted with the result and are available in subsequent stages of the plan and in deployment version created from a result. Result variables hide any global or plan variables (but their value is not changed). If a local variable exists with the same key, it will be removed. Calling this method second time with the same key assigns new value to the variable.

Parameters:
key -
value -
Since:
5.7

getSubstitutions

@NotNull
Map<String,VariableSubstitutionContext> getSubstitutions()
Returns:
variables used in current build

getPasswordVariables

Iterable<VariableDefinitionContext> getPasswordVariables()
Get all variables in current context that are considered "password" variables, i.e. contain string "password" in name.

Since:
5.10


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.