Search in sources :

Example 1 with V3Statistic

use of org.ovirt.engine.api.v3.types.V3Statistic in project ovirt-engine by oVirt.

the class V3StatisticInAdapter method adapt.

@Override
public Statistic adapt(V3Statistic from) {
    Statistic to = new Statistic();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetBrick()) {
        to.setBrick(adaptIn(from.getBrick()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetDisk()) {
        to.setDisk(adaptIn(from.getDisk()));
    }
    if (from.isSetGlusterVolume()) {
        to.setGlusterVolume(adaptIn(from.getGlusterVolume()));
    }
    if (from.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetHostNic()) {
        to.setHostNic(adaptIn(from.getHostNic()));
    }
    if (from.isSetHostNumaNode()) {
        to.setHostNumaNode(adaptIn(from.getHostNumaNode()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.getType() != null) {
        switch(from.getType()) {
            case COUNTER:
                to.setKind(StatisticKind.COUNTER);
                break;
            case GAUGE:
                to.setKind(StatisticKind.GAUGE);
                break;
        }
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetNic()) {
        to.setNic(adaptIn(from.getNic()));
    }
    if (from.isSetStep()) {
        to.setStep(adaptIn(from.getStep()));
    }
    if (from.isSetUnit()) {
        switch(from.getUnit()) {
            case NONE:
                to.setUnit(StatisticUnit.NONE);
                break;
            case PERCENT:
                to.setUnit(StatisticUnit.PERCENT);
                break;
            case BYTES:
                to.setUnit(StatisticUnit.BYTES);
                break;
            case SECONDS:
                to.setUnit(StatisticUnit.SECONDS);
                break;
            case BYTES_PER_SECOND:
                to.setUnit(StatisticUnit.BYTES_PER_SECOND);
                break;
            case BITS_PER_SECOND:
                to.setUnit(StatisticUnit.BITS_PER_SECOND);
                break;
            case COUNT_PER_SECOND:
                to.setUnit(StatisticUnit.COUNT_PER_SECOND);
                break;
        }
    }
    if (from.isSetValues()) {
        V3Values fromValues = from.getValues();
        if (fromValues.isSetType()) {
            switch(fromValues.getType()) {
                case DECIMAL:
                    to.setType(ValueType.DECIMAL);
                    break;
                case INTEGER:
                    to.setType(ValueType.INTEGER);
                    break;
                case STRING:
                    to.setType(ValueType.STRING);
                    break;
            }
        }
        to.setValues(new Values());
        to.getValues().getValues().addAll(adaptIn(fromValues.getValues()));
    }
    if (from.isSetVm()) {
        to.setVm(adaptIn(from.getVm()));
    }
    return to;
}
Also used : V3Values(org.ovirt.engine.api.v3.types.V3Values) Statistic(org.ovirt.engine.api.model.Statistic) V3Statistic(org.ovirt.engine.api.v3.types.V3Statistic) V3Values(org.ovirt.engine.api.v3.types.V3Values) Values(org.ovirt.engine.api.model.Values)

Example 2 with V3Statistic

use of org.ovirt.engine.api.v3.types.V3Statistic in project ovirt-engine by oVirt.

the class V3StatisticOutAdapter method adapt.

@Override
public V3Statistic adapt(Statistic from) {
    V3Statistic to = new V3Statistic();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptOut(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptOut(from.getActions()));
    }
    if (from.isSetBrick()) {
        to.setBrick(adaptOut(from.getBrick()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetDisk()) {
        to.setDisk(adaptOut(from.getDisk()));
    }
    if (from.isSetGlusterVolume()) {
        to.setGlusterVolume(adaptOut(from.getGlusterVolume()));
    }
    if (from.isSetHost()) {
        to.setHost(adaptOut(from.getHost()));
    }
    if (from.isSetHostNic()) {
        to.setHostNic(adaptOut(from.getHostNic()));
    }
    if (from.isSetHostNumaNode()) {
        to.setHostNumaNode(adaptOut(from.getHostNumaNode()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetKind()) {
        switch(from.getKind()) {
            case COUNTER:
                to.setType(V3StatisticType.COUNTER);
                break;
            case GAUGE:
                to.setType(V3StatisticType.GAUGE);
                break;
        }
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetNic()) {
        to.setNic(adaptOut(from.getNic()));
    }
    if (from.isSetStep()) {
        to.setStep(adaptOut(from.getStep()));
    }
    if (from.isSetUnit()) {
        switch(from.getUnit()) {
            case BITS_PER_SECOND:
                to.setUnit(V3StatisticUnit.BITS_PER_SECOND);
                break;
            case BYTES:
                to.setUnit(V3StatisticUnit.BYTES);
                break;
            case BYTES_PER_SECOND:
                to.setUnit(V3StatisticUnit.BYTES_PER_SECOND);
                break;
            case COUNT_PER_SECOND:
                to.setUnit(V3StatisticUnit.COUNT_PER_SECOND);
                break;
            case NONE:
                to.setUnit(V3StatisticUnit.NONE);
                break;
            case PERCENT:
                to.setUnit(V3StatisticUnit.PERCENT);
                break;
            case SECONDS:
                to.setUnit(V3StatisticUnit.SECONDS);
                break;
        }
    }
    if (from.isSetValues()) {
        V3Values toValues = new V3Values();
        toValues.getValues().addAll(adaptOut(from.getValues().getValues()));
        if (from.isSetType()) {
            switch(from.getType()) {
                case DECIMAL:
                    toValues.setType(V3ValueType.DECIMAL);
                    break;
                case INTEGER:
                    toValues.setType(V3ValueType.INTEGER);
                    break;
                case STRING:
                    toValues.setType(V3ValueType.STRING);
                    break;
            }
        }
        to.setValues(toValues);
    }
    if (from.isSetVm()) {
        to.setVm(adaptOut(from.getVm()));
    }
    return to;
}
Also used : V3Values(org.ovirt.engine.api.v3.types.V3Values) V3Statistic(org.ovirt.engine.api.v3.types.V3Statistic)

Aggregations

V3Statistic (org.ovirt.engine.api.v3.types.V3Statistic)2 V3Values (org.ovirt.engine.api.v3.types.V3Values)2 Statistic (org.ovirt.engine.api.model.Statistic)1 Values (org.ovirt.engine.api.model.Values)1