use of com.evolveum.midpoint.prism.Visitor in project midpoint by Evolveum.
the class CryptoUtil method checkEncrypted.
// Checks that everything is encrypted
public static <T extends ObjectType> void checkEncrypted(final ObjectDelta<T> delta) {
Visitor visitor = new Visitor() {
@Override
public void visit(Visitable visitable) {
if (!(visitable instanceof PrismPropertyValue)) {
return;
}
PrismPropertyValue<?> pval = (PrismPropertyValue<?>) visitable;
checkEncrypted(pval);
}
};
try {
delta.accept(visitor);
} catch (IllegalStateException e) {
throw new IllegalStateException(e.getMessage() + " in delta " + delta, e);
}
}
use of com.evolveum.midpoint.prism.Visitor in project midpoint by Evolveum.
the class CryptoUtil method checkEncrypted.
public static void checkEncrypted(Collection<? extends ItemDelta> modifications) {
Visitor visitor = new Visitor() {
@Override
public void visit(Visitable visitable) {
if (!(visitable instanceof PrismPropertyValue)) {
return;
}
PrismPropertyValue<?> pval = (PrismPropertyValue<?>) visitable;
checkEncrypted(pval);
}
};
for (ItemDelta<?, ?> delta : modifications) {
try {
delta.accept(visitor);
} catch (IllegalStateException e) {
throw new IllegalStateException(e.getMessage() + " in modification " + delta, e);
}
}
}
use of com.evolveum.midpoint.prism.Visitor in project midpoint by Evolveum.
the class PrismAsserts method assertAllParsedNodes.
public static void assertAllParsedNodes(XNode xnode) {
Visitor visitor = new Visitor() {
@Override
public void visit(Visitable visitable) {
if ((visitable instanceof PrimitiveXNode<?>)) {
assert ((PrimitiveXNode<?>) visitable).isParsed() : "Xnode " + visitable + " is not parsed";
}
}
};
xnode.accept(visitor);
}
use of com.evolveum.midpoint.prism.Visitor in project midpoint by Evolveum.
the class PrismAsserts method assertOrigin.
public static void assertOrigin(ObjectDelta<?> objectDelta, final Objectable expectedOriginObject, final OriginType... expectedOriginTypes) {
Visitor visitor = createOriginVisitor(objectDelta, expectedOriginObject, expectedOriginTypes);
objectDelta.accept(visitor, false);
}
use of com.evolveum.midpoint.prism.Visitor in project midpoint by Evolveum.
the class Utils method resolveReferences.
/**
* Resolves references contained in given PrismObject.
*
* @param object
* @param repository
* @param enforceReferentialIntegrity If true, missing reference causes fatal error when processing (if false, only warning is issued).
* @param forceFilterReevaluation If true, references are reevaluated even if OID is present. (Given that filter is present as well, of course.)
* @param prismContext
* @param result
*/
public static <T extends ObjectType> void resolveReferences(PrismObject<T> object, RepositoryService repository, boolean enforceReferentialIntegrity, boolean forceFilterReevaluation, EvaluationTimeType resolutionTime, boolean throwExceptionOnFailure, PrismContext prismContext, OperationResult result) {
Visitor visitor = visitable -> {
if (!(visitable instanceof PrismReferenceValue)) {
return;
}
resolveRef((PrismReferenceValue) visitable, repository, enforceReferentialIntegrity, forceFilterReevaluation, resolutionTime, prismContext, object.toString(), throwExceptionOnFailure, result);
};
object.accept(visitor);
}
Aggregations