Search in sources :

Example 21 with GlusterVolumeSnapshotConfig

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

the class GlusterClusterSnapshotConfigureOptionsPopupView method initEditors.

private void initEditors() {
    clusterEditor = new ListModelListBoxEditor<>(new NameRenderer<Cluster>());
    configsTable = new EntityModelCellTable<>(false, true);
    configsTable.setSelectionModel(new NoSelectionModel());
    configsTable.addColumn(new AbstractEntityModelTextColumn<GlusterVolumeSnapshotConfig>() {

        @Override
        public String getText(GlusterVolumeSnapshotConfig object) {
            return object.getParamName();
        }
    }, constants.volumeSnapshotConfigName(), // $NON-NLS-1$
    "200px");
    Column<EntityModel<GlusterVolumeSnapshotConfig>, String> valueColumn = new Column<EntityModel<GlusterVolumeSnapshotConfig>, String>(new TextInputCell()) {

        @Override
        public String getValue(EntityModel<GlusterVolumeSnapshotConfig> object) {
            return object.getEntity().getParamValue();
        }
    };
    // $NON-NLS-1$
    configsTable.addColumn(valueColumn, constants.volumeSnapshotConfigValue(), "100px");
    valueColumn.setFieldUpdater((index, object, value) -> object.getEntity().setParamValue(value));
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) AbstractEntityModelTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn) Column(com.google.gwt.user.cellview.client.Column) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) TextInputCell(com.google.gwt.cell.client.TextInputCell)

Example 22 with GlusterVolumeSnapshotConfig

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

the class GlusterSnapshotSyncJob method addOrUpdateClusterConfig.

private void addOrUpdateClusterConfig(Cluster cluster, final String paramName, final String paramValue) {
    GlusterVolumeSnapshotConfig param = new GlusterVolumeSnapshotConfig();
    param.setClusterId(cluster.getId());
    param.setVolumeId(null);
    param.setParamName(paramName);
    param.setParamValue(paramValue);
    GlusterVolumeSnapshotConfig existingParamDetail = volumeSnapshotConfigDao.getConfigByClusterIdAndName(cluster.getId(), paramName);
    if (existingParamDetail == null) {
        volumeSnapshotConfigDao.save(param);
        log.debug("Detected new gluster volume snapshot configuration '{}' with value '{}' for cluster: '{}'", paramName, paramValue, cluster.getName());
        Map<String, String> customValues = new HashMap<>();
        customValues.put("snapConfigName", paramName);
        customValues.put("snapConfigValue", paramValue);
        logUtil.logAuditMessage(cluster.getId(), cluster.getName(), null, null, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_CLUSTER_CONFIG_DETECTED_NEW, customValues);
    } else if (!existingParamDetail.getParamValue().equals(paramValue)) {
        volumeSnapshotConfigDao.updateConfigByClusterIdAndName(cluster.getId(), paramName, paramValue);
    }
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) HashMap(java.util.HashMap)

Example 23 with GlusterVolumeSnapshotConfig

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

the class GlusterSnapshotSyncJob method addOrUpdateVolumeConfig.

private void addOrUpdateVolumeConfig(Cluster cluster, final GlusterVolumeEntity volume, final String paramName, final String paramValue) {
    GlusterVolumeSnapshotConfig cfg = new GlusterVolumeSnapshotConfig();
    cfg.setClusterId(cluster.getId());
    cfg.setVolumeId(volume.getId());
    cfg.setParamName(paramName);
    cfg.setParamValue(paramValue);
    GlusterVolumeSnapshotConfig existingParamDetail = volumeSnapshotConfigDao.getConfigByVolumeIdAndName(cluster.getId(), volume.getId(), paramName);
    if (existingParamDetail == null) {
        volumeSnapshotConfigDao.save(cfg);
        log.debug("Detected new gluster volume snapshot configuration '{}' with value '{}' for volume: '{}' on cluster '{}'", paramName, paramValue, cluster.getName(), volume.getName());
        Map<String, String> customValues = new HashMap<>();
        customValues.put("snapConfigName", paramName);
        customValues.put("snapConfigValue", paramValue);
        customValues.put(GlusterConstants.VOLUME_NAME, volume.getName());
        logUtil.logAuditMessage(cluster.getId(), cluster.getName(), volume, null, AuditLogType.GLUSTER_VOLUME_SNAPSHOT_VOLUME_CONFIG_DETECTED_NEW, customValues);
    } else if (!existingParamDetail.getParamValue().equals(paramValue)) {
        volumeSnapshotConfigDao.updateConfigByVolumeIdAndName(cluster.getId(), volume.getId(), paramName, paramValue);
    }
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) HashMap(java.util.HashMap)

Aggregations

GlusterVolumeSnapshotConfig (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig)23 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)5 HashMap (java.util.HashMap)4 Guid (org.ovirt.engine.core.compat.Guid)3 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)3 List (java.util.List)2 UpdateGlusterVolumeSnapshotConfigParameters (org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters)2 GlusterClusterSnapshotConfigModel (org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel)2 TextInputCell (com.google.gwt.cell.client.TextInputCell)1 Column (com.google.gwt.user.cellview.client.Column)1 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Inject (javax.inject.Inject)1 Named (javax.inject.Named)1 Singleton (javax.inject.Singleton)1 StringUtils (org.apache.commons.lang.StringUtils)1