Class CoAccreditedRemoteImportCDMFrComponent
java.lang.Object
org.ametys.plugins.odfsync.cdmfr.components.AbstractImportCDMFrComponent
org.ametys.plugins.odfsync.cdmfr.components.impl.RemoteImportCDMFrComponent
org.ametys.plugins.odfsync.cdmfr.components.impl.CoAccreditedRemoteImportCDMFrComponent
- All Implemented Interfaces:
ImportCDMFrComponent
,Initializable
,Component
,Configurable
,Contextualizable
,Serviceable
Component to import a CDM-fr input stream from a remote server with co-accredited mode.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enum to define the way to detect shared subProgramNested classes/interfaces inherited from class org.ametys.plugins.odfsync.cdmfr.components.AbstractImportCDMFrComponent
AbstractImportCDMFrComponent.ContentWorkflowDescription
-
Field Summary
Modifier and TypeFieldDescriptionprotected DeleteODFContentHelper
The delete ODF content helperThe list of metadata to copy for mention programprotected MergeMetadataForSharedProgramHelper
The merge metadata helperThe list of metadata to mergestatic final String
The name of the JCR node holding the shared metadataFields inherited from class org.ametys.plugins.odfsync.cdmfr.components.impl.RemoteImportCDMFrComponent
_forcedCatalog, _validateAfterImport, ROLE
Fields inherited from class org.ametys.plugins.odfsync.cdmfr.components.AbstractImportCDMFrComponent
_catalogsManager, _cdmFrSyncExtensionPoint, _cocoonContext, _contentPrefix, _contentTypeEP, _currentUserProvider, _domParser, _importedContents, _nbCreatedContents, _nbError, _nbNotChangedContents, _nbSynchronizedContents, _observationManager, _odfLang, _odfRefTableHelper, _resolver, _rootOUProvider, _shareableCourseHelper, _syncFieldsByContentType, _synchroComponent, _synchronizedContents, _TAG_CONTAINER, _TAG_COURSELIST, _TAG_COURSEPART, _TAG_PROGRAM, _TAG_SUBPROGRAM, _updatedContents, _xPathProcessor
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_configureCoAccreditedParams
(Configuration configuration) Configure the co-accredited paramsprotected Program
_createMention
(Document doc, Node contentNode, String mentionId, String catalog, String lang, Logger logger) Create the mentionprotected SubProgram
_getMainSharedWithSubProgram
(Program mentionProgram, Node contentNode, Logger logger) Get the main subprogram shared with the program representing by the content nodeprotected Program
_getMention
(String mentionId, String degreeId, String lang, String catalog) Get the mention program_getMultipleValuesFromContent
(SubProgram sharedProgram, String logicalMetadataPath, MetadataType type, Logger logger) Get multiple values from content_getMultipleValuesFromDOM
(Document doc, Node sharedProgramDOM, SubProgram mainProgram, MetadataDefinition metadataDefinition, String logicalMetadataPath, MetadataType type, String catalog, String lang, Logger logger) Get multiple values from DOMprotected Program
_getOrCreateMention
(Document doc, Node contentNode, String mentionCode, String lang, String catalog, Logger logger) Get of create the mention programprotected ModifiableCompositeMetadata
_getSharedMetadataHolder
(Document doc, Node sharedProgramNode, SubProgram mainProgram, SubProgram sharedProgram, Logger logger) Get the metadata composite holding shared metadata of subprogramsprotected SubProgram
_getSharedSubProgram
(Program mentionProgram, String code, Logger logger) Get the shared subprogram with the given code_getSharedWithAsString
(Node contentNode, Logger logger) Get the list of "shared with" program from the remote documentGet the defined way to detect shared programprotected SubProgram
_getSubProgramWithSameTitle
(Program mentionProgram, Node contentNode, String lang) Get the subProgram with the same titleprotected boolean
_hasSubProgramWithSameTitle
(Program mentionProgram, Node contentNode, String lang, Logger logger) True if there is a subProgram with the same title of the content nodeprotected ModifiableDefaultContent
_importOrSynchronizeContent
(Document doc, Node contentNode, AbstractImportCDMFrComponent.ContentWorkflowDescription wfDescription, String title, String lang, String catalog, String syncCode, Logger logger) Import or synchronize the content.protected ModifiableDefaultContent
_importOrSynchronizeSharedSubPrograms
(Document doc, Program mentionProgram, Node contentNode, AbstractImportCDMFrComponent.ContentWorkflowDescription contentWfDescription, String title, String syncCode, String lang, String catalog, Logger logger) Import or synchronized shared subProgramsprotected boolean
_isSecondarySharedSubPrograms
(Program mentionProgram, Node contentNode, String lang, Logger logger) True if the subProgram node is shared with a main subProgram.protected boolean
_synchronizeAndDeleteSharedSubPrograms
(Program rootProgram, SubProgram mainSubProgram, List<String> sharedWith, String catalog, String lang, Logger logger) Synchronize the shared metadata of a shared subprogram before deleting the subprogramprotected boolean
_synchronizeMentionMetadata
(Document doc, Node contentNode, ModifiableDefaultContent mention, String metadataPath, String lang, String catalog, Logger logger) Synchronize metadata in the mention programboolean
_synchronizeSharedMetadata
(Document doc, Node sharedProgramNode, SubProgram mainProgram, SubProgram sharedProgram, Set<String> metadataToMerge, String catalog, String lang, Logger logger) Synchronize the shared program node for a main subprogram, from a secondary subprogramprotected boolean
_synchronizeSharedMultipleMetadata
(Document doc, Node sharedProgramNode, SubProgram mainProgram, SubProgram sharedProgram, MetadataDefinition metadataDefinition, ModifiableCompositeMetadata sharedMetadataHolder, String logicalMetadataPath, String catalog, String lang, Logger logger) Synchronize a shared multiple metadata for shared programprotected boolean
_synchronizeSharedSingleMetadata
(Document doc, Node sharedProgramNode, SubProgram mainProgram, SubProgram sharedProgram, MetadataDefinition metadataDefinition, ModifiableCompositeMetadata sharedMetadataHolder, String logicalMetadataPath, String catalog, String lang, Logger logger) Synchronize single metadata for shared programprotected void
_updateContentsAttribute
(ModifiableDefaultContent content, String attributeName, List<String> contentIds, List<String> contentIdsToAdd) For the attribute name of the content, add new contents (contentIdsToAdd) to existed contents (contentIds)protected void
_updateMentionAttributes
(Program mention, SubProgram subProgram) Update mention attributes depending on the sub programprotected void
additionalOperationsBeforeSave
(ModifiableDefaultContent content, Logger logger) Additional operation to do on the content before saving it.protected void
additionalParameters
(Map<String, Object> parameters) Additional parameters for specific treatments.void
configure
(Configuration configuration) protected void
deleteSharedSubProgram
(ModifiableDefaultContent sharedProgram, Logger logger) Delete a shared secondary subprogram.protected SubProgram
getMainSharedSubProgram
(Program mentionProgram, Node contentNode, String lang, Logger logger) Get the main subprogram shared with the program representing by the content nodevoid
void
service
(ServiceManager manager) protected boolean
synchronizeRepeaterMetadataFromContent
(SubProgram sharedProgram, ModifiableCompositeMetadata sharedMetadataHolder, String logicalMetadataPath, Logger logger) Synchronize repeater from contentprotected boolean
synchronizeRepeaterMetadataFromDOM
(Document doc, Node sharedProgramNode, SubProgram mainProgram, MetadataDefinition metadataDefinition, ModifiableCompositeMetadata sharedMetadataHolder, String logicalMetadataPath, String catalog, String lang, Logger logger) Synchronize repeater from DOMboolean
synchronizeSimpleMetadataFromDOM
(Document doc, SubProgram subProgram, Node metadataNode, MetadataDefinition metadataDefinition, String logicalMetadataPath, ModifiableCompositeMetadata sharedMetadataHolder, String metadataName, String catalog, String lang, Logger logger) Synchronize a simple metadata from DOMMethods inherited from class org.ametys.plugins.odfsync.cdmfr.components.impl.RemoteImportCDMFrComponent
getCatalogName, ignoreRights, removalSync, transformDocument, validateAfterImport
Methods inherited from class org.ametys.plugins.odfsync.cdmfr.components.AbstractImportCDMFrComponent
_getContent, _getIdFromCDMThenCode, _getOrCreateContent, _handleBinaryMetadata, _handleBinaryMetadata, _handleFileMetadata, _handleFileMetadata, _handleGeocodeMetadata, _handleGeocodeMetadata, _handleMetadataValues, _linkTranslationsIfExist, _saveContentChanges, _setChildren, _setOrgUnitParent, _setRelations, _synchronizeContent, _synchronizeCourseList, _synchronizeMetadata, contextualize, getContainerWfDescription, getCourseListWfDescription, getCoursePartWfDescription, getCourseWfDescription, getExpressionsList, getIdField, getLocalAndExternalFields, getOrgUnitWfDescription, getPersonWfDescription, getProgramWfDescription, getSubProgramWfDescription, handleInputStream
-
Field Details
-
SHARED_PROGRAMS_NODE_NAME
The name of the JCR node holding the shared metadata- See Also:
-
_mergeMetadataHelper
The merge metadata helper -
_deleteODFContent
The delete ODF content helper -
_mentionMetadataPaths
The list of metadata to copy for mention program -
_metadataPathsToMerge
The list of metadata to merge
-
-
Constructor Details
-
CoAccreditedRemoteImportCDMFrComponent
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractImportCDMFrComponent
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classAbstractImportCDMFrComponent
- Throws:
Exception
-
configure
- Specified by:
configure
in interfaceConfigurable
- Overrides:
configure
in classAbstractImportCDMFrComponent
- Throws:
ConfigurationException
-
_configureCoAccreditedParams
protected void _configureCoAccreditedParams(Configuration configuration) throws ConfigurationException Configure the co-accredited params- Parameters:
configuration
- the configuration- Throws:
ConfigurationException
- if an error occurred
-
additionalParameters
Description copied from class:AbstractImportCDMFrComponent
Additional parameters for specific treatments.- Overrides:
additionalParameters
in classRemoteImportCDMFrComponent
- Parameters:
parameters
- The parameters map to get
-
_importOrSynchronizeContent
protected ModifiableDefaultContent _importOrSynchronizeContent(Document doc, Node contentNode, AbstractImportCDMFrComponent.ContentWorkflowDescription wfDescription, String title, String lang, String catalog, String syncCode, Logger logger) Description copied from class:AbstractImportCDMFrComponent
Import or synchronize the content.- Overrides:
_importOrSynchronizeContent
in classAbstractImportCDMFrComponent
- Parameters:
doc
- XML documentcontentNode
- Node of the contentwfDescription
- The workflow descriptiontitle
- The titlelang
- The langcatalog
- The catalogsyncCode
- The synchronization codelogger
- The logger- Returns:
- The imported or synchronized content
-
_updateMentionAttributes
Update mention attributes depending on the sub program- Parameters:
mention
- the mentionsubProgram
- the subProgram
-
_updateContentsAttribute
protected void _updateContentsAttribute(ModifiableDefaultContent content, String attributeName, List<String> contentIds, List<String> contentIdsToAdd) For the attribute name of the content, add new contents (contentIdsToAdd) to existed contents (contentIds)- Parameters:
content
- the content to modifiedattributeName
- the attribute namecontentIds
- the content idscontentIdsToAdd
- the content ids to add
-
_getOrCreateMention
protected Program _getOrCreateMention(Document doc, Node contentNode, String mentionCode, String lang, String catalog, Logger logger) Get of create the mention program- Parameters:
doc
- the documentcontentNode
- the content nodementionCode
- the mention codelang
- the languagecatalog
- the cataloglogger
- the logger- Returns:
- the mention program
-
_createMention
protected Program _createMention(Document doc, Node contentNode, String mentionId, String catalog, String lang, Logger logger) Create the mention- Parameters:
doc
- the documentcontentNode
- the content nodementionId
- the mention idcatalog
- the cataloglang
- the languagelogger
- the logger- Returns:
- the created mention
-
_getMention
Get the mention program- Parameters:
mentionId
- the mention content iddegreeId
- the degree content idlang
- the languagecatalog
- the catalog- Returns:
- the mention program or
null
if it doesn't exist
-
_synchronizeMentionMetadata
protected boolean _synchronizeMentionMetadata(Document doc, Node contentNode, ModifiableDefaultContent mention, String metadataPath, String lang, String catalog, Logger logger) Synchronize metadata in the mention program- Parameters:
doc
- the documentcontentNode
- the content nodemention
- the mention programmetadataPath
- the metadata path to synchronizelang
- the languagecatalog
- the cataloglogger
- the logger- Returns:
- true if some changes were made
-
additionalOperationsBeforeSave
protected void additionalOperationsBeforeSave(ModifiableDefaultContent content, Logger logger) throws RepositoryException Description copied from class:AbstractImportCDMFrComponent
Additional operation to do on the content before saving it.- Overrides:
additionalOperationsBeforeSave
in classRemoteImportCDMFrComponent
- Parameters:
content
- The contentlogger
- The logger- Throws:
RepositoryException
- if an error occurs
-
_hasSubProgramWithSameTitle
protected boolean _hasSubProgramWithSameTitle(Program mentionProgram, Node contentNode, String lang, Logger logger) True if there is a subProgram with the same title of the content node- Parameters:
mentionProgram
- the mention programcontentNode
- the content nodelang
- the langlogger
- the logger- Returns:
- true if there is a subProgram with the same title of the content node
-
_getSubProgramWithSameTitle
protected SubProgram _getSubProgramWithSameTitle(Program mentionProgram, Node contentNode, String lang) Get the subProgram with the same title- Parameters:
mentionProgram
- the mention programcontentNode
- the content nodelang
- the lang- Returns:
- the subProgram with the same title. null if there are no subProgram with same title.
-
_getMultipleValuesFromContent
protected List<Object> _getMultipleValuesFromContent(SubProgram sharedProgram, String logicalMetadataPath, MetadataType type, Logger logger) Get multiple values from content- Parameters:
sharedProgram
- the shared programlogicalMetadataPath
- The logical metadata path (to retrieve the definition)type
- the type of the data to retrievelogger
- the logger- Returns:
- the list of values
-
_getMultipleValuesFromDOM
protected List<Object> _getMultipleValuesFromDOM(Document doc, Node sharedProgramDOM, SubProgram mainProgram, MetadataDefinition metadataDefinition, String logicalMetadataPath, MetadataType type, String catalog, String lang, Logger logger) Get multiple values from DOM- Parameters:
doc
- the documentsharedProgramDOM
- the shared program nodemainProgram
- the main programmetadataDefinition
- the metadata definitionlogicalMetadataPath
- The logical metadata path (to retrieve the definition)type
- the type of the data to retrievecatalog
- the cataloglang
- the langlogger
- the logger- Returns:
- the list of values
-
synchronizeRepeaterMetadataFromContent
protected boolean synchronizeRepeaterMetadataFromContent(SubProgram sharedProgram, ModifiableCompositeMetadata sharedMetadataHolder, String logicalMetadataPath, Logger logger) Synchronize repeater from content- Parameters:
sharedProgram
- the shared programsharedMetadataHolder
- the metadata composite holding shared metadata of subprogramslogicalMetadataPath
- The logical metadata path (to retrieve the definition)logger
- the logger- Returns:
true
if changes were made
-
synchronizeRepeaterMetadataFromDOM
protected boolean synchronizeRepeaterMetadataFromDOM(Document doc, Node sharedProgramNode, SubProgram mainProgram, MetadataDefinition metadataDefinition, ModifiableCompositeMetadata sharedMetadataHolder, String logicalMetadataPath, String catalog, String lang, Logger logger) Synchronize repeater from DOM- Parameters:
doc
- the documentsharedProgramNode
- the shared program nodemainProgram
- the main programmetadataDefinition
- the metadata definitionsharedMetadataHolder
- the metadata composite holding shared metadata of subprogramslogicalMetadataPath
- The logical metadata path (to retrieve the definition)catalog
- the cataloglang
- the languagelogger
- the logger- Returns:
true
if changes were made
-
synchronizeSimpleMetadataFromDOM
public boolean synchronizeSimpleMetadataFromDOM(Document doc, SubProgram subProgram, Node metadataNode, MetadataDefinition metadataDefinition, String logicalMetadataPath, ModifiableCompositeMetadata sharedMetadataHolder, String metadataName, String catalog, String lang, Logger logger) Synchronize a simple metadata from DOM- Parameters:
doc
- the documentsubProgram
- the subProgram contentmetadataNode
- The metadata DOM nodemetadataDefinition
- the metadata definitionlogicalMetadataPath
- The logical metadata path (to retrieve the definition)sharedMetadataHolder
- the metadata composite holding shared metadata of subprogramsmetadataName
- the metadata namecatalog
- the cataloglang
- the languagelogger
- The logger- Returns:
true
if changes were made
-