use of org.ovirt.engine.api.model.ApiSummaryItem in project ovirt-engine by oVirt.
the class V3ApiSummaryOutAdapter method adapt.
@Override
public V3ApiSummary adapt(ApiSummary from) {
V3ApiSummary to = new V3ApiSummary();
if (from.isSetHosts()) {
ApiSummaryItem fromHosts = from.getHosts();
V3Hosts toHosts = new V3Hosts();
if (fromHosts.isSetTotal()) {
toHosts.setTotal(fromHosts.getTotal().longValue());
}
if (fromHosts.isSetActive()) {
toHosts.setActive(fromHosts.getActive().longValue());
}
to.setHosts(toHosts);
}
if (from.isSetStorageDomains()) {
ApiSummaryItem fromSds = from.getStorageDomains();
V3StorageDomains toSds = new V3StorageDomains();
if (fromSds.isSetTotal()) {
toSds.setTotal(fromSds.getTotal().longValue());
}
if (fromSds.isSetActive()) {
toSds.setActive(fromSds.getActive().longValue());
}
to.setStorageDomains(toSds);
}
if (from.isSetUsers()) {
ApiSummaryItem fromUsers = from.getUsers();
V3Users toUsers = new V3Users();
if (fromUsers.isSetTotal()) {
toUsers.setTotal(fromUsers.getTotal().longValue());
}
if (fromUsers.isSetActive()) {
toUsers.setActive(fromUsers.getActive().longValue());
}
to.setUsers(toUsers);
}
if (from.isSetVms()) {
ApiSummaryItem fromVms = from.getVms();
V3VMs toVms = new V3VMs();
if (fromVms.isSetTotal()) {
toVms.setTotal(fromVms.getTotal().longValue());
}
if (fromVms.isSetActive()) {
toVms.setActive(fromVms.getActive().longValue());
}
to.setVMs(toVms);
}
return to;
}
use of org.ovirt.engine.api.model.ApiSummaryItem in project ovirt-engine by oVirt.
the class BackendApiResource method makeSummaryItem.
private ApiSummaryItem makeSummaryItem(Map<String, Integer> values, String totalKey, String activeKey) {
Integer totalValue = values.get(totalKey);
Integer activeValue = values.get(activeKey);
if (totalValue == null && activeValue == null) {
return null;
}
ApiSummaryItem item = new ApiSummaryItem();
if (totalValue != null) {
item.setTotal(totalValue);
}
if (activeValue != null) {
item.setActive(activeValue);
}
return item;
}
Aggregations