Interface DocumentManager<T_REST_DOCUMENT extends RestDocument>
-
- Type Parameters:
T_REST_DOCUMENT- TheRestDocumenttype managed by theDocumentManager.
- All Known Implementing Classes:
AbstractDocumentManager,RestWebServiceDocumentManager
public interface DocumentManager<T_REST_DOCUMENT extends RestDocument>A class implementingDocumentManagerallows to monitor and interact with theRestDocuments uploaded to aRestSessionof the webPDF server.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancontainsDocument(@NotNull String documentId)voiddeleteDocument(@NotNull String documentId)Deletes theRestDocumentwith the given document ID from the webPDF server.voiddownloadDocument(@NotNull String documentId, @NotNull OutputStream outputStream)Downloads theRestDocumentwith the given document ID and writes it to the givenOutputStream.voiddownloadDocument(@Nullable RestDocument document, @NotNull OutputStream outputStream)Downloads theRestDocumentand writes it to the givenOutputStream.T_REST_DOCUMENTgetDocument(@NotNull String documentId)Returns theRestDocumentthat is known to theDocumentManagerfor the given document ID.@NotNull List<HistoryEntry>getDocumentHistory(@NotNull String documentId)Returns theHistoryEntrys known for theRestDocumentwith the given document ID.@NotNull HistoryEntrygetDocumentHistoryEntry(@NotNull String documentId, int historyId)Returns theHistoryEntrywith the given history ID for theRestDocumentwith the given document ID.@NotNull StringgetDocumentID(@NotNull DocumentFile document)Returns the document ID the givenDocumentFileis known by to thisDocumentManager.@NotNull List<T_REST_DOCUMENT>getDocuments()Returns a list of allRestDocuments known to thisDocumentManager.@NotNull RestSession<T_REST_DOCUMENT>getSession()booleanisDocumentHistoryActive()Checks whether a document history is collected for managedRestDocuments.T_REST_DOCUMENTrenameDocument(@NotNull String documentId, @NotNull String fileName)Rename theRestDocumentwith the given document ID.voidsetDocumentHistoryActive(boolean documentHistoryActive)Sets whether a document history shall be collected for managedRestDocuments.@NotNull List<T_REST_DOCUMENT>synchronize()Synchronizes theRestDocuments of thisDocumentManagerwith the actually uploaded documents of the webPDF server.T_REST_DOCUMENTsynchronize(@NotNull DocumentFile documentFile)@Nullable HistoryEntryupdateDocumentHistory(@NotNull String documentId, @NotNull HistoryEntry historyEntry)Updates the history of theRestDocumentwith the given document ID using the givenHistoryEntry.T_REST_DOCUMENTuploadDocument(@NotNull File file)Uploads the givenFileto the webPDF server, adds it to thisDocumentManagerand returns the resultingRestDocumenthandle.T_REST_DOCUMENTuploadDocument(@NotNull InputStream data, @NotNull String fileName)Uploads the givenInputStreamto the webPDF server as a document resource with the given file name, adds it to thisDocumentManagerand returns the resultingRestDocumenthandle.
-
-
-
Method Detail
-
getSession
@NotNull @NotNull RestSession<T_REST_DOCUMENT> getSession()
- Returns:
- The
RestSessiontheDocumentManageris managingRestDocuments for.
-
synchronize
@NotNull T_REST_DOCUMENT synchronize(@NotNull @NotNull DocumentFile documentFile) throws ResultException
- Returns:
- The synchronized
RestDocument. - Throws:
ResultException- Shall be thrown upon a synchronization failure.
-
synchronize
@NotNull @NotNull List<T_REST_DOCUMENT> synchronize() throws ResultException
Synchronizes theRestDocuments of thisDocumentManagerwith the actually uploaded documents of the webPDF server.- Returns:
- A list of the synchronized
RestDocuments. - Throws:
ResultException- Shall be thrown upon a synchronization failure.
-
getDocumentID
@NotNull @NotNull String getDocumentID(@NotNull @NotNull DocumentFile document) throws ResultException
Returns the document ID the givenDocumentFileis known by to thisDocumentManager.- Parameters:
document- TheDocumentFilea document ID shall be found for.- Returns:
- The document ID mapped to the given
DocumentFile. - Throws:
ResultException- Shall be thrown, if requesting the document ID failed.
-
getDocument
@NotNull T_REST_DOCUMENT getDocument(@NotNull @NotNull String documentId) throws ResultException
Returns theRestDocumentthat is known to theDocumentManagerfor the given document ID.- Parameters:
documentId- The document ID aRestDocumentshall be found for.- Returns:
- The
RestDocumentmapped to the given document ID. - Throws:
ResultException- Shall be thrown, if requesting the document failed.
-
getDocuments
@NotNull @NotNull List<T_REST_DOCUMENT> getDocuments()
Returns a list of allRestDocuments known to thisDocumentManager.- Returns:
- A list of all
RestDocuments known to thisDocumentManager.
-
containsDocument
boolean containsDocument(@NotNull @NotNull String documentId)- Parameters:
documentId- The document ID, that shall be checked for existence.- Returns:
true, if thisDocumentManagercontains aRestDocumentwith the given ID.
-
downloadDocument
void downloadDocument(@NotNull @NotNull String documentId, @NotNull @NotNull OutputStream outputStream) throws ResultExceptionDownloads theRestDocumentwith the given document ID and writes it to the givenOutputStream.- Parameters:
documentId- The document ID of theRestDocumentto download.outputStream- TheOutputStreamto write the downloadedRestDocumentto.- Throws:
ResultException- Shall be thrown, should the download have failed.
-
downloadDocument
void downloadDocument(@Nullable @Nullable RestDocument document, @NotNull @NotNull OutputStream outputStream) throws ResultExceptionDownloads theRestDocumentand writes it to the givenOutputStream.- Parameters:
document- TheRestDocumentto download.outputStream- TheOutputStreamto write the downloadedRestDocumentto.- Throws:
ResultException- Shall be thrown, should the download have failed.
-
uploadDocument
@NotNull T_REST_DOCUMENT uploadDocument(@NotNull @NotNull File file) throws ResultException
Uploads the givenFileto the webPDF server, adds it to thisDocumentManagerand returns the resultingRestDocumenthandle.- Parameters:
file- TheFileto upload.- Returns:
- The resulting
RestDocumenthandle. - Throws:
ResultException- Shall be thrown, should the upload have failed.
-
uploadDocument
@NotNull T_REST_DOCUMENT uploadDocument(@NotNull @NotNull InputStream data, @NotNull @NotNull String fileName) throws ResultException
Uploads the givenInputStreamto the webPDF server as a document resource with the given file name, adds it to thisDocumentManagerand returns the resultingRestDocumenthandle.- Parameters:
data- The documentInputStreamto upload.fileName- The name of the uploaded document.- Returns:
- The resulting
RestDocumenthandle. - Throws:
ResultException- Shall be thrown, should the upload have failed.
-
deleteDocument
void deleteDocument(@NotNull @NotNull String documentId) throws ResultExceptionDeletes theRestDocumentwith the given document ID from the webPDF server.- Parameters:
documentId- The document ID of theRestDocumentto delete.- Throws:
ResultException- Shall be thrown, should deleting the document have failed.
-
renameDocument
@NotNull T_REST_DOCUMENT renameDocument(@NotNull @NotNull String documentId, @NotNull @NotNull String fileName) throws ResultException
Rename theRestDocumentwith the given document ID.- Parameters:
documentId- The document ID of theRestDocumentto rename.fileName- The new name for theRestDocument.- Returns:
- The resulting
RestDocumenthandle. - Throws:
ResultException- Shall be thrown, should renaming the document have failed.
-
isDocumentHistoryActive
boolean isDocumentHistoryActive()
Checks whether a document history is collected for managedRestDocuments.- Returns:
trueshould collecting the document history be active.
-
setDocumentHistoryActive
void setDocumentHistoryActive(boolean documentHistoryActive) throws ResultExceptionSets whether a document history shall be collected for managedRestDocuments.- Parameters:
documentHistoryActive-trueshould collecting the document history be activated.- Throws:
ResultException
-
getDocumentHistory
@NotNull @NotNull List<HistoryEntry> getDocumentHistory(@NotNull @NotNull String documentId) throws ResultException
Returns theHistoryEntrys known for theRestDocumentwith the given document ID.- Parameters:
documentId- The document ID of theRestDocumentthe history shall be requested for.- Returns:
- The
HistoryEntrys known for the selectedRestDocument. - Throws:
ResultException- Shall be thrown, should requesting the document history have failed.
-
getDocumentHistoryEntry
@NotNull @NotNull HistoryEntry getDocumentHistoryEntry(@NotNull @NotNull String documentId, int historyId) throws ResultException
Returns theHistoryEntrywith the given history ID for theRestDocumentwith the given document ID.- Parameters:
documentId- The document ID of theRestDocumenttheHistoryEntryshall be requested for.historyId- The history ID of theHistoryEntry, that shall be requested.- Returns:
- The selected
HistoryEntry. - Throws:
ResultException- Shall be thrown, should requesting the document history have failed.
-
updateDocumentHistory
@Nullable @Nullable HistoryEntry updateDocumentHistory(@NotNull @NotNull String documentId, @NotNull @NotNull HistoryEntry historyEntry) throws ResultException
Updates the history of theRestDocumentwith the given document ID using the givenHistoryEntry.- Parameters:
documentId- The document ID of theRestDocumentto update.historyEntry- TheHistoryEntryto update the contained values for.- Returns:
- The updated
HistoryEntry. - Throws:
ResultException- Shall be thrown, should updating the document history have failed.
-
-