use of com.haulmont.cuba.gui.app.security.entity.EntityPermissionTarget in project cuba by cuba-platform.
the class EntityNameFilter method test.
@Override
public boolean test(@Nullable T target) {
if (target != null) {
if (Boolean.TRUE.equals(assignedOnlyCheckBox.getValue()) && !target.isAssigned()) {
return false;
}
if (Boolean.FALSE.equals(systemLevelCheckBox.getValue()) && (target instanceof EntityPermissionTarget) && !target.isAssigned()) {
Class entityClass = ((EntityPermissionTarget) target).getEntityClass();
MetaClass metaClass = metadata.getSession().getClassNN(entityClass);
if (metadata.getTools().isSystemLevel(metaClass)) {
return false;
}
}
String filterValue = StringUtils.trimToEmpty(entityFilter.<String>getValue());
return StringUtils.isBlank(filterValue) || StringUtils.containsIgnoreCase(target.getCaption(), filterValue);
}
return false;
}
Aggregations