Interface IDocumentService
-
public interface IDocumentService
Provides methods to handle documents.
The documents can either be attached to a
case
or are managed by aworkflow 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:
ICase.documents()
,IWorkflowContext.documents()
- API:
- This is a public API.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IDocument
add(Path path)
Adds a new document with the given pathIDocument
add(String path)
Adds a new document with the given pathvoid
delete(long documentId)
Deletes the document with the given document identifier.void
delete(IDocument documentToDelete)
Deletes the given document.void
delete(Path path)
Deletes the document with the given path.IDocument
get(long documentId)
Get a document by its document identifierIDocument
get(Path path)
Get a document by its pathList<IDocument>
getAll()
Get all documentsList<IDocument>
getAllBelow(Path path)
Get all documents that are located below the given path.List<IDocument>
getAllDirectBelow(Path path)
Get all documents that are located directly below the given path.
-
-
-
Method Detail
-
get
IDocument get(long documentId)
Get a document by its document identifier- Parameters:
documentId
- identifier of the document- Returns:
- document or null
- See Also:
IDocument.getId()
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
- Security:
- SESSION OWNS DocumentRead PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseRead PERMISSION OR OWNS DocumentRead@SYSTEM PERMISSION
-
get
IDocument get(Path path)
Get a document by its path- Parameters:
path
- path of the document- Returns:
- document or null
- See Also:
IDocument.getPath()
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
- 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:
getAllBelow(Path)
,getAllDirectBelow(Path)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
- 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:
getAll()
,getAllDirectBelow(Path)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
- 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:
getAll()
,getAllBelow(Path)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
- 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:
add(String)
- API:
- This public API is available in IvyScript and Java. It has the visibility ADVANCED.
- 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:
add(Path)
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
- Security:
- SESSION OWNS DocumentWrite PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseWrite PERMISSION OR OWNS DocumentWrite@SYSTEM PERMISSION
-
delete
void delete(IDocument documentToDelete)
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 IvyScript and Java. It has the visibility NOVICE.
- 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:
IDocument.getId()
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
- Security:
- SESSION OWNS DocumentWrite PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseWrite PERMISSION OR OWNS DocumentWrite@SYSTEM PERMISSION
-
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:
IDocument.getPath()
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
- Security:
- SESSION OWNS DocumentWrite PERMISSION OR MATCHES THIS.BelongsToInvolvedCase AND OWNS DocumentOfInvolvedCaseWrite PERMISSION OR OWNS DocumentWrite@SYSTEM PERMISSION
-
-