public class AmetysObjectCollectionFactory extends SimpleAmetysObjectFactory
AmetysObjectCollection.| Modifier and Type | Class and Description |
|---|---|
private class |
AmetysObjectCollectionFactory.WrapperNodeIterator |
| Modifier and Type | Field and Description |
|---|---|
static String |
COLLECTION_ELEMENT_NODETYPE
JCR nodetype for collection elements (ie.
|
static String |
COLLECTION_NODETYPE
JCR nodetype for the collection itself
|
_ametysFactoryExtensionPoint, _manager, _nodetype, _repository, _resolver, _scheme| Constructor and Description |
|---|
AmetysObjectCollectionFactory() |
| Modifier and Type | Method and Description |
|---|---|
private void |
_addFirstLevelChildren(String parentPath,
List<AmetysObjectIterable> iterators,
NodeIterator it,
Session session) |
private void |
_addNextLevelChildren(String parentPath,
List<AmetysObjectIterable> iterators,
NodeIterator it,
Session session) |
void |
configure(Configuration configuration) |
<A extends AmetysObject> |
createChild(String parentPath,
Node parentNode,
String name,
String type)
Creates a child object in the collection and resolve it to an
AmetysObject. |
AmetysObjectCollection |
getAmetysObject(Node node,
String parentPath)
Creates a
AmetysObject from a persistent JCR node. |
AmetysObjectIterable |
getChildren(String parentPath,
Node collectionNode)
Returns the
AmetysObjects children of the JCR Node backing an AmetysObjectCollection.This method should never been called by clients. |
protected String[] |
getHashedPath(String name)
Computes a hashed path in the JCR tree from the name of the child object.
Subclasses may override this method to provide a more suitable hash function. This implementation relies on the buzhash algorithm. |
Collection<String> |
getNodetypes()
Returns the nodetypes of the
Node associated with this factory. |
<A extends AmetysObject> |
getObject(String parentPath,
Node node,
String subPath)
Returns a single
AmetysObject given its path and JCR Node.This method should never been called by clients. |
AmetysObject |
getParent(AmetysObjectCollection object)
Returns the parent of the given
AmetysObjectCollection |
String |
getScheme()
Returns the protocol of this factory, used to construct unique ids.
|
getAmetysObjectById, getAmetysObjectById, getNode, getParent, getWorkspaceNode, hasAmetysObjectForId, serviceenableLogging, getLogger, setupLogger, setupLogger, setupLoggerpublic static final String COLLECTION_NODETYPE
public static final String COLLECTION_ELEMENT_NODETYPE
public AmetysObjectCollectionFactory()
public void configure(Configuration configuration) throws ConfigurationException
configure in interface Configurableconfigure in class SimpleAmetysObjectFactoryConfigurationExceptionpublic String getScheme()
AmetysObjectFactorygetScheme in interface AmetysObjectFactory<SimpleAmetysObject>getScheme in class SimpleAmetysObjectFactorypublic Collection<String> getNodetypes()
JCRAmetysObjectFactoryNode associated with this factory.getNodetypes in interface JCRAmetysObjectFactory<SimpleAmetysObject>getNodetypes in class SimpleAmetysObjectFactoryNode.public AmetysObjectCollection getAmetysObject(Node node, String parentPath) throws AmetysRepositoryException, RepositoryException
JCRAmetysObjectFactoryAmetysObject from a persistent JCR node.getAmetysObject in interface JCRAmetysObjectFactory<SimpleAmetysObject>getAmetysObject in class SimpleAmetysObjectFactorynode - the JCR node to use.parentPath - the parent Path in the Ametys hierarchy,
may be null if not known yet.AmetysRepositoryException - if an error occurs.RepositoryException - if a JCR error occurs.protected String[] getHashedPath(String name)
name - the name of the child objectpublic AmetysObject getParent(AmetysObjectCollection object) throws AmetysRepositoryException
AmetysObjectCollectionobject - an AmetysObjectCollectionAmetysObjectCollectionAmetysRepositoryException - if an error occurspublic <A extends AmetysObject> A getObject(String parentPath, Node node, String subPath) throws AmetysRepositoryException
AmetysObject given its path and JCR Node.A - the type of the composite AmetysObject.parentPath - the path of the collectionnode - the node of the childsubPath - the subpath in the Ametys hierarchyAmetysObjectAmetysRepositoryException - if an error occurs.public <A extends AmetysObject> A createChild(String parentPath, Node parentNode, String name, String type) throws AmetysRepositoryException
AmetysObject.A - the type of the composite AmetysObject.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.AmetysObject.AmetysRepositoryException - if an error occurs.public AmetysObjectIterable getChildren(String parentPath, Node collectionNode)
AmetysObjects children of the JCR Node backing an AmetysObjectCollection.parentPath - the parent path in the Ametys hierarchy of all AmetysObject being returned.collectionNode - the JCR Node backing the AmetysObjectCollection.AmetysObjects children.private void _addFirstLevelChildren(String parentPath, List<AmetysObjectIterable> iterators, NodeIterator it, Session session) throws RepositoryException
RepositoryExceptionprivate void _addNextLevelChildren(String parentPath, List<AmetysObjectIterable> iterators, NodeIterator it, Session session) throws RepositoryException
RepositoryException