Enum QuerydslUtils
- java.lang.Object
-
- java.lang.Enum<QuerydslUtils>
-
- com.evolveum.midpoint.repo.sqlbase.querydsl.QuerydslUtils
-
- All Implemented Interfaces:
Serializable
,Comparable<QuerydslUtils>
public enum QuerydslUtils extends Enum<QuerydslUtils>
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Comparable<T>>
TconvertTimestampToPathType(@NotNull Object value, @NotNull com.querydsl.core.types.dsl.DateTimePath<T> path)
Tries to convert value of type typeXMLGregorianCalendar
to paths ofInstant
(most likely used),Timestamp
andLong
.static <O,M>
Map<O,Collection<M>>mapOneToMany(Collection<com.querydsl.core.Tuple> rawResult, com.querydsl.core.types.Expression<O> onePath, com.querydsl.core.types.Expression<M> manyPath)
LikemapOneToMany(Collection, Expression, Expression, BiConsumer)
, just without any consumer for additional processing.static <O,M>
Map<O,Collection<M>>mapOneToMany(Collection<com.querydsl.core.Tuple> rawResult, com.querydsl.core.types.Expression<O> onePath, com.querydsl.core.types.Expression<M> manyPath, @Nullable BiConsumer<O,M> manyAccumulator)
Resolves one-to-many relations between two paths from theTuple
-based result.static com.querydsl.sql.Configuration
querydslConfiguration(SupportedDatabase databaseType)
Returns configuration for Querydsl based on the used database type.static QuerydslUtils
valueOf(String name)
Returns the enum constant of this type with the specified name.static QuerydslUtils[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Method Detail
-
values
public static QuerydslUtils[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (QuerydslUtils c : QuerydslUtils.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static QuerydslUtils valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
querydslConfiguration
public static com.querydsl.sql.Configuration querydslConfiguration(SupportedDatabase databaseType)
Returns configuration for Querydsl based on the used database type.
-
mapOneToMany
public static <O,M> Map<O,Collection<M>> mapOneToMany(Collection<com.querydsl.core.Tuple> rawResult, com.querydsl.core.types.Expression<O> onePath, com.querydsl.core.types.Expression<M> manyPath, @Nullable @Nullable BiConsumer<O,M> manyAccumulator)
Resolves one-to-many relations between two paths from theTuple
-based result. Returns map with "one" entities as keys (preserving original order) and related "many" entities as a collection in the value for each key.Optional accumulator can call further processing on both objects for each "many" item with "one" being internalized to the actual key in the resulting map. This solves the problem when the same entity is represented by different instances. Without this it wouldn't be possible to accumulate "many" in the collection owned by "one".
Note that proper equals/hashCode must be implemented for
<O>
type.- Type Parameters:
O
- type of "one" roleM
- type of "many" role- Parameters:
rawResult
- collection of tuples, unprocessed resultonePath
- path expression designating "one" role of the relationshipmanyPath
- path expression designating "many" role of the relationshipmanyAccumulator
- optional, called for each row with respective "one" and "many" items (always the same "one" instance is used for the group matching one key, see details above)- Returns:
- map of one->[many*] with keys in the original iterating order
-
mapOneToMany
public static <O,M> Map<O,Collection<M>> mapOneToMany(Collection<com.querydsl.core.Tuple> rawResult, com.querydsl.core.types.Expression<O> onePath, com.querydsl.core.types.Expression<M> manyPath)
LikemapOneToMany(Collection, Expression, Expression, BiConsumer)
, just without any consumer for additional processing.
-
convertTimestampToPathType
public static <T extends Comparable<T>> T convertTimestampToPathType(@NotNull @NotNull Object value, @NotNull @NotNull com.querydsl.core.types.dsl.DateTimePath<T> path)
Tries to convert value of type typeXMLGregorianCalendar
to paths ofInstant
(most likely used),Timestamp
andLong
.
-
-