use of org.ovirt.engine.api.model.AffinityLabel in project ovirt-engine by oVirt.
the class BackendAffinityLabelResource method update.
@Override
public AffinityLabel update(AffinityLabel incoming) {
QueryIdResolver<Guid> labelResolver = new QueryIdResolver<>(QueryType.GetLabelById, IdQueryParameters.class);
Label entity = getEntity(labelResolver, true);
AffinityLabel label = performUpdate(incoming, entity, map(entity), labelResolver, ActionType.UpdateLabel, new UpdateParametersProvider());
return label;
}
use of org.ovirt.engine.api.model.AffinityLabel in project ovirt-engine by oVirt.
the class BackendAssignedAffinityLabelsResource method add.
@Override
public Response add(AffinityLabel label) {
validateParameters(label, "id");
IdQueryParameters parameters = new IdQueryParameters(GuidUtils.asGuid(label.getId()));
org.ovirt.engine.core.common.businessentities.Label entity = getEntity(org.ovirt.engine.core.common.businessentities.Label.class, QueryType.GetLabelById, parameters, label.getId(), true);
BusinessEntity<Guid> parent = constructor.create();
parent.setId(GuidUtils.asGuid(parentId));
org.ovirt.engine.core.common.businessentities.Label updatedLabel = new LabelBuilder(entity).entity(parent).build();
// Add the affinity label using the backend "update" operation. As the backend will return the added label as
// the result of the operation, we can fetch it using a simple "identity" resolver, that just returns the same
// value it is passed.
LabelActionParameters updateParams = new LabelActionParameters(updatedLabel);
return performCreate(ActionType.UpdateLabel, updateParams, (IResolver<Label, Label>) result -> result);
}
Aggregations