Search in sources :

Example 1 with MacPool

use of org.ovirt.engine.core.common.businessentities.MacPool in project ovirt-engine by oVirt.

the class ClusterListModel method addMacPool.

private void addMacPool(final ClusterModel clusterModel) {
    SharedMacPoolModel macPoolModel = new NewSharedMacPoolModel.ClosingWithSetConfirmWindow(this) {

        @Override
        protected void onActionSucceeded(Guid macPoolId) {
            MacPool macPool = getEntity();
            macPool.setId(macPoolId);
            Collection<MacPool> macPools = new ArrayList<>(clusterModel.getMacPoolListModel().getItems());
            macPools.add(macPool);
            clusterModel.getMacPoolListModel().setItems(macPools);
            clusterModel.getMacPoolListModel().setSelectedItem(macPool);
            ClusterListModel.this.setConfirmWindow(null);
        }
    };
    macPoolModel.setEntity(new MacPool());
    setConfirmWindow(macPoolModel);
}
Also used : MacPool(org.ovirt.engine.core.common.businessentities.MacPool) ArrayList(java.util.ArrayList) SharedMacPoolModel(org.ovirt.engine.ui.uicommonweb.models.macpool.SharedMacPoolModel) NewSharedMacPoolModel(org.ovirt.engine.ui.uicommonweb.models.macpool.NewSharedMacPoolModel) Guid(org.ovirt.engine.core.compat.Guid)

Example 2 with MacPool

use of org.ovirt.engine.core.common.businessentities.MacPool in project ovirt-engine by oVirt.

the class MacPoolValidatorTest method callHasUniqueName.

private ValidationResult callHasUniqueName(Guid macPool1Id, Guid macPool2Id, String macPool1Name, String macPool2Name) {
    final MacPool existingMacPool = new MacPool();
    existingMacPool.setId(macPool1Id);
    existingMacPool.setName(macPool1Name);
    when(macPoolDaoMock.getAll()).thenReturn(Collections.singletonList(existingMacPool));
    macPool.setId(macPool2Id);
    macPool.setName(macPool2Name);
    return macPoolValidator.hasUniqueName();
}
Also used : MacPool(org.ovirt.engine.core.common.businessentities.MacPool)

Example 3 with MacPool

use of org.ovirt.engine.core.common.businessentities.MacPool in project ovirt-engine by oVirt.

the class SharedMacPoolListModel method newMacPool.

private void newMacPool() {
    SharedMacPoolModel model = new NewSharedMacPoolModel(this);
    model.setEntity(new MacPool());
    setWindow(model);
}
Also used : MacPool(org.ovirt.engine.core.common.businessentities.MacPool)

Example 4 with MacPool

use of org.ovirt.engine.core.common.businessentities.MacPool in project ovirt-engine by oVirt.

the class SharedMacPoolListModel method onRemove.

private void onRemove() {
    cancel();
    ArrayList<ActionParametersBase> params = new ArrayList<>();
    for (MacPool macPool : getSelectedItems()) {
        params.add(new RemoveMacPoolByIdParameters(macPool.getId()));
    }
    Frontend.getInstance().runMultipleAction(ActionType.RemoveMacPool, params);
}
Also used : MacPool(org.ovirt.engine.core.common.businessentities.MacPool) ArrayList(java.util.ArrayList) RemoveMacPoolByIdParameters(org.ovirt.engine.core.common.action.RemoveMacPoolByIdParameters) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 5 with MacPool

use of org.ovirt.engine.core.common.businessentities.MacPool in project ovirt-engine by oVirt.

the class SharedMacPoolModel method onSave.

private void onSave() {
    if (getProgress() != null || !validate()) {
        return;
    }
    startProgress();
    MacPool macPool = flush();
    Frontend.getInstance().runAction(actionType, new MacPoolParameters(macPool), result -> {
        stopProgress();
        if (result.getReturnValue() != null && result.getReturnValue().getSucceeded()) {
            onActionSucceeded((Guid) result.getReturnValue().getActionReturnValue());
        }
    });
}
Also used : MacPool(org.ovirt.engine.core.common.businessentities.MacPool) MacPoolParameters(org.ovirt.engine.core.common.action.MacPoolParameters)

Aggregations

MacPool (org.ovirt.engine.core.common.businessentities.MacPool)20 Test (org.junit.Test)8 Guid (org.ovirt.engine.core.compat.Guid)5 ArrayList (java.util.ArrayList)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)3 MacRange (org.ovirt.engine.core.common.businessentities.MacRange)3 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 MacPoolParameters (org.ovirt.engine.core.common.action.MacPoolParameters)1 RemoveMacPoolByIdParameters (org.ovirt.engine.core.common.action.RemoveMacPoolByIdParameters)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)1 EngineException (org.ovirt.engine.core.common.errors.EngineException)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1 NewSharedMacPoolModel (org.ovirt.engine.ui.uicommonweb.models.macpool.NewSharedMacPoolModel)1 SharedMacPoolModel (org.ovirt.engine.ui.uicommonweb.models.macpool.SharedMacPoolModel)1