Interface IDocumentService


public interface IDocumentService

Provides methods to handle documents.

The documents can either be attached to a case or are managed by a workflow context.

Examples:

Add a document to a case:
IDocument document = ivy.case.documents().add(new Path("images/myImage.png")).write().withContentFrom(in.file);

Get all documents attached to a case:
List<IDocument> documents = ivy.case.documents().getAll();

By default the content of a document is stored in a file that is located in the application's files directory. The meta data of a document is stored in the system database. Depending on the document provider that is used for an application this may change.

See Also:
API:
This is a public API.
  • Method Details

    • get

      @Deprecated(since="11.2", forRemoval=true) IDocument get(long documentId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use get(Strin
      Get a document by its document identifier
      Parameters:
      documentId - identifier of the document
      Returns:
      document or null
      See Also:
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS DocumentRead PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseRead PERMISSION OR OWNS DocumentRead@SYSTEM PERMISSION
    • get

      IDocument get(String uuid)
      Get a document by its UUID.
      Parameters:
      uuid -
      Returns:
      document or null
      See Also:
      API:
      This public API is available in Java.
    • get

      IDocument get(Path path)
      Get a document by its path
      Parameters:
      path - path of the document
      Returns:
      document or null
      See Also:
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS DocumentRead PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseRead PERMISSION OR OWNS DocumentRead@SYSTEM PERMISSION
    • getAll

      List<IDocument> getAll()
      Get all documents
      Returns:
      list of documents
      See Also:
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS DocumentRead PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseRead PERMISSION OR OWNS DocumentRead@SYSTEM PERMISSION
    • getAllBelow

      List<IDocument> getAllBelow(Path path)
      Get all documents that are located below the given path. Documents located in a sub paths, sub sub paths, etc are also returned.
      Parameters:
      path -
      Returns:
      list of documents
      See Also:
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS DocumentRead PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseRead PERMISSION OR OWNS DocumentRead@SYSTEM PERMISSION
    • getAllDirectBelow

      List<IDocument> getAllDirectBelow(Path path)
      Get all documents that are located directly below the given path. Documents located in sub paths are not returned.
      Parameters:
      path -
      Returns:
      list of documents
      See Also:
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS DocumentRead PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseRead PERMISSION OR OWNS DocumentRead@SYSTEM PERMISSION
    • add

      IDocument add(Path path)

      Adds a new document with the given path

      Example:
      import ch.ivyteam.ivy.workflow.document.Path; IDocument document = ivy.case.documents().add(new Path("Images/myImage.png")).write().withContentFrom(in.file);

      Parameters:
      path - path of the document to add
      Returns:
      added document
      Throws:
      PersistencyException - if a document with the given path already exists
      See Also:
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS DocumentWrite PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseWrite PERMISSION OR OWNS DocumentWrite@SYSTEM PERMISSION
    • add

      IDocument add(String path)

      Adds a new document with the given path

      Example:
      IDocument document = ivy.case.documents().add("Images/myImage.png").write().withContentFrom(in.file);

      Parameters:
      path - path of the document to add
      Returns:
      added document
      Throws:
      PersistencyException - if a document with the given path already exists
      See Also:
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS DocumentWrite PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseWrite PERMISSION OR OWNS DocumentWrite@SYSTEM PERMISSION
    • delete

      void delete(IDocument doc)
      Deletes the given document. If the content of the document is stored in a file then the file is also deleted.
      Parameters:
      doc -
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS DocumentWrite PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseWrite PERMISSION OR OWNS DocumentWrite@SYSTEM PERMISSION
    • delete

      @Deprecated(since="11.2", forRemoval=true) void delete(long documentId)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Deletes the document with the given document identifier. If the content of the document is stored in a file then the file is also deleted.
      Parameters:
      documentId -
      See Also:
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS DocumentWrite PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseWrite PERMISSION OR OWNS DocumentWrite@SYSTEM PERMISSION
    • delete

      void delete(String uuid)
      Deletes the document with the given UUID.
      Parameters:
      uuid -
      API:
      This public API is available in Java.
    • delete

      void delete(Path path)
      Deletes the document with the given path. If the content of the document is stored in a file then the file is also deleted.
      Parameters:
      path -
      See Also:
      API:
      This public API is available in Java.
      Security:
      SESSION OWNS DocumentWrite PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseWrite PERMISSION OR OWNS DocumentWrite@SYSTEM PERMISSION