use of org.ovirt.engine.api.model.Weights in project ovirt-engine by oVirt.
the class BackendWeightsResource method list.
@Override
public Weights list() {
ClusterPolicy clusterPolicy = getClusterPolicy();
Weights weights = new Weights();
if (clusterPolicy.getFunctions() != null) {
for (Pair<Guid, Integer> weightPair : clusterPolicy.getFunctions()) {
Weight weight = new Weight();
weight.setId(weightPair.getFirst().toString());
weight.setFactor(weightPair.getSecond());
weights.getWeights().add(addLinks(map(clusterPolicy, weight)));
}
}
return weights;
}
use of org.ovirt.engine.api.model.Weights in project ovirt-engine by oVirt.
the class V3WeightsInAdapter method adapt.
@Override
public Weights adapt(V3Weights from) {
Weights to = new Weights();
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetActive()) {
to.setActive(from.getActive());
}
if (from.isSetSize()) {
to.setSize(from.getSize());
}
if (from.isSetTotal()) {
to.setTotal(from.getTotal());
}
to.getWeights().addAll(adaptIn(from.getWeights()));
return to;
}
Aggregations