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
Get information about the definition of the structure a
MetadataSet
.-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentTypeExtensionPoint
Content type extension point.protected ContentTypesHelper
Helper for content typesprotected AmetysObjectResolver
The Ametys object resolverprotected RightManager
The rights managerprotected RootContentHelper
Helper for root contentprotected CurrentUserProvider
The current user providerFields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
_getMetadataType
(MetadataDefinition metadataDefinition) Returns the type of thisMetadataDefinition
protected boolean
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.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.fieldset2JsonObject
(String[] contentTypes, String[] mixins, MetadataDefinition metadataDefinition, Fieldset fieldset, boolean recurse) Get the properties of aFieldset
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.metadata2JsonObject
(String[] contentTypes, String[] mixins, MetadataDefinition parentMetadataDef, MetadataDefinitionReference metadataDefRef, boolean recurse) Get properties of theMetadataDefinition
through itsMetadataDefinitionReference
metadataError2JsonObject
(String[] contentTypes, String viewName, String metadataSetMode) Get some error properties when the requested metadata set is not found.metadataSet2JsonObject
(String[] contentTypes, String[] mixins, MetadataDefinition metadataDefinition, AbstractMetadataSetElement metadataSetElement, boolean recurse) Get properties of theAbstractMetadataSetElement
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 Details
-
_resolver
The Ametys object resolver -
_contentTypeExtensionPoint
Content type extension point. -
_userProvider
The current user provider -
_rightManager
The rights manager -
_contentTypesHelper
Helper for content types -
_rootContentHelper
Helper for root content
-
-
Constructor Details
-
GetMetadataSetDefinitionAction
public GetMetadataSetDefinitionAction()
-
-
Method Details
-
service
- 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
Returns the type of thisMetadataDefinition
- Parameters:
metadataDefinition
- The metadata defintion- Returns:
- the name of type
-
_isMandatory
Indicates if thisMetadataDefinition
is mandatory.- Parameters:
metadataDefinition
- The metadata definition- Returns:
- true if mandatory
-
_hasRight
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.
-