Class ImportCDMFrValuesExtractor
java.lang.Object
org.ametys.plugins.repository.data.extractor.xml.ModelAwareXMLValuesExtractor
org.ametys.plugins.odfsync.cdmfr.extractor.ImportCDMFrValuesExtractor
- All Implemented Interfaces:
ModelAwareValuesExtractor
,ValuesExtractor
- Direct Known Subclasses:
ImportCourseListValuesExtractor
,ImportCoursePartValuesExtractor
,ImportCourseValuesExtractor
,ImportTraversableProgramPartValuesExtractor
This class provides methods to extract values from a CMD-fr import document
-
Field Summary
Modifier and TypeFieldDescriptionprotected ImportCDMFrComponent
The import CDM-fr componentprotected ImportCDMFrContext
The import contextprotected ImportCDMFrValuesExtractorFactory
The values extractor factoryprotected static final String
Tag used for each value of multiples dataprotected static final String
Tag to identify a courseListFields inherited from class org.ametys.plugins.repository.data.extractor.xml.ModelAwareXMLValuesExtractor
_additionalDataGetter, _element, _modelItemContainers
-
Constructor Summary
ConstructorDescriptionImportCDMFrValuesExtractor
(Element element, ImportCDMFrValuesExtractorFactory factory, ImportCDMFrComponent component, ImportCDMFrContext context, XMLValuesExtractorAdditionalDataGetter additionalDataGetter, Collection<? extends ModelItemContainer> modelItemContainers) Creates an import CDM-fr values extractorImportCDMFrValuesExtractor
(Element element, ImportCDMFrValuesExtractorFactory factory, ImportCDMFrComponent component, ImportCDMFrContext context, XMLValuesExtractorAdditionalDataGetter additionalDataGetter, Model... models) Creates an import CDM-fr values extractor -
Method Summary
Modifier and TypeMethodDescription_extractContentValue
(Element item, String contentTagName, ContentWorkflowDescription workflowDescription) Extract the content value for the given attributeprotected Object
_extractContentValues
(Element parent, ElementDefinition definition, String contentTagName, ContentWorkflowDescription workflowDescription) Extract the content values for the given attributeprotected <T> Object
_extractElementValue
(Element parent, ElementDefinition<T> definition, Optional<Object> additionalData) Extracts the value of the given element_extractTableRefValue
(Element item, String contentTypeId) Extract the content value for the given attributeprotected Object
_extractTableRefValues
(Element parent, ElementDefinition definition, String contentTypeId) Extract the table reference values for the given attributeprotected String
_getAttributeOrDefault
(Element element, String attributeName, String defaultValue) Retrieve the element's attribute with the given name, or the default value if there is no such attributeMethods inherited from class org.ametys.plugins.repository.data.extractor.xml.ModelAwareXMLValuesExtractor
_extractElementValue, _extractGroupValues, _extractValue, _extractValue, _extractValues, _fillViewItemContainerFromXML, _fillViewItemContainerFromXML, _getModelItemFromNodeName, _hasChildForAttribute, extractValue, extractValues, extractValues
-
Field Details
-
_TAG_COURSELIST
Tag to identify a courseList- See Also:
-
_MULTIPLE_DATA_ITEM_TAG
Tag used for each value of multiples data- See Also:
-
_factory
The values extractor factory -
_component
The import CDM-fr component -
_context
The import context
-
-
Constructor Details
-
ImportCDMFrValuesExtractor
public ImportCDMFrValuesExtractor(Element element, ImportCDMFrValuesExtractorFactory factory, ImportCDMFrComponent component, ImportCDMFrContext context, XMLValuesExtractorAdditionalDataGetter additionalDataGetter, Model... models) Creates an import CDM-fr values extractor- Parameters:
element
- the DOM element containing the XML valuesfactory
- the values extractor factorycomponent
- the import CDM-fr componentcontext
- the import contextadditionalDataGetter
- the getter that retrieves needed additional data by typesmodels
- the model of the extracted values
-
ImportCDMFrValuesExtractor
public ImportCDMFrValuesExtractor(Element element, ImportCDMFrValuesExtractorFactory factory, ImportCDMFrComponent component, ImportCDMFrContext context, XMLValuesExtractorAdditionalDataGetter additionalDataGetter, Collection<? extends ModelItemContainer> modelItemContainers) Creates an import CDM-fr values extractor- Parameters:
element
- the DOM element containing the XML valuesfactory
- the values extractor factorycomponent
- the import CDM-fr componentcontext
- the imported content's contextadditionalDataGetter
- the getter that retrieves needed additional data by typesmodelItemContainers
- the model of the extracted values
-
-
Method Details
-
_extractElementValue
protected <T> Object _extractElementValue(Element parent, ElementDefinition<T> definition, Optional<Object> additionalData) throws Exception Description copied from class:ModelAwareXMLValuesExtractor
Extracts the value of the given element- Overrides:
_extractElementValue
in classModelAwareXMLValuesExtractor
- Type Parameters:
T
- type of the element definition- Parameters:
parent
- the DOM element of the element definition's parentdefinition
- the element's definitionadditionalData
- the additional data needed to extract the value- Returns:
- the value
- Throws:
Exception
- if an error occurs
-
_extractContentValues
protected Object _extractContentValues(Element parent, ElementDefinition definition, String contentTagName, ContentWorkflowDescription workflowDescription) throws Exception Extract the content values for the given attribute- Parameters:
parent
- the DOM element of the definition's parentdefinition
- the attribute's definitioncontentTagName
- the tag name of the contents to extractworkflowDescription
- theContentWorkflowDescription
of the extracted contents- Returns:
- the extracted contents
- Throws:
Exception
- if an error occurs
-
_extractContentValue
protected Optional<Content> _extractContentValue(Element item, String contentTagName, ContentWorkflowDescription workflowDescription) throws Exception Extract the content value for the given attribute- Parameters:
item
- the DOM element of the content itemcontentTagName
- the tag name of the contents to extractworkflowDescription
- theContentWorkflowDescription
of the extracted contents- Returns:
- the extracted content
- Throws:
Exception
- if an error occurs
-
_extractTableRefValues
protected Object _extractTableRefValues(Element parent, ElementDefinition definition, String contentTypeId) throws Exception Extract the table reference values for the given attribute- Parameters:
parent
- the DOM element of the definition's parentdefinition
- the attribute's definitioncontentTypeId
- the id of the content type- Returns:
- the extracted contents
- Throws:
Exception
- if an error occurs
-
_extractTableRefValue
protected Optional<Content> _extractTableRefValue(Element item, String contentTypeId) throws Exception Extract the content value for the given attribute- Parameters:
item
- the DOM element of the content itemcontentTypeId
- the id of the content type- Returns:
- the extracted content
- Throws:
Exception
- if an error occurs
-
_getAttributeOrDefault
Retrieve the element's attribute with the given name, or the default value if there is no such attribute- Parameters:
element
- the elementattributeName
- the name of the attribute to retrievedefaultValue
- the default value- Returns:
- the element's attribute
-