Search in sources :

Example 6 with GlusterVolumeOptionInfo

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

the class VolumeParameterListModel method getOptionsMap.

private HashMap<String, GlusterVolumeOptionInfo> getOptionsMap(Set<GlusterVolumeOptionInfo> optionList) {
    HashMap<String, GlusterVolumeOptionInfo> optionsMap = new HashMap<>();
    for (GlusterVolumeOptionInfo volumeOption : optionList) {
        optionsMap.put(volumeOption.getKey(), volumeOption);
    }
    GlusterVolumeOptionInfo cifsVolumeOption = getCifsVolumeOption();
    optionsMap.put(cifsVolumeOption.getKey(), cifsVolumeOption);
    return optionsMap;
}
Also used : GlusterVolumeOptionInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo) HashMap(java.util.HashMap)

Example 7 with GlusterVolumeOptionInfo

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

the class VolumeParameterListModel method addParameter.

private void addParameter() {
    if (getWindow() != null) {
        return;
    }
    GlusterVolumeEntity volume = getEntity();
    if (volume == null) {
        return;
    }
    VolumeParameterModel volumeParameterModel = new VolumeParameterModel();
    volumeParameterModel.setTitle(ConstantsManager.getInstance().getConstants().addOptionVolume());
    volumeParameterModel.setHelpTag(HelpTag.add_option);
    // $NON-NLS-1$
    volumeParameterModel.setHashName("add_option");
    setWindow(volumeParameterModel);
    volumeParameterModel.startProgress();
    AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
        VolumeParameterModel innerParameterModel = (VolumeParameterModel) getWindow();
        if (!returnValue.getSucceeded()) {
            innerParameterModel.setOptionsMap(new HashMap<String, GlusterVolumeOptionInfo>());
            innerParameterModel.setMessage(ConstantsManager.getInstance().getConstants().errorInFetchingVolumeOptionList());
        } else {
            innerParameterModel.setOptionsMap(getOptionsMap((Set<GlusterVolumeOptionInfo>) returnValue.getReturnValue()));
        }
        innerParameterModel.stopProgress();
        // $NON-NLS-1$
        UICommand command = UICommand.createDefaultOkUiCommand("OnSetParameter", VolumeParameterListModel.this);
        innerParameterModel.getCommands().add(command);
        // $NON-NLS-1$
        innerParameterModel.getCommands().add(UICommand.createCancelUiCommand("OnCancel", VolumeParameterListModel.this));
    });
    asyncQuery.setHandleFailure(true);
    AsyncDataProvider.getInstance().getGlusterVolumeOptionInfoList(asyncQuery, volume.getClusterId());
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Set(java.util.Set) GlusterVolumeOptionInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Aggregations

GlusterVolumeOptionInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo)7 Set (java.util.Set)2 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)2 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2 HashMap (java.util.HashMap)1 GlusterVolumeOptionEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity)1 GlusterParameters (org.ovirt.engine.core.common.queries.gluster.GlusterParameters)1