Class AmetysObjectCollectionFactory
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory
org.ametys.plugins.repository.collection.AmetysObjectCollectionFactory
- All Implemented Interfaces:
AmetysObjectFactory<SimpleAmetysObject>,JCRAmetysObjectFactory<SimpleAmetysObject>,Component,Configurable,LogEnabled,Serviceable
Factory for
AmetysObjectCollection.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJCR nodetype for collection elements (ie.static final StringJCR nodetype for the collection itselfFields inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory
_ametysFactoryExtensionPoint, _manager, _nodetype, _repository, _resolver, _scheme -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(Configuration configuration) <A extends AmetysObject>
AcreateChild(String parentPath, javax.jcr.Node parentNode, String name, String type) Creates a child object in the collection and resolve it to anAmetysObject.getAmetysObject(javax.jcr.Node node, String parentPath) Creates aAmetysObjectfrom a persistent JCR node.getChildren(String parentPath, javax.jcr.Node collectionNode) Returns theAmetysObjects children of the JCR Node backing anAmetysObjectCollection.
This method should never been called by clients.Returns the nodetypes of theNodeassociated with this factory.<A extends AmetysObject>
AReturns a singleAmetysObjectgiven its path and JCR Node.
This method should never been called by clients.getParent(AmetysObjectCollection object) Returns the parent of the givenAmetysObjectCollectionReturns the protocol of this factory, used to construct unique ids.Methods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory
getAmetysObjectById, getAmetysObjectById, getNode, getParent, getWorkspaceNode, hasAmetysObjectForId, serviceMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
COLLECTION_NODETYPE
JCR nodetype for the collection itself- See Also:
-
COLLECTION_ELEMENT_NODETYPE
JCR nodetype for collection elements (ie. nodes "between" the collection and contained contents)- See Also:
-
-
Constructor Details
-
AmetysObjectCollectionFactory
public AmetysObjectCollectionFactory()
-
-
Method Details
-
configure
- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classSimpleAmetysObjectFactory- Throws:
ConfigurationException
-
getScheme
Description copied from interface:AmetysObjectFactoryReturns the protocol of this factory, used to construct unique ids.- Specified by:
getSchemein interfaceAmetysObjectFactory<SimpleAmetysObject>- Overrides:
getSchemein classSimpleAmetysObjectFactory- Returns:
- the protocol of this factory.
-
getNodetypes
Description copied from interface:JCRAmetysObjectFactoryReturns the nodetypes of theNodeassociated with this factory.- Specified by:
getNodetypesin interfaceJCRAmetysObjectFactory<SimpleAmetysObject>- Overrides:
getNodetypesin classSimpleAmetysObjectFactory- Returns:
- the nodetypes of the
Node.
-
getAmetysObject
public AmetysObjectCollection getAmetysObject(javax.jcr.Node node, String parentPath) throws AmetysRepositoryException, javax.jcr.RepositoryException Description copied from interface:JCRAmetysObjectFactoryCreates aAmetysObjectfrom a persistent JCR node.- Specified by:
getAmetysObjectin interfaceJCRAmetysObjectFactory<SimpleAmetysObject>- Overrides:
getAmetysObjectin classSimpleAmetysObjectFactory- Parameters:
node- the JCR node to use.parentPath- the parent Path in the Ametys hierarchy, may benullif not known yet.- Returns:
- the object.
- Throws:
AmetysRepositoryException- if an error occurs.javax.jcr.RepositoryException- if a JCR error occurs.
-
getParent
Returns the parent of the givenAmetysObjectCollection- Parameters:
object- anAmetysObjectCollection- Returns:
- the parent of the given
AmetysObjectCollection - Throws:
AmetysRepositoryException- if an error occurs
-
getObject
public <A extends AmetysObject> A getObject(String parentPath, javax.jcr.Node node, String subPath) throws AmetysRepositoryException Returns a singleAmetysObjectgiven its path and JCR Node.
This method should never been called by clients.- Type Parameters:
A- the type of the compositeAmetysObject.- Parameters:
parentPath- the path of the collectionnode- the node of the childsubPath- the subpath in the Ametys hierarchy- Returns:
- an
AmetysObject - Throws:
AmetysRepositoryException- if an error occurs.
-
createChild
public <A extends AmetysObject> A createChild(String parentPath, javax.jcr.Node parentNode, String name, String type) throws AmetysRepositoryException Creates a child object in the collection and resolve it to anAmetysObject.- Type Parameters:
A- the type of the compositeAmetysObject.- Parameters:
parentPath- the parentPath of the new object.parentNode- the parent JCR Node of the new object, corresponding to a collection element.name- the name of the new object.type- the type of the Node backing the new object.- Returns:
- the newly created
AmetysObject. - Throws:
AmetysRepositoryException- if an error occurs.
-
getChildren
Returns theAmetysObjects children of the JCR Node backing anAmetysObjectCollection.
This method should never been called by clients.- Parameters:
parentPath- the parent path in the Ametys hierarchy of allAmetysObjectbeing returned.collectionNode- the JCR Node backing theAmetysObjectCollection.- Returns:
- the
AmetysObjects children.
-