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
AmetysObjectFactory
handling DefaultContent
.-
Field Summary
Fields inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObjectFactory
_ametysFactoryExtensionPoint, _manager, _nodetype, _repository, _resolver, _scheme
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<A extends AmetysObject>
AcreateChild
(DefaultContent object, String name, String type) Creates a child to the given object.getAmetysObject
(javax.jcr.Node node, String parentPath) Creates aAmetysObject
from a persistent JCR node.<A extends AmetysObject>
AgetChild
(DefaultContent object, String path) Returns theAmetysObject
at the given subPath, relative to the givenDefaultTraversableAmetysObject
.<A extends AmetysObject>
AmetysObjectIterable<A>getChildren
(DefaultContent object) Returns all children of the givenDefaultTraversableAmetysObject
.Retrieves the content data helperRetrieves the content helperRetrieves the content saxerRetrieves theContentTypeExtensionPoint
Retrieves the extension point with available data types for internal dataRetrieves theSystemPropertyExtensionPoint
for contentsboolean
hasChild
(DefaultContent object, String name) Tests if a given object has a child with a given name.void
service
(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
-
Constructor Details
-
ContentFactory
public ContentFactory()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classDefaultAmetysObjectFactory
- Throws:
ServiceException
-
getContentSaxer
Retrieves the content saxer- Returns:
- the content saxer
-
getContentHelper
Retrieves the content helper- Returns:
- the content helper
-
getContentDataHelper
Retrieves the content data helper- Returns:
- the content data helper
-
getInternalDataTypesExtensionPoint
Retrieves the extension point with available data types for internal data- Returns:
- the extension point with available data types for internal data
-
getSystemPropertyExtensionPoint
Retrieves theSystemPropertyExtensionPoint
for contents- Returns:
- the
SystemPropertyExtensionPoint
for contents
-
getContentTypeExtensionPoint
Retrieves theContentTypeExtensionPoint
- Returns:
- the
ContentTypeExtensionPoint
-
getAmetysObject
public DefaultContent getAmetysObject(javax.jcr.Node node, String parentPath) throws AmetysRepositoryException Description copied from interface:JCRAmetysObjectFactory
Creates aAmetysObject
from a persistent JCR node.- Specified by:
getAmetysObject
in interfaceJCRAmetysObjectFactory<SimpleAmetysObject>
- Overrides:
getAmetysObject
in classDefaultAmetysObjectFactory
- Parameters:
node
- the JCR node to use.parentPath
- the parent Path in the Ametys hierarchy, may benull
if 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 theAmetysObject
at 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
AmetysObject
at 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 ofAmetysObject
s- Parameters:
object
- aDefaultTraversableAmetysObject
.- Returns:
- a List containing all children object in the Ametys hierarchy.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
hasChild
Tests if a given object has a child with a given name.- Parameters:
object
- the context object.name
- the name to test.- Returns:
true
is the given object has a child with the given name,false
otherwise.- 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.
-