use of com.evolveum.midpoint.util.Producer in project midpoint by Evolveum.
the class PasswordPanel method getValuePolicy.
protected <F extends FocusType> ValuePolicyType getValuePolicy(PrismObject<F> object) {
ValuePolicyType valuePolicyType = null;
try {
MidPointPrincipal user = AuthUtil.getPrincipalUser();
if (getPageBase() != null) {
if (user != null) {
Task task = getPageBase().createSimpleTask("load value policy");
valuePolicyType = searchValuePolicy(object, task);
} else {
valuePolicyType = getPageBase().getSecurityContextManager().runPrivileged(new Producer<ValuePolicyType>() {
private static final long serialVersionUID = 1L;
@Override
public ValuePolicyType run() {
Task task = getPageBase().createAnonymousTask("load value policy");
return searchValuePolicy(object, task);
}
});
}
}
} catch (Exception e) {
LOGGER.warn("Couldn't load security policy for focus " + object, e);
}
return valuePolicyType;
}
Aggregations