Class VariablesMap
- java.lang.Object
-
- com.evolveum.midpoint.schema.expression.VariablesMap
-
- All Implemented Interfaces:
DebugDumpable
,Map<String,TypedValue>
public class VariablesMap extends Object implements Map<String,TypedValue>, DebugDumpable
- Author:
- semancik
-
-
Field Summary
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description VariablesMap()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <D extends ItemDefinition>
voidaddVariableDefinition(String name, Object value, D definition)
void
addVariableDefinitions(VariablesMap extraVariables)
Adds map of extra variables to the expression.void
addVariableDefinitions(VariablesMap extraVariables, @NotNull Collection<String> exceptFor)
void
addVariableDefinitionsNew(VariablesMap extraVariables)
Adds map of extra variables to the expression.void
addVariableDefinitionsOld(VariablesMap extraVariables)
Adds map of extra variables to the expression.void
clear()
boolean
containsKey(Object key)
boolean
containsValue(Object value)
static VariablesMap
create(PrismContext prismContext, Object... parameters)
Expects name-value-definition triplets.String
debugDump(int indent)
String
dumpSingleLine()
static VariablesMap
emptyMap()
@NotNull Set<Map.Entry<String,TypedValue>>
entrySet()
boolean
equals(Object o)
protected void
fillIn(PrismContext prismContext, Object... parameters)
Expects name-value-definition triplets.String
formatVariables()
TypedValue
get(Object key)
@NotNull Collection<String>
getAliases(String key)
String
getAliasResolution(String key)
Object
getValue(String name)
<T> T
getValue(String name, Class<T> type)
<O extends ObjectType>
PrismObject<O>getValueNew(String name)
int
hashCode()
boolean
haveDeltas()
boolean
isAlias(String key)
boolean
isEmpty()
@NotNull Set<String>
keySet()
TypedValue
put(String key, TypedValue typedValue)
<D extends ItemDefinition>
TypedValueput(String key, Object value, D definition)
<T> TypedValue
put(String key, Object value, Class<T> typeClass)
Note: Type of the value should really be Object and not T.void
putAll(VariablesMap m)
void
putAll(Map<? extends String,? extends TypedValue> m)
<T> TypedValue<List<T>>
putList(String key, List<T> list)
Convenience method to put multivalue variables (lists).<O extends ObjectType>
TypedValue<O>putObject(String key, PrismObject<O> object, Class<O> expectedClass)
Convenience method to put objects with definition.<O extends ObjectType>
TypedValue<O>putObject(String key, O objectType, Class<O> expectedClass)
Convenience method to put objects with definition.void
registerAlias(String alias, @Nullable String realName)
void
registerAliasesFrom(VariablesMap map)
Use only if you previously register all variables from this map!TypedValue
remove(Object key)
<D extends ItemDefinition>
voidreplaceVariableDefinition(String name, Object value, D definition)
void
setRootNode(ObjectReferenceType objectRef, PrismReferenceDefinition def)
int
size()
String
toString()
void
unregisterAlias(String alias)
@NotNull Collection<TypedValue>
values()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Method Detail
-
size
public int size()
- Specified by:
size
in interfaceMap<String,TypedValue>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceMap<String,TypedValue>
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap<String,TypedValue>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interfaceMap<String,TypedValue>
-
get
public TypedValue get(Object key)
- Specified by:
get
in interfaceMap<String,TypedValue>
-
put
public TypedValue put(String key, TypedValue typedValue)
- Specified by:
put
in interfaceMap<String,TypedValue>
-
registerAliasesFrom
public void registerAliasesFrom(VariablesMap map)
Use only if you previously register all variables from this map!
-
unregisterAlias
public void unregisterAlias(String alias)
-
put
public <D extends ItemDefinition> TypedValue put(String key, Object value, D definition)
-
put
public <T> TypedValue put(String key, Object value, Class<T> typeClass)
Note: Type of the value should really be Object and not T. The value may be quite complicated, e.g. it may be ItemDeltaItem of the actual real value. However, the class defines the real type of the value precisely.
-
putObject
public <O extends ObjectType> TypedValue<O> putObject(String key, O objectType, Class<O> expectedClass)
Convenience method to put objects with definition. Maybe later improve by looking up full definition.
-
putObject
public <O extends ObjectType> TypedValue<O> putObject(String key, PrismObject<O> object, Class<O> expectedClass)
Convenience method to put objects with definition. Maybe later improve by looking up full definition.
-
putList
public <T> TypedValue<List<T>> putList(String key, List<T> list)
Convenience method to put multivalue variables (lists). This is very simple now. But later on we may need to declare generics. Therefore dedicated method would be easier to find all usages and fix them.
-
remove
public TypedValue remove(Object key)
- Specified by:
remove
in interfaceMap<String,TypedValue>
-
putAll
public void putAll(Map<? extends String,? extends TypedValue> m)
- Specified by:
putAll
in interfaceMap<String,TypedValue>
-
putAll
public void putAll(VariablesMap m)
-
clear
public void clear()
- Specified by:
clear
in interfaceMap<String,TypedValue>
-
keySet
@NotNull public @NotNull Set<String> keySet()
- Specified by:
keySet
in interfaceMap<String,TypedValue>
-
values
@NotNull public @NotNull Collection<TypedValue> values()
- Specified by:
values
in interfaceMap<String,TypedValue>
-
entrySet
@NotNull public @NotNull Set<Map.Entry<String,TypedValue>> entrySet()
- Specified by:
entrySet
in interfaceMap<String,TypedValue>
-
create
public static VariablesMap create(PrismContext prismContext, Object... parameters)
Expects name-value-definition triplets. Definition can be just a type QName. E.g. create(var1name, var1value, var1type, var2name, var2value, var2type, ...) Mostly for testing. Use at your own risk.
-
fillIn
protected void fillIn(PrismContext prismContext, Object... parameters)
Expects name-value-definition triplets. Definition can be just a type QName. E.g. create(var1name, var1value, var1type, var2name, var2value, var2type, ...) Mostly for testing. Use at your own risk.
-
emptyMap
public static VariablesMap emptyMap()
-
formatVariables
public String formatVariables()
-
getAliases
@NotNull public @NotNull Collection<String> getAliases(String key)
-
isAlias
public boolean isAlias(String key)
-
dumpSingleLine
public String dumpSingleLine()
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
addVariableDefinitions
public void addVariableDefinitions(VariablesMap extraVariables)
Adds map of extra variables to the expression. If there are variables with deltas (ObjectDeltaObject) the operation fail because it cannot decide which version to use.
-
addVariableDefinitions
public void addVariableDefinitions(VariablesMap extraVariables, @NotNull @NotNull Collection<String> exceptFor)
-
addVariableDefinitionsOld
public void addVariableDefinitionsOld(VariablesMap extraVariables)
Adds map of extra variables to the expression. If there are variables with deltas (ObjectDeltaObject) it takes the "old" version of the object.
-
addVariableDefinitionsNew
public void addVariableDefinitionsNew(VariablesMap extraVariables)
Adds map of extra variables to the expression. If there are variables with deltas (ObjectDeltaObject) it takes the "new" version of the object.
-
setRootNode
public void setRootNode(ObjectReferenceType objectRef, PrismReferenceDefinition def)
-
addVariableDefinition
public <D extends ItemDefinition> void addVariableDefinition(String name, Object value, D definition)
-
replaceVariableDefinition
public <D extends ItemDefinition> void replaceVariableDefinition(String name, Object value, D definition)
-
getValue
public <T> T getValue(String name, Class<T> type) throws SchemaException
- Throws:
SchemaException
-
getValueNew
public <O extends ObjectType> PrismObject<O> getValueNew(String name) throws SchemaException
- Throws:
SchemaException
-
haveDeltas
public boolean haveDeltas()
-
equals
public boolean equals(Object o)
-
hashCode
public int hashCode()
-
-