Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QFocus added as a superclass for QUser
- removed superfluous pk mapping (QObject.pk is enough) - QObject and QFocus are not abstract, we may need to instantiate them for "generic" queries
- Loading branch information
Showing
21 changed files
with
306 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
repo/repo-sqale/src/main/java/com/evolveum/midpoint/repo/sqale/qbean/MFocus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (C) 2010-2021 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.repo.sqale.qbean; | ||
|
||
import java.time.Instant; | ||
|
||
import com.evolveum.midpoint.repo.sqale.qmodel.QFocus; | ||
|
||
/** | ||
* Querydsl "row bean" type related to {@link QFocus}. | ||
*/ | ||
public class MFocus extends MObject { | ||
|
||
public Integer administrativeStatus; | ||
public Integer effectiveStatus; | ||
public Instant enableTimestamp; | ||
public Instant disableTimestamp; | ||
public String disableReason; | ||
public Instant archiveTimestamp; | ||
public Instant validFrom; | ||
public Instant validTo; | ||
public Instant validityChangeTimestamp; | ||
public Integer validityStatus; | ||
public String costCenter; | ||
public String emailAddress; | ||
public byte[] photo; | ||
public String locale; | ||
public String localityNorm; | ||
public String localityOrig; | ||
public String preferredLanguage; | ||
public String telephoneNumber; | ||
public String timezone; | ||
public Instant passwordCreateTimestamp; | ||
public Instant passwordModifyTimestamp; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
repo/repo-sqale/src/main/java/com/evolveum/midpoint/repo/sqale/qmapping/QFocusMapping.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright (C) 2010-2021 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.repo.sqale.qmapping; | ||
|
||
import java.util.Collection; | ||
|
||
import com.querydsl.core.types.Path; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import com.evolveum.midpoint.prism.PrismConstants; | ||
import com.evolveum.midpoint.repo.sqale.qbean.MFocus; | ||
import com.evolveum.midpoint.repo.sqale.qmodel.QFocus; | ||
import com.evolveum.midpoint.repo.sqlbase.mapping.item.PolyStringItemFilterProcessor; | ||
import com.evolveum.midpoint.repo.sqlbase.mapping.item.StringItemFilterProcessor; | ||
import com.evolveum.midpoint.schema.GetOperationOptions; | ||
import com.evolveum.midpoint.schema.SelectorOptions; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType; | ||
|
||
/** | ||
* Mapping between {@link QFocus} and {@link FocusType}. | ||
*/ | ||
public class QFocusMapping<S extends FocusType, Q extends QFocus<R>, R extends MFocus> | ||
extends QObjectMapping<S, Q, R> { | ||
|
||
public static final String DEFAULT_ALIAS_NAME = "f"; | ||
|
||
public static final QFocusMapping<FocusType, QFocus.QFocusReal, MFocus> INSTANCE = | ||
new QFocusMapping<>(QFocus.TABLE_NAME, DEFAULT_ALIAS_NAME, | ||
FocusType.class, QFocus.QFocusReal.class); | ||
|
||
protected QFocusMapping( | ||
@NotNull String tableName, | ||
@NotNull String defaultAliasName, | ||
@NotNull Class<S> schemaType, | ||
@NotNull Class<Q> queryType) { | ||
super(tableName, defaultAliasName, schemaType, queryType); | ||
|
||
addItemMapping(PrismConstants.T_ID, StringItemFilterProcessor.mapper(path(q -> q.oid))); | ||
addItemMapping(FocusType.F_NAME, | ||
PolyStringItemFilterProcessor.mapper( | ||
path(q -> q.nameOrig), path(q -> q.nameNorm))); | ||
|
||
// TODO mappings | ||
} | ||
|
||
@Override | ||
public @NotNull Path<?>[] selectExpressions( | ||
Q entity, Collection<SelectorOptions<GetOperationOptions>> options) { | ||
return new Path[] { entity.oid, entity.fullObject }; | ||
} | ||
|
||
// TODO verify that this allows creation of QFocus alias and that it suffices for "generic query" | ||
@Override | ||
protected Q newAliasInstance(String alias) { | ||
//noinspection unchecked | ||
return (Q) new QFocus<>(MFocus.class, alias); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.