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,JCRAmetysObject,MetadataAwareAmetysObject,ModifiableMetadataAwareAmetysObject,ModifiableAmetysObject,RemovableAmetysObject,TraversableAmetysObject
public class CMISRootResourcesCollection extends AbstractAmetysObject implements JCRAmetysObject, ResourceCollection
AmetysObjectimplementing the root ofCMISResourcesCollections
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.Logger__LOGGERprivate CMISTreeFactory_factoryThe correspondingSimpleAmetysObjectFactoryprivate String_nameprivate Node_nodeprivate String_parentPathprivate Folder_rootprivate Session_sessionstatic StringAPPLICATION_IDapplication id for resources collections.static StringMETADATA_PASSWORDMetadata for user passwordstatic StringMETADATA_REPOSITORY_IDMetadata for repository idstatic StringMETADATA_REPOSITORY_URLMetadata for repository urlstatic StringMETADATA_USERMetadata for user login
-
Constructor Summary
Constructors Constructor Description CMISRootResourcesCollection(Node node, String parentPath, CMISTreeFactory factory)Creates aCMISRootResourcesCollection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidconnect(Session session, Folder root)StringgetApplicationId()Returns the application id corresponding to this Node.AmetysObjectgetChild(String path)Retrieves a given child from its relative path.CollectionIterable<AmetysObject>getChildren()Retrieves children of the current object.StringgetDescription()Get the description of the applicationStringgetExplorerPath()Returns 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.StringgetIconCls()Returns the icon css class for this Node.StringgetId()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>ModifiableCompositeMetadatagetMetadataHolder()Returns the rootCompositeMetadataof thisAmetysObject.StringgetName()Retrieves the name of the current object.NodegetNode()Gives access to the underlying JCR node.<A extends AmetysObject>
AgetParent()Returns the parent object in the Ametys hierarchy.StringgetParentPath()Returns the path of the parent object in the Ametys hierarchy.StringgetPassword()Get the password to connect to CMIS repositoryStringgetPath()Retrieves the path of the current object.StringgetRepositoryId()Get the CMIS repository idStringgetRepositoryUrl()Get the CMIS repository URLStringgetResourcePath()Returns 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.(package private) FoldergetRootFolder()(package private) SessiongetSession()StringgetUser()Get the user to connect to CMIS repositorybooleanhasChild(String name)Tests if this Object has at least one child with the given name.booleanhasChildExplorerNodes()Returns true if this explorer node contains child explorer nodes.booleanhasChildResources()Returns true if this explorer node contains resources.booleanneedsSave()Returns true if there is pending changes.voidremove()Removes thisAmetysObjectfrom the Ametys tree.voidrename(String newName)Rename theAmetysObjectvoidrevertChanges()Discard pending changes and revert to the currently persisted version.voidsaveChanges()Persists pending changes.
If the underlying Node is new, the Session is globally saved.voidsetPassword(String password)Set a password for the CMIS RepositoryvoidsetRepositoryId(String id)Set the id of the CMIS repositoryvoidsetRepositoryUrl(String url)Set the URL of the CMIS repositoryvoidsetUser(String user)Set a user name for the CMIS Repository-
Methods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, hashCode
-
Methods inherited from interface org.ametys.plugins.repository.TraversableAmetysObject
getChildAt, getChildPosition
-
-
-
-
Field Detail
-
APPLICATION_ID
public static final String APPLICATION_ID
application id for resources collections.- See Also:
- Constant Field Values
-
METADATA_REPOSITORY_ID
public static final String METADATA_REPOSITORY_ID
Metadata for repository id- See Also:
- Constant Field Values
-
METADATA_REPOSITORY_URL
public static final String METADATA_REPOSITORY_URL
Metadata for repository url- See Also:
- Constant Field Values
-
METADATA_USER
public static final String METADATA_USER
Metadata for user login- See Also:
- Constant Field Values
-
METADATA_PASSWORD
public static final String METADATA_PASSWORD
Metadata for user password- See Also:
- Constant Field Values
-
__LOGGER
private static final org.slf4j.Logger __LOGGER
-
_factory
private final CMISTreeFactory _factory
The correspondingSimpleAmetysObjectFactory
-
_parentPath
private String _parentPath
-
-
Constructor Detail
-
CMISRootResourcesCollection
public CMISRootResourcesCollection(Node node, String parentPath, CMISTreeFactory factory)
Creates aCMISRootResourcesCollection.- Parameters:
node- the node backing thisAmetysObjectparentPath- the parentPath in the Ametys hierarchyfactory- the CMISRootResourcesCollectionFactory which created this AmetysObject
-
-
Method Detail
-
getSession
Session getSession()
-
getRootFolder
Folder getRootFolder()
-
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
public CollectionIterable<AmetysObject> getChildren() throws AmetysRepositoryException
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
public boolean hasChild(String name) throws AmetysRepositoryException
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.
-
getMetadataHolder
public ModifiableCompositeMetadata getMetadataHolder()
Description copied from interface:MetadataAwareAmetysObjectReturns the rootCompositeMetadataof thisAmetysObject.- Specified by:
getMetadataHolderin interfaceMetadataAwareAmetysObject- Specified by:
getMetadataHolderin interfaceModifiableMetadataAwareAmetysObject- Returns:
- the root
CompositeMetadataof thisAmetysObject
-
getIconCls
public String 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
public String 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
public String getName() throws AmetysRepositoryException
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
public String getParentPath() throws AmetysRepositoryException
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
public String getPath() throws AmetysRepositoryException
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
public Node getNode()
Description copied from interface:JCRAmetysObjectGives access to the underlying JCR node.- Specified by:
getNodein interfaceJCRAmetysObject- Returns:
- the JCR node backing this AmetysObject.
-
getId
public String 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
public boolean hasChildResources() throws AmetysRepositoryException
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
public boolean hasChildExplorerNodes() throws AmetysRepositoryException
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
public void rename(String newName) throws AmetysRepositoryException
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
public void remove() throws AmetysRepositoryException, RepositoryIntegrityViolationException
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
public <A extends AmetysObject> A getParent() throws AmetysRepositoryException
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
public void saveChanges() throws AmetysRepositoryException
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
public void revertChanges() throws AmetysRepositoryException
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
public boolean needsSave() throws AmetysRepositoryException
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
public String getResourcePath() throws AmetysRepositoryException
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
public String 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
public String getUser() throws AmetysRepositoryException
Get the user to connect to CMIS repository- Returns:
- the user login
- Throws:
AmetysRepositoryException- if an error occurred
-
getPassword
public String getPassword() throws AmetysRepositoryException
Get the password to connect to CMIS repository- Returns:
- the user password
- Throws:
AmetysRepositoryException- if an error occurred
-
getRepositoryUrl
public String getRepositoryUrl() throws AmetysRepositoryException
Get the CMIS repository URL- Returns:
- the CMIS repository URL
- Throws:
AmetysRepositoryException- if an error occurred
-
getRepositoryId
public String getRepositoryId() throws AmetysRepositoryException
Get the CMIS repository id- Returns:
- the CMIS repository id
- Throws:
AmetysRepositoryException- if an error occurred
-
setRepositoryUrl
public void setRepositoryUrl(String url) throws AmetysRepositoryException
Set the URL of the CMIS repository- Parameters:
url- the CMIS repository URL- Throws:
AmetysRepositoryException- if an error occurred
-
setRepositoryId
public void setRepositoryId(String id) throws AmetysRepositoryException
Set the id of the CMIS repository- Parameters:
id- the CMIS repository id- Throws:
AmetysRepositoryException- if an error occurred
-
setUser
public void setUser(String user)
Set a user name for the CMIS Repository- Parameters:
user- the login
-
setPassword
public void setPassword(String password)
Set a password for the CMIS Repository- Parameters:
password- the password
-
getDescription
public String getDescription()
Description copied from interface:ExplorerNodeGet the description of the application- Specified by:
getDescriptionin interfaceExplorerNode- Returns:
- the description
-
-