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
FieldsModifier and TypeFieldDescriptionThe list of attributes to mergeprotected booleanAttribute to handle shared sub programs or notThe list of attributes to copy for mention programprotected ContentTypeThe content type of the mentionprotected StringThe mention idprotected StringThe program code to link to the mentionprotected ContentTypeThe content type of the sub programprotected static final StringThe name of the JCR node holding the shared metadataFields inherited from class org.ametys.plugins.odfsync.cdmfr.components.impl.RemoteImportCDMFrComponent
_forcedCatalog, _validateAfterImport, ROLEFields 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
Constructors -
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 ViewCreate 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, SubProgram mainSubProgram, 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 voidadditionalParameters(Map<String, Object> parameters) Additional parameters for specific treatments.voidconfigure(Configuration configuration) importOrSynchronizeContent(Element contentElement, ContentWorkflowDescription wfDescription, String title, String syncCode, ImportCDMFrContext context) Import or synchronize the content.voidprotected booleanisValidAttributePath(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)Methods inherited from class org.ametys.plugins.odfsync.cdmfr.components.impl.RemoteImportCDMFrComponent
getCatalogName, ignoreRights, removalSync, transformDocument, validateAfterImportMethods 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, service, validateContent
-
Field Details
-
SHARED_PROGRAMS_NODE_NAME
The name of the JCR node holding the shared metadata- See Also:
-
_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
-
configure
- Specified by:
configurein interfaceConfigurable- Overrides:
configurein 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:
initializein interfaceInitializable- Overrides:
initializein classAbstractImportCDMFrComponent- Throws:
Exception
-
additionalParameters
Description copied from class:AbstractImportCDMFrComponentAdditional parameters for specific treatments.- Overrides:
additionalParametersin 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:ImportCDMFrComponentImport or synchronize the content.- Specified by:
importOrSynchronizeContentin interfaceImportCDMFrComponent- Overrides:
importOrSynchronizeContentin 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
nullif 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
nullif none is found
-
_getAdditionalValuesToSynchronize
protected Map<String,Object> _getAdditionalValuesToSynchronize(ModifiableContent content, String syncCode, ImportCDMFrContext context) Description copied from class:AbstractImportCDMFrComponentRetrieves additional values to synchronize for the content- Overrides:
_getAdditionalValuesToSynchronizein 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:AbstractImportCDMFrComponentRetrieves the ids of the contents related to the given content but that are not part of the synchronization- Overrides:
_getNotSynchronizedRelatedContentIdsin 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:
trueif the attribute can be merged,falseotherwise
-
_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
-