@Override protected void syncSearch() { super.syncSearch(); QueryParametersBase tempVar = new QueryParametersBase(); tempVar.setRefresh(getIsQueryFirstTime()); Frontend.getInstance().runQuery(QueryType.GetAllRoles, tempVar, new AsyncQuery<QueryReturnValue>(returnValue -> { ArrayList<Role> filteredList = new ArrayList<>(); for (Role item : (ArrayList<Role>) returnValue.getReturnValue()) { // ignore CONSUME_QUOTA_ROLE in UI if (item.getId().equals(ApplicationGuids.quotaConsumer.asGuid())) { continue; } if (getItemsFilter() == null || getItemsFilter() == item.getType()) { filteredList.add(item); } } Collections.sort(filteredList, new NameableComparator()); setItems(filteredList); })); setIsQueryFirstTime(false); }
@Mapping(from = org.ovirt.engine.core.common.businessentities.Role.class, to = Role.class) public static Role map(org.ovirt.engine.core.common.businessentities.Role entity, Role template) { Role model = template != null ? template : new Role(); model.setName(entity.getName()); model.setDescription(entity.getDescription()); model.setId(entity.getId().toString()); model.setMutable(!entity.isReadonly()); model.setAdministrative(RoleType.ADMIN.equals(entity.getType())); return model; }
@Override public void update(Role role) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("description", role.getDescription()) .addValue("id", role.getId()).addValue("name", role.getName()) .addValue("is_readonly", role.isReadonly()) .addValue("role_type", role.getType().getId()) .addValue("allows_viewing_children", role.allowsViewingChildren()); getCallsHandler().executeModification("UpdateRole", parameterSource); }
@Override public void save(Role role) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("description", role.getDescription()) .addValue("id", role.getId()).addValue("name", role.getName()) .addValue("is_readonly", role.isReadonly()) .addValue("role_type", role.getType().getId()) .addValue("allows_viewing_children", role.allowsViewingChildren()) .addValue("app_mode", role.getAppMode().getValue()); getCallsHandler().executeModification("InsertRole", parameterSource); }
model.getIsAdminRole().setEntity(RoleType.ADMIN.equals(role.getType())); model.getName().setEntity(role.getName()); if (commandType == CommandType.Clone) {