PageRenderTime 58ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/src/main/java/com/atlassian/bamboo/plugin/dotnet/ncover/NCoverIndexReader.java

https://bitbucket.org/atlassian/bamboo-dotnet-plugin/
Java | 32 lines | 18 code | 2 blank | 12 comment | 2 complexity | 3b6d92e583513c2ca1ff87c30e36465a MD5 | raw file
Possible License(s): BSD-3-Clause
  1. package com.atlassian.bamboo.plugin.dotnet.ncover;
  2. import com.atlassian.bamboo.index.CustomIndexReader;
  3. import com.atlassian.bamboo.resultsummary.BuildResultsSummary;
  4. import org.apache.lucene.document.Document;
  5. import org.apache.lucene.index.IndexableField;
  6. /**
  7. * Handles reading NCover-specific values that were previously stored.
  8. *
  9. * @author Ross Rowe
  10. */
  11. public class NCoverIndexReader implements CustomIndexReader
  12. {
  13. /**
  14. * Reads NCover properties from the <code>Document</code> and stores them in
  15. * the custom build data of the <code>buildResultsSummary</code>.
  16. *
  17. * @param document
  18. * @param buildResultsSummary
  19. */
  20. @Override
  21. public void extractFromDocument(Document document, BuildResultsSummary buildResultsSummary)
  22. {
  23. IndexableField field = document.getField(NCoverBuildProcessor.NCOVER_LINE_RATE);
  24. if (field != null)
  25. {
  26. final double nCoverLineRate = field.numericValue().doubleValue();
  27. buildResultsSummary.getCustomBuildData().put(NCoverBuildProcessor.NCOVER_LINE_RATE, Double.toString(nCoverLineRate));
  28. }
  29. }
  30. }