use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.
the class InstanceTypeListModel method onDeleteInstanceType.
private void onDeleteInstanceType() {
final ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
boolean latchChecked = !model.validate();
if (model.getProgress() != null || latchChecked) {
return;
}
model.startProgress();
Guid instanceTypeId = getSelectedItem().getId();
Frontend.getInstance().runAction(ActionType.RemoveVmTemplate, new VmTemplateManagementParameters(instanceTypeId), result -> {
model.stopProgress();
cancel();
}, this);
}
use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.
the class NewClusterPolicyModel method refreshCustomProperties.
private void refreshCustomProperties(PolicyUnit toRemove, boolean reset) {
if (!customPropertiesInitialized) {
return;
}
Map<String, String> policyProperties = new HashMap<>();
Map<Guid, PolicyUnit> allPolicyUnits = new HashMap<>();
for (PolicyUnit policyUnit : getUsedFilters()) {
allPolicyUnits.put(policyUnit.getId(), policyUnit);
}
for (Pair<PolicyUnit, Integer> pair : getUsedFunctions()) {
allPolicyUnits.put(pair.getFirst().getId(), pair.getFirst());
}
if (toRemove != null && !allPolicyUnits.containsKey(toRemove.getId())) {
if (toRemove.getParameterRegExMap() != null) {
for (Entry<String, String> entry : toRemove.getParameterRegExMap().entrySet()) {
getCustomProperties().remove(entry.getKey());
}
}
}
PolicyUnit selectedItem = loadBalanceList.getSelectedItem();
allPolicyUnits.put(selectedItem.getId(), selectedItem);
for (PolicyUnit policyUnit : allPolicyUnits.values()) {
if (policyUnit.getParameterRegExMap() != null) {
policyProperties.putAll(policyUnit.getParameterRegExMap());
}
}
Map<String, String> defaultMap = new HashMap<>(getCustomProperties());
if (!reset) {
defaultMap.putAll(KeyValueModel.convertProperties(getCustomPropertySheet().serialize()));
}
getCustomPropertySheet().setKeyValueMap(policyProperties);
getCustomPropertySheet().deserialize(KeyValueModel.convertProperties(defaultMap));
}
use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.
the class NewClusterPolicyModel method initFilters.
private void initFilters() {
getUsedFilters().clear();
getUnusedFilters().clear();
if (clusterPolicy.getFilters() == null) {
getUnusedFilters().addAll(getFilterPolicyUnits(policyUnits));
return;
}
HashMap<Guid, PolicyUnit> map = (HashMap<Guid, PolicyUnit>) ((HashMap<Guid, PolicyUnit>) policyUnitsMap).clone();
for (Guid policyUnitId : clusterPolicy.getFilters()) {
map.remove(policyUnitId);
getUsedFilters().add(policyUnitsMap.get(policyUnitId));
}
initFilterPositions();
getUnusedFilters().addAll(getFilterPolicyUnits(new ArrayList<>(map.values())));
}
use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.
the class VmAffinityGroupListModel method getNewAffinityGroup.
@Override
protected AffinityGroup getNewAffinityGroup() {
AffinityGroup affinityGroup = super.getNewAffinityGroup();
affinityGroup.setVmIds(new ArrayList<Guid>());
affinityGroup.getVmIds().add(getEntity().getId());
return affinityGroup;
}
use of org.ovirt.engine.core.compat.Guid in project ovirt-engine by oVirt.
the class GuideModel method checkVdsClusterChangeSucceeded.
protected void checkVdsClusterChangeSucceeded(final String searchStr, final List<ActionParametersBase> changeVdsParameterList, final List<ActionParametersBase> activateVdsParameterList) {
final Map<Guid, Guid> hostClusterIdMap = new HashMap<>();
for (ActionParametersBase param : changeVdsParameterList) {
hostClusterIdMap.put(((ChangeVDSClusterParameters) param).getVdsId(), ((ChangeVDSClusterParameters) param).getClusterId());
}
Frontend.getInstance().runQuery(QueryType.Search, new SearchParameters(searchStr, SearchType.VDS), new AsyncQuery<QueryReturnValue>(returnValue -> {
List<VDS> hosts = returnValue.getReturnValue();
boolean succeeded = true;
for (VDS host : hosts) {
if (!host.getClusterId().equals(hostClusterIdMap.get(host.getId()))) {
succeeded = false;
}
}
if (!succeeded) {
getWindow().stopProgress();
cancel();
errorPopupManager.show(ConstantsManager.getInstance().getConstants().hostChangeClusterTimeOut());
} else {
activateHostsAfterClusterChange(searchStr, activateVdsParameterList);
}
}));
}
Aggregations