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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations