if (validityCondition instanceof CapabilityContextAware) {
((CapabilityContextAware) validityCondition).setContext(reference.context());
}
}
catch (Exception e) {
validityCondition = new SatisfiedCondition(
"Always satisfied (failed to determine validity condition)"
);
log.error(
"Could not get validation condition from capability {} ({}). Considering it as always valid",
new Object[]{reference.capability(), reference.context().id(), e}
);
}
if (validityCondition == null) {
validityCondition = new SatisfiedCondition("Always satisfied (capability has no validity condition)");
}
validityCondition.bind();
}
return this;
}