Source:
public void run() { String projectName = build.getParent().getFullName(); int buildNumber = build.getNumber(); String displayName = build.getDisplayName(); Date startingTime = build.getTime(); long duration = build.getDuration(); List<String> triggerCauses = new LinkedList<String>(); for (Object o : build.getCauses()) { triggerCauses.add(o.getClass().getSimpleName()); } String nodeName = "NoNodeInformation"; if (build instanceof AbstractBuild) { AbstractBuild abstractBuild = (AbstractBuild)build; Node node = abstractBuild.getBuiltOn(); if (node != null) { nodeName = node.getNodeName(); } } int timeZoneOffset = TimeZone.getDefault().getRawOffset(); String master; String result = "Unknown"; final Result buildResult = build.getResult(); if (buildResult != null) { result = buildResult.toString(); } List<FailureCauseStatistics> failureCauseStatistics = new LinkedList<FailureCauseStatistics>(); List<String> causeIds = new LinkedList<String>(); for (FoundFailureCause cause : causes) { FailureCauseStatistics stats = new FailureCauseStatistics(cause.getId(), cause.getIndications()); failureCauseStatistics.add(stats); causeIds.add(cause.getId()); } master = BfaUtils.getMasterName(); Cause.UpstreamCause uc = (Cause.UpstreamCause)build.getCause(Cause.UpstreamCause.class); Statistics.UpstreamCause suc = new Statistics.UpstreamCause(uc); Statistics obj = new Statistics(projectName, buildNumber, displayName, startingTime, duration, triggerCauses, nodeName, master, timeZoneOffset, result, suc, failureCauseStatistics); PluginImpl p = PluginImpl.getInstance(); KnowledgeBase kb = p.getKnowledgeBase(); try { kb.saveStatistics(obj); } catch (Exception e) { logger.log(Level.WARNING, "Couldn't save statistics: ", e); } kb.updateLastSeen(causeIds, startingTime); }

Target:
public void run() { String projectName = build.getParent().getFullName(); int buildNumber = build.getNumber(); String displayName = build.getDisplayName(); Date startingTime = build.getTime(); long duration = build.getDuration(); List<String> triggerCauses = new LinkedList<String>(); for (Object o : build.getCauses()) { triggerCauses.add(o.getClass().getSimpleName()); } String nodeName = "NoNodeInformation"; if (build instanceof AbstractBuild) { AbstractBuild abstractBuild = (AbstractBuild)build; Node node = abstractBuild.getBuiltOn(); if (node != null) { nodeName = node.getNodeName(); } } int timeZoneOffset = TimeZone.getDefault().getRawOffset(); String master; String result = "Running"; final Result buildResult = build.getResult(); if (buildResult != null) { result = buildResult.toString(); } List<FailureCauseStatistics> failureCauseStatistics = new LinkedList<FailureCauseStatistics>(); List<String> causeIds = new LinkedList<String>(); for (FoundFailureCause cause : causes) { FailureCauseStatistics stats = new FailureCauseStatistics(cause.getId(), cause.getIndications()); failureCauseStatistics.add(stats); causeIds.add(cause.getId()); } master = BfaUtils.getMasterName(); Cause.UpstreamCause uc = (Cause.UpstreamCause)build.getCause(Cause.UpstreamCause.class); Statistics.UpstreamCause suc = new Statistics.UpstreamCause(uc); Statistics obj = new Statistics(projectName, buildNumber, displayName, startingTime, duration, triggerCauses, nodeName, master, timeZoneOffset, result, suc, failureCauseStatistics); PluginImpl p = PluginImpl.getInstance(); KnowledgeBase kb = p.getKnowledgeBase(); try { kb.saveStatistics(obj); } catch (Exception e) { logger.log(Level.WARNING, "Couldn't save statistics: ", e); } kb.updateLastSeen(causeIds, startingTime); }