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
public class CoAccreditedRemoteImportCDMFrComponent extends RemoteImportCDMFrComponent
Component to import a CDM-fr input stream from a remote server with co-accredited mode.
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<String>_attributePathsToMergeThe list of attributes to mergeprotected DeleteODFContentHelper_deleteODFContentThe delete ODF content helperprotected Set<String>_mentionAttributePathsThe list of attributes to copy for mention programprotected static StringSHARED_PROGRAMS_NODE_NAMEThe name of the JCR node holding the shared metadata-
Fields 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
Constructors Constructor Description CoAccreditedRemoteImportCDMFrComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_configureCoAccreditedParams(Configuration configuration)Configure the co-accredited paramsprotected Program_createMention(Element contentElement, String mentionId, String syncCode, ImportCDMFrContext context)Create the mentionprotected View_createMentionView()Create the view to use to extract values for mention creationprotected View_createMergeView(Set<String> attributePathsToMerge, ImportCDMFrContext context)Creates a view with attributes to mergeprotected Map<String,Object>_extractValuesToMerge(Element contentElement, View mergeView, String sharedSubProgramCode, ImportCDMFrContext context)Extract the values to merge with the main programprotected Map<String,Object>_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 programprotected Map<String,Object>_getMergedAttributes(SubProgram mainSubProgram, View mergeView)Retrieves the merged attributes of all sub programs shared with the given main sub programprotected Set<String>_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 voidadditionalParameters(Map<String,Object> parameters)Additional parameters for specific treatments.voidconfigure(Configuration configuration)ModifiableContentimportOrSynchronizeContent(Element contentElement, ContentWorkflowDescription wfDescription, String title, String syncCode, ImportCDMFrContext context)Import or synchronize the content.voidinitialize()protected 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)voidservice(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 Detail
-
SHARED_PROGRAMS_NODE_NAME
protected static final String SHARED_PROGRAMS_NODE_NAME
The name of the JCR node holding the shared metadata- See Also:
- Constant Field Values
-
_deleteODFContent
protected DeleteODFContentHelper _deleteODFContent
The delete ODF content helper
-
_mentionAttributePaths
protected Set<String> _mentionAttributePaths
The list of attributes to copy for mention program
-
_attributePathsToMerge
protected Set<String> _attributePathsToMerge
The list of attributes to merge
-
-
Constructor Detail
-
CoAccreditedRemoteImportCDMFrComponent
public CoAccreditedRemoteImportCDMFrComponent()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractImportCDMFrComponent- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- 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
public void initialize() throws Exception
- Specified by:
initializein interfaceInitializable- Overrides:
initializein classAbstractImportCDMFrComponent- Throws:
Exception
-
additionalParameters
protected void additionalParameters(Map<String,Object> parameters)
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
protected Program _getMention(String mentionId, String degreeId, ImportCDMFrContext context)
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
protected View _createMentionView()
Create the view to use to extract values for mention creation- Returns:
- the created view
-
_importOrSynchronizeSharedSubProgram
protected ModifiableContent _importOrSynchronizeSharedSubProgram(Program mentionProgram, Element contentElement, String title, String syncCode, ImportCDMFrContext context)
Import or synchronized shared subPrograms- Parameters:
mentionProgram- the mention programcontentElement- the content elementtitle- the title of the subprogramsyncCode- the synchronisation codecontext- the import context- Returns:
- the imported of synchronized content
-
_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
protected View _createMergeView(Set<String> attributePathsToMerge, ImportCDMFrContext context)
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
-
_synchronizeAttributesToMergeOnSharedSubProgramNode
protected void _synchronizeAttributesToMergeOnSharedSubProgramNode(SubProgram mainSubProgram, String sharedSubProgramCode, View mergeView, Map<String,Object> valuesToMerge, ImportCDMFrContext context)
Synchronize the attributes to merge on the shared sub program data- Parameters:
mainSubProgram- the main sub programsharedSubProgramCode- the code of the shared sub programmergeView- the view containing the attributes to mergevaluesToMerge- the values to mergecontext- the import context
-
_getMergedAttributes
protected Map<String,Object> _getMergedAttributes(SubProgram mainSubProgram, View mergeView)
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
-
_getSharedSubProgramRootRepositoryData
protected ModifiableRepositoryData _getSharedSubProgramRootRepositoryData(SubProgram mainSubProgram)
Get the shared program repository data holding the shared subprogram data- Parameters:
mainSubProgram- the main program- Returns:
- root repository data
-
_getSharedSubProgramDataHolder
protected ModifiableModelAwareDataHolder _getSharedSubProgramDataHolder(ModifiableRepositoryData rootRepositoryData, String subProgramCode)
Get the data holder for the shared attributes for subprogram of given code- Parameters:
rootRepositoryData- the repository data containing the values of all shared sub programssubProgramCode- the sub program code- Returns:
- the shared data holder
-
_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
-
-