-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for search based on event-tag-refs in processed objects
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
- Loading branch information
1 parent
cf6445f
commit a4e11a3
Showing
8 changed files
with
181 additions
and
3 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
8 changes: 8 additions & 0 deletions
8
...com/evolveum/midpoint/repo/sqale/qmodel/simulation/MProcessedObjectEventTagReference.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,8 @@ | ||
package com.evolveum.midpoint.repo.sqale.qmodel.simulation; | ||
|
||
import com.evolveum.midpoint.repo.sqale.qmodel.ref.MReference; | ||
|
||
public class MProcessedObjectEventTagReference extends MReference { | ||
|
||
public Long processedObjectCid; | ||
} |
37 changes: 37 additions & 0 deletions
37
...com/evolveum/midpoint/repo/sqale/qmodel/simulation/QProcessedObjectEventTagReference.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,37 @@ | ||
package com.evolveum.midpoint.repo.sqale.qmodel.simulation; | ||
|
||
import java.sql.Types; | ||
|
||
import com.evolveum.midpoint.repo.sqale.qmodel.ref.QReference; | ||
import com.querydsl.core.types.dsl.BooleanExpression; | ||
import com.querydsl.core.types.dsl.NumberPath; | ||
import com.querydsl.sql.ColumnMetadata; | ||
import com.querydsl.sql.PrimaryKey; | ||
|
||
public class QProcessedObjectEventTagReference extends QReference<MProcessedObjectEventTagReference, MProcessedObject> { | ||
|
||
private static final long serialVersionUID = -4323954643404516391L; | ||
|
||
public static final ColumnMetadata PROCESSED_OBJECT_CID = | ||
ColumnMetadata.named("processedObjectCid").ofType(Types.BIGINT).notNull(); | ||
|
||
public final NumberPath<Long> processedObjectCid = createLong("processedObjectCid", PROCESSED_OBJECT_CID); | ||
|
||
public final PrimaryKey<MProcessedObjectEventTagReference> pk = | ||
createPrimaryKey(ownerOid, processedObjectCid, referenceType, relationId, targetOid); | ||
|
||
public QProcessedObjectEventTagReference(String variable, String tableName) { | ||
this(variable, DEFAULT_SCHEMA_NAME, tableName); | ||
} | ||
|
||
public QProcessedObjectEventTagReference(String variable, String schema, String table) { | ||
super(MProcessedObjectEventTagReference.class, variable, schema, table); | ||
} | ||
|
||
@Override | ||
public BooleanExpression isOwnedBy(MProcessedObject ownerRow) { | ||
return ownerOid.eq(ownerRow.ownerOid) | ||
.and(processedObjectCid.eq(ownerRow.cid)); | ||
} | ||
|
||
} |
69 changes: 69 additions & 0 deletions
69
...lveum/midpoint/repo/sqale/qmodel/simulation/QProcessedObjectEventTagReferenceMapping.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,69 @@ | ||
package com.evolveum.midpoint.repo.sqale.qmodel.simulation; | ||
|
||
import java.awt.desktop.QuitEvent; | ||
import java.util.Objects; | ||
import java.util.function.BiFunction; | ||
import java.util.function.Supplier; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
import com.evolveum.midpoint.repo.sqale.SqaleRepoContext; | ||
import com.evolveum.midpoint.repo.sqale.qmodel.object.MObject; | ||
import com.evolveum.midpoint.repo.sqale.qmodel.object.MObjectType; | ||
import com.evolveum.midpoint.repo.sqale.qmodel.object.QObject; | ||
import com.evolveum.midpoint.repo.sqale.qmodel.ref.QReferenceMapping; | ||
import com.evolveum.midpoint.repo.sqale.qmodel.tag.QTagMapping; | ||
import com.evolveum.midpoint.repo.sqlbase.mapping.QueryTableMapping; | ||
import com.querydsl.core.types.Predicate; | ||
|
||
public class QProcessedObjectEventTagReferenceMapping extends QReferenceMapping<QProcessedObjectEventTagReference, MProcessedObjectEventTagReference, | ||
QProcessedObject, MProcessedObject> { | ||
|
||
|
||
private static final String TABLE_NAME = "m_processed_object_event_tag"; | ||
|
||
public static QProcessedObjectEventTagReferenceMapping instance; | ||
|
||
public static QProcessedObjectEventTagReferenceMapping init(@NotNull SqaleRepoContext repositoryContext) { | ||
if (needsInitialization(instance, repositoryContext)) { | ||
instance = new QProcessedObjectEventTagReferenceMapping( | ||
TABLE_NAME, "srpoet", repositoryContext, | ||
QTagMapping::getInstance); | ||
} | ||
return getInstance(); | ||
} | ||
|
||
public static QProcessedObjectEventTagReferenceMapping getInstance() { | ||
return Objects.requireNonNull(instance); | ||
} | ||
|
||
protected <TQ extends QObject<TR>, TR extends MObject> QProcessedObjectEventTagReferenceMapping( | ||
String tableName, | ||
String defaultAliasName, | ||
@NotNull SqaleRepoContext repositoryContext, | ||
@NotNull Supplier<QueryTableMapping<?, TQ, TR>> targetMappingSupplier) { | ||
super(tableName, defaultAliasName, QProcessedObjectEventTagReference.class, | ||
repositoryContext, targetMappingSupplier); | ||
} | ||
|
||
@Override | ||
protected QProcessedObjectEventTagReference newAliasInstance(String alias) { | ||
return new QProcessedObjectEventTagReference(alias, TABLE_NAME); | ||
} | ||
|
||
@Override | ||
public MProcessedObjectEventTagReference newRowObject(MProcessedObject ownerRow) { | ||
var row = new MProcessedObjectEventTagReference(); | ||
row.ownerOid = ownerRow.ownerOid; | ||
row.ownerType = MObjectType.SIMULATION_RESULT; | ||
row.processedObjectCid = ownerRow.cid; | ||
return row; | ||
} | ||
|
||
@Override | ||
public BiFunction<QProcessedObject, QProcessedObjectEventTagReference, Predicate> correlationPredicate() { | ||
return (a, r) -> a.ownerOid.eq(r.ownerOid) | ||
.and(a.cid.eq(r.processedObjectCid)); | ||
} | ||
|
||
} |
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