com.atlassian.bamboo.variable
Class VariableContextImpl

java.lang.Object
  extended by com.atlassian.bamboo.variable.VariableContextImpl
All Implemented Interfaces:
VariableContext, Serializable

@NotThreadSafe
public class VariableContextImpl
extends Object
implements VariableContext

See Also:
Serialized Form

Constructor Summary
VariableContextImpl(Map<String,VariableDefinitionContext> definitions)
           
 
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()
           
 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.
 List<VariableDefinitionContext> getPasswordVariables()
          Get all variables in current context that are considered "password" variables, i.e.
 Map<String,VariableDefinitionContext> getResultVariables()
           
 Map<String,VariableSubstitutionContext> getSubstitutions()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableContextImpl

public VariableContextImpl(Map<String,VariableDefinitionContext> definitions)
Method Detail

getSubstitutions

@NotNull
public Map<String,VariableSubstitutionContext> getSubstitutions()
Specified by:
getSubstitutions in interface VariableContext
Returns:
variables used in current build

getDefinitions

@NotNull
public Map<String,VariableDefinitionContext> getDefinitions()
Specified by:
getDefinitions in interface VariableContext
Returns:
available variable definitions

getOriginalVariables

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

Specified by:
getOriginalVariables in interface VariableContext
Returns:
immutable state of the variables as it was when this object was created

getEffectiveVariables

@NotNull
public Map<String,VariableDefinitionContext> getEffectiveVariables()
Description copied from interface: VariableContext
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

Specified by:
getEffectiveVariables in interface VariableContext
Returns:
immutable map containing effective state of variables in this context

getResultVariables

@NotNull
public Map<String,VariableDefinitionContext> getResultVariables()
Specified by:
getResultVariables in interface VariableContext
Returns:
immutable map containing all result variables in this context

addResultVariable

public void addResultVariable(@NotNull
                              String key,
                              @NotNull
                              String value)
Description copied from interface: VariableContext
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.

Specified by:
addResultVariable in interface VariableContext

addLocalVariable

public void addLocalVariable(@NotNull
                             String key,
                             @NotNull
                             String value)
Description copied from interface: VariableContext
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.

Specified by:
addLocalVariable in interface VariableContext

getPasswordVariables

public List<VariableDefinitionContext> getPasswordVariables()
Description copied from interface: VariableContext
Get all variables in current context that are considered "password" variables, i.e. contain string "password" in name.

Specified by:
getPasswordVariables in interface VariableContext


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