Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop visiting embedded objects by default
Visitor in prism module did NOT visit objects embedded in references for a very long time. Recently we changed this behavior and started visiting embedded objects - in order to assure encryption of protected values in such objects (see 60328c4). But this change broke other things, like resolution of references in ApprovalSchemaExecutionInformationType. Analysis of other uses indicate that visiting embedded objects can be wrong in other contexts as well. So now we are reverting to the old behavior and providing ConfigurableVisitor to allow controlling this feature. This resolves MID-6171.
- Loading branch information
Showing
10 changed files
with
70 additions
and
17 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
34 changes: 34 additions & 0 deletions
34
infra/prism-api/src/main/java/com/evolveum/midpoint/prism/ConfigurableVisitor.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,34 @@ | ||
/* | ||
* Copyright (c) 2020 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.prism; | ||
|
||
import com.evolveum.midpoint.util.annotation.Experimental; | ||
|
||
/** | ||
* Visitor with configurable behavior. | ||
*/ | ||
@Experimental | ||
public interface ConfigurableVisitor<T extends Visitable<T>> extends Visitor<T> { | ||
|
||
/** | ||
* Should we visit also objects that are embedded in references? | ||
*/ | ||
boolean shouldVisitEmbeddedObjects(); | ||
|
||
/** | ||
* Helper method. | ||
*/ | ||
static boolean shouldVisitEmbeddedObjects(Visitor<?> visitor) { | ||
//noinspection SimplifiableIfStatement | ||
if (visitor instanceof ConfigurableVisitor) { | ||
return ((ConfigurableVisitor<?>) visitor).shouldVisitEmbeddedObjects(); | ||
} else { | ||
return false; // This is the behavior before 60328c40b2b99c6cf41ab6ce90145fae941d07bd (March 24th, 2020) | ||
} | ||
} | ||
} |
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