| org.outerj.daisy.repository.commonimpl.DocumentStrategy
All known Subclasses: org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy, org.outerj.daisy.repository.clientimpl.RemoteDocumentStrategy,
DocumentStrategy | public interface DocumentStrategy (Code) | | Allows to customise some of the behaviour of the
CommonRepository , and especially
DocumentImpl .
The typical use of this is to provide two implementations of the repository API's:
one for local (in-server) use, and one for remote (= client) use, by only having to
implement twice those aspects which differ in each implementation.
The most important difference between the client and server API implementations
will be how they load and store entities (such as Document objects): the client API
implementation will do this by contacting the server, the server implementation will
do this by using its persistence mechanisms (such as an RDBMS).
Note that this API is not really meant for public consumption, and the correct
workings of its implementations (especially the server-side one) are crucial for
the correct operation of the repository. It is important that the strategy implementation
correctly initialiases, updates and interprets the internal state of the objects it handles.
Certain methonds, like
DocumentStrategy.load(DocId,long,long,AuthenticatedUser) and
DocumentStrategy.store(org.outerj.daisy.repository.commonimpl.DocumentImpl) need to check
if the user has the rights to perform this operation. This is especially true for the serverside
implementation, the client side implementation doesn't need to do this as it will contact the
server which will automatically do this checks.
Certain methods, like
DocumentStrategy.store(org.outerj.daisy.repository.commonimpl.DocumentImpl) might
also need to send out events to eventlisteners.
|
Method Summary | |
public void | completeVersion(DocumentVariantImpl variant, VersionImpl version) Loads the additional information skipped when the version was loaded via
DocumentStrategy.loadShallowVersions(org.outerj.daisy.repository.commonimpl.DocumentVariantImpl) . | public Document | createVariant(DocId docId, long startBranchId, long startLanguageId, long startVersionId, long newBranchId, long newLanguageId, AuthenticatedUser user) | public void | deleteDocument(DocId docId, AuthenticatedUser user) | public void | deleteVariant(DocId docId, long branchId, long languageId, AuthenticatedUser user) | public AvailableVariantImpl[] | getAvailableVariants(DocId docId, AuthenticatedUser user) | public InputStream | getBlob(DocId docId, long branchId, long languageId, long versionId, long partTypeId, AuthenticatedUser user) | public InputStream | getBlob(String blobKey) This method does not check access rights (unlike
DocumentStrategy.getBlob(DocId,long,long,long,long,AuthenticatedUser) ,
because this one is only intended for use by Part objects. | public LockInfoImpl | getLockInfo(DocumentVariantImpl documentVariant) | public Document | load(DocId docId, long branchId, long languageId, AuthenticatedUser user) | public VersionImpl[] | loadShallowVersions(DocumentVariantImpl variant) Loads all Version objects for this document as shallow Version objects (i.e. | public VersionImpl | loadVersion(DocumentVariantImpl documentVariant, long versionId) | public LockInfoImpl | lock(DocumentVariantImpl documentVariant, long duration, LockType lockType) Tries to create a lock on the document. | public LockInfoImpl | releaseLock(DocumentVariantImpl documentVariant) | public void | store(DocumentImpl document) Stores a document. | public void | storeVersion(DocumentImpl document, VersionImpl version, VersionState versionState, VersionKey syncedWith, ChangeType changeType, String changeComment) |
createVariant | public Document createVariant(DocId docId, long startBranchId, long startLanguageId, long startVersionId, long newBranchId, long newLanguageId, AuthenticatedUser user) throws RepositoryException(Code) | | Parameters: startVersionId - -1 for last version, -2 for live version |
loadShallowVersions | public VersionImpl[] loadShallowVersions(DocumentVariantImpl variant) throws RepositoryException(Code) | | Loads all Version objects for this document as shallow Version objects (i.e. without
their full content, but only the data necessary to show a version overview table).
|
lock | public LockInfoImpl lock(DocumentVariantImpl documentVariant, long duration, LockType lockType) throws RepositoryException(Code) | | Tries to create a lock on the document. If there was alread a pessimitic lock on
the document, this method will return a LockInfo object containing information about
that lock, so it is important to check the info in the LockInfo object to know if
the lock was successful.
|
store | public void store(DocumentImpl document) throws RepositoryException(Code) | | Stores a document. After successful storage, the document object status should be
updates, i.e. the lastModified and lastModifier parts should be updated, and some
dirty-indication flags should be reset.
|
|
|