use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.
the class GetErrataCountsForHostQueryTest method availableHostErrata.
@Test
public void availableHostErrata() {
setupToReportErrata(expectedErrata());
getQuery().executeQueryCommand();
ErrataCounts counts = getQuery().getQueryReturnValue().getReturnValue();
assertEquals(5, counts.getCountByType(ErrataType.BUGFIX));
assertEquals(4, counts.getCountByType(ErrataType.ENHANCEMENT));
assertEquals(2, counts.getCountByType(ErrataType.SECURITY));
assertEquals(0, counts.getCountByTypeAndSeverity(ErrataType.SECURITY, ErrataSeverity.MODERATE));
}
use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.
the class SubTabVirtualMachineErrataPresenter method onBind.
@Override
protected void onBind() {
super.onBind();
getView().getTotalSecurity().setCommand(errataCountModel.getShowSecurityCommand());
getView().getTotalBugFix().setCommand(errataCountModel.getShowBugsCommand());
getView().getTotalEnhancement().setCommand(errataCountModel.getShowEnhancementsCommand());
registerHandler(getView().getTotalSecurity().addClickHandler(event -> getView().getTotalSecurity().getCommand().execute()));
registerHandler(getView().getTotalBugFix().addClickHandler(event -> getView().getTotalBugFix().getCommand().execute()));
registerHandler(getView().getTotalEnhancement().addClickHandler(event -> getView().getTotalEnhancement().getCommand().execute()));
// Handle the counts changing -> simple view update.
//
errataCountModel.addErrataCountsChangeListener((ev, sender, args) -> {
// bus published message that the counts changed. update view.
ErrataCounts counts = errataCountModel.getErrataCounts();
getView().showCounts(counts);
});
// Handle the count model getting a query error -> simple view update.
//
errataCountModel.addPropertyChangeListener((ev, sender, args) -> {
if ("Message".equals(args.propertyName)) {
// bus published message that an error occurred communicating with Katello. Show the alert panel.
if (errataCountModel.getMessage() != null && !errataCountModel.getMessage().isEmpty()) {
getView().showErrorMessage(SafeHtmlUtils.fromString(errataCountModel.getMessage()));
} else {
getView().clearErrorMessage();
}
} else if (PropertyChangedEventArgs.PROGRESS.equals(args.propertyName)) {
if (errataCountModel.getProgress() != null) {
getView().showProgress();
}
}
});
}
use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.
the class SubTabHostErrataPresenter method initializeHandlers.
@Override
public void initializeHandlers() {
super.initializeHandlers();
registerHandler(getView().getTotalSecurity().addClickHandler(event -> getView().getTotalSecurity().getCommand().execute()));
registerHandler(getView().getTotalBugFix().addClickHandler(event -> getView().getTotalBugFix().getCommand().execute()));
registerHandler(getView().getTotalEnhancement().addClickHandler(event -> getView().getTotalEnhancement().getCommand().execute()));
// Handle the counts changing -> simple view update.
//
errataCountModel.addErrataCountsChangeListener((ev, sender, args) -> {
// bus published message that the counts changed. update view.
ErrataCounts counts = errataCountModel.getErrataCounts();
getView().showCounts(counts);
});
// Handle the count model getting a query error -> simple view update.
//
errataCountModel.addPropertyChangeListener((ev, sender, args) -> {
if ("Message".equals(args.propertyName)) {
// $NON-NLS-1$
if (errataCountModel.getMessage() != null && !errataCountModel.getMessage().isEmpty()) {
// bus published message that an error occurred communicating with Katello. Show the alert panel.
getView().showErrorMessage(SafeHtmlUtils.fromString(errataCountModel.getMessage()));
}
} else if (PropertyChangedEventArgs.PROGRESS.equals(args.propertyName)) {
if (errataCountModel.getProgress() != null) {
getView().showProgress();
}
}
});
}
use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.
the class KatelloProvider method mapErrataCounts.
private ErrataCounts mapErrataCounts(ErrataWrapper wrapper) {
ErrataCounts errataCounts = new ErrataCounts();
errataCounts.setTotalErrata(wrapper.getTotalCount());
errataCounts.setSubTotalErrata(wrapper.getSubTotalCount());
return errataCounts;
}
use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.
the class AbstractErrataCountModel method runQuery.
public void runQuery(Guid guid) {
// $NON-NLS-1$
startProgress("getCount");
AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
stopProgress();
ErrataCounts resultEntity = returnValue.getReturnValue();
// Set message to null to make sure the actual setMessage creates an event.
setMessage(null);
if (resultEntity != null && returnValue.getSucceeded()) {
setErrataCounts(resultEntity);
} else {
setMessage(// $NON-NLS-1$
constants.katelloProblemRetrievingErrata() + " " + returnValue.getExceptionMessage());
}
});
asyncQuery.setHandleFailure(true);
Frontend.getInstance().runQuery(getQueryType(), new GetErrataCountsParameters(guid), asyncQuery);
}
Aggregations