Class DefaultXmlContentImporter
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.contentio.in.AbstractContentImporter
org.ametys.plugins.contentio.in.xml.AbstractXmlContentImporter
org.ametys.plugins.contentio.in.xml.DefaultXmlContentImporter
- All Implemented Interfaces:
ContentImporter
,XmlContentImporter
,LogEnabled
,Prioritizable
,Configurable
,Serviceable
Default implementation of an XML content importer.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ametys.plugins.contentio.in.xml.AbstractXmlContentImporter
AbstractXmlContentImporter.DefaultPrefixResolver
Nested classes/interfaces inherited from class org.ametys.plugins.contentio.in.AbstractContentImporter
AbstractContentImporter.ContentReference
-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentTypesHelper
The content type helper.protected static final String
Default content language key in the import map.protected static final String
Default content mixins key in the import map.protected static final String
Default content types key in the import map.protected String
The XPath expression to match.protected Pattern
The XPath value to match.protected String
The XPath value to match.Fields inherited from class org.ametys.plugins.contentio.in.xml.AbstractXmlContentImporter
_domParser, _manager, _prefixResolver, _srcResolver, _xPathProcessor, _xsl, _xsltProcessor, _xslTransformerHandler
Fields inherited from class org.ametys.plugins.contentio.in.AbstractContentImporter
_CONTENT_ID_MAP_KEY, _CONTENT_LINK_MAP_KEY, _CONTENT_REPEATER_SIZE_MAP, _contentTypes, _contentWorkflowHelper, _editActionId, _extensions, _initialActionId, _language, _mixins, _priority, _resolver, _workflowName, DEFAULT_PRIORITY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(Configuration configuration) protected void
configureXmlMatch
(Configuration configuration) Configure the matching value.protected Content
importContent
(Element contentElement, String[] defaultTypes, String[] defaultMixins, String defaultLang, Map<String, Object> params) Import a content from a XML node.importContents
(Document node, Map<String, Object> params) Import the contents from the XML DOMDocument
.void
service
(ServiceManager serviceManager) boolean
Tests if theXmlContentImporter
is able to import the corresponding Document.Methods inherited from class org.ametys.plugins.contentio.in.xml.AbstractXmlContentImporter
configureContentCreation, configureNamespaces, configureXml, getAttributeValue, getAttributeValue, getPrefixResolver, getTextContent, getTextContent, importContents, initializeXslTransformerHandler, supports
Methods inherited from class org.ametys.plugins.contentio.in.AbstractContentImporter
addContentReference, addContentReference, addContentReferences, configureExtensions, configureWorkflow, createContent, createContent, createContent, getContentFromProperties, getContentIdMap, getContentRefMap, getContentRepeaterSizeMap, getContentTypes, getDefaultExtensions, getEditActionId, getInitialActionId, getLanguage, getMixins, getPriority, getReferencedContentId, getWorkflowName, isExtensionValid, restoreContentReferences, setReferenceMetadatas, setRepeaterSize
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ametys.runtime.plugin.component.Prioritizable
getPriority
-
Field Details
-
_DEFAULT_CONTENT_TYPES_KEY
Default content types key in the import map. -
_DEFAULT_CONTENT_MIXINS_KEY
Default content mixins key in the import map. -
_DEFAULT_CONTENT_LANG_KEY
Default content language key in the import map. -
_cTypeHelper
The content type helper. -
_matchPath
The XPath expression to match. -
_matchValue
The XPath value to match. -
_matchRegex
The XPath value to match.
-
-
Constructor Details
-
DefaultXmlContentImporter
public DefaultXmlContentImporter()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractXmlContentImporter
- Throws:
ServiceException
-
configure
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractXmlContentImporter
- Throws:
ConfigurationException
-
configureXmlMatch
Configure the matching value.- Parameters:
configuration
- the matching configuration.- Throws:
ConfigurationException
- if an error occurs.
-
supports
Description copied from interface:XmlContentImporter
Tests if theXmlContentImporter
is able to import the corresponding Document.- Parameters:
document
- the XMLDocument
to test.- Returns:
- true if the
XmlContentImporter
can import the corresponding stream, false otherwise. - Throws:
IOException
- if an error occurs.
-
importContents
Description copied from class:AbstractXmlContentImporter
Import the contents from the XML DOMDocument
.- Specified by:
importContents
in classAbstractXmlContentImporter
- Parameters:
node
- the XML Document.params
- the import parameters.- Returns:
- a Set of the imported content IDs.
- Throws:
IOException
- if an error occurs importing the contents.
-
importContent
protected Content importContent(Element contentElement, String[] defaultTypes, String[] defaultMixins, String defaultLang, Map<String, Object> params) throws ExceptionImport a content from a XML node.- Parameters:
contentElement
- the content XML node.defaultTypes
- the default content types.defaultMixins
- the default mixins.defaultLang
- the default content language.params
- the import parameters.- Returns:
- the Content or null if not created.
- Throws:
Exception
- if an error occurs creating the Content.
-