Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update context + delta processor moved from sqlbase to sqale only
- Loading branch information
Showing
24 changed files
with
169 additions
and
98 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
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
36 changes: 36 additions & 0 deletions
36
...-sqale/src/main/java/com/evolveum/midpoint/repo/sqale/delta/SimpleItemDeltaProcessor.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,36 @@ | ||
/* | ||
* 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.delta; | ||
|
||
import java.util.function.Function; | ||
|
||
import com.querydsl.core.types.EntityPath; | ||
import com.querydsl.core.types.Path; | ||
|
||
import com.evolveum.midpoint.prism.delta.ItemDelta; | ||
import com.evolveum.midpoint.repo.sqale.SqaleUpdateContext; | ||
import com.evolveum.midpoint.repo.sqlbase.RepositoryException; | ||
|
||
public class SimpleItemDeltaProcessor<P extends Path<?>> extends ItemDeltaProcessor { | ||
|
||
protected final P path; | ||
|
||
public SimpleItemDeltaProcessor( | ||
SqaleUpdateContext<?, ?, ?> context, Function<EntityPath<?>, P> rootToQueryItem) { | ||
super(context); | ||
this.path = rootToQueryItem.apply(context.path()); | ||
} | ||
|
||
@Override | ||
public void process(ItemDelta<?, ?> modification) throws RepositoryException { | ||
System.out.println(path + " <= applying modification: " + modification); // TODO out | ||
if (modification.isDelete()) { | ||
// context.update(path, NULL); | ||
} | ||
// context.update(path, modification.getv) | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
repo/repo-sqale/src/main/java/com/evolveum/midpoint/repo/sqale/delta/SqaleItemSqlMapper.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,57 @@ | ||
/* | ||
* 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.delta; | ||
|
||
import java.util.Objects; | ||
import java.util.function.Function; | ||
|
||
import com.querydsl.core.types.EntityPath; | ||
import com.querydsl.core.types.Path; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import com.evolveum.midpoint.repo.sqale.SqaleUpdateContext; | ||
import com.evolveum.midpoint.repo.sqlbase.SqlQueryContext; | ||
import com.evolveum.midpoint.repo.sqlbase.filtering.item.ItemFilterProcessor; | ||
import com.evolveum.midpoint.repo.sqlbase.mapping.item.ItemSqlMapper; | ||
|
||
/** | ||
* Declarative information how an item (from schema/prism world) is to be processed | ||
* when interpreting query or applying delta (delta application is addition to sqlbase superclass). | ||
*/ | ||
public class SqaleItemSqlMapper extends ItemSqlMapper { | ||
|
||
@NotNull private final | ||
Function<SqaleUpdateContext<?, ?, ?>, ItemDeltaProcessor> deltaProcessorFactory; | ||
|
||
public <P extends Path<?>> SqaleItemSqlMapper( | ||
@NotNull Function<SqlQueryContext<?, ?, ?>, ItemFilterProcessor<?>> filterProcessorFactory, | ||
@NotNull Function<SqaleUpdateContext<?, ?, ?>, ItemDeltaProcessor> deltaProcessorFactory, | ||
@Nullable Function<EntityPath<?>, P> primaryItemMapping) { | ||
super(filterProcessorFactory, primaryItemMapping); | ||
this.deltaProcessorFactory = Objects.requireNonNull(deltaProcessorFactory); | ||
} | ||
|
||
public <P extends Path<?>> SqaleItemSqlMapper( | ||
@NotNull Function<SqlQueryContext<?, ?, ?>, ItemFilterProcessor<?>> filterProcessorFactory, | ||
@NotNull Function<SqaleUpdateContext<?, ?, ?>, ItemDeltaProcessor> deltaProcessorFactory) { | ||
super(filterProcessorFactory); | ||
this.deltaProcessorFactory = Objects.requireNonNull(deltaProcessorFactory); | ||
} | ||
|
||
/** | ||
* Creates {@link ItemDeltaProcessor} based on this mapping. | ||
* Provided {@link SqaleUpdateContext} is used to figure out the query paths when this is | ||
* executed (as the entity path instance is not yet available when the mapping is configured | ||
* in a declarative manner). | ||
* | ||
* The type of the returned filter is adapted to the client code needs for convenience. | ||
*/ | ||
public ItemDeltaProcessor createItemDeltaProcessor(SqaleUpdateContext<?, ?, ?> sqlUpdateContext) { | ||
return deltaProcessorFactory.apply(sqlUpdateContext); | ||
} | ||
} |
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
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
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
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.