Package com.evolveum.midpoint.schema
Class SelectorOptions<T>
- java.lang.Object
-
- com.evolveum.midpoint.schema.SelectorOptions<T>
-
- All Implemented Interfaces:
DebugDumpable
,ShortDumpable
,Serializable
,Cloneable
public class SelectorOptions<T> extends Object implements Serializable, DebugDumpable, ShortDumpable, Cloneable
- Author:
- semancik
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description SelectorOptions(@NotNull SelectorOptions<T> prototype)
SelectorOptions(ObjectSelector selector, T options)
SelectorOptions(T options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SelectorOptions<T>
clone()
static <T> SelectorOptions<T>
create(UniformItemPath path, T options)
static <T> SelectorOptions<T>
create(T options)
static <T> Collection<SelectorOptions<T>>
createCollection(UniformItemPath path, T options)
static <T> Collection<SelectorOptions<T>>
createCollection(T options)
static <T> Collection<SelectorOptions<T>>
createCollection(T options, UniformItemPath... paths)
String
debugDump(int indent)
boolean
equals(Object o)
static <T> Map<T,Collection<UniformItemPath>>
extractOptionValues(Collection<SelectorOptions<GetOperationOptions>> options, Function<GetOperationOptions,T> supplier, PrismContext prismContext)
static List<SelectorOptions<GetOperationOptions>>
filterRetrieveOptions(Collection<SelectorOptions<GetOperationOptions>> options)
static <T> @NotNull Collection<T>
findOptionsForPath(Collection<SelectorOptions<T>> options, @NotNull UniformItemPath path)
Finds all the options for given path.static <T> T
findRootOptions(Collection<SelectorOptions<T>> options)
Returns options that apply to the "root" object.@NotNull UniformItemPath
getItemPath(UniformItemPath emptyPath)
T
getOptions()
ObjectSelector
getSelector()
int
hashCode()
static boolean
hasToFetchPathNotRetrievedByDefault(@NotNull ItemPath path, @Nullable Collection<SelectorOptions<GetOperationOptions>> options)
Returns true if the asked path must be considered for fetching based on the provided get options.static boolean
hasToIncludePath(@NotNull ItemPath path, @Nullable Collection<SelectorOptions<GetOperationOptions>> options, boolean defaultValue)
Returns true if the asked path must be included in the object based on the provided get options.static boolean
isRetrievedFullyByDefault(Class<?> objectType)
boolean
isRoot()
void
shortDump(StringBuilder sb)
Show the content of the object intended for diagnostics.String
toString()
static <T> @NotNull Collection<SelectorOptions<T>>
updateRootOptions(@Nullable Collection<SelectorOptions<T>> options, @NotNull Consumer<T> updater, Supplier<T> newValueSupplier)
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.util.ShortDumpable
shortDump, shortDumpLazily
-
-
-
-
Constructor Detail
-
SelectorOptions
public SelectorOptions(ObjectSelector selector, T options)
-
SelectorOptions
public SelectorOptions(T options)
-
SelectorOptions
public SelectorOptions(@NotNull @NotNull SelectorOptions<T> prototype)
-
-
Method Detail
-
create
public static <T> SelectorOptions<T> create(UniformItemPath path, T options)
-
create
public static <T> SelectorOptions<T> create(T options)
-
createCollection
public static <T> Collection<SelectorOptions<T>> createCollection(UniformItemPath path, T options)
-
createCollection
public static <T> Collection<SelectorOptions<T>> createCollection(T options)
-
createCollection
public static <T> Collection<SelectorOptions<T>> createCollection(T options, UniformItemPath... paths)
-
getSelector
public ObjectSelector getSelector()
-
getOptions
public T getOptions()
-
getItemPath
@NotNull public @NotNull UniformItemPath getItemPath(UniformItemPath emptyPath)
-
findRootOptions
public static <T> T findRootOptions(Collection<SelectorOptions<T>> options)
Returns options that apply to the "root" object. I.e. options that have null selector, null path, empty path, ... Must return 'live object' that could be modified.
-
updateRootOptions
@NotNull public static <T> @NotNull Collection<SelectorOptions<T>> updateRootOptions(@Nullable @Nullable Collection<SelectorOptions<T>> options, @NotNull @NotNull Consumer<T> updater, Supplier<T> newValueSupplier)
-
findOptionsForPath
@NotNull public static <T> @NotNull Collection<T> findOptionsForPath(Collection<SelectorOptions<T>> options, @NotNull @NotNull UniformItemPath path)
Finds all the options for given path. TODO could there be more than one? Returns live objects that could be modified by client.
-
isRoot
public boolean isRoot()
-
isRetrievedFullyByDefault
public static boolean isRetrievedFullyByDefault(Class<?> objectType)
-
hasToIncludePath
public static boolean hasToIncludePath(@NotNull @NotNull ItemPath path, @Nullable @Nullable Collection<SelectorOptions<GetOperationOptions>> options, boolean defaultValue)
Returns true if the asked path must be included in the object based on the provided get options. SeeGetOperationOptions.retrieve
javadoc for more details. Retrieve option with null or empty path asks to load everything. This is not used only in repository but also for retrieving information during provisioning. Default value must be explicitly provided as it depends on the context of the question. Simplified example: When we ask for path "x/y", the path itself and anything under it is to be included. User wants "x/y", as well as "x/y/ya", etc. User does not say anything about path "x" (prefix) or "z" (different path altogether). If no option defines what to do with the asked path, defaultValue is returned.
-
hasToFetchPathNotRetrievedByDefault
public static boolean hasToFetchPathNotRetrievedByDefault(@NotNull @NotNull ItemPath path, @Nullable @Nullable Collection<SelectorOptions<GetOperationOptions>> options)
Returns true if the asked path must be considered for fetching based on the provided get options. This is different fromhasToIncludePath(ItemPath, Collection, boolean)
as it considers path relation in any direction (subpath or prefix or equal). This is typical for repository usage that asks questions like: "Should I load container x *that I don't fetch by default*?" When the user specifies options with retrieve of the path inside that container, e.g. "x/a"), he does not state that he wants to fetch "x", but the repo can't just ignore processing of "x" and skip it altogether if it is stored separately. At the same time, original semantics ofhasToIncludePath(ItemPath, Collection, boolean)
has to hold as well - if user asks to load "a", repo needs to fetch "a/b" as well (everything under "a"). Simplified example: When we ask for path "x/y", the path itself, any subpath and any prefix must be considered for fetching. User wants "x/y", as well as "x/y/ya", etc. User does not say anything about path "x" (prefix) or "z" (different path altogether), but while we can ignore "z", we must consider "x" if the repo does not provide it by default. In that case it needs to fetch it (fully or partially, whatever is practical and/or efficient) to provide the requested "x/y" content.
-
filterRetrieveOptions
public static List<SelectorOptions<GetOperationOptions>> filterRetrieveOptions(Collection<SelectorOptions<GetOperationOptions>> options)
-
extractOptionValues
public static <T> Map<T,Collection<UniformItemPath>> extractOptionValues(Collection<SelectorOptions<GetOperationOptions>> options, Function<GetOperationOptions,T> supplier, PrismContext prismContext)
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
shortDump
public void shortDump(StringBuilder sb)
Description copied from interface:ShortDumpable
Show the content of the object intended for diagnostics. This method is supposed to append a compact, human-readable output in a single line. Unlike toString() method, there is no requirement to identify the actual class or type of the object. It is assumed that the class/type will be obvious from the context in which the output is used.- Specified by:
shortDump
in interfaceShortDumpable
- Parameters:
sb
- StringBuilder to which to a compact one-line content of the object intended for diagnostics by system administrator should be appended.
-
clone
public SelectorOptions<T> clone()
-
-