Package org.ametys.cms.contenttype
Class GetMetadataSetDefinitionAction
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.acting.AbstractAction
-
- org.apache.cocoon.acting.ServiceableAction
-
- org.ametys.cms.contenttype.GetMetadataSetDefinitionAction
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
,Action
public class GetMetadataSetDefinitionAction extends ServiceableAction
Get information about the definition of the structure aMetadataSet
.
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentTypeExtensionPoint
_contentTypeExtensionPoint
Content type extension point.protected ContentTypesHelper
_contentTypesHelper
Helper for content typesprotected AmetysObjectResolver
_resolver
The Ametys object resolverprotected RightManager
_rightManager
The rights managerprotected RootContentHelper
_rootContentHelper
Helper for root contentprotected CurrentUserProvider
_userProvider
The current user provider-
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
-
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
-
Constructor Summary
Constructors Constructor Description GetMetadataSetDefinitionAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private MetadataDefinition
_getMetadataDefinition(String[] contentTypes, String[] mixins, MetadataDefinition parentMetadataDef, MetadataDefinitionReference metadataDefRef)
Retrieves aMetadataDefinition
through itsMetadataDefinitionReference
protected String
_getMetadataType(MetadataDefinition metadataDefinition)
Returns the type of thisMetadataDefinition
protected boolean
_hasRight(String contentTypeId)
Test if the current user has the right needed by the content type to create a content.protected boolean
_isMandatory(MetadataDefinition metadataDefinition)
Indicates if thisMetadataDefinition
is mandatory.Map
act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)
protected void
addChildrenInformation(Map<String,Object> properties, String[] contentTypes, String[] mixins, MetadataDefinition metadataDefinition, AbstractMetadataSetElement metadataSetElement)
Add informations in a map of properties for the children of a metadata set element.protected Map<String,Object>
fieldset2JsonObject(String[] contentTypes, String[] mixins, MetadataDefinition metadataDefinition, Fieldset fieldset, boolean recurse)
Get the properties of aFieldset
protected Map<String,Object>
getMetadataSetElementInformation(String[] contentTypes, String[] mixins, AbstractMetadataSetElement metadataSetElement, boolean recurse)
Get properties of theAbstractMetadataSetElement
This method is the entry point to retrieves information of a MetadataSetElement.protected Map<String,Object>
metadata2JsonObject(String[] contentTypes, String[] mixins, MetadataDefinition parentMetadataDef, MetadataDefinitionReference metadataDefRef, boolean recurse)
Get properties of theMetadataDefinition
through itsMetadataDefinitionReference
protected Map<String,Object>
metadataError2JsonObject(String[] contentTypes, String viewName, String metadataSetMode)
Get some error properties when the requested metadata set is not found.protected Map<String,Object>
metadataSet2JsonObject(String[] contentTypes, String[] mixins, MetadataDefinition metadataDefinition, AbstractMetadataSetElement metadataSetElement, boolean recurse)
Get properties of theAbstractMetadataSetElement
protected Map<String,Object>
metadataSetElement2JsonObject(String[] contentTypes, String[] mixins, AbstractMetadataSetElement metadataSetElement)
Get properties of theAbstractMetadataSetElement
and its child element.void
service(ServiceManager smanager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
_contentTypeExtensionPoint
protected ContentTypeExtensionPoint _contentTypeExtensionPoint
Content type extension point.
-
_userProvider
protected CurrentUserProvider _userProvider
The current user provider
-
_rightManager
protected RightManager _rightManager
The rights manager
-
_contentTypesHelper
protected ContentTypesHelper _contentTypesHelper
Helper for content types
-
_rootContentHelper
protected RootContentHelper _rootContentHelper
Helper for root content
-
-
Constructor Detail
-
GetMetadataSetDefinitionAction
public GetMetadataSetDefinitionAction()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableAction
- Throws:
ServiceException
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception
- Throws:
Exception
-
metadataError2JsonObject
protected Map<String,Object> metadataError2JsonObject(String[] contentTypes, String viewName, String metadataSetMode)
Get some error properties when the requested metadata set is not found.- Parameters:
contentTypes
- The content typesviewName
- The view namemetadataSetMode
- The metadata set mode- Returns:
- A map containing the properties.
-
metadataSetElement2JsonObject
protected Map<String,Object> metadataSetElement2JsonObject(String[] contentTypes, String[] mixins, AbstractMetadataSetElement metadataSetElement)
Get properties of theAbstractMetadataSetElement
and its child element. This method is the entry point to retrieves information of a MetadataSetElement.- Parameters:
contentTypes
- The content typesmixins
- The mixinsmetadataSetElement
- The metadata set element- Returns:
- A map containing the properties of this
AbstractMetadataSetElement
.
-
getMetadataSetElementInformation
protected Map<String,Object> getMetadataSetElementInformation(String[] contentTypes, String[] mixins, AbstractMetadataSetElement metadataSetElement, boolean recurse)
Get properties of theAbstractMetadataSetElement
This method is the entry point to retrieves information of a MetadataSetElement.- Parameters:
contentTypes
- The content typesmixins
- The mixinsmetadataSetElement
- The metadata set elementrecurse
- If true, also retrieves the properties of the child elements.- Returns:
- A map containing the properties of this
AbstractMetadataSetElement
.
-
metadataSet2JsonObject
protected Map<String,Object> metadataSet2JsonObject(String[] contentTypes, String[] mixins, MetadataDefinition metadataDefinition, AbstractMetadataSetElement metadataSetElement, boolean recurse)
Get properties of theAbstractMetadataSetElement
- Parameters:
contentTypes
- The content typesmixins
- The mixinsmetadataDefinition
- The metadata definintion in recursive path. null at root.metadataSetElement
- The metadata set elementrecurse
- If true, also retrieves the properties of the child elements.- Returns:
- A map containing the properties of this
AbstractMetadataSetElement
.
-
addChildrenInformation
protected void addChildrenInformation(Map<String,Object> properties, String[] contentTypes, String[] mixins, MetadataDefinition metadataDefinition, AbstractMetadataSetElement metadataSetElement)
Add informations in a map of properties for the children of a metadata set element.- Parameters:
properties
- The map of properties to populatecontentTypes
- The content typesmixins
- The mixinsmetadataDefinition
- The metadata definition for recursive purposes. null at root.metadataSetElement
- The metadate set.
-
fieldset2JsonObject
protected Map<String,Object> fieldset2JsonObject(String[] contentTypes, String[] mixins, MetadataDefinition metadataDefinition, Fieldset fieldset, boolean recurse)
Get the properties of aFieldset
- Parameters:
contentTypes
- The content typesmixins
- The mixinsmetadataDefinition
- The metadataset definition for recusive purposes. null at root.fieldset
- The fieldset to convertrecurse
- Should it be recursive- Returns:
- A map containing the
Fieldset
properties.
-
metadata2JsonObject
protected Map<String,Object> metadata2JsonObject(String[] contentTypes, String[] mixins, MetadataDefinition parentMetadataDef, MetadataDefinitionReference metadataDefRef, boolean recurse)
Get properties of theMetadataDefinition
through itsMetadataDefinitionReference
- Parameters:
contentTypes
- The content typesmixins
- The mixinsparentMetadataDef
- The parent metadatarefmetadataDefRef
- The metadatarefrecurse
- True to convert recursively- Returns:
- A map containing the
MetadataDefinitionReference
properties.
-
_getMetadataType
protected String _getMetadataType(MetadataDefinition metadataDefinition)
Returns the type of thisMetadataDefinition
- Parameters:
metadataDefinition
- The metadata defintion- Returns:
- the name of type
-
_isMandatory
protected boolean _isMandatory(MetadataDefinition metadataDefinition)
Indicates if thisMetadataDefinition
is mandatory.- Parameters:
metadataDefinition
- The metadata definition- Returns:
- true if mandatory
-
_hasRight
protected boolean _hasRight(String contentTypeId)
Test if the current user has the right needed by the content type to create a content.- Parameters:
contentTypeId
- The content type id- Returns:
- true if the user has the right needed, false otherwise.
-
_getMetadataDefinition
private MetadataDefinition _getMetadataDefinition(String[] contentTypes, String[] mixins, MetadataDefinition parentMetadataDef, MetadataDefinitionReference metadataDefRef)
Retrieves aMetadataDefinition
through itsMetadataDefinitionReference
- Parameters:
contentTypes
- The content typesmixins
- The mixinsparentMetadataDef
- The parent metadata referencemetadataDefRef
- The metadata reference- Returns:
- The metadata definition found
-
-