Class ProductDao

java.lang.Object
gov.nasa.pds.registry.common.es.dao.ProductDao

public class ProductDao extends Object
Product data access object. Provides methods to query Elasticsearch for product information.
Author:
karpenko
  • Constructor Details

    • ProductDao

      public ProductDao(RestClient client, String indexName)
      Constructor.
      Parameters:
      client - Elasticsearch client
      indexName - Elasticsearch index name, e.g., "registry".
  • Method Details

    • getProductClass

      public String getProductClass(String lidvid) throws Exception
      Get product class by LIDVID
      Parameters:
      lidvid - product LIDVID
      Returns:
      product class, such as "Product_Bundle" or null if the LIDVID doesn't exist.
      Throws:
      Exception - an exception
    • getRefDocCount

      public int getRefDocCount(String collectionLidVid, char type) throws Exception
      Get number of reference documents (pages) by collection LIDVID and type.
      Parameters:
      collectionLidVid - collection LIDVID
      type - reference type: 'P' - primary, 'S' - secondary
      Returns:
      number of documents (pages)
      Throws:
      Exception - an exception
    • getRefs

      public List<String> getRefs(String collectionLidVid, char type, int page) throws Exception
      Get product references from collection inventory
      Parameters:
      collectionLidVid - collection LIDVID
      type - reference type: 'P' - primary, 'S' - secondary
      page - page number starting from 1
      Returns:
      list of product LIDVIDs
      Throws:
      Exception - ResponseException exception - there was a problem calling Elasticsearch, other exceptions - parsing problems (invalid JSON).
    • updateArchiveStatus

      public void updateArchiveStatus(Collection<String> lidvids, String status) throws Exception
      Update archive status by lidvids
      Parameters:
      lidvids - a list of lidvids to update
      status - new status
      Throws:
      Exception - an exception
    • getCollectionIds

      public LidvidSet getCollectionIds(String bundleLidvid) throws Exception
      Get collection references of a bundle. References can be either LIDs, LIDVIDs or both.
      Parameters:
      bundleLidvid - bundle LIDVID
      Returns:
      Collection references
      Throws:
      Exception - an exception
    • getLatestLidVids

      public List<String> getLatestLidVids(Collection<String> lids) throws Exception
      Given a list of LIDs, find latest versions
      Parameters:
      lids - a list of LIDs
      Returns:
      a list of latest LIDVIDs
      Throws:
      Exception - an exception