Search in sources :

Example 1 with SchedulingPolicyUnit

use of org.ovirt.engine.api.model.SchedulingPolicyUnit in project ovirt-engine by oVirt.

the class PolicyUnitMapper method map.

@Mapping(from = PolicyUnit.class, to = SchedulingPolicyUnit.class)
public static SchedulingPolicyUnit map(PolicyUnit entity, SchedulingPolicyUnit template) {
    SchedulingPolicyUnit model = template != null ? template : new SchedulingPolicyUnit();
    model.setId(entity.getId().toString());
    model.setName(entity.getName());
    model.setDescription(entity.getDescription());
    model.setType(map(entity.getPolicyUnitType(), null));
    model.setEnabled(entity.isEnabled());
    model.setInternal(entity.isInternal());
    if (entity.getParameterRegExMap() != null && !entity.getParameterRegExMap().isEmpty()) {
        model.setProperties(CustomPropertiesParser.fromMap(entity.getParameterRegExMap()));
    }
    return model;
}
Also used : SchedulingPolicyUnit(org.ovirt.engine.api.model.SchedulingPolicyUnit)

Example 2 with SchedulingPolicyUnit

use of org.ovirt.engine.api.model.SchedulingPolicyUnit in project ovirt-engine by oVirt.

the class V3SchedulingPolicyUnitInAdapter method adapt.

@Override
public SchedulingPolicyUnit adapt(V3SchedulingPolicyUnit from) {
    SchedulingPolicyUnit to = new SchedulingPolicyUnit();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetEnabled()) {
        to.setEnabled(from.isEnabled());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetInternal()) {
        to.setInternal(from.isInternal());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetPropertiesMetaData()) {
        to.setProperties(new Properties());
        to.getProperties().getProperties().addAll(adaptIn(from.getPropertiesMetaData().getProperties()));
    }
    if (from.isSetType()) {
        to.setType(PolicyUnitType.fromValue(from.getType()));
    }
    return to;
}
Also used : SchedulingPolicyUnit(org.ovirt.engine.api.model.SchedulingPolicyUnit) V3SchedulingPolicyUnit(org.ovirt.engine.api.v3.types.V3SchedulingPolicyUnit) Properties(org.ovirt.engine.api.model.Properties)

Example 3 with SchedulingPolicyUnit

use of org.ovirt.engine.api.model.SchedulingPolicyUnit in project ovirt-engine by oVirt.

the class SchedulingWeightMapperTest method postPopulate.

@Override
protected Weight postPopulate(Weight model) {
    model.setId(ID);
    SchedulingPolicyUnit schedulingPolicyUnit = new SchedulingPolicyUnit();
    schedulingPolicyUnit.setId(ID);
    model.setSchedulingPolicyUnit(schedulingPolicyUnit);
    model.setFactor(FACTOR);
    return model;
}
Also used : SchedulingPolicyUnit(org.ovirt.engine.api.model.SchedulingPolicyUnit)

Example 4 with SchedulingPolicyUnit

use of org.ovirt.engine.api.model.SchedulingPolicyUnit in project ovirt-engine by oVirt.

the class SchedulingPolicyMapper method map.

@Mapping(from = ClusterPolicy.class, to = Filter.class)
public static Filter map(ClusterPolicy entity, Filter template) {
    if (template == null) {
        assert false : "scheduling filter cannot be null";
        return null;
    }
    Filter model = template;
    SchedulingPolicyUnit schedulingPolicyUnit = new SchedulingPolicyUnit();
    schedulingPolicyUnit.setId(model.getId());
    model.setSchedulingPolicyUnit(schedulingPolicyUnit);
    Integer position = null;
    if (entity.getFilterPositionMap() != null) {
        position = entity.getFilterPositionMap().get(GuidUtils.asGuid(model.getId()));
    }
    model.setPosition(position != null ? position : 0);
    return model;
}
Also used : Filter(org.ovirt.engine.api.model.Filter) SchedulingPolicyUnit(org.ovirt.engine.api.model.SchedulingPolicyUnit)

Example 5 with SchedulingPolicyUnit

use of org.ovirt.engine.api.model.SchedulingPolicyUnit in project ovirt-engine by oVirt.

the class SchedulingPolicyMapper method map.

@Mapping(from = ClusterPolicy.class, to = Balance.class)
public static Balance map(ClusterPolicy entity, Balance template) {
    if (template == null) {
        assert false : "scheduling balance cannot be null";
        return null;
    }
    Balance model = template;
    SchedulingPolicyUnit schedulingPolicyUnit = new SchedulingPolicyUnit();
    schedulingPolicyUnit.setId(model.getId());
    model.setSchedulingPolicyUnit(schedulingPolicyUnit);
    return model;
}
Also used : SchedulingPolicyUnit(org.ovirt.engine.api.model.SchedulingPolicyUnit) Balance(org.ovirt.engine.api.model.Balance)

Aggregations

SchedulingPolicyUnit (org.ovirt.engine.api.model.SchedulingPolicyUnit)7 Balance (org.ovirt.engine.api.model.Balance)1 Filter (org.ovirt.engine.api.model.Filter)1 Properties (org.ovirt.engine.api.model.Properties)1 V3SchedulingPolicyUnit (org.ovirt.engine.api.v3.types.V3SchedulingPolicyUnit)1