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.DefaultPrefixResolverNested classes/interfaces inherited from class org.ametys.plugins.contentio.in.AbstractContentImporter
AbstractContentImporter.ContentReference -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContentTypesHelperThe content type helper.protected static final StringDefault content language key in the import map.protected static final StringDefault content mixins key in the import map.protected static final StringDefault content types key in the import map.protected StringThe XPath expression to match.protected PatternThe XPath value to match.protected StringThe XPath value to match.Fields inherited from class org.ametys.plugins.contentio.in.xml.AbstractXmlContentImporter
_domParser, _manager, _prefixResolver, _srcResolver, _xPathProcessor, _xsl, _xsltProcessor, _xslTransformerHandlerFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(Configuration configuration) protected voidconfigureXmlMatch(Configuration configuration) Configure the matching value.protected ContentimportContent(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.voidservice(ServiceManager serviceManager) booleanTests if theXmlContentImporteris 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, supportsMethods inherited from class org.ametys.plugins.contentio.in.AbstractContentImporter
addContentReference, addContentReference, addContentReferences, configureExtensions, configureWorkflow, createContent, createContent, createContent, createContent, createContent, getContentFromProperties, getContentIdMap, getContentRefMap, getContentRepeaterSizeMap, getContentTypes, getDefaultExtensions, getEditActionId, getInitialActionId, getLanguage, getMixins, getPriority, getReferencedContentId, getWorkflowName, isExtensionValid, restoreContentReferences, setReferenceMetadatas, setRepeaterSizeMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
servicein interfaceServiceable- Overrides:
servicein classAbstractXmlContentImporter- Throws:
ServiceException
-
configure
- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classAbstractXmlContentImporter- Throws:
ConfigurationException
-
configureXmlMatch
Configure the matching value.- Parameters:
configuration- the matching configuration.- Throws:
ConfigurationException- if an error occurs.
-
supports
Description copied from interface:XmlContentImporterTests if theXmlContentImporteris able to import the corresponding Document.- Parameters:
document- the XMLDocumentto test.- Returns:
- true if the
XmlContentImportercan import the corresponding stream, false otherwise. - Throws:
IOException- if an error occurs.
-
importContents
Description copied from class:AbstractXmlContentImporterImport the contents from the XML DOMDocument.- Specified by:
importContentsin 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.
-