-
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.
Merge branch 'master' of github.com:Evolveum/midpoint
- Loading branch information
Showing
8 changed files
with
212 additions
and
19 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
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
48 changes: 48 additions & 0 deletions
48
model/workflow-impl/src/test/resources/miscellaneous/role-autocompletions.xml
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,48 @@ | ||
<!-- | ||
~ Copyright (C) 2010-2023 Evolveum and contributors | ||
~ | ||
~ This work is dual-licensed under the Apache License 2.0 | ||
~ and European Union Public License. See LICENSE file for details. | ||
--> | ||
|
||
<role xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
oid="a2570ee8-6c13-48b9-9a33-d8e88c4fe618"> | ||
<name>autocompletions</name> | ||
<assignment> | ||
<policyRule> | ||
<policyConstraints> | ||
<assignment> | ||
<operation>add</operation> | ||
</assignment> | ||
</policyConstraints> | ||
<policyActions> | ||
<approval> | ||
<approvalSchema> | ||
<stage> | ||
<number>1</number> | ||
<approverRef oid="00000000-0000-0000-0000-000000000002" type="UserType"/> | ||
<automaticallyCompleted> | ||
<script> | ||
<code>'approve'</code> | ||
</script> | ||
</automaticallyCompleted> | ||
</stage> | ||
<stage> | ||
<number>2</number> | ||
<approverRef oid="00000000-0000-0000-0000-000000000002" type="UserType"/> | ||
<automaticallyCompleted> | ||
<script> | ||
<code>'skip'</code> | ||
</script> | ||
</automaticallyCompleted> | ||
</stage> | ||
<stage> | ||
<number>3</number> | ||
<approverRef oid="00000000-0000-0000-0000-000000000002" type="UserType"/> | ||
</stage> | ||
</approvalSchema> | ||
</approval> | ||
</policyActions> | ||
</policyRule> | ||
</assignment> | ||
</role> |
67 changes: 67 additions & 0 deletions
67
...rc/main/java/com/evolveum/midpoint/repo/sqale/filtering/TypeQNameItemFilterProcessor.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,67 @@ | ||
/* | ||
* Copyright (C) 2010-2022 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.filtering; | ||
|
||
import java.util.function.Function; | ||
|
||
import javax.xml.namespace.QName; | ||
|
||
import com.querydsl.core.types.ExpressionUtils; | ||
import com.querydsl.core.types.Ops; | ||
import com.querydsl.core.types.Predicate; | ||
import com.querydsl.core.types.dsl.EnumPath; | ||
import com.evolveum.midpoint.prism.query.PropertyValueFilter; | ||
import com.evolveum.midpoint.repo.sqale.qmodel.object.MObjectType; | ||
import com.evolveum.midpoint.repo.sqlbase.QueryException; | ||
import com.evolveum.midpoint.repo.sqlbase.RepositoryException; | ||
import com.evolveum.midpoint.repo.sqlbase.SqlQueryContext; | ||
import com.evolveum.midpoint.repo.sqlbase.filtering.item.FilterOperation; | ||
import com.evolveum.midpoint.repo.sqlbase.filtering.item.SimpleItemFilterProcessor; | ||
import com.evolveum.midpoint.repo.sqlbase.filtering.item.SinglePathItemFilterProcessor; | ||
import com.evolveum.midpoint.repo.sqlbase.querydsl.FlexibleRelationalPathBase; | ||
|
||
/** | ||
* Similar to {@link SimpleItemFilterProcessor} but String value can be just UUID prefixes | ||
* and must be smartly converted based on the actual operation. | ||
* | ||
* [WARNING] | ||
* Prefix support assumes OID column only and does not treat predicate for nullable columns. | ||
*/ | ||
public class TypeQNameItemFilterProcessor extends SinglePathItemFilterProcessor<QName, EnumPath<MObjectType>> { | ||
|
||
public <Q extends FlexibleRelationalPathBase<R>, R> TypeQNameItemFilterProcessor( | ||
SqlQueryContext<?, Q, R> context, Function<Q, EnumPath<MObjectType>> rootToQueryItem) { | ||
super(context, rootToQueryItem); | ||
} | ||
|
||
@Override | ||
public Predicate process(PropertyValueFilter<QName> filter) throws RepositoryException { | ||
FilterOperation operation = operation(filter); | ||
if (!operation.isEqualOperation()) { | ||
throw new QueryException("Only equal filter supported"); | ||
} | ||
if (filter.hasNoValue()) { | ||
if (operation.isAnyEqualOperation()) { | ||
return ExpressionUtils.predicate(Ops.IS_NULL, path); | ||
} else { | ||
throw new QueryException("Null value for other than EQUAL filter: " + filter); | ||
} | ||
} | ||
|
||
Predicate predicate = null; | ||
for (var value : filter.getValues()) { | ||
var local = path.eq(MObjectType.fromTypeQName(value.getValue())); | ||
if (predicate == null) { | ||
predicate = local; | ||
} else { | ||
predicate = ExpressionUtils.and(predicate, local); | ||
} | ||
} | ||
return predicate; | ||
} | ||
|
||
} |
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