private boolean isAnyRoleReadOnly(List roles) { for (Object item : roles) { Role r = (Role) item; if (r.isReadonly()) { return true; } } return false; }
void setAttachedActionGroups(List<ActionGroup> attachedActions) { Role role = getSelectedItem(); RoleModel model = (RoleModel) getWindow(); ArrayList<SelectionTreeNodeModel> selectionTree = RoleTreeView.getRoleTreeView(model.getIsNew() ? false : role.isReadonly(), model.getIsAdminRole().getEntity()); for (SelectionTreeNodeModel sm : selectionTree) { for (SelectionTreeNodeModel smChild : sm.getChildren()) { smChild.setParent(sm); smChild.setIsSelectedNotificationPrevent(false); for (SelectionTreeNodeModel smGrandChild : smChild.getChildren()) { smGrandChild.setParent(smChild); smGrandChild.setIsSelectedNotificationPrevent(false); if (attachedActions.contains(ActionGroup.valueOf(smGrandChild.getTitle()))) { smGrandChild.setIsSelectedNullable(true); smGrandChild.updateParentSelection(); } if (smChild.getChildren().get(0).equals(smGrandChild)) { smGrandChild.updateParentSelection(); } } } } model.setPermissionGroupModels(selectionTree); }
@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); }
model.getName().setIsChangeable(!role.isReadonly()); model.getDescription().setIsChangeable(!role.isReadonly()); if (!role.isReadonly() || commandType == CommandType.Clone) { UICommand tempVar = UICommand.createDefaultOkUiCommand("OnSave", this); //$NON-NLS-1$ model.getCommands().add(tempVar); tempVar3.setTitle(!role.isReadonly() ? ConstantsManager.getInstance().getConstants().cancel() : ConstantsManager.getInstance().getConstants().close()); tempVar3.setIsCancel(true); tempVar3.setIsDefault(role.isReadonly()); model.getCommands().add(tempVar3);
@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); }