@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.getName().setEntity(COPY_OF + role.getName()); model.getDescription().setEntity(role.getDescription()); if (commandType == CommandType.Edit) { model.getName().setIsChangeable(!role.isReadonly());