private static Map<String, String> mapExternalRoleMapping(RegistrationRoleMappings model) { return model.getRegistrationRoleMappings() .stream() .collect(Collectors.toMap( registrationMap -> registrationMap.isSetFrom() ? registrationMap.getFrom().getName() : null, registrationMap -> registrationMap.isSetTo() ? RoleMapper.map(registrationMap.getTo(), null).getName() : null)); }
public void remove() { if (getWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().removeRolesTitle()); model.setHelpTag(HelpTag.remove_role); model.setHashName("remove_role"); //$NON-NLS-1$ ArrayList<String> list = new ArrayList<>(); for (Role role : getSelectedItems()) { list.add(role.getName()); } model.setItems(list); UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this); //$NON-NLS-1$ model.getCommands().add(tempVar); UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this); //$NON-NLS-1$ model.getCommands().add(tempVar2); }
/** * Ensures that retrieving a role by name works as expected. */ @Test public void testGetRoleByName() { Role result = dao.getByName(existingEntity.getName()); assertNotNull(result); assertEquals(existingEntity, result); }
@Test public void testGetEntityNameByIdAndTypeForRole() { Role role = roleDao.get(ROLE_ID); assertNotNull(role); String name = role.getName(); assertEquals(name, dao.getEntityNameByIdAndType(ROLE_ID, VdcObjectType.Role)); }
@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); }