TectonicSummaryIndexerModule.java

  1. package gov.usgs.earthquake.tectonicsummary;

  2. import gov.usgs.earthquake.indexer.DefaultIndexerModule;
  3. import gov.usgs.earthquake.indexer.IndexerModule;
  4. import gov.usgs.earthquake.indexer.ProductSummary;
  5. import gov.usgs.earthquake.product.Product;

  6. /**
  7.  * Tectonic Summary indexer module.
  8.  *
  9.  * Provides a higher and more specific level of support for tectonic summary
  10.  * products, including checking for "Reviewed" status on the tectonic summary.
  11.  * These "Reviewed tectonic summmaries will always be preferred.
  12.  */
  13. @Deprecated()
  14. public class TectonicSummaryIndexerModule extends DefaultIndexerModule {

  15.     /** Summary weight */
  16.     public static final int REVIEWED_TECTONIC_SUMMARY_WEIGHT = 200;

  17.     @Override
  18.     public int getSupportLevel(Product product) {
  19.         int supportLevel = IndexerModule.LEVEL_UNSUPPORTED;
  20.         String type = getBaseProductType(product.getId().getType());
  21.         // support tectonic summary products
  22.         if (type.equals("tectonic-summary")) {
  23.             supportLevel = IndexerModule.LEVEL_SUPPORTED;
  24.         }
  25.         return supportLevel;
  26.     }

  27.     @Override
  28.     protected long getPreferredWeight(final ProductSummary summary)
  29.             throws Exception {
  30.         long preferredWeight = super.getPreferredWeight(summary);
  31.         String reviewStatus = summary.getProperties().get("review-status");

  32.         if ("REVIEWED".equalsIgnoreCase(reviewStatus)) {
  33.             preferredWeight += REVIEWED_TECTONIC_SUMMARY_WEIGHT;
  34.         }

  35.         return preferredWeight;
  36.     }
  37. }