package org.jboss.pnc.core.builder;

import org.jboss.pnc.model.ProjectBuildResult;
import org.jboss.pnc.spi.builddriver.BuildJobConfiguration;
import org.jboss.pnc.spi.builddriver.BuildJobDetails;
import org.jboss.pnc.spi.datastore.Datastore;

import javax.inject.Inject;

/**
 * Created by <a href="mailto:matejonnet@gmail.com">Matej Lazar</a> on 2014-12-15.
 */
public class DatastoreAdapter {

    private Datastore datastore;

    @Inject
    public DatastoreAdapter(Datastore datastore) {
        this.datastore = datastore;
    }

    public void storeResult(BuildJobDetails buildDetails, BuildJobConfiguration buildJobConfiguration) {
        ProjectBuildResult buildResult = new ProjectBuildResult();
        buildResult.setBuildLog(buildDetails.getBuildLog());
        buildResult.setStatus(buildDetails.getBuildStatus());
        buildResult.setProjectBuildConfiguration(buildJobConfiguration.getProjectBuildConfiguration());
        datastore.storeCompletedBuild(buildResult);
    }

}

@@ -30,16 +30,49 @@
 ilder;%0A%0A
+import org.jboss.logging.Logger;%0A
 import o
@@ -110,16 +110,16 @@
 Result;%0A
-
 import o
@@ -458,16 +458,97 @@
 store;%0A%0A
+    private static final Logger log = Logger.getLogger(DatastoreAdapter.class);%0A%0A
     @Inj
@@ -936,24 +936,24 @@
 dStatus());%0A
-
         buil
@@ -1040,24 +1040,110 @@
 uration());%0A
+        log.tracef(%22Storing results of %25s to datastore.%22, buildDetails.getJobName());%0A
         data

Add logging before storing to datastore.