Search in sources :

Example 1 with IdParameters

use of org.ovirt.engine.core.common.action.IdParameters in project ovirt-engine by oVirt.

the class UserListModel method onRemove.

public void onRemove() {
    List<DbUser> selectedItems = getSelectedItems();
    ArrayList<ActionParametersBase> userPrms = new ArrayList<>();
    ArrayList<ActionParametersBase> groupPrms = new ArrayList<>();
    for (DbUser item : selectedItems) {
        if (!item.isGroup()) {
            userPrms.add(new IdParameters(item.getId()));
        } else {
            groupPrms.add(new IdParameters(item.getId()));
        }
    }
    IFrontendMultipleActionAsyncCallback lastCallback = result -> Scheduler.get().scheduleDeferred(() -> {
        // Refresh user list.
        syncSearch();
        cancel();
    });
    if (getUserOrGroup() == UserOrGroup.User) {
        if (userPrms.size() > 0) {
            Frontend.getInstance().runMultipleAction(ActionType.RemoveUser, userPrms, lastCallback);
        }
    } else if (getUserOrGroup() == UserOrGroup.Group) {
        if (groupPrms.size() > 0) {
            Frontend.getInstance().runMultipleAction(ActionType.RemoveGroup, groupPrms, lastCallback);
        }
    }
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) TagModel(org.ovirt.engine.ui.uicommonweb.models.tags.TagModel) QueryType(org.ovirt.engine.core.common.queries.QueryType) AttachEntityToTagParameters(org.ovirt.engine.core.common.action.AttachEntityToTagParameters) AddGroupParameters(org.ovirt.engine.core.common.action.AddGroupParameters) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) Guid(org.ovirt.engine.core.compat.Guid) AdSearchType(org.ovirt.engine.ui.uicommonweb.models.users.AdElementListModel.AdSearchType) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback) Inject(com.google.inject.Inject) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) TagListModel(org.ovirt.engine.ui.uicommonweb.models.tags.TagListModel) HashMap(java.util.HashMap) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) IFrontendMultipleActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) Map(java.util.Map) Tags(org.ovirt.engine.core.common.businessentities.Tags) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) ActionUtils(org.ovirt.engine.core.common.ActionUtils) UserOrGroup(org.ovirt.engine.core.searchbackend.VdcUserConditionFieldAutoCompleter.UserOrGroup) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) DbGroup(org.ovirt.engine.core.common.businessentities.aaa.DbGroup) Scheduler(com.google.gwt.core.client.Scheduler) List(java.util.List) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) AddUserParameters(org.ovirt.engine.core.common.action.AddUserParameters) TagAssigningModel(org.ovirt.engine.ui.uicommonweb.TagAssigningModel) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) IdParameters(org.ovirt.engine.core.common.action.IdParameters) IFrontendMultipleActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendMultipleActionAsyncCallback) IdParameters(org.ovirt.engine.core.common.action.IdParameters) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser)

Example 2 with IdParameters

use of org.ovirt.engine.core.common.action.IdParameters in project ovirt-engine by oVirt.

the class BackendQuotaResource method remove.

@Override
public Response remove() {
    get();
    IdParameters prms = new IdParameters(asGuid(id));
    return performAction(ActionType.RemoveQuota, prms);
}
Also used : IdParameters(org.ovirt.engine.core.common.action.IdParameters)

Example 3 with IdParameters

use of org.ovirt.engine.core.common.action.IdParameters in project ovirt-engine by oVirt.

the class RemoveAdGroupCommandTest method initializeCommand.

@Before
public void initializeCommand() {
    IdParameters parameters = createParameters();
    command = spy(new RemoveGroupCommand<>(parameters, null));
}
Also used : IdParameters(org.ovirt.engine.core.common.action.IdParameters) Before(org.junit.Before)

Example 4 with IdParameters

use of org.ovirt.engine.core.common.action.IdParameters in project ovirt-engine by oVirt.

the class QuotaListModel method onRemove.

public void onRemove() {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> prms = new ArrayList<>();
    for (Quota a : getSelectedItems()) {
        IdParameters idParameters = new IdParameters(a.getId());
        prms.add(idParameters);
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveQuota, prms, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : IdParameters(org.ovirt.engine.core.common.action.IdParameters) Quota(org.ovirt.engine.core.common.businessentities.Quota) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 5 with IdParameters

use of org.ovirt.engine.core.common.action.IdParameters in project ovirt-engine by oVirt.

the class ExternalNetworkSyncService method synchronize.

private void synchronize() {
    List<Provider<?>> networkProviders = providerDao.getAllByTypes(ProviderType.EXTERNAL_NETWORK, ProviderType.OPENSTACK_NETWORK);
    networkProviders.stream().filter(provider -> {
        OpenstackNetworkProviderProperties networkProperties = (OpenstackNetworkProviderProperties) provider.getAdditionalProperties();
        return networkProperties.getAutoSync();
    }).map(Provider::getId).distinct().forEach(providerId -> {
        backendInternal.runInternalAction(ActionType.SyncNetworkProvider, new IdParameters(providerId));
    });
}
Also used : OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) Logger(org.slf4j.Logger) ProviderDao(org.ovirt.engine.core.dao.provider.ProviderDao) LoggerFactory(org.slf4j.LoggerFactory) Provider(org.ovirt.engine.core.common.businessentities.Provider) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) ThreadPools(org.ovirt.engine.core.utils.threadpool.ThreadPools) TimeUnit(java.util.concurrent.TimeUnit) Inject(javax.inject.Inject) ActionType(org.ovirt.engine.core.common.action.ActionType) List(java.util.List) BackendInternal(org.ovirt.engine.core.bll.interfaces.BackendInternal) PostConstruct(javax.annotation.PostConstruct) ProviderType(org.ovirt.engine.core.common.businessentities.ProviderType) ApplicationScoped(javax.enterprise.context.ApplicationScoped) BackendService(org.ovirt.engine.core.common.BackendService) IdParameters(org.ovirt.engine.core.common.action.IdParameters) ManagedScheduledExecutorService(javax.enterprise.concurrent.ManagedScheduledExecutorService) Config(org.ovirt.engine.core.common.config.Config) IdParameters(org.ovirt.engine.core.common.action.IdParameters) OpenstackNetworkProviderProperties(org.ovirt.engine.core.common.businessentities.OpenstackNetworkProviderProperties) Provider(org.ovirt.engine.core.common.businessentities.Provider)

Aggregations

IdParameters (org.ovirt.engine.core.common.action.IdParameters)5 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 ActionType (org.ovirt.engine.core.common.action.ActionType)2 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)2 Scheduler (com.google.gwt.core.client.Scheduler)1 Inject (com.google.inject.Inject)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TimeUnit (java.util.concurrent.TimeUnit)1 PostConstruct (javax.annotation.PostConstruct)1 ManagedScheduledExecutorService (javax.enterprise.concurrent.ManagedScheduledExecutorService)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1 Inject (javax.inject.Inject)1 Before (org.junit.Before)1 BackendInternal (org.ovirt.engine.core.bll.interfaces.BackendInternal)1 ActionUtils (org.ovirt.engine.core.common.ActionUtils)1 BackendService (org.ovirt.engine.core.common.BackendService)1