use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class VMConsoleProxyServlet method availablePublicKeys.
// TODO: implmement key filtering based on input parameters
private List<Map<String, String>> availablePublicKeys(String keyFingerPrint, String keyType, String keyContent) {
List<Map<String, String>> jsonUsers = new ArrayList<>();
QueryParametersBase userProfileParams = new QueryParametersBase();
QueryReturnValue v = backend.runInternalQuery(QueryType.GetAllUserProfiles, userProfileParams);
if (v != null) {
List<UserProfile> profiles = v.getReturnValue();
for (UserProfile profile : profiles) {
if (StringUtils.isNotEmpty(profile.getSshPublicKey())) {
for (String publicKey : StringUtils.split(profile.getSshPublicKey(), "\n")) {
if (StringUtils.isNotEmpty(publicKey)) {
Map<String, String> jsonUser = new HashMap<>();
jsonUser.put("entityid", profile.getUserId().toString());
jsonUser.put("entity", profile.getLoginName());
jsonUser.put("key", publicKey.trim());
jsonUsers.add(jsonUser);
}
}
}
}
}
return jsonUsers;
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class BackendGroupsResource method add.
@Override
public Response add(Group group) {
List<String> authzProvidersNames = getBackendCollection(String.class, QueryType.GetDomainList, new QueryParametersBase());
validateParameters(group, "name");
if (AuthzUtils.getAuthzNameFromEntityName(group.getName(), authzProvidersNames) == null) {
validateParameters(group, "domain.id|name");
}
String directoryName = getAuthzProviderName(group, authzProvidersNames);
DirectoryGroup directoryGroup = findDirectoryGroup(directoryName, group);
if (directoryGroup == null) {
return Response.status(Status.BAD_REQUEST).entity("No such group: " + group.getName() + " in directory " + directoryName).build();
}
AddGroupParameters parameters = new AddGroupParameters();
parameters.setGroupToAdd(new DbGroup(directoryGroup));
QueryIdResolver<Guid> resolver = new QueryIdResolver<>(QueryType.GetDbGroupById, IdQueryParameters.class);
return performCreate(ActionType.AddGroup, parameters, resolver, BaseResource.class);
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class BackendOpenStackStorageProviderHelper method getStorageDomainId.
/**
* Finds the identifier of the storage domain corresponding to the given provider.
*
* @param resource the resource that will be used to perform the operation
* @param providerId identifier of the provider
* @return the identifier of the corresponding storage domain or {@code null} if no such storage domain exists
*/
public static Guid getStorageDomainId(BackendResource resource, String providerId) {
// The backend doesn't have any mechanism to obtain the images other than listing the images provided by the
// storage domain that is created for the provider, and the only way to find that provider is to iterate the
// complete list. This is potentially very slow, so it should be improved in the future.
Guid storageDomainId = null;
List<StorageDomain> storageDomains = resource.runQuery(QueryType.GetAllStorageDomains, new QueryParametersBase()).getReturnValue();
for (StorageDomain storageDomain : storageDomains) {
String storageId = storageDomain.getStorage();
if (providerId.equals(storageId)) {
storageDomainId = storageDomain.getId();
break;
}
}
return storageDomainId;
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class ClusterModel method initMacPools.
private void initMacPools() {
setMacPoolListModel(new SortedListModel<>(Linq.SharedMacPoolComparator));
setMacPoolModel(new MacPoolModel());
getMacPoolModel().setIsChangeable(false);
getMacPoolListModel().getItemsChangedEvent().addListener(this);
getMacPoolListModel().getSelectedItemChangedEvent().addListener(this);
startProgress();
Frontend.getInstance().runQuery(QueryType.GetAllMacPools, new QueryParametersBase(), new AsyncQuery<QueryReturnValue>(returnValue -> {
getMacPoolListModel().setItems(returnValue.getReturnValue());
stopProgress();
}));
}
use of org.ovirt.engine.core.common.queries.QueryParametersBase in project ovirt-engine by oVirt.
the class BackendAssignedPermissionsResource method lookupUsers.
private List<DbUser> lookupUsers() {
QueryParametersBase queryParams = new QueryParametersBase();
queryParams.setFiltered(isFiltered());
return getBackendCollection(DbUser.class, QueryType.GetAllDbUsers, queryParams);
}
Aggregations