Class ImportTraversableProgramPartValuesExtractor
java.lang.Object
org.ametys.plugins.repository.data.extractor.xml.ModelAwareXMLValuesExtractor
org.ametys.plugins.odfsync.cdmfr.extractor.ImportCDMFrValuesExtractor
org.ametys.plugins.odfsync.cdmfr.extractor.ImportTraversableProgramPartValuesExtractor
- All Implemented Interfaces:
ModelAwareValuesExtractor
,ValuesExtractor
This class provides methods to extract traversable program part's values from a CMD-fr import document
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
The imported content's synchronization codeprotected static final String
Tag to identify a containerprotected static final String
Tag to identify a subprogramFields inherited from class org.ametys.plugins.odfsync.cdmfr.extractor.ImportCDMFrValuesExtractor
_component, _context, _factory, _MULTIPLE_DATA_ITEM_TAG, _TAG_COURSELIST
Fields inherited from class org.ametys.plugins.repository.data.extractor.xml.ModelAwareXMLValuesExtractor
_additionalDataGetter, _element, _modelItemContainers
-
Constructor Summary
ConstructorDescriptionImportTraversableProgramPartValuesExtractor
(Element element, ImportCDMFrValuesExtractorFactory factory, ImportCDMFrComponent component, String synchronizationCode, ImportCDMFrContext context, XMLValuesExtractorAdditionalDataGetter additionalDataGetter, Collection<? extends ModelItemContainer> modelItemContainers) Creates an import traversable program part values extractorImportTraversableProgramPartValuesExtractor
(Element element, ImportCDMFrValuesExtractorFactory factory, ImportCDMFrComponent component, String synchronizationCode, ImportCDMFrContext context, XMLValuesExtractorAdditionalDataGetter additionalDataGetter, Model... models) Creates an import traversable program part values extractor -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> Object
_extractElementValue
(Element parent, ElementDefinition<T> definition, Optional<Object> additionalData) Extracts the value of the given element_getModelItemFromNodeName
(Element parent, String nodeName, Collection<? extends ModelItemContainer> modelItemContainers) Retrieves the model item corresponding to the given node nameprotected boolean
_hasChildForAttribute
(Element element, String attributeName) Checks if the given element contains a child for the given attribute nameMethods inherited from class org.ametys.plugins.odfsync.cdmfr.extractor.ImportCDMFrValuesExtractor
_extractContentValue, _extractContentValues, _extractTableRefValue, _extractTableRefValues, _getAttributeOrDefault
Methods inherited from class org.ametys.plugins.repository.data.extractor.xml.ModelAwareXMLValuesExtractor
_extractElementValue, _extractGroupValues, _extractValue, _extractValue, _extractValues, _fillViewItemContainerFromXML, _fillViewItemContainerFromXML, extractValue, extractValues, extractValues
-
Field Details
-
_TAG_SUBPROGRAM
Tag to identify a subprogram- See Also:
-
_TAG_CONTAINER
Tag to identify a container- See Also:
-
_synchronizationCode
The imported content's synchronization code
-
-
Constructor Details
-
ImportTraversableProgramPartValuesExtractor
public ImportTraversableProgramPartValuesExtractor(Element element, ImportCDMFrValuesExtractorFactory factory, ImportCDMFrComponent component, String synchronizationCode, ImportCDMFrContext context, XMLValuesExtractorAdditionalDataGetter additionalDataGetter, Model... models) Creates an import traversable program part values extractor- Parameters:
element
- the DOM element containing the XML valuesfactory
- the values extractor factorycomponent
- the import CDM-fr componentsynchronizationCode
- the imported content's synchronization codecontext
- the import contextadditionalDataGetter
- the getter that retrieves needed additional data by typesmodels
- the model of the extracted values
-
ImportTraversableProgramPartValuesExtractor
public ImportTraversableProgramPartValuesExtractor(Element element, ImportCDMFrValuesExtractorFactory factory, ImportCDMFrComponent component, String synchronizationCode, ImportCDMFrContext context, XMLValuesExtractorAdditionalDataGetter additionalDataGetter, Collection<? extends ModelItemContainer> modelItemContainers) Creates an import traversable program part values extractor- Parameters:
element
- the DOM element containing the XML valuesfactory
- the values extractor factorycomponent
- the import CDM-fr componentsynchronizationCode
- the imported content's synchronization codecontext
- the imported content's contextadditionalDataGetter
- the getter that retrieves needed additional data by typesmodelItemContainers
- the model of the extracted values
-
-
Method Details
-
_getModelItemFromNodeName
protected Optional<ModelItem> _getModelItemFromNodeName(Element parent, String nodeName, Collection<? extends ModelItemContainer> modelItemContainers) Description copied from class:ModelAwareXMLValuesExtractor
Retrieves the model item corresponding to the given node name- Overrides:
_getModelItemFromNodeName
in classModelAwareXMLValuesExtractor
- Parameters:
parent
- the DOM parent elementnodeName
- the node namemodelItemContainers
- the model item containers where to search for the model item- Returns:
- the model item corresponding to the given node name
-
_hasChildForAttribute
Description copied from class:ModelAwareXMLValuesExtractor
Checks if the given element contains a child for the given attribute name- Overrides:
_hasChildForAttribute
in classModelAwareXMLValuesExtractor
- Parameters:
element
- the element to checkattributeName
- the name of the attribute to search- Returns:
true
if the element contains a child corresponding to the given attribute name,false
otherwise
-
_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 classImportCDMFrValuesExtractor
- 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
-