|
Daisy Open Source CMS | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Repository
Start point for a user to access the repository.
An instance of this object is obtained from the RepositoryManager and
is contextualized for a certain user. Thus instead of having to supply
credentials to each method, you authenticate once via the RepositoryManager
and can then do all further operations on this Repository object.
A Repository object should not be assumed to be thread safe.
| Method Summary | |
|---|---|
void |
addListener(RepositoryListener listener)
Add an event listener. |
Document |
createDocument(String name,
long documentTypeId)
Same as createDocument(String, long, long, long) but assumes branch id 1
and language id 1. |
Document |
createDocument(String name,
long documentTypeId,
long branchId,
long languageId)
Creates a new document. |
Document |
createDocument(String name,
String documentTypeName)
Same as createDocument(String, long) but takes a document type
name instead of an id. |
Document |
createDocument(String name,
String documentTypeName,
String branchName,
String languageName)
Same as createDocument(String, long, long, long) but takes names instead
of ids. |
Document |
createVariant(String documentId,
long startBranchId,
long startLanguageId,
long startVersionId,
long newBranchId,
long newLanguageId,
boolean copyContent)
Creates a new variant on a document. |
Document |
createVariant(String documentId,
String startBranchName,
String startLanguageName,
long startVersionId,
String newBranchName,
String newLanguageName,
boolean copyContent)
|
void |
deleteDocument(String documentId)
Deletes a document permanently (unrecoverable) from the repository (including all its variants). |
void |
deleteVariant(String documentId,
long branchId,
long languageId)
|
void |
deleteVariant(VariantKey variantKey)
Deletes a document variant permanently (unrecoverable) from the repository. |
AccessManager |
getAccessManager()
|
long[] |
getActiveRoleIds()
The roles of the user that are currently active. |
String[] |
getActiveRolesDisplayNames()
Returns the names of the active roles. |
long[] |
getAvailableRoles()
The id's of the available roles of the user. |
AvailableVariants |
getAvailableVariants(String documentId)
Gets the available variants of a document. |
String |
getClientVersion()
Gets the version of the Daisy client API. |
CollectionManager |
getCollectionManager()
Returns the Collection Manager for this Repository. |
CommentManager |
getCommentManager()
|
Document |
getDocument(long documentId,
boolean updateable)
Deprecated. use getDocument(String, boolean) instead. |
Document |
getDocument(String documentId,
boolean updateable)
|
Document |
getDocument(String documentId,
long branchId,
long languageId,
boolean updateable)
Gets a document from the repository. |
Document |
getDocument(String documentId,
String branchName,
String languageName,
boolean updateable)
Gets a document from the repository. |
Document |
getDocument(VariantKey key,
boolean updateable)
Gets a document from the repository. |
Object |
getExtension(String name)
Retrieves an extension of the standard repository functionality. |
String |
getNamespace()
Returns the namespace for the current repository. |
NamespaceManager |
getNamespaceManager()
|
InputStream |
getPartData(String documentId,
long versionId,
long partTypeId)
Retrieves part data for the branch "main", language "default". |
InputStream |
getPartData(String documentId,
long branchId,
long languageId,
long versionId,
long partTypeId)
Retrieves the specified blob without the need to go through the Document object. |
QueryManager |
getQueryManager()
|
RepositorySchema |
getRepositorySchema()
|
String |
getServerVersion()
Returns the version number of the Daisy repository server. |
String |
getUserDisplayName()
The name of the user with who this Repository instance is associated, the same as returned from User.getDisplayName(). |
long |
getUserId()
Id of the user with who this Repository instance is associated. |
org.outerx.daisy.x10.UserInfoDocument |
getUserInfoAsXml()
Returns an XML document containing some information about the user with which this Repository instance is associated. |
String |
getUserLogin()
The login of the user with who this Repository instance is associated. |
UserManager |
getUserManager()
Returns the User Manager for this Repository |
VariantManager |
getVariantManager()
|
boolean |
hasExtension(String name)
|
boolean |
isInRole(long roleId)
|
boolean |
isInRole(String roleName)
|
String |
normalizeDocumentId(String documentId)
Makes sure the document ID is of the form "docSeqId-namespace", if the namespace is missing the default repository namespace is added. |
void |
removeListener(RepositoryListener listener)
Removes an event listener. |
void |
setActiveRoleIds(long[] roleIds)
Sets the active roles of the user. |
void |
switchRole(long roleId)
Changes the user's role for this Repository instance. |
| Method Detail |
|---|
String getNamespace()
Document createDocument(String name,
long documentTypeId,
long branchId,
long languageId)
RepositorySchema.
The document will not be stored physically
in the repository until Document.save() is called. Thus
calling this method has no permanent side effects.
Document createDocument(String name,
String documentTypeName,
String branchName,
String languageName)
createDocument(String, long, long, long) but takes names instead
of ids.
Document createDocument(String name,
long documentTypeId)
createDocument(String, long, long, long) but assumes branch id 1
and language id 1.
Document createDocument(String name,
String documentTypeName)
createDocument(String, long) but takes a document type
name instead of an id.
Document createVariant(String documentId,
long startBranchId,
long startLanguageId,
long startVersionId,
long newBranchId,
long newLanguageId,
boolean copyContent)
throws RepositoryException
Document.getVariantCreatedFromBranchId() etc. methods).
If copyContent is false, a document object for the new variant will
be returned, with no data copied from the start variant (except for
the document name), and the new variant will not yet be persisted
(i.o.w. you need to call save on the returned Document object to do
this). Thus using copyContent = false allows to create a variant
from scratch, while copyContent = true branches of from an existing
variant.
startVersionId - -1 for last version, -2 for live version
RepositoryException
Document createVariant(String documentId,
String startBranchName,
String startLanguageName,
long startVersionId,
String newBranchName,
String newLanguageName,
boolean copyContent)
throws RepositoryException
RepositoryException
Document getDocument(String documentId,
long branchId,
long languageId,
boolean updateable)
throws RepositoryException
updateable - if false, you won't be able to make modifications
to the document (and thus to save it). The repository
can return a cached copy in this case.
DocumentNotFoundException - in case the document does not exist
DocumentVariantNotFoundException - in case the document exists, but the variant not
NamespaceNotFoundException - in case the document ID contains an invalid namespace
DocumentReadDeniedException - if read access to the document is denied.
RepositoryException
Document getDocument(String documentId,
String branchName,
String languageName,
boolean updateable)
throws RepositoryException
In case the branch or language does not exist, this will throw a Branch/LanugageNotFoundexception.
branchName - a branch name, or a branch id as stringlanguageName - a language name, or a language id as string
RepositoryException
Document getDocument(VariantKey key,
boolean updateable)
throws RepositoryException
In case the branch or language ID specified in the VariantKey do not exist, this will not throw a Branch/LanguageNotFoundException, rather a Document(Variant)NotFoundException.
RepositoryException
Document getDocument(String documentId,
boolean updateable)
throws RepositoryException
RepositoryException
Document getDocument(long documentId,
boolean updateable)
throws RepositoryException
getDocument(String, boolean) instead.
RepositoryExceptionString normalizeDocumentId(String documentId)
This is an utility method.
IllegalArgumentException - if a null documentId is supplied
InvalidDocumentIdException - if the document ID is not validly structured.
AvailableVariants getAvailableVariants(String documentId)
throws RepositoryException
RepositoryException
void deleteDocument(String documentId)
throws RepositoryException
RepositoryException
void deleteVariant(String documentId,
long branchId,
long languageId)
throws RepositoryException
RepositoryExceptiondeleteVariant(VariantKey)
void deleteVariant(VariantKey variantKey)
throws RepositoryException
To delete a document variant virtually, but not permanently, you can set it
retired (see Document.setRetired(boolean)).
RepositoryException
InputStream getPartData(String documentId,
long branchId,
long languageId,
long versionId,
long partTypeId)
throws RepositoryException
DocumentReadDeniedException - if read access to the document is denied.
RepositoryException
InputStream getPartData(String documentId,
long versionId,
long partTypeId)
throws RepositoryException
RepositoryExceptionRepositorySchema getRepositorySchema()
AccessManager getAccessManager()
QueryManager getQueryManager()
CommentManager getCommentManager()
VariantManager getVariantManager()
CollectionManager getCollectionManager()
UserManager getUserManager()
NamespaceManager getNamespaceManager()
long getUserId()
String getUserDisplayName()
User.getDisplayName().
String getUserLogin()
long[] getActiveRoleIds()
setActiveRoleIds(long[]).
boolean isInRole(long roleId)
boolean isInRole(String roleName)
void setActiveRoleIds(long[] roleIds)
roleIds - a subset of, or equal to, the roles returned by getAvailableRoles().String[] getActiveRolesDisplayNames()
long[] getAvailableRoles()
void switchRole(long roleId)
setActiveRoleIds(long[]) with a one-length array.
roleId - a valid roleId, thus one of those returned by getAvailableRoles().org.outerx.daisy.x10.UserInfoDocument getUserInfoAsXml()
void addListener(RepositoryListener listener)
See also the comments in RepositoryListener.
Not all events are per-se also implemented in the repository client, and for so far as they are, they only provide events for operations done through that client, and not other ones happening on the server or through other clients.
This listener functionality is mostly meant for internal use, usually to clear caches. For most usecases you should use the JMS-based (assynchronous) event notification system.
A listener stays in effect until it is removed using
removeListener(org.outerj.daisy.repository.RepositoryListener).
void removeListener(RepositoryListener listener)
Object getExtension(String name)
The reason for making this extension functionality part of the Repository API, instead of using completely separate and standalone components, is that in this way the extensions can operate in the authenticated context of the current user (ie Repository instance).
So, for as far as the extension performs any operations that depend on the current user and its role, the extension will operate using the same credentials as associated with the Repository object from which the extension instance has been retrieved.
boolean hasExtension(String name)
String getClientVersion()
getServerVersion().
At the time of this writing, in the remote API implementation this will usually also be the same, as the client and server API implementations evolve together and get the same version numbers assigned.
String getServerVersion()
|
Daisy Open Source CMS | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||