Package org.ametys.plugins.explorer.cmis
Class CMISRootResourcesCollection
java.lang.Object
org.ametys.plugins.repository.AbstractAmetysObject
org.ametys.plugins.explorer.cmis.CMISRootResourcesCollection
- All Implemented Interfaces:
ExplorerNode,ResourceCollection,AmetysObject,DataHolder,ModifiableDataHolder,JCRAmetysObject,MetadataAwareAmetysObject,ModifiableMetadataAwareAmetysObject,ModifiableAmetysObject,RemovableAmetysObject,TraversableAmetysObject
public class CMISRootResourcesCollection
extends AbstractAmetysObject
implements JCRAmetysObject, ResourceCollection
AmetysObject implementing the root of CMISResourcesCollections-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringapplication id for resources collections.static final StringAttribute for repository root pathstatic final StringMetadata for user passwordstatic final StringMetadata for repository idstatic final StringMetadata for repository urlstatic final StringMetadata for user login -
Constructor Summary
ConstructorsConstructorDescriptionCMISRootResourcesCollection(javax.jcr.Node node, String parentPath, CMISTreeFactory factory) Creates aCMISRootResourcesCollection. -
Method Summary
Modifier and TypeMethodDescriptionReturns the application id corresponding to this Node.Retrieves a given child from its relative path.Retrieves children of the current object.getComposite(String compositePath) Retrieves the composite at the given pathgetComposite(String compositePath, boolean createNew) Retrieves the composite at the given pathprotected ModifiableDataHolderReturns theDataHolderof thisAmetysObject.Get the description of the applicationReturns the path of this explorer node in the explorer hierarchy (which is a subset of the whole repository).
If this collection is the root explorer node, "" is returned.Returns the icon css class for this Node.getId()Retrieves the unique identifier of this AmetysObject.
It must be unique in the whole repository and must never be null.
It must conform to the URI syntax:
<protocol>://<protocol-specific-part>Returns the rootCompositeMetadataof thisAmetysObject.Get the CMIS mount pointgetName()Retrieves the name of the current object.javax.jcr.NodegetNode()Gives access to the underlying JCR node.<A extends AmetysObject>
AReturns the parent object in the Ametys hierarchy.Optional<? extends ModifiableDataHolder> Retrieves the optional parent of the currentDataHolderThere can be no parent if the currentDataHolderis the rootReturns the path of the parent object in the Ametys hierarchy.Get the password to connect to CMIS repositorygetPath()Retrieves the path of the current object.Retrieves the repository data used by thisDataHolderGet the CMIS repository idGet the CMIS repository URLReturns the path of this resource collection in its hierarchy (which is a subset of the whole repository).
If this collection is the root collection, "" is returned.Retrieves theDataHolderthat is the root of the current onegetUser()Get the user to connect to CMIS repositorybooleanTests if this Object has at least one child with the given name.booleanReturns true if this explorer node contains child explorer nodes.booleanReturns true if this explorer node contains resources.booleanReturns true if there is pending changes.voidremove()Removes thisAmetysObjectfrom the Ametys tree.voidremoveValue(String dataPath) Removes the stored value of the data at the given pathvoidRename theAmetysObjectvoidDiscard pending changes and revert to the currently persisted version.voidPersists pending changes.
If the underlying Node is new, the Session is globally saved.voidsetMountPoint(String mountPoint) Set a mount point for the CMIS RepositoryvoidsetPassword(String password) Set a password for the CMIS RepositoryvoidSet the id of the CMIS repositoryvoidsetRepositoryUrl(String url) Set the URL of the CMIS repositoryvoidSet a user name for the CMIS RepositoryvoidSets the value of the data at the given pathvoidSets the value of the data at the given path<T extends SynchronizationResult>
TsynchronizeValues(Map<String, Object> values) Synchronizes the given values with the current onesMethods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
dataToJSON, dataToJSON, dataToSAX, dataToSAX, equals, getDataNames, getModelItemTypeExtensionPoint, getType, getValue, getValueOfType, getValueOfTypeOrDefault, getValueOrDefault, hasDifferences, hashCode, hasValue, hasValue, hasValueOrEmpty, isMultiple, isMultiple, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, hashCodeMethods inherited from interface org.ametys.plugins.repository.data.holder.DataHolder
copyTo, copyTo, dataToJSON, dataToJSON, dataToJSON, dataToJSON, dataToSAX, dataToSAX, dataToSAX, dataToSAX, getDataNames, getModelItemTypeExtensionPoint, getType, getValue, getValueOfType, getValueOfTypeOrDefault, getValueOrDefault, hasDifferences, hasValue, hasValue, hasValueOrEmpty, isMultiple, isMultipleMethods inherited from interface org.ametys.plugins.repository.TraversableAmetysObject
getChildAt, getChildPosition
-
Field Details
-
APPLICATION_ID
application id for resources collections.- See Also:
-
DATA_REPOSITORY_ID
Metadata for repository id- See Also:
-
DATA_REPOSITORY_URL
Metadata for repository url- See Also:
-
DATA_MOUNT_POINT
Attribute for repository root path- See Also:
-
DATA_USER
Metadata for user login- See Also:
-
DATA_PASSWORD
Metadata for user password- See Also:
-
-
Constructor Details
-
CMISRootResourcesCollection
Creates aCMISRootResourcesCollection.- Parameters:
node- the node backing thisAmetysObjectparentPath- the parentPath in the Ametys hierarchyfactory- the CMISRootResourcesCollectionFactory which created this AmetysObject
-
-
Method Details
-
getChild
public AmetysObject getChild(String path) throws AmetysRepositoryException, UnknownAmetysObjectException Description copied from interface:TraversableAmetysObjectRetrieves a given child from its relative path. The path cannot benull, empty nor begin with a'/'.- Specified by:
getChildin interfaceTraversableAmetysObject- Parameters:
path- the path of the child which can contains a position with.[n]if same name sibling is allowed.- Returns:
- the child found.
- Throws:
AmetysRepositoryException- if an error occurs.UnknownAmetysObjectException- if the object does not exist.
-
getChildren
Description copied from interface:TraversableAmetysObjectRetrieves children of the current object.- Specified by:
getChildrenin interfaceTraversableAmetysObject- Returns:
- the children or an empty
AmetysObjectIterable. - Throws:
AmetysRepositoryException- if an error occurs.
-
hasChild
Description copied from interface:TraversableAmetysObjectTests if this Object has at least one child with the given name.- Specified by:
hasChildin interfaceTraversableAmetysObject- Parameters:
name- the name to test. Cannot benullnor empty nor begin with a'/'and it cannot contain'/'.- Returns:
trueif the named child exists,falseotherwise.- Throws:
AmetysRepositoryException- if an error occurs.
-
getDataHolder
Description copied from class:AbstractAmetysObjectReturns theDataHolderof thisAmetysObject.- Specified by:
getDataHolderin classAbstractAmetysObject- Returns:
- the
DataHolderof thisAmetysObject
-
getMetadataHolder
Description copied from interface:MetadataAwareAmetysObjectReturns the rootCompositeMetadataof thisAmetysObject.- Specified by:
getMetadataHolderin interfaceMetadataAwareAmetysObject- Specified by:
getMetadataHolderin interfaceModifiableMetadataAwareAmetysObject- Returns:
- the root
CompositeMetadataof thisAmetysObject
-
getIconCls
Description copied from interface:ExplorerNodeReturns the icon css class for this Node.- Specified by:
getIconClsin interfaceExplorerNode- Returns:
- the icon css class for this Node for rendering in the tree.
-
getApplicationId
Description copied from interface:ExplorerNodeReturns the application id corresponding to this Node.- Specified by:
getApplicationIdin interfaceExplorerNode- Returns:
- the application id corresponding to this Node.
-
getName
Description copied from interface:AmetysObjectRetrieves the name of the current object.- Specified by:
getNamein interfaceAmetysObject- Returns:
- the name.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getParentPath
Description copied from interface:AmetysObjectReturns the path of the parent object in the Ametys hierarchy.- Specified by:
getParentPathin interfaceAmetysObject- Returns:
- the path of the parent object.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getPath
Description copied from interface:AmetysObjectRetrieves the path of the current object.- Specified by:
getPathin interfaceAmetysObject- Returns:
- the path.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getNode
Description copied from interface:JCRAmetysObjectGives access to the underlying JCR node.- Specified by:
getNodein interfaceJCRAmetysObject- Returns:
- the JCR node backing this AmetysObject.
-
getId
Description copied from interface:AmetysObjectRetrieves the unique identifier of this AmetysObject.
It must be unique in the whole repository and must never be null.
It must conform to the URI syntax:
<protocol>://<protocol-specific-part>- Specified by:
getIdin interfaceAmetysObject- Returns:
- the unique identifier of this AmetysObject
-
hasChildResources
Description copied from interface:ResourceCollectionReturns true if this explorer node contains resources.- Specified by:
hasChildResourcesin interfaceResourceCollection- Returns:
- true if this explorer node contains resources.
- Throws:
AmetysRepositoryException- if an error occurs.
-
hasChildExplorerNodes
Description copied from interface:ExplorerNodeReturns true if this explorer node contains child explorer nodes.- Specified by:
hasChildExplorerNodesin interfaceExplorerNode- Returns:
- true if this explorer node contains child explorer nodes.
- Throws:
AmetysRepositoryException- if an error occurs.
-
rename
Description copied from interface:ModifiableAmetysObjectRename theAmetysObject- Specified by:
renamein interfaceModifiableAmetysObject- Parameters:
newName- the new name of the ametys object- Throws:
AmetysRepositoryException- if an error occurs.
-
remove
Description copied from interface:RemovableAmetysObjectRemoves thisAmetysObjectfrom the Ametys tree.- Specified by:
removein interfaceRemovableAmetysObject- Throws:
AmetysRepositoryException- if an error occurs.RepositoryIntegrityViolationException- if thisAmetysObjectis referenced by another objects.
-
getParent
Description copied from interface:AmetysObjectReturns the parent object in the Ametys hierarchy.- Specified by:
getParentin interfaceAmetysObject- Type Parameters:
A- the type of the parentAmetysObject.- Returns:
- the parent object or
nullif current object is the root. - Throws:
AmetysRepositoryException- if an error occurs.
-
saveChanges
Description copied from interface:ModifiableAmetysObjectPersists pending changes.
If the underlying Node is new, the Session is globally saved.- Specified by:
saveChangesin interfaceModifiableAmetysObject- Throws:
AmetysRepositoryException- if an error occurs.
-
revertChanges
Description copied from interface:ModifiableAmetysObjectDiscard pending changes and revert to the currently persisted version.- Specified by:
revertChangesin interfaceModifiableAmetysObject- Throws:
AmetysRepositoryException- if an error occurs.
-
needsSave
Description copied from interface:ModifiableAmetysObjectReturns true if there is pending changes.- Specified by:
needsSavein interfaceModifiableAmetysObject- Returns:
- true if there is pending changes.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getResourcePath
Description copied from interface:ResourceCollectionReturns the path of this resource collection in its hierarchy (which is a subset of the whole repository).
If this collection is the root collection, "" is returned.- Specified by:
getResourcePathin interfaceResourceCollection- Returns:
- the path of this collection in its hierarchy.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getExplorerPath
Description copied from interface:ExplorerNodeReturns the path of this explorer node in the explorer hierarchy (which is a subset of the whole repository).
If this collection is the root explorer node, "" is returned.- Specified by:
getExplorerPathin interfaceExplorerNode- Returns:
- the path of this node in its hierarchy.
-
getUser
Get the user to connect to CMIS repository- Returns:
- the user login
- Throws:
AmetysRepositoryException- if an error occurred
-
getPassword
Get the password to connect to CMIS repository- Returns:
- the user password
- Throws:
AmetysRepositoryException- if an error occurred
-
getRepositoryUrl
Get the CMIS repository URL- Returns:
- the CMIS repository URL
- Throws:
AmetysRepositoryException- if an error occurred
-
getRepositoryId
Get the CMIS repository id- Returns:
- the CMIS repository id
- Throws:
AmetysRepositoryException- if an error occurred
-
getMountPoint
Get the CMIS mount point- Returns:
- the mount point
- Throws:
AmetysRepositoryException- if an error occurred
-
setRepositoryUrl
Set the URL of the CMIS repository- Parameters:
url- the CMIS repository URL- Throws:
AmetysRepositoryException- if an error occurred
-
setRepositoryId
Set the id of the CMIS repository- Parameters:
id- the CMIS repository id- Throws:
AmetysRepositoryException- if an error occurred
-
setMountPoint
Set a mount point for the CMIS Repository- Parameters:
mountPoint- the mount point path
-
setUser
Set a user name for the CMIS Repository- Parameters:
user- the login
-
setPassword
Set a password for the CMIS Repository- Parameters:
password- the password
-
getDescription
Description copied from interface:ExplorerNodeGet the description of the application- Specified by:
getDescriptionin interfaceExplorerNode- Returns:
- the description
-
getComposite
public ModifiableComposite getComposite(String compositePath) throws IllegalArgumentException, UnknownTypeException, BadItemTypeException Description copied from interface:DataHolderRetrieves the composite at the given path- Specified by:
getCompositein interfaceDataHolder- Specified by:
getCompositein interfaceModifiableDataHolder- Overrides:
getCompositein classAbstractAmetysObject- Parameters:
compositePath- path of the composite to retrieve- Returns:
- the composite or
nullif not exists or is empty - Throws:
IllegalArgumentException- if the given composite path is null or emptyUnknownTypeException- if the type composite is not available for this data holderBadItemTypeException- if the stored value at the given path is not a composite
-
getComposite
public ModifiableComposite getComposite(String compositePath, boolean createNew) throws IllegalArgumentException, UnknownTypeException, BadItemTypeException Description copied from interface:ModifiableDataHolderRetrieves the composite at the given path- Specified by:
getCompositein interfaceModifiableDataHolder- Parameters:
compositePath- path of the composite to retrievecreateNew-trueto create the composite if it does not exist,falseotherwise- Returns:
- the composite or
nullif createNew isfalseand value not exists or is empty - Throws:
IllegalArgumentException- if the given composite path is null or emptyUnknownTypeException- if the type composite is not available for this data holderBadItemTypeException- if the stored value at the given path is not a composite
-
synchronizeValues
public <T extends SynchronizationResult> T synchronizeValues(Map<String, Object> values) throws UnknownTypeException, NotUniqueTypeException, BadItemTypeExceptionDescription copied from interface:ModifiableDataHolderSynchronizes the given values with the current ones- Specified by:
synchronizeValuesin interfaceModifiableDataHolder- Type Parameters:
T- the type of theSynchronizationResult- Parameters:
values- the values to synchronize- Returns:
- the
SynchronizationResult - Throws:
UnknownTypeException- if there is no available type compatible with a given value for this data holder's type extension pointNotUniqueTypeException- if there is more than one available types compatibles with the a value for this data holder's type extension pointBadItemTypeException- if type of the a data doesn't match the corresponding given value to set
-
setValue
public void setValue(String dataPath, Object value) throws IllegalArgumentException, UnknownDataException, UnknownTypeException, NotUniqueTypeException, BadItemTypeException Description copied from interface:ModifiableDataHolderSets the value of the data at the given path- Specified by:
setValuein interfaceModifiableDataHolder- Parameters:
dataPath- path of the datavalue- the value to set. To empty a value, useModifiableDataHolder.setValue(String, Object, String)with anullvalue- Throws:
IllegalArgumentException- if the given data path is null or emptyUnknownDataException- if the given the data path is composed of an non existing groupUnknownTypeException- if there is no available type compatible with the given value for this data holder's type extension pointNotUniqueTypeException- if there is more than one available types compatibles with the given value for this data holder's type extension pointBadItemTypeException- if type of the data at the given path doesn't match the given value to set
-
setValue
public void setValue(String dataPath, Object value, String dataType) throws IllegalArgumentException, UnknownDataException, UnknownTypeException, BadItemTypeException Description copied from interface:ModifiableDataHolderSets the value of the data at the given path- Specified by:
setValuein interfaceModifiableDataHolder- Parameters:
dataPath- path of the datavalue- the value to set. Givenullto empty the value.dataType- type identifier of the data- Throws:
IllegalArgumentException- if the given data path is null or emptyUnknownDataException- if the given data path is composed of an non existing groupUnknownTypeException- if the given type is not available for this data holder's type extension pointBadItemTypeException- if the given type doesn't match the given value to set
-
removeValue
public void removeValue(String dataPath) throws IllegalArgumentException, UnknownTypeException, BadItemTypeException Description copied from interface:ModifiableDataHolderRemoves the stored value of the data at the given path- Specified by:
removeValuein interfaceModifiableDataHolder- Parameters:
dataPath- path of the data- Throws:
IllegalArgumentException- if the given data path is null or emptyUnknownTypeException- if the the data to remove is in a group and there is no available type compatible with this groupBadItemTypeException- if the value of the parent of the given path is not an item container
-
getRepositoryData
Description copied from interface:DataHolderRetrieves the repository data used by thisDataHolder- Specified by:
getRepositoryDatain interfaceDataHolder- Specified by:
getRepositoryDatain interfaceModifiableDataHolder- Overrides:
getRepositoryDatain classAbstractAmetysObject- Returns:
- the repository data used by this
DataHolder
-
getParentDataHolder
Description copied from interface:DataHolderRetrieves the optional parent of the currentDataHolderThere can be no parent if the currentDataHolderis the root- Specified by:
getParentDataHolderin interfaceDataHolder- Specified by:
getParentDataHolderin interfaceModifiableDataHolder- Overrides:
getParentDataHolderin classAbstractAmetysObject- Returns:
- the parent of the current
DataHolder
-
getRootDataHolder
Description copied from interface:DataHolderRetrieves theDataHolderthat is the root of the current one- Specified by:
getRootDataHolderin interfaceDataHolder- Specified by:
getRootDataHolderin interfaceModifiableDataHolder- Overrides:
getRootDataHolderin classAbstractAmetysObject- Returns:
- the root
DataHolder
-