use of org.ovirt.engine.core.common.businessentities.ActionGroup in project ovirt-engine by oVirt.
the class RoleListModel method eventRaised.
@Override
public void eventRaised(Event ev, Object sender, EventArgs args) {
super.eventRaised(ev, sender, args);
if (getWindow() != null && sender == ((RoleModel) getWindow()).getIsAdminRole()) {
if (commandType == CommandType.New) {
List<ActionGroup> selectedActionGroups = new ArrayList<>();
selectedActionGroups.add(ActionGroup.LOGIN);
setAttachedActionGroups(selectedActionGroups);
} else {
Role role = getSelectedItem();
Frontend.getInstance().runQuery(QueryType.GetRoleActionGroupsByRoleId, new IdQueryParameters(role.getId()), new AsyncQuery<QueryReturnValue>(returnValue -> {
publicAttachedActions = returnValue.getReturnValue();
setAttachedActionGroups(publicAttachedActions);
}));
}
}
}
use of org.ovirt.engine.core.common.businessentities.ActionGroup in project ovirt-engine by oVirt.
the class RoleListModel method onReset.
public void onReset() {
RoleModel model = (RoleModel) getWindow();
ArrayList<ActionGroup> attachedActions = commandType == CommandType.New ? new ArrayList<ActionGroup>() : publicAttachedActions;
for (SelectionTreeNodeModel sm : model.getPermissionGroupModels()) {
for (SelectionTreeNodeModel smChild : sm.getChildren()) {
for (SelectionTreeNodeModel smGrandChild : smChild.getChildren()) {
smGrandChild.setIsSelectedNullable(attachedActions.contains(ActionGroup.valueOf(smGrandChild.getTitle())));
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.ActionGroup in project ovirt-engine by oVirt.
the class VmModelBehaviorBase method postInitStorageDomains.
protected void postInitStorageDomains() {
if (getModel().getDisks() == null) {
return;
}
ActionGroup actionGroup = getModel().isCreateInstanceOnly() ? ActionGroup.CREATE_INSTANCE : ActionGroup.CREATE_VM;
StoragePool dataCenter = getModel().getSelectedDataCenter();
AsyncDataProvider.getInstance().getPermittedStorageDomainsByStoragePoolId(new AsyncQuery<>(storageDomains -> {
ArrayList<StorageDomain> activeStorageDomains = filterStorageDomains(storageDomains);
boolean provisioning = getModel().getProvisioning().getEntity();
ArrayList<DiskModel> disks = (ArrayList<DiskModel>) getModel().getDisks();
activeStorageDomains.sort(new NameableComparator());
List<DiskModel> diskImages = Linq.filterDisksByType(disks, DiskStorageType.IMAGE);
for (DiskModel diskModel : diskImages) {
List<StorageDomain> availableDiskStorageDomains;
diskModel.getQuota().setItems(getModel().getQuota().getItems());
List<Guid> storageIds = ((DiskImage) diskModel.getDisk()).getStorageIds();
// Active storage domains that the disk resides on
List<StorageDomain> activeDiskStorageDomains = Linq.getStorageDomainsByIds(storageIds, activeStorageDomains);
// Set target storage domains
availableDiskStorageDomains = provisioning ? activeStorageDomains : activeDiskStorageDomains;
availableDiskStorageDomains.sort(new NameableComparator());
diskModel.getStorageDomain().setItems(availableDiskStorageDomains);
diskModel.getStorageDomain().setChangeProhibitionReason(constants.noActiveTargetStorageDomainAvailableMsg());
diskModel.getStorageDomain().setIsChangeable(!availableDiskStorageDomains.isEmpty());
}
List<DiskModel> cinderDisks = Linq.filterDisksByType(disks, DiskStorageType.CINDER);
Collection<StorageDomain> cinderStorageDomains = Linq.filterStorageDomainsByStorageType(storageDomains, StorageType.CINDER);
initStorageDomainsForCinderDisks(cinderDisks, cinderStorageDomains);
}), dataCenter.getId(), actionGroup);
}
use of org.ovirt.engine.core.common.businessentities.ActionGroup in project ovirt-engine by oVirt.
the class AttachActionGroupsToRoleCommandTest method generateParameters.
@Override
protected ActionGroupsToRoleParameter generateParameters() {
Guid roleId = Guid.newGuid();
ArrayList<ActionGroup> groups = new ArrayList<>(Arrays.asList(ActionGroup.DELETE_HOST, ActionGroup.CONFIGURE_ENGINE));
return new ActionGroupsToRoleParameter(roleId, groups);
}
use of org.ovirt.engine.core.common.businessentities.ActionGroup in project ovirt-engine by oVirt.
the class DetachActionGroupsFromRoleCommandTest method mockRoleGroups.
/**
* Mock the action groups remaining on the role AFTER some were detached
*/
private void mockRoleGroups(ActionGroup... groups) {
List<RoleGroupMap> maps = new ArrayList<>();
for (ActionGroup group : groups) {
maps.add(new RoleGroupMap(group, getParams().getRoleId()));
}
when(getRoleGroupMapDaoMock().getAllForRole(getParams().getRoleId())).thenReturn(maps);
}
Aggregations