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
public class DefaultXmlContentImporter extends AbstractXmlContentImporter
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
Fields Modifier and Type Field Description protected ContentTypesHelper_cTypeHelperThe content type helper.protected static String_DEFAULT_CONTENT_LANG_KEYDefault content language key in the import map.protected static String_DEFAULT_CONTENT_MIXINS_KEYDefault content mixins key in the import map.protected static String_DEFAULT_CONTENT_TYPES_KEYDefault content types key in the import map.protected String_matchPathThe XPath expression to match.protected Pattern_matchRegexThe XPath value to match.protected String_matchValueThe 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
Constructors Constructor Description DefaultXmlContentImporter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(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.protected Set<String>importContents(Document node, Map<String,Object> params)Import the contents from the XML DOMDocument.voidservice(ServiceManager serviceManager)booleansupports(Document document)Tests 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, supports
-
Methods 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, 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 Detail
-
_DEFAULT_CONTENT_TYPES_KEY
protected static final String _DEFAULT_CONTENT_TYPES_KEY
Default content types key in the import map.
-
_DEFAULT_CONTENT_MIXINS_KEY
protected static final String _DEFAULT_CONTENT_MIXINS_KEY
Default content mixins key in the import map.
-
_DEFAULT_CONTENT_LANG_KEY
protected static final String _DEFAULT_CONTENT_LANG_KEY
Default content language key in the import map.
-
_cTypeHelper
protected ContentTypesHelper _cTypeHelper
The content type helper.
-
_matchPath
protected String _matchPath
The XPath expression to match.
-
_matchValue
protected String _matchValue
The XPath value to match.
-
_matchRegex
protected Pattern _matchRegex
The XPath value to match.
-
-
Constructor Detail
-
DefaultXmlContentImporter
public DefaultXmlContentImporter()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractXmlContentImporter- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classAbstractXmlContentImporter- Throws:
ConfigurationException
-
configureXmlMatch
protected void configureXmlMatch(Configuration configuration) throws ConfigurationException
Configure the matching value.- Parameters:
configuration- the matching configuration.- Throws:
ConfigurationException- if an error occurs.
-
supports
public boolean supports(Document document) throws IOException
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
protected Set<String> importContents(Document node, Map<String,Object> params) throws IOException
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 Exception
Import 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.
-
-