Interface GraphQLQueryProvider


public interface GraphQLQueryProvider
GraphQLQueryProvider is an abstraction layer that constructs GraphQL queries on file metadata.

Implementation must be package-scoped and let GraphQLQueryProviderFactory as the broker for their instance provision

  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull String
    mutation(@NotNull String fileId, @NotNull MetaData metaData)
    Constructs and returns a GraphQL file metadata Mutation document given a MetaData object to be saved and a specified file ID associated with the metadata.
    @NotNull String
    query(@NotNull String fileId, @NotNull List<String> metadataFields)
    Constructs and returns a GraphQL file metadata Query document given the specified file ID associated with the requested metadata and the metadata fields.
  • Method Details

    • query

      @NotNull @NotNull String query(@NotNull @NotNull String fileId, @NotNull @NotNull List<String> metadataFields)
      Constructs and returns a GraphQL file metadata Query document given the specified file ID associated with the requested metadata and the metadata fields.

      For example, if file ID is "df32wsv3rr3ed", and the requested metadata fields are ["fileType", "fileName"], this method will return a string of

       
       query {
           metaData(fileId: "df32wsv3rr3ed") {
               fileType
               fileName
           }
       }
       
       
      Parameters:
      fileId - The file ID associated with the requested metadata info
      metadataFields - The requested metadata fields
      Returns:
      a GraphQL query
      Throws:
      NullPointerException - if fileId or metadataFields is null
      IllegalArgumentException - if metadataFields list is empty
    • mutation

      @NotNull @NotNull String mutation(@NotNull @NotNull String fileId, @NotNull @NotNull MetaData metaData)
      Constructs and returns a GraphQL file metadata Mutation document given a MetaData object to be saved and a specified file ID associated with the metadata.

      For example, if file ID is "df32wsv3rr3ed", and the metadata to be saved is {"fileType": "PDF", "fileName": "Pride and Prejudice"}, then this method will return a string of

       
       mutation createMetaData {
           createMetaData(fileId: "df32wsv3rr3ed", fileName: "Pride and Prejudice", fileType: "PDF") {
               fileName,
               fileType
           }
       }
       
       
      Parameters:
      fileId - The file ID associated with the requested metadata info
      metaData - An object that contains all information about the new metadata to be saved
      Returns:
      a GraphQL query that creates a new MetaData object in database
      Throws:
      NullPointerException - if fileId or metaData is null