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 Summary
Modifier and TypeMethodDescriptionAdds a new document with the given pathAdds a new document with the given pathvoid
delete
(long documentId) Deletes the document with the given document identifier.void
Deletes the given document.void
Deletes the document with the given path.get
(long documentId) Get a document by its document identifierGet a document by its pathgetAll()
Get all documentsgetAllBelow
(Path path) Get all documents that are located below the given path.getAllDirectBelow
(Path path) Get all documents that are located directly below the given path.
-
Method Details
-
get
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
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
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
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
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
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
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
Deletes the given document. If the content of the document is stored in a file then the file is also deleted.- Parameters:
documentToDelete
-- 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(long documentId) 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
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
-