-
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.
Re-allow null intent for dependency specification
Making indent in dependency configuration obligatory (in d62cd32) was not a good idea. This commit implements handling of null intent there: it is interpreted as "default in a kind". This means that specialized methods for dependency lookup have been introduced in DependencyProcessor class. Also, ResourceObjectTypeDependencyType has been separated from ShadowDiscriminatorType. Not all fields are relevant, and the meaning (hence the docs) is different as well.
- Loading branch information
Showing
40 changed files
with
512 additions
and
407 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
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
70 changes: 70 additions & 0 deletions
70
...src/main/java/com/evolveum/midpoint/schema/util/ResourceObjectTypeDependencyTypeUtil.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,70 @@ | ||
/* | ||
* 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.schema.util; | ||
|
||
import com.evolveum.midpoint.util.MiscUtil; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectTypeDependencyStrictnessType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectTypeDependencyType; | ||
|
||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Objects; | ||
|
||
import static com.evolveum.midpoint.prism.Referencable.getOid; | ||
import static com.evolveum.midpoint.util.MiscUtil.or0; | ||
import static com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectTypeDependencyStrictnessType.STRICT; | ||
|
||
public class ResourceObjectTypeDependencyTypeUtil { | ||
|
||
public static String describe(ResourceObjectTypeDependencyType dependency) { | ||
return describe(dependency, null); | ||
} | ||
|
||
public static String describe(ResourceObjectTypeDependencyType dependency, @Nullable String resourceName) { | ||
if (dependency == null) { | ||
return "null"; | ||
} else { | ||
String resourceOid = getOid(dependency.getResourceRef()); | ||
return String.format("%s/%s on %s; with order=%d", | ||
dependency.getKind(), | ||
dependency.getIntent() != null ? dependency.getIntent() : "(not specified)", | ||
resourceName != null ? | ||
resourceName + " (" + resourceOid + ")" : | ||
resourceOid, | ||
or0(dependency.getOrder())); | ||
} | ||
} | ||
|
||
public static @NotNull String getResourceOidRequired(@NotNull ResourceObjectTypeDependencyType dependency) { | ||
return MiscUtil.argNonNull( | ||
getOid(dependency.getResourceRef()), | ||
() -> "No resource OID in dependency [" + describe(dependency) + "]"); | ||
} | ||
|
||
public static @NotNull ShadowKindType getKindRequired(@NotNull ResourceObjectTypeDependencyType dependency) { | ||
return MiscUtil.argNonNull( | ||
dependency.getKind(), | ||
() -> "No kind in dependency [" + describe(dependency) + "]"); | ||
} | ||
|
||
public static ResourceObjectTypeDependencyStrictnessType getDependencyStrictness( | ||
ResourceObjectTypeDependencyType dependency) { | ||
return Objects.requireNonNullElse(dependency.getStrictness(), STRICT); | ||
} | ||
|
||
public static boolean isStrict(ResourceObjectTypeDependencyType dependency) { | ||
return getDependencyStrictness(dependency) == STRICT; | ||
} | ||
|
||
public static boolean isForceLoadDependentShadow(ResourceObjectTypeDependencyType dependency) { | ||
return Boolean.TRUE.equals(dependency.isForceLoad()); | ||
} | ||
} |
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.