Class DocRefServiceHttpClient<T extends DocRefEntity>

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, DocRefService<T>

    public class DocRefServiceHttpClient<T extends DocRefEntity>
    extends java.lang.Object
    implements DocRefService<T>, java.io.Closeable
    • Constructor Summary

      Constructors 
      Constructor Description
      DocRefServiceHttpClient​(java.lang.String type, java.lang.Class<T> docRefEntityClass, java.lang.String baseUrl)  
    • Method Summary

      Modifier and Type Method Description
      void close()  
      java.util.Optional<T> copyDocument​(ServiceUser user, java.lang.String originalUuid, java.lang.String copyUuid)
      A notification from Stroom that a document is being copied.
      java.util.Optional<T> createDocument​(ServiceUser user, java.lang.String uuid, java.lang.String name)
      A new document has been created in Stroom
      java.util.Optional<java.lang.Boolean> deleteDocument​(ServiceUser user, java.lang.String uuid)
      The document with this UUID is being deleted in Stroom.
      ExportDTO exportDocument​(ServiceUser user, java.lang.String uuid)
      Used to export the full details of a document for transfer.
      java.util.Optional<T> get​(ServiceUser user, java.lang.String uuid)
      Retrieve the full config for the given DocRef
      java.util.List<T> getAll​(ServiceUser user)
      Retrieve all of the index entities currently registered
      java.lang.String getType()
      Get the doc ref type that this service wraps.
      java.util.Optional<T> importDocument​(ServiceUser user, java.lang.String uuid, java.lang.String name, java.lang.Boolean confirmed, java.util.Map<java.lang.String,​java.lang.String> dataMap)
      Used to import a document into the system
      java.util.Optional<T> moveDocument​(ServiceUser user, java.lang.String uuid)
      A Notification from Stroom that the document has been 'moved'.
      java.util.Optional<T> renameDocument​(ServiceUser user, java.lang.String uuid, java.lang.String name)
      A notifiation from Stroom that the name of a document has been changed.
      java.util.Optional<T> update​(ServiceUser user, java.lang.String uuid, T updatedConfig)
      Used to update a specific document.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DocRefServiceHttpClient

        public DocRefServiceHttpClient​(java.lang.String type,
                                       java.lang.Class<T> docRefEntityClass,
                                       java.lang.String baseUrl)
    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
      • getType

        public java.lang.String getType()
        Description copied from interface: DocRefService
        Get the doc ref type that this service wraps.
        Specified by:
        getType in interface DocRefService<T extends DocRefEntity>
        Returns:
        The doc ref type name
      • get

        public java.util.Optional<T> get​(ServiceUser user,
                                         java.lang.String uuid)
                                  throws QueryApiException
        Description copied from interface: DocRefService
        Retrieve the full config for the given DocRef
        Specified by:
        get in interface DocRefService<T extends DocRefEntity>
        Parameters:
        user - The logged in user
        uuid - The UUID of the docRef to return
        Returns:
        The full implementation specific config for this docRef.
        Throws:
        QueryApiException - if anything goes wrong
      • createDocument

        public java.util.Optional<T> createDocument​(ServiceUser user,
                                                    java.lang.String uuid,
                                                    java.lang.String name)
                                             throws QueryApiException
        Description copied from interface: DocRefService
        A new document has been created in Stroom
        Specified by:
        createDocument in interface DocRefService<T extends DocRefEntity>
        Parameters:
        user - The logged in user
        uuid - The UUID of the document as created by stroom
        name - The name of the document to be created.
        Returns:
        The new index entity
        Throws:
        QueryApiException - if anything goes wrong
      • update

        public java.util.Optional<T> update​(ServiceUser user,
                                            java.lang.String uuid,
                                            T updatedConfig)
                                     throws QueryApiException
        Description copied from interface: DocRefService
        Used to update a specific document. This will be used by our user interface to configure the underlying index and the stroom references to it
        Specified by:
        update in interface DocRefService<T extends DocRefEntity>
        Parameters:
        user - The logged in user
        uuid - The UUID of DocRef used to store the index configuration
        updatedConfig - The updated configuration
        Returns:
        The updated config
        Throws:
        QueryApiException - if anything goes wrong
      • copyDocument

        public java.util.Optional<T> copyDocument​(ServiceUser user,
                                                  java.lang.String originalUuid,
                                                  java.lang.String copyUuid)
                                           throws QueryApiException
        Description copied from interface: DocRefService
        A notification from Stroom that a document is being copied. The external system should copy it's configuration for the original into a new entity.
        Specified by:
        copyDocument in interface DocRefService<T extends DocRefEntity>
        Parameters:
        user - The logged in user
        originalUuid - The uuid of the document being copied
        copyUuid - The uuid of the copy
        Returns:
        The new index entity
        Throws:
        QueryApiException - if anything goes wrong
      • moveDocument

        public java.util.Optional<T> moveDocument​(ServiceUser user,
                                                  java.lang.String uuid)
                                           throws QueryApiException
        Description copied from interface: DocRefService
        A Notification from Stroom that the document has been 'moved'. In most cases the external system will not care about this.
        Specified by:
        moveDocument in interface DocRefService<T extends DocRefEntity>
        Parameters:
        user - The logged in user
        uuid - The uuid of the document that was moved
        Returns:
        The updated index entity
        Throws:
        QueryApiException - if anything goes wrong
      • renameDocument

        public java.util.Optional<T> renameDocument​(ServiceUser user,
                                                    java.lang.String uuid,
                                                    java.lang.String name)
                                             throws QueryApiException
        Description copied from interface: DocRefService
        A notifiation from Stroom that the name of a document has been changed. Whilst the name belongs to stroom it may be helpful for the external system to know what the name is, but the name should not be used for referencing the DocRef between systems as it could easily be out of sync.
        Specified by:
        renameDocument in interface DocRefService<T extends DocRefEntity>
        Parameters:
        user - The logged in user
        uuid - The uuid of the document you want to rename.
        name - The new name of the document.
        Returns:
        The updated index entity
        Throws:
        QueryApiException - if anything goes wrong
      • deleteDocument

        public java.util.Optional<java.lang.Boolean> deleteDocument​(ServiceUser user,
                                                                    java.lang.String uuid)
                                                             throws QueryApiException
        Description copied from interface: DocRefService
        The document with this UUID is being deleted in Stroom.
        Specified by:
        deleteDocument in interface DocRefService<T extends DocRefEntity>
        Parameters:
        user - The logged in user
        uuid - The uuid of the document you want to delete.
        Returns:
        Optional boolean, if missing, the document could not be found, if false, it could not be deleted
        Throws:
        QueryApiException - if anything goes wrong
      • importDocument

        public java.util.Optional<T> importDocument​(ServiceUser user,
                                                    java.lang.String uuid,
                                                    java.lang.String name,
                                                    java.lang.Boolean confirmed,
                                                    java.util.Map<java.lang.String,​java.lang.String> dataMap)
                                             throws QueryApiException
        Description copied from interface: DocRefService
        Used to import a document into the system
        Specified by:
        importDocument in interface DocRefService<T extends DocRefEntity>
        Parameters:
        user - The logged in user
        uuid - The UUID of the document to import
        name - The Name of the document to import
        confirmed - Used to indicate if this is a dry run
        dataMap - The data that gives all the implementation specific details
        Returns:
        The imported document
        Throws:
        QueryApiException - if anything goes wrong