package org.ovirt.engine.core.bll;

import org.ovirt.engine.core.bll.host.provider.HostProviderProxy;
import org.ovirt.engine.core.bll.provider.ProviderProxyFactory;
import org.ovirt.engine.core.common.businessentities.Provider;
import org.ovirt.engine.core.common.businessentities.VdsStatic;
import org.ovirt.engine.core.common.queries.HostErratumQueryParameters;

public class GetErratumByIdForHostQuery<P extends HostErratumQueryParameters> extends QueriesCommandBase<P> {

    public GetErratumByIdForHostQuery(P parameters) {
        super(parameters);
    }

    @Override
    protected void executeQueryCommand() {
        VdsStatic host = getDbFacade().getVdsStaticDao().get(getParameters().getId());
        if (host == null || host.getHostProviderId() == null) {
            return;
        }

        Provider<?> provider = getDbFacade().getProviderDao().get(host.getHostProviderId());
        if (provider != null) {
            HostProviderProxy proxy = ProviderProxyFactory.getInstance().create(provider);
            getQueryReturnValue().setReturnValue(proxy.getErratumForHost(host.getHostName(),
                    getParameters().getErratumId()));
        }
    }
}

@@ -29,16 +29,45 @@
 e.bll;%0A%0A
+import javax.inject.Inject;%0A%0A
 import o
@@ -124,16 +124,16 @@
 rProxy;%0A
-
 import o
@@ -386,16 +386,118 @@
 ameters;
+%0Aimport org.ovirt.engine.core.dao.VdsStaticDao;%0Aimport org.ovirt.engine.core.dao.provider.ProviderDao;
 %0A%0Apublic
@@ -601,16 +601,119 @@
 e%3CP%3E %7B%0A%0A
+    @Inject%0A    private VdsStaticDao hostStaticDao;%0A%0A    @Inject%0A    private ProviderDao providerDao;%0A%0A
     publ
@@ -878,28 +878,12 @@
 t = 
-getDbFacade().getVds
+host
 Stat
@@ -887,18 +887,16 @@
 taticDao
-()
 .get(get
@@ -1048,26 +1048,9 @@
 r = 
-getDbFacade().getP
+p
 rovi
@@ -1055,18 +1055,16 @@
 viderDao
-()
 .get(hos

Use injection instead of static access