Class MetadataApiService


  • public class MetadataApiService
    extends Object
    Service for Metadata Integration
    • Field Detail

      • log

        private static final org.apache.logging.log4j.Logger log
      • ddoEndpoint

        private String ddoEndpoint
    • Constructor Detail

      • MetadataApiService

        private MetadataApiService​(String url)
        Constructor
        Parameters:
        url - the url of Metadata Api
    • Method Detail

      • getInstance

        public static MetadataApiService getInstance​(String url)
        Builds an instance of MetadataApiService
        Parameters:
        url - url of metadata api
        Returns:
        MetadataApiService instance
      • getDdoEndpoint

        public String getDdoEndpoint()
      • createDDO

        public DDO createDDO​(DDO ddo)
                      throws DDOException
        Registers a new DDO in Metadata Api
        Parameters:
        ddo - the ddo
        Returns:
        the created DDO
        Throws:
        DDOException - DDOException
      • getDDO

        public DDO getDDO​(String url)
                   throws DDOException
        Gets a DDO from an URL
        Parameters:
        url - the url
        Returns:
        the DDO
        Throws:
        DDOException - DDOException
      • getDDOUsingId

        public DDO getDDOUsingId​(String id)
                          throws Exception
        Gets a DDO from the DID
        Parameters:
        id - the DID
        Returns:
        the DDO
        Throws:
        Exception - Exception
      • updateDDO

        public boolean updateDDO​(String id,
                                 DDO ddo)
                          throws Exception
        Updates the metadata of a DDO
        Parameters:
        id - the did
        ddo - the DDO
        Returns:
        a flag that indicates if the update operation was executed correctly
        Throws:
        Exception - Exception
      • searchDDO

        public SearchResult searchDDO​(String param,
                                      int offset,
                                      int page)
                               throws DDOException
        Search all the DDOs that match the text passed as a parameter
        Parameters:
        param - the criteria
        offset - parameter to paginate
        page - parameter to paginate
        Returns:
        a List of all the DDOs found
        Throws:
        DDOException - DDOException
      • searchDDO

        public SearchResult searchDDO​(SearchQuery searchQuery)
                               throws DDOException
        Search all the DDOs that match the query passed as a parameter
        Parameters:
        searchQuery - the query
        Returns:
        a List of all the DDOs found
        Throws:
        DDOException - DDOException
      • retireAssetDDO

        public boolean retireAssetDDO​(String id)
                               throws DDOException
        Retire the asset ddo from Metadata Api.
        Parameters:
        id - the did
        Returns:
        a flag that indicates if the retire operation was executed correctly
        Throws:
        DDOException - DDOException
      • validateMetadata

        public boolean validateMetadata​(AssetMetadata metadata)
                                 throws DDOException
        Check that the metadata has a valid formUrl.
        Parameters:
        metadata - the metadata of the DDO
        Returns:
        a flag that indicates if the metadata is valid
        Throws:
        DDOException - DDOException