Package org.ametys.cms.repository
Class ContentFactory
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory
-
- org.ametys.plugins.repository.jcr.DefaultAmetysObjectFactory
-
- org.ametys.cms.repository.ContentFactory
-
- All Implemented Interfaces:
AmetysObjectFactory<SimpleAmetysObject>,JCRAmetysObjectFactory<SimpleAmetysObject>,Component,Configurable,LogEnabled,Serviceable
- Direct Known Subclasses:
DefaultWebContentFactory,DefaultWorkflowAwareContentFactory,ModifiableContentFactory
public class ContentFactory extends DefaultAmetysObjectFactory
AmetysObjectFactoryhandlingDefaultContent.
-
-
Field Summary
Fields Modifier and Type Field Description private ContentDAO_contentDAOprivate ContentDataHelper_contentDataHelperprivate ContentHelper_contentHelperprivate ContentSaxer_contentSaxerprivate ModifiableContentHelper_modifiableContentHelperprivate ServiceManager_serviceManager-
Fields inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory
_ametysFactoryExtensionPoint, _manager, _nodetype, _repository, _resolver, _scheme
-
-
Constructor Summary
Constructors Constructor Description ContentFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) AmetysObjectResolver_getAOResolver()(package private) ContentDAO_getContentDAO()(package private) ModifiableContentHelper_getModifiableContentHelper()<A extends AmetysObject>
AcreateChild(DefaultContent object, String name, String type)Creates a child to the given object.DefaultContentgetAmetysObject(Node node, String parentPath)Creates aAmetysObjectfrom a persistent JCR node.<A extends AmetysObject>
AgetChild(DefaultContent object, String path)Returns theAmetysObjectat the given subPath, relative to the givenDefaultTraversableAmetysObject.<A extends AmetysObject>
AmetysObjectIterable<A>getChildren(DefaultContent object)Returns all children of the givenDefaultTraversableAmetysObject.ContentDataHelpergetContentDataHelper()Retrieves the content data helperContentHelpergetContentHelper()Retrieves the content helperContentSaxergetContentSaxer()Retrieves the content saxerbooleanhasChild(DefaultContent object, String name)Tests if a given object has a child with a given name.voidservice(ServiceManager smanager)-
Methods inherited from class org.ametys.plugins.repository.jcr.DefaultAmetysObjectFactory
getCurrentUser, getUnversionedDataTypeExtensionPoint, getWorkspaceNode
-
Methods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory
configure, getAmetysObjectById, getAmetysObjectById, getNode, getNodetypes, getParent, getScheme, hasAmetysObjectForId
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_serviceManager
private ServiceManager _serviceManager
-
_contentDAO
private ContentDAO _contentDAO
-
_contentSaxer
private ContentSaxer _contentSaxer
-
_contentHelper
private ContentHelper _contentHelper
-
_modifiableContentHelper
private ModifiableContentHelper _modifiableContentHelper
-
_contentDataHelper
private ContentDataHelper _contentDataHelper
-
-
Constructor Detail
-
ContentFactory
public ContentFactory()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classDefaultAmetysObjectFactory- Throws:
ServiceException
-
_getContentDAO
ContentDAO _getContentDAO()
-
_getAOResolver
AmetysObjectResolver _getAOResolver()
-
_getModifiableContentHelper
ModifiableContentHelper _getModifiableContentHelper()
-
getContentSaxer
public ContentSaxer getContentSaxer()
Retrieves the content saxer- Returns:
- the content saxer
-
getContentHelper
public ContentHelper getContentHelper()
Retrieves the content helper- Returns:
- the content helper
-
getContentDataHelper
public ContentDataHelper getContentDataHelper()
Retrieves the content data helper- Returns:
- the content data helper
-
getAmetysObject
public DefaultContent getAmetysObject(Node node, String parentPath) throws AmetysRepositoryException
Description copied from interface:JCRAmetysObjectFactoryCreates aAmetysObjectfrom a persistent JCR node.- Specified by:
getAmetysObjectin interfaceJCRAmetysObjectFactory<SimpleAmetysObject>- Overrides:
getAmetysObjectin classDefaultAmetysObjectFactory- 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(DefaultContent object, String path) throws AmetysRepositoryException, UnknownAmetysObjectException
Returns theAmetysObjectat the given subPath, relative to the givenDefaultTraversableAmetysObject.- Type Parameters:
A- the actual type ofAmetysObject.- Parameters:
object- the contextDefaultTraversableAmetysObject.path- the sub path. Cannot benull, empty or absolute.- Returns:
- the
AmetysObjectat the given subPath, relative to the givenDefaultTraversableAmetysObject. - Throws:
AmetysRepositoryException- if an error occurs.UnknownAmetysObjectException- if no such object exists.
-
getChildren
public <A extends AmetysObject> AmetysObjectIterable<A> getChildren(DefaultContent object) throws AmetysRepositoryException
Returns all children of the givenDefaultTraversableAmetysObject.- Type Parameters:
A- the actual type ofAmetysObjects- Parameters:
object- aDefaultTraversableAmetysObject.- Returns:
- a List containing all children object in the Ametys hierarchy.
- Throws:
AmetysRepositoryException- if an error occurs.
-
hasChild
public boolean hasChild(DefaultContent 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(DefaultContent 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.
-
-