Class RestWebServiceDocumentState
- java.lang.Object
-
- net.webpdf.wsclient.session.rest.documents.RestWebServiceDocumentState
-
- All Implemented Interfaces:
RestDocumentState<RestWebServiceDocument>
public class RestWebServiceDocumentState extends Object implements RestDocumentState<RestWebServiceDocument>
An instance of
RestWebServiceDocumentStaterepresents the internal state of aRestWebServiceDocument, that has been uploaded to a webPDF server.The
RestWebServiceDocumentStateallows aRestWebServiceDocumentto access and publish the state, without violating the exclusive update rights of theDocumentManager.
(i.e. TheDocumentManagershall always be the only entity, that is allowed to change the internal state of an uploaded document.)
-
-
Constructor Summary
Constructors Constructor Description RestWebServiceDocumentState(@NotNull String documentId, @NotNull RestWebServiceDocumentManager documentManager)Creates aRestWebServiceDocumentStateknown to the webPDF server by the given document ID.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull HistoryEntryactiveHistory()Returns the currently activeHistoryEntry.@NotNull DocumentFilegetDocumentFile()Returns theDocumentFileof the managedRestWebServiceDocument.@NotNull StringgetDocumentId()Returns the document ID of the managedRestWebServiceDocument.@NotNull DocumentManager<RestWebServiceDocument>getDocumentManager()Returns the owningDocumentManager.@NotNull List<HistoryEntry>getHistory()Returns theHistoryEntrys of the managedRestWebServiceDocument.@NotNull HistoryEntrygetHistoryEntry(int historyId)Returns aHistoryEntryfrom the internal history map, by given history ID.intgetHistorySize()Returns the number of knownHistoryEntrys for thisRestWebServiceDocument.@NotNull HistoryEntrylastHistory()Returns the most recentHistoryEntry.voidsetDocumentFile(@NotNull DocumentFile documentFile)Sets theDocumentFileof the managedRestWebServiceDocument.voidsetHistory(@NotNull HistoryEntry[] historyEntries)Replaces the internally storedHistoryEntrylist of the managedRestDocumentvoidupdateHistoryEntry(@NotNull HistoryEntry historyEntry)Updates the givenHistoryEntryin the internally managed document history.
-
-
-
Constructor Detail
-
RestWebServiceDocumentState
public RestWebServiceDocumentState(@NotNull @NotNull String documentId, @NotNull @NotNull RestWebServiceDocumentManager documentManager)Creates aRestWebServiceDocumentStateknown to the webPDF server by the given document ID.- Parameters:
documentId- The document ID of the managedRestWebServiceDocument.documentManager- The owningDocumentManager
-
-
Method Detail
-
getDocumentId
@NotNull public @NotNull String getDocumentId()
Returns the document ID of the managedRestWebServiceDocument.- Specified by:
getDocumentIdin interfaceRestDocumentState<RestWebServiceDocument>- Returns:
- The document ID of the managed
RestWebServiceDocument.
-
getDocumentFile
@NotNull public @NotNull DocumentFile getDocumentFile()
Returns theDocumentFileof the managedRestWebServiceDocument.- Specified by:
getDocumentFilein interfaceRestDocumentState<RestWebServiceDocument>- Returns:
- The
DocumentFileof the managedRestWebServiceDocument.
-
setDocumentFile
public void setDocumentFile(@NotNull @NotNull DocumentFile documentFile)Sets theDocumentFileof the managedRestWebServiceDocument.- Specified by:
setDocumentFilein interfaceRestDocumentState<RestWebServiceDocument>- Parameters:
documentFile- the newDocumentFileof the managedRestWebServiceDocument.
-
getHistory
@NotNull public @NotNull List<HistoryEntry> getHistory()
Returns theHistoryEntrys of the managedRestWebServiceDocument.- Specified by:
getHistoryin interfaceRestDocumentState<RestWebServiceDocument>- Returns:
- The
HistoryEntrys of the managedRestWebServiceDocument.
-
setHistory
public void setHistory(@NotNull @NotNull HistoryEntry[] historyEntries) throws ResultExceptionReplaces the internally storedHistoryEntrylist of the managedRestDocument- Specified by:
setHistoryin interfaceRestDocumentState<RestWebServiceDocument>- Parameters:
historyEntries- The newHistoryEntrys to be set.- Throws:
ResultException- Shall be thrown, when updating the document history failed.
-
getHistoryEntry
@NotNull public @NotNull HistoryEntry getHistoryEntry(int historyId) throws ResultException
Returns aHistoryEntryfrom the internal history map, by given history ID.- Specified by:
getHistoryEntryin interfaceRestDocumentState<RestWebServiceDocument>- Parameters:
historyId- The history ID of theHistoryEntrythat shall be returned.- Returns:
- A
HistoryEntryrepresenting a historic state of the uploaded resource. - Throws:
ResultException- Shall be thrown, should accessing the document history fail.
-
updateHistoryEntry
public void updateHistoryEntry(@NotNull @NotNull HistoryEntry historyEntry) throws ResultExceptionUpdates the givenHistoryEntryin the internally managed document history.- Specified by:
updateHistoryEntryin interfaceRestDocumentState<RestWebServiceDocument>- Parameters:
historyEntry- TheHistoryEntrycontaining the values to be set.- Throws:
ResultException- Shall be thrown, when updating the document history failed.
-
lastHistory
@NotNull public @NotNull HistoryEntry lastHistory() throws ResultException
Returns the most recentHistoryEntry.- Specified by:
lastHistoryin interfaceRestDocumentState<RestWebServiceDocument>- Returns:
- The most recent
HistoryEntry. - Throws:
ResultException- Shall be thrown, when updating the document history failed.
-
getHistorySize
public int getHistorySize()
Returns the number of knownHistoryEntrys for thisRestWebServiceDocument.- Specified by:
getHistorySizein interfaceRestDocumentState<RestWebServiceDocument>- Returns:
- The number of known
HistoryEntrys for thisRestWebServiceDocument.
-
activeHistory
@NotNull public @NotNull HistoryEntry activeHistory() throws ResultException
Returns the currently activeHistoryEntry.- Specified by:
activeHistoryin interfaceRestDocumentState<RestWebServiceDocument>- Returns:
- The currently active
HistoryEntry. - Throws:
ResultException- Shall be thrown, when updating the document history failed.
-
getDocumentManager
@NotNull public @NotNull DocumentManager<RestWebServiceDocument> getDocumentManager()
Returns the owningDocumentManager.- Specified by:
getDocumentManagerin interfaceRestDocumentState<RestWebServiceDocument>- Returns:
- The owning
DocumentManager.
-
-