Package org.ametys.cms.repository
Class DefaultIndexableTraversableAmetysObjectFactory
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory
org.ametys.plugins.repository.jcr.SimpleModelAwareAmetysObjectFactory
org.ametys.cms.repository.SimpleIndexableAmetysObjectFactory
org.ametys.cms.repository.DefaultIndexableTraversableAmetysObjectFactory
- All Implemented Interfaces:
AmetysObjectFactory<SimpleAmetysObject>,JCRAmetysObjectFactory<SimpleAmetysObject>,Component,Configurable,LogEnabled,Serviceable
- Direct Known Subclasses:
FormFactory,FormQuestionFactory,JCRCalendarEventFactory,JCRCalendarFactory,JCRTasksListFactory,SiteFactory,TrashElementFactory
public class DefaultIndexableTraversableAmetysObjectFactory
extends SimpleIndexableAmetysObjectFactory
Default implementation of an
JCRAmetysObjectFactory,
handling DefaultIndexableTraversableAmetysObject.-
Field Summary
Fields inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory
_ametysFactoryExtensionPoint, _manager, _modelItemTypeExtensionPoint, _nodetype, _repository, _resolver, _scheme -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<A extends AmetysObject>
AcreateChild(DefaultIndexableTraversableAmetysObject object, String name, String type) Creates a child to the given object.getAmetysObject(javax.jcr.Node node, String parentPath) Creates aAmetysObjectfrom a persistent JCR node.<A extends AmetysObject>
AgetChild(DefaultIndexableTraversableAmetysObject object, String path) Returns theAmetysObjectat the given subPath, relative to the givenDefaultIndexableTraversableAmetysObject.<A extends AmetysObject>
AmetysObjectIterable<A> Returns all children of the givenDefaultIndexableTraversableAmetysObject.booleanhasChild(DefaultIndexableTraversableAmetysObject object, String name) Tests if a given object has a child with a given name.Methods inherited from class org.ametys.plugins.repository.jcr.SimpleModelAwareAmetysObjectFactory
getModel, getModelItemTypeExtensionPointIdMethods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory
configure, getAmetysObjectById, getAmetysObjectById, getModelItemTypeExtensionPoint, getNode, getNodetypes, getParent, getScheme, getWorkspaceNode, hasAmetysObjectForId, serviceMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Constructor Details
-
DefaultIndexableTraversableAmetysObjectFactory
-
-
Method Details
-
getAmetysObject
public DefaultIndexableTraversableAmetysObject getAmetysObject(javax.jcr.Node node, String parentPath) throws AmetysRepositoryException Description copied from interface:JCRAmetysObjectFactoryCreates aAmetysObjectfrom a persistent JCR node.- Specified by:
getAmetysObjectin interfaceJCRAmetysObjectFactory<SimpleAmetysObject>- Overrides:
getAmetysObjectin classSimpleIndexableAmetysObjectFactory- 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.
-
getChild
public <A extends AmetysObject> A getChild(DefaultIndexableTraversableAmetysObject object, String path) throws AmetysRepositoryException, UnknownAmetysObjectException Returns theAmetysObjectat the given subPath, relative to the givenDefaultIndexableTraversableAmetysObject.- Type Parameters:
A- the actual type ofAmetysObject.- Parameters:
object- the contextDefaultIndexableTraversableAmetysObject.path- the sub path. Cannot benull, empty or absolute.- Returns:
- the
AmetysObjectat the given subPath, relative to the givenDefaultIndexableTraversableAmetysObject. - Throws:
AmetysRepositoryException- if an error occurs.UnknownAmetysObjectException- if no such object exists.
-
getChildren
public <A extends AmetysObject> AmetysObjectIterable<A> getChildren(DefaultIndexableTraversableAmetysObject object) throws AmetysRepositoryException Returns all children of the givenDefaultIndexableTraversableAmetysObject.- Type Parameters:
A- the actual type ofAmetysObjects- Parameters:
object- aDefaultIndexableTraversableAmetysObject.- Returns:
- a List containing all children object in the Ametys hierarchy.
- Throws:
AmetysRepositoryException- if an error occurs.
-
hasChild
public boolean hasChild(DefaultIndexableTraversableAmetysObject object, String name) throws AmetysRepositoryException Tests if a given object has a child with a given name.- Parameters:
object- the context object.name- the name to test.- Returns:
trueis the given object has a child with the given name,falseotherwise.- Throws:
AmetysRepositoryException- if an error occurs.
-
createChild
public <A extends AmetysObject> A createChild(DefaultIndexableTraversableAmetysObject object, String name, String type) throws AmetysRepositoryException Creates a child to the given object.- Type Parameters:
A- the actual type ofAmetysObject.- Parameters:
object- the parentAmetysObject.name- the new object's name.type- the new object's type.- Returns:
- the newly created
AmetysObject. - Throws:
AmetysRepositoryException- if an error occurs.
-