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.
-
Field Summary
Modifier and TypeFieldDescriptionThe list of attributes to mergeprotected DeleteODFContentHelper
The delete ODF content helperprotected boolean
Attribute to handle shared sub programs or notThe list of attributes to copy for mention programprotected ContentType
The content type of the mentionprotected String
The mention idprotected String
The program code to link to the mentionprotected ContentType
The content type of the sub programprotected static 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, _contentWorkflowHelper, _currentUserProvider, _domParser, _importedContents, _nbError, _observationManager, _odfHelper, _odfLang, _odfRefTableHelper, _resolver, _rootOUProvider, _sccHelper, _shareableCourseHelper, _syncFieldsByContentType, _SYNCHRONIZE_WORKFLOW_ACTION_ID, _synchronizedContents, _TAG_CONTAINER, _TAG_COURSELIST, _TAG_COURSEPART, _TAG_PROGRAM, _TAG_SUBPROGRAM, _valuesExtractorFactory, _xPathProcessor
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_configureCoAccreditedParams
(Configuration configuration) Configure the co-accredited paramsprotected Program
_createMention
(Element contentElement, String mentionId, String syncCode, ImportCDMFrContext context) Create the mentionprotected View
Create the view to use to extract values for mention creationprotected View
_createMergeView
(Set<String> attributePathsToMerge, ImportCDMFrContext context) Creates a view with attributes to merge_extractValuesToMerge
(Element contentElement, View mergeView, String sharedSubProgramCode, ImportCDMFrContext context) Extract the values to merge with the main program_getAdditionalValuesToSynchronize
(ModifiableContent content, String syncCode, ImportCDMFrContext context) Retrieves additional values to synchronize for the contentprotected Program
_getMention
(String mentionId, String degreeId, ImportCDMFrContext context) Get the mention program_getMergedAttributes
(SubProgram mainSubProgram, View mergeView) Retrieves the merged attributes of all sub programs shared with the given main sub program_getNotSynchronizedRelatedContentIds
(ModifiableContent content, String syncCode, ImportCDMFrContext context) Retrieves the ids of the contents related to the given content but that are not part of the synchronizationprotected Program
_getOrCreateMention
(Element contentElement, String mentionCode, String syncCode, ImportCDMFrContext context) Get of create the mention programprotected SubProgram
_getSameSubProgram
(Program mentionProgram, Element contentElement, ImportCDMFrContext context) Search for a sub program corresponding to the one represented by the content elementprotected ModifiableModelAwareDataHolder
_getSharedSubProgramDataHolder
(ModifiableRepositoryData rootRepositoryData, String subProgramCode) Get the data holder for the shared attributes for subprogram of given codeprotected ModifiableRepositoryData
_getSharedSubProgramRootRepositoryData
(SubProgram mainSubProgram) Get the shared program repository data holding the shared subprogram dataprotected ModifiableContent
_importOrSynchronizeSharedSubProgram
(Program mentionProgram, Element contentElement, String title, String syncCode, ImportCDMFrContext context) Import or synchronized shared subProgramsprotected void
_synchronizeAttributesToMergeOnSharedSubProgramNode
(SubProgram mainSubProgram, String sharedSubProgramCode, View mergeView, Map<String, Object> valuesToMerge, ImportCDMFrContext context) Synchronize the attributes to merge on the shared sub program dataprotected void
_updateMentionAttributes
(Program mention, SubProgram subProgram, ImportCDMFrContext context) Update mention attributes depending on the sub programprotected void
additionalParameters
(Map<String, Object> parameters) Additional parameters for specific treatments.void
configure
(Configuration configuration) importOrSynchronizeContent
(Element contentElement, ContentWorkflowDescription wfDescription, String title, String syncCode, ImportCDMFrContext context) Import or synchronize the content.void
protected boolean
isValidAttributePath
(ContentType contentType, String attributePath, ImportCDMFrContext context) Determines if the attribute path is a valid path from the given content type and eligible to merge An attribute is considered as valid if it is part of the content type it is multiple (to be able to merge all data from main and shared subprograms)void
service
(ServiceManager manager) Methods 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
_createContent, _editContent, _getExpressionsList, _getInputsForContentCreation, _getOrCreateContent, _initializeShareableCoursesFields, _linkTranslationsIfExist, _setOrgUnitParent, _synchronizeContent, additionalOperations, contextualize, getContent, getIdField, getIdFromCDMThenCode, getLocalAndExternalFields, handleInputStream, validateContent
-
Field Details
-
SHARED_PROGRAMS_NODE_NAME
The name of the JCR node holding the shared metadata- See Also:
-
_deleteODFContent
The delete ODF content helper -
_mentionAttributePaths
The list of attributes to copy for mention program -
_attributePathsToMerge
The list of attributes to merge -
_mentionContentType
The content type of the mention -
_mentionId
The mention id -
_programToLinkCode
The program code to link to the mention -
_subProgramContentType
The content type of the sub program
-
-
Constructor Details
-
CoAccreditedRemoteImportCDMFrComponent
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractImportCDMFrComponent
- Throws:
ServiceException
-
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
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classAbstractImportCDMFrComponent
- Throws:
Exception
-
additionalParameters
Description copied from class:AbstractImportCDMFrComponent
Additional parameters for specific treatments.- Overrides:
additionalParameters
in classRemoteImportCDMFrComponent
- Parameters:
parameters
- The parameters map to get
-
importOrSynchronizeContent
public ModifiableContent importOrSynchronizeContent(Element contentElement, ContentWorkflowDescription wfDescription, String title, String syncCode, ImportCDMFrContext context) Description copied from interface:ImportCDMFrComponent
Import or synchronize the content.- Specified by:
importOrSynchronizeContent
in interfaceImportCDMFrComponent
- Overrides:
importOrSynchronizeContent
in classAbstractImportCDMFrComponent
- Parameters:
contentElement
- Element of the contentwfDescription
- The workflow descriptiontitle
- The titlesyncCode
- The synchronization codecontext
- the import context- Returns:
- The imported or synchronized content
-
_getOrCreateMention
protected Program _getOrCreateMention(Element contentElement, String mentionCode, String syncCode, ImportCDMFrContext context) Get of create the mention program- Parameters:
contentElement
- the content elementmentionCode
- the mention codesyncCode
- the content synchronization codecontext
- the import context- Returns:
- the mention program
-
_getMention
Get the mention program- Parameters:
mentionId
- the mention content iddegreeId
- the degree content idcontext
- the import context- Returns:
- the mention program or
null
if it doesn't exist
-
_createMention
protected Program _createMention(Element contentElement, String mentionId, String syncCode, ImportCDMFrContext context) Create the mention- Parameters:
contentElement
- the content elementmentionId
- the mention idsyncCode
- the content synchronization codecontext
- the import context- Returns:
- the created mention
-
_createMentionView
Create the view to use to extract values for mention creation- Returns:
- the created view
-
_getSameSubProgram
protected SubProgram _getSameSubProgram(Program mentionProgram, Element contentElement, ImportCDMFrContext context) Search for a sub program corresponding to the one represented by the content element- Parameters:
mentionProgram
- the mention programcontentElement
- the content elementcontext
- the import context- Returns:
- the corresponding subProgram, or
null
if none is found
-
_getAdditionalValuesToSynchronize
protected Map<String,Object> _getAdditionalValuesToSynchronize(ModifiableContent content, String syncCode, ImportCDMFrContext context) Description copied from class:AbstractImportCDMFrComponent
Retrieves additional values to synchronize for the content- Overrides:
_getAdditionalValuesToSynchronize
in classAbstractImportCDMFrComponent
- Parameters:
content
- the contentsyncCode
- the content synchronization codecontext
- the import context- Returns:
- the additional values
-
_getNotSynchronizedRelatedContentIds
protected Set<String> _getNotSynchronizedRelatedContentIds(ModifiableContent content, String syncCode, ImportCDMFrContext context) Description copied from class:AbstractImportCDMFrComponent
Retrieves the ids of the contents related to the given content but that are not part of the synchronization- Overrides:
_getNotSynchronizedRelatedContentIds
in classAbstractImportCDMFrComponent
- Parameters:
content
- the contentsyncCode
- the content synchronization codecontext
- the import context- Returns:
- the not synchronized content ids
-
_createMergeView
Creates a view with attributes to merge- Parameters:
attributePathsToMerge
- the attributes to put in the viewcontext
- the import context- Returns:
- the created view
-
isValidAttributePath
protected boolean isValidAttributePath(ContentType contentType, String attributePath, ImportCDMFrContext context) Determines if the attribute path is a valid path from the given content type and eligible to merge An attribute is considered as valid if- it is part of the content type
- it is multiple (to be able to merge all data from main and shared subprograms)
- Parameters:
contentType
- The content typeattributePath
- The attribute pathcontext
- the import context- Returns:
true
if the attribute can be merged,false
otherwise
-
_extractValuesToMerge
protected Map<String,Object> _extractValuesToMerge(Element contentElement, View mergeView, String sharedSubProgramCode, ImportCDMFrContext context) Extract the values to merge with the main program- Parameters:
contentElement
- the content elementmergeView
- the view containing the attributes to mergesharedSubProgramCode
- the shared sub program codecontext
- the import context- Returns:
- the extracted values
-
_getMergedAttributes
Retrieves the merged attributes of all sub programs shared with the given main sub program- Parameters:
mainSubProgram
- the main sub programmergeView
- the view containing the attributes to merge- Returns:
- the merged values
-
_updateMentionAttributes
protected void _updateMentionAttributes(Program mention, SubProgram subProgram, ImportCDMFrContext context) Update mention attributes depending on the sub program- Parameters:
mention
- the mentionsubProgram
- the subProgramcontext
- the import context
-