Interface ExtRepository
Most data transferred in this class is in the external repository's domain format. For example, external repository data such as object keys and user names are strings expressed in the native external repository format.
One exception is the search(SearchContext, Query, ExtRepositoryQueryMapper)
method where the Query
contains Liferay
identifiers and user names. To help with this, the ExtRepositoryQueryMapper
instance can be used to translate such IDs to the
native external repository format.
-
Method Summary
Modifier and TypeMethodDescriptionaddExtRepositoryFileEntry
(String extRepositoryParentFolderKey, String fileName, String mimeType, String title, String description, String changeLog, InputStream inputStream) Adds an external repository file entry and associated metadata based on theInputStream
object.addExtRepositoryFolder
(String extRepositoryParentFolderKey, String name, String description) Adds an external repository folder.cancelCheckOut
(String extRepositoryFileEntryKey) Cancels the check out of the external repository file.void
checkInExtRepositoryFileEntry
(String extRepositoryFileEntryKey, boolean createMajorVersion, String changeLog) Checks in the external repository file entry.checkOutExtRepositoryFileEntry
(String extRepositoryFileEntryKey) Checks out the external repository file entry.<T extends ExtRepositoryObject>
TcopyExtRepositoryObject
(ExtRepositoryObjectType<T> extRepositoryObjectType, String extRepositoryFileEntryKey, String newExtRepositoryFolderKey, String newTitle) Copies the external repository object to a different parent folder.void
deleteExtRepositoryObject
(ExtRepositoryObjectType<? extends ExtRepositoryObject> extRepositoryObjectType, String extRepositoryObjectKey) Deletes the external repository object.getContentStream
(ExtRepositoryFileEntry extRepositoryFileEntry) Returns the content stream of the external repository file entry.getContentStream
(ExtRepositoryFileVersion extRepositoryFileVersion) Returns the content stream of the external repository file version.getExtRepositoryFileVersion
(ExtRepositoryFileEntry extRepositoryFileEntry, String version) Returns the external repository file version of the file entry, identified by the version name.getExtRepositoryFileVersionDescriptor
(String extRepositoryFileVersionKey) Returns theExtRepositoryFileVersionDescriptor
translated from the repository file version key.getExtRepositoryFileVersions
(ExtRepositoryFileEntry extRepositoryFileEntry) Returns the external repository file versions of the external repository file entry.<T extends ExtRepositoryObject>
TgetExtRepositoryObject
(ExtRepositoryObjectType<T> extRepositoryObjectType, String extRepositoryObjectKey) Returns the external repository object matching the type and key.<T extends ExtRepositoryObject>
TgetExtRepositoryObject
(ExtRepositoryObjectType<T> extRepositoryObjectType, String extRepositoryFolderKey, String title) Returns the external repository object matching the type and title, in the parent folder.<T extends ExtRepositoryObject>
List<T>getExtRepositoryObjects
(ExtRepositoryObjectType<T> extRepositoryObjectType, String extRepositoryFolderKey) Returns the external repository objects matching the type, in the parent folder.int
getExtRepositoryObjectsCount
(ExtRepositoryObjectType<? extends ExtRepositoryObject> extRepositoryObjectType, String extRepositoryFolderKey) Returns the number of elements in the external repository folder matching the object type.getExtRepositoryParentFolder
(ExtRepositoryObject extRepositoryObject) Returns the external repository parent folder of the external repository object.getLiferayLogin
(String extRepositoryLogin) Returns the Liferay login value, which is mapped from the user's external repository login value.Returns the primary key of the external repository root folder.getSubfolderKeys
(String extRepositoryFolderKey, boolean recurse) Returns the keys of the external repository subfolders stored inside the external repository folder.String[]
Returns the supported configurations for the external repository.String[][]
Returns the supported external repository configuration parameters indexed by configuration type.void
initRepository
(com.liferay.portal.kernel.util.UnicodeProperties typeSettingsUnicodeProperties, CredentialsProvider credentialsProvider) Initializes the external repository and checks the connectivity between the external repository and Liferay Portal.<T extends ExtRepositoryObject>
TmoveExtRepositoryObject
(ExtRepositoryObjectType<T> extRepositoryObjectType, String extRepositoryObjectKey, String newExtRepositoryFolderKey, String newTitle) Moves the external repository object to a different location.search
(com.liferay.portal.kernel.search.SearchContext searchContext, com.liferay.portal.kernel.search.Query query, ExtRepositoryQueryMapper extRepositoryQueryMapper) Returns the external repository objects fulfilling the query.updateExtRepositoryFileEntry
(String extRepositoryFileEntryKey, String mimeType, InputStream inputStream) Updates the external repository file entry's content.
-
Method Details
-
addExtRepositoryFileEntry
ExtRepositoryFileEntry addExtRepositoryFileEntry(String extRepositoryParentFolderKey, String fileName, String mimeType, String title, String description, String changeLog, InputStream inputStream) throws com.liferay.portal.kernel.exception.PortalException Adds an external repository file entry and associated metadata based on theInputStream
object.- Parameters:
extRepositoryParentFolderKey
- the primary key of the repository file entry's parent folderfileName
- the repository file entry's file namemimeType
- the repository file entry's MIME typetitle
- the repository file entry's titledescription
- the repository file entry's descriptionchangeLog
- the repository file entry's version change loginputStream
- the repository file entry's data (optionallynull
)- Returns:
- the repository file entry
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository parent folder could not be found or if the repository file entry's information was invalid
-
addExtRepositoryFolder
ExtRepositoryFolder addExtRepositoryFolder(String extRepositoryParentFolderKey, String name, String description) throws com.liferay.portal.kernel.exception.PortalException Adds an external repository folder.- Parameters:
extRepositoryParentFolderKey
- the primary key of the repository folder's parent foldername
- the repository folder's namedescription
- the repository folder's description- Returns:
- the repository folder
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository parent folder could not be found or if the repository folder's information was invalid
-
cancelCheckOut
ExtRepositoryFileVersion cancelCheckOut(String extRepositoryFileEntryKey) throws com.liferay.portal.kernel.exception.PortalException Cancels the check out of the external repository file. If a user has not checked out the external repository file entry, invoking this method results in no changes.- Parameters:
extRepositoryFileEntryKey
- the primary key of the repository file entry- Returns:
- the discarded repository file version, or
null
if no version was available - Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository file entry's information was invalid
-
checkInExtRepositoryFileEntry
void checkInExtRepositoryFileEntry(String extRepositoryFileEntryKey, boolean createMajorVersion, String changeLog) throws com.liferay.portal.kernel.exception.PortalException Checks in the external repository file entry. If a user has not checked out the external repository file entry, invoking this method results in no changes.- Parameters:
extRepositoryFileEntryKey
- the primary key of the repository file entrycreateMajorVersion
- whether to increase the major or minor version numberchangeLog
- the description of the changes being checked in- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository file entry's information was invalid
-
checkOutExtRepositoryFileEntry
ExtRepositoryFileEntry checkOutExtRepositoryFileEntry(String extRepositoryFileEntryKey) throws com.liferay.portal.kernel.exception.PortalException Checks out the external repository file entry.- Parameters:
extRepositoryFileEntryKey
- the primary key of the repository file entry- Returns:
- the checked out repository file entry
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository file entry's information was invalid
-
copyExtRepositoryObject
<T extends ExtRepositoryObject> T copyExtRepositoryObject(ExtRepositoryObjectType<T> extRepositoryObjectType, String extRepositoryFileEntryKey, String newExtRepositoryFolderKey, String newTitle) throws com.liferay.portal.kernel.exception.PortalException Copies the external repository object to a different parent folder.- Parameters:
extRepositoryObjectType
- the repository object's type (file or folder)extRepositoryFileEntryKey
- the primary key of the repository objectnewExtRepositoryFolderKey
- the primary key of the repository destination foldernewTitle
- the new name of the repository object in the destination folder- Returns:
- the repository object
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if a portal exception occurred
-
deleteExtRepositoryObject
void deleteExtRepositoryObject(ExtRepositoryObjectType<? extends ExtRepositoryObject> extRepositoryObjectType, String extRepositoryObjectKey) throws com.liferay.portal.kernel.exception.PortalException Deletes the external repository object.- Parameters:
extRepositoryObjectType
- the repository object's type (file or folder)extRepositoryObjectKey
- the primary key of the repository object- Throws:
com.liferay.portal.kernel.exception.PortalException
- if a portal exception occurred
-
getAuthType
String getAuthType() -
getContentStream
InputStream getContentStream(ExtRepositoryFileEntry extRepositoryFileEntry) throws com.liferay.portal.kernel.exception.PortalException Returns the content stream of the external repository file entry.- Parameters:
extRepositoryFileEntry
- the primary key of the repository file entry- Returns:
- the content stream of the repository file entry
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository file entry's information was invalid
-
getContentStream
InputStream getContentStream(ExtRepositoryFileVersion extRepositoryFileVersion) throws com.liferay.portal.kernel.exception.PortalException Returns the content stream of the external repository file version.- Parameters:
extRepositoryFileVersion
- the primary key of the repository file version- Returns:
- the content stream of the repository file version
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository file version's information was invalid
-
getExtRepositoryFileVersion
ExtRepositoryFileVersion getExtRepositoryFileVersion(ExtRepositoryFileEntry extRepositoryFileEntry, String version) throws com.liferay.portal.kernel.exception.PortalException Returns the external repository file version of the file entry, identified by the version name.- Parameters:
extRepositoryFileEntry
- the primary key of the repository file entryversion
- the repository version name (e.g.1.0
)- Returns:
- the repository file version of the file entry
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository file entry or version information was invalid
-
getExtRepositoryFileVersionDescriptor
ExtRepositoryFileVersionDescriptor getExtRepositoryFileVersionDescriptor(String extRepositoryFileVersionKey) Returns theExtRepositoryFileVersionDescriptor
translated from the repository file version key. The descriptor describes the external repository file entry key and version name.- Parameters:
extRepositoryFileVersionKey
- the repository file version's key- Returns:
- the
ExtRepositoryFileVersionDescriptor
translated from the repository file version key
-
getExtRepositoryFileVersions
List<ExtRepositoryFileVersion> getExtRepositoryFileVersions(ExtRepositoryFileEntry extRepositoryFileEntry) throws com.liferay.portal.kernel.exception.PortalException Returns the external repository file versions of the external repository file entry. The versions are ordered newest to oldest.- Parameters:
extRepositoryFileEntry
- the primary key of the repository file entry- Returns:
- the repository file versions of the repository file entry
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository file entry was invalid
-
getExtRepositoryObject
<T extends ExtRepositoryObject> T getExtRepositoryObject(ExtRepositoryObjectType<T> extRepositoryObjectType, String extRepositoryObjectKey) throws com.liferay.portal.kernel.exception.PortalException Returns the external repository object matching the type and key.- Parameters:
extRepositoryObjectType
- the repository object's type. UseExtRepositoryObjectType.FILE
,ExtRepositoryObjectType.FOLDER
, orExtRepositoryObjectType.OBJECT
to specify file, folder, or both, respectively.extRepositoryObjectKey
- the primary key of the repository object- Returns:
- the repository object matching the type and key
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if a portal exception occurred
-
getExtRepositoryObject
<T extends ExtRepositoryObject> T getExtRepositoryObject(ExtRepositoryObjectType<T> extRepositoryObjectType, String extRepositoryFolderKey, String title) throws com.liferay.portal.kernel.exception.PortalException Returns the external repository object matching the type and title, in the parent folder.- Parameters:
extRepositoryObjectType
- the repository object's type. UseExtRepositoryObjectType.FILE
,ExtRepositoryObjectType.FOLDER
, orExtRepositoryObjectType.OBJECT
to specify file, folder, or both, respectively.extRepositoryFolderKey
- the primary key of the repository object's parent foldertitle
- the repository object's name- Returns:
- the repository object matching the type and title, in the parent folder
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if a portal exception occurred
-
getExtRepositoryObjects
<T extends ExtRepositoryObject> List<T> getExtRepositoryObjects(ExtRepositoryObjectType<T> extRepositoryObjectType, String extRepositoryFolderKey) throws com.liferay.portal.kernel.exception.PortalException Returns the external repository objects matching the type, in the parent folder. Depending on the repository object type requested, this method may return only repository files, only repository folders, or both repository files and folders.- Parameters:
extRepositoryObjectType
- the type of repository objects to return. UseExtRepositoryObjectType.FILE
,ExtRepositoryObjectType.FOLDER
, orExtRepositoryObjectType.OBJECT
to specify file, folder, or both, respectively.extRepositoryFolderKey
- the primary key of the repository folder to search- Returns:
- the repository objects matching the type, in the parent folder
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if a portal exception occurred
-
getExtRepositoryObjectsCount
int getExtRepositoryObjectsCount(ExtRepositoryObjectType<? extends ExtRepositoryObject> extRepositoryObjectType, String extRepositoryFolderKey) throws com.liferay.portal.kernel.exception.PortalException Returns the number of elements in the external repository folder matching the object type. Depending on the repository object type requested, this method may only return the number of repository files, the number of repository folders, or the combined number of repository files and folders.- Parameters:
extRepositoryObjectType
- the repository object type to count. UseExtRepositoryObjectType.FILE
,ExtRepositoryObjectType.FOLDER
, orExtRepositoryObjectType.OBJECT
to specify file, folder, or both, respectively.extRepositoryFolderKey
- the primary key of the repository folder to search- Returns:
- the number of elements in the repository folder matching the object type
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if a portal exception occurred
-
getExtRepositoryParentFolder
ExtRepositoryFolder getExtRepositoryParentFolder(ExtRepositoryObject extRepositoryObject) throws com.liferay.portal.kernel.exception.PortalException Returns the external repository parent folder of the external repository object.- Parameters:
extRepositoryObject
- the repository object (file or folder)- Returns:
- the repository parent folder of the repository object
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository object's information was invalid
-
getLiferayLogin
Returns the Liferay login value, which is mapped from the user's external repository login value. A Liferay login value can be a user ID, screen name, email, etc, depending on the value returned by thegetAuthType()
method. The format of the repository login is specific for each repository implementation.- Parameters:
extRepositoryLogin
- the user's repository login value- Returns:
- the Liferay login value, which is mapped from the user's repository login value
-
getRootFolderKey
Returns the primary key of the external repository root folder.- Returns:
- the primary key of the repository root folder
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository root folder could not be accessed
-
getSubfolderKeys
List<String> getSubfolderKeys(String extRepositoryFolderKey, boolean recurse) throws com.liferay.portal.kernel.exception.PortalException Returns the keys of the external repository subfolders stored inside the external repository folder.- Parameters:
extRepositoryFolderKey
- the primary key of the repository folderrecurse
- whether to recurse through each repository subfolder- Returns:
- the keys of the repository subfolders stored inside the repository folder
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository folder's information was invalid
-
getSupportedConfigurations
String[] getSupportedConfigurations()Returns the supported configurations for the external repository. Each configuration may have a different list of supported parameters.- Returns:
- the supported configurations for the repository
- See Also:
-
getSupportedParameters
String[][] getSupportedParameters()Returns the supported external repository configuration parameters indexed by configuration type. These parameters are stored in the database when the repository is configured and made available through aUnicodeProperties
object passed to theinitRepository(UnicodeProperties, CredentialsProvider)
method.- Returns:
- the supported repository configuration parameters indexed by configuration type
- See Also:
-
initRepository
void initRepository(com.liferay.portal.kernel.util.UnicodeProperties typeSettingsUnicodeProperties, CredentialsProvider credentialsProvider) throws com.liferay.portal.kernel.exception.PortalException Initializes the external repository and checks the connectivity between the external repository and Liferay Portal.This method uses the credentials provided by the
CredentialsProvider
object to authenticate to the repository. In addition, the method acquires the repository-specific configuration parameters from the type settings properties parameter. The parameters contained in the type settings properties parameter object are indexed by the key names returned by thegetSupportedParameters()
method. This method is called only once, the first time the repository is used.- Parameters:
typeSettingsUnicodeProperties
- the type settings propertiescredentialsProvider
- the Liferay Portal username and password- Throws:
com.liferay.portal.kernel.exception.PortalException
- if a portal exception occurred
-
moveExtRepositoryObject
<T extends ExtRepositoryObject> T moveExtRepositoryObject(ExtRepositoryObjectType<T> extRepositoryObjectType, String extRepositoryObjectKey, String newExtRepositoryFolderKey, String newTitle) throws com.liferay.portal.kernel.exception.PortalException Moves the external repository object to a different location. This method can also be used to rename repository objects.- Parameters:
extRepositoryObjectType
- the repository object's type (file or folder)extRepositoryObjectKey
- the primary key of the repository objectnewExtRepositoryFolderKey
- the primary key of the destination repository foldernewTitle
- the new name of the repository object (may not change)- Returns:
- the repository object
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the repository object could not be moved or if a portal exception occurred
-
search
List<ExtRepositorySearchResult<?>> search(com.liferay.portal.kernel.search.SearchContext searchContext, com.liferay.portal.kernel.search.Query query, ExtRepositoryQueryMapper extRepositoryQueryMapper) throws com.liferay.portal.kernel.exception.PortalException Returns the external repository objects fulfilling the query. There may be some limitations due to back-end repository constraints.The limitations are repository specific, which means there is a specific set of constraints for each type of external repository (Documentum, SharePoint, etc). This method is given a
Query
object, which is a logic expression matching Lucene's capabilities. Implementors of external repositories must map that query to a native repository query. Some external repositories may be missing some of Lucene's capabilities, so the query may not be fully translated.- Parameters:
searchContext
- the search context to be applied. The folder ID, start bound, and end bound attributes must be set in this search context.query
- the logical expression describing the query to be performed. This may need to be translated to an equivalent native repository query.extRepositoryQueryMapper
- the repository query mapper to translate Liferay IDs to the native repository format- Returns:
- the repository objects fulfilling the query
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if a portal exception occurred
-
updateExtRepositoryFileEntry
ExtRepositoryFileEntry updateExtRepositoryFileEntry(String extRepositoryFileEntryKey, String mimeType, InputStream inputStream) throws com.liferay.portal.kernel.exception.PortalException Updates the external repository file entry's content.- Parameters:
extRepositoryFileEntryKey
- the primary key of the repository file entrymimeType
- the repository file entry's MIME typeinputStream
- the new repository file entry's content- Returns:
- the updated file entry
- Throws:
com.liferay.portal.kernel.exception.PortalException
- if a portal exception occurred
-