Class CoAccreditedRemoteImportCDMFrComponent

    • Method Detail

      • _updateMentionAttributes

        protected void _updateMentionAttributes​(Program mention,
                                                SubProgram subProgram)
        Update mention attributes depending on the sub program
        Parameters:
        mention - the mention
        subProgram - 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 modified
        attributeName - the attribute name
        contentIds - the content ids
        contentIdsToAdd - the content ids to add
      • _getOrCreateMention

        protected Program _getOrCreateMention​(Document doc,
                                              Node contentNode,
                                              String mentionCode,
                                              String lang,
                                              String catalog,
                                              org.slf4j.Logger logger)
        Get of create the mention program
        Parameters:
        doc - the document
        contentNode - the content node
        mentionCode - the mention code
        lang - the language
        catalog - the catalog
        logger - the logger
        Returns:
        the mention program
      • _createMention

        protected Program _createMention​(Document doc,
                                         Node contentNode,
                                         String mentionId,
                                         String catalog,
                                         String lang,
                                         org.slf4j.Logger logger)
        Create the mention
        Parameters:
        doc - the document
        contentNode - the content node
        mentionId - the mention id
        catalog - the catalog
        lang - the language
        logger - the logger
        Returns:
        the created mention
      • _getMention

        protected Program _getMention​(String mentionId,
                                      String degreeId,
                                      String lang,
                                      String catalog)
        Get the mention program
        Parameters:
        mentionId - the mention content id
        degreeId - the degree content id
        lang - the language
        catalog - 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,
                                                      org.slf4j.Logger logger)
        Synchronize metadata in the mention program
        Parameters:
        doc - the document
        contentNode - the content node
        mention - the mention program
        metadataPath - the metadata path to synchronize
        lang - the language
        catalog - the catalog
        logger - the logger
        Returns:
        true if some changes were made
      • getMainSharedSubProgram

        protected SubProgram getMainSharedSubProgram​(Program mentionProgram,
                                                     Node contentNode,
                                                     String lang,
                                                     org.slf4j.Logger logger)
        Get the main subprogram shared with the program representing by the content node
        Parameters:
        mentionProgram - the root mention program
        contentNode - the content node
        lang - the content lang
        logger - the logger
        Returns:
        the main subprogram if the program is a shared subprogram or null otherwise
      • _isSecondarySharedSubPrograms

        protected boolean _isSecondarySharedSubPrograms​(Program mentionProgram,
                                                        Node contentNode,
                                                        String lang,
                                                        org.slf4j.Logger logger)
        True if the subProgram node is shared with a main subProgram. False if the subProgram node is not shared or if the main subProgram is not already imported
        Parameters:
        mentionProgram - the mention program
        contentNode - the content node
        lang - the lang
        logger - the logger
        Returns:
        true if it's a secondary subProgram
      • _hasSubProgramWithSameTitle

        protected boolean _hasSubProgramWithSameTitle​(Program mentionProgram,
                                                      Node contentNode,
                                                      String lang,
                                                      org.slf4j.Logger logger)
        True if there is a subProgram with the same title of the content node
        Parameters:
        mentionProgram - the mention program
        contentNode - the content node
        lang - the lang
        logger - 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 program
        contentNode - the content node
        lang - the lang
        Returns:
        the subProgram with the same title. null if there are no subProgram with same title.
      • _getSharedWithAsString

        protected List<String_getSharedWithAsString​(Node contentNode,
                                                      org.slf4j.Logger logger)
        Get the list of "shared with" program from the remote document
        Parameters:
        contentNode - The content node
        logger - the logger
        Returns:
        The CDM code of shared program
      • _getMainSharedWithSubProgram

        protected SubProgram _getMainSharedWithSubProgram​(Program mentionProgram,
                                                          Node contentNode,
                                                          org.slf4j.Logger logger)
        Get the main subprogram shared with the program representing by the content node
        Parameters:
        mentionProgram - the root mention program
        contentNode - the content node
        logger - the logger
        Returns:
        the main subprogram if the program is a shared subprogram or null otherwise
      • _getSharedSubProgram

        protected SubProgram _getSharedSubProgram​(Program mentionProgram,
                                                  String code,
                                                  org.slf4j.Logger logger)
        Get the shared subprogram with the given code
        Parameters:
        mentionProgram - The root mention program
        code - The CDMfr code
        logger - the logger
        Returns:
        The shared subprogram if exist or null if not found
      • deleteSharedSubProgram

        protected void deleteSharedSubProgram​(ModifiableDefaultContent sharedProgram,
                                              org.slf4j.Logger logger)
        Delete a shared secondary subprogram. This subprogram was created by a precede import before the main subprogram was imported
        Parameters:
        sharedProgram - the shared program
        logger - the logger
      • _synchronizeAndDeleteSharedSubPrograms

        protected boolean _synchronizeAndDeleteSharedSubPrograms​(Program rootProgram,
                                                                 SubProgram mainSubProgram,
                                                                 List<String> sharedWith,
                                                                 String catalog,
                                                                 String lang,
                                                                 org.slf4j.Logger logger)
        Synchronize the shared metadata of a shared subprogram before deleting the subprogram
        Parameters:
        rootProgram - The root mention
        mainSubProgram - The main subprogram
        sharedWith - The CDMfr of shared subprogram
        catalog - the catalog
        lang - the language
        logger - The logger
        Returns:
        true if changes were made
      • _synchronizeSharedMetadata

        public boolean _synchronizeSharedMetadata​(Document doc,
                                                  Node sharedProgramNode,
                                                  SubProgram mainProgram,
                                                  SubProgram sharedProgram,
                                                  Set<String> metadataToMerge,
                                                  String catalog,
                                                  String lang,
                                                  org.slf4j.Logger logger)
                                           throws RepositoryException
        Synchronize the shared program node for a main subprogram, from a secondary subprogram
        Parameters:
        doc - the document. Can be null if the sharedProgram is not
        sharedProgramNode - the shared program node. Can be null if the sharedProgram is not
        mainProgram - the main program
        sharedProgram - the shared program. Can be null if the doc and the sharedProgramNode is not
        metadataToMerge - the set of metadata to merge
        catalog - the catalog
        lang - the language
        logger - the logger
        Returns:
        true if changes were made
        Throws:
        RepositoryException - if an error occurred
      • _getSharedMetadataHolder

        protected ModifiableCompositeMetadata _getSharedMetadataHolder​(Document doc,
                                                                       Node sharedProgramNode,
                                                                       SubProgram mainProgram,
                                                                       SubProgram sharedProgram,
                                                                       org.slf4j.Logger logger)
                                                                throws RepositoryException
        Get the metadata composite holding shared metadata of subprograms
        Parameters:
        doc - the document. Can be null if the sharedProgram is not
        sharedProgramNode - the shared program node. Can be null if the sharedProgram is not
        mainProgram - the main program
        sharedProgram - the shared program. Can be null if the doc and the sharedProgramNode is not
        logger - the logger
        Returns:
        the shared metadata holder
        Throws:
        RepositoryException - if an error occurred
      • _synchronizeSharedMultipleMetadata

        protected boolean _synchronizeSharedMultipleMetadata​(Document doc,
                                                             Node sharedProgramNode,
                                                             SubProgram mainProgram,
                                                             SubProgram sharedProgram,
                                                             MetadataDefinition metadataDefinition,
                                                             ModifiableCompositeMetadata sharedMetadataHolder,
                                                             String logicalMetadataPath,
                                                             String catalog,
                                                             String lang,
                                                             org.slf4j.Logger logger)
        Synchronize a shared multiple metadata for shared program
        Parameters:
        doc - the document. Can be null if the sharedProgram is not
        sharedProgramNode - the shared program node. Can be null if the sharedProgram is not
        mainProgram - the main program
        sharedProgram - the shared program. Can be null if the doc and the sharedProgramNode is not
        metadataDefinition - the metadata definition
        sharedMetadataHolder - the metadata composite holding shared metadata of subprograms
        logicalMetadataPath - The logical metadata path (to retrieve the definition)
        catalog - the catalog
        lang - the language
        logger - the logger
        Returns:
        true if changes were made
      • _getMultipleValuesFromContent

        protected List<Object_getMultipleValuesFromContent​(SubProgram sharedProgram,
                                                             String logicalMetadataPath,
                                                             MetadataType type,
                                                             org.slf4j.Logger logger)
        Get multiple values from content
        Parameters:
        sharedProgram - the shared program
        logicalMetadataPath - The logical metadata path (to retrieve the definition)
        type - the type of the data to retrieve
        logger - 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,
                                                         org.slf4j.Logger logger)
        Get multiple values from DOM
        Parameters:
        doc - the document
        sharedProgramDOM - the shared program node
        mainProgram - the main program
        metadataDefinition - the metadata definition
        logicalMetadataPath - The logical metadata path (to retrieve the definition)
        type - the type of the data to retrieve
        catalog - the catalog
        lang - the lang
        logger - the logger
        Returns:
        the list of values
      • _synchronizeSharedSingleMetadata

        protected boolean _synchronizeSharedSingleMetadata​(Document doc,
                                                           Node sharedProgramNode,
                                                           SubProgram mainProgram,
                                                           SubProgram sharedProgram,
                                                           MetadataDefinition metadataDefinition,
                                                           ModifiableCompositeMetadata sharedMetadataHolder,
                                                           String logicalMetadataPath,
                                                           String catalog,
                                                           String lang,
                                                           org.slf4j.Logger logger)
        Synchronize single metadata for shared program
        Parameters:
        doc - the document. Can be null if the sharedProgram is not
        sharedProgramNode - the shared program node. Can be null if the sharedProgram is not
        mainProgram - the main program
        sharedProgram - the shared program. Can be null if the doc and the sharedProgramNode is not
        metadataDefinition - the metadata definition
        sharedMetadataHolder - the metadata composite holding shared metadata of subprograms
        logicalMetadataPath - The logical metadata path (to retrieve the definition)
        catalog - the catalog
        lang - the language
        logger - the logger
        Returns:
        true if changes were made
      • synchronizeRepeaterMetadataFromContent

        protected boolean synchronizeRepeaterMetadataFromContent​(SubProgram sharedProgram,
                                                                 ModifiableCompositeMetadata sharedMetadataHolder,
                                                                 String logicalMetadataPath,
                                                                 org.slf4j.Logger logger)
        Synchronize repeater from content
        Parameters:
        sharedProgram - the shared program
        sharedMetadataHolder - the metadata composite holding shared metadata of subprograms
        logicalMetadataPath - 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,
                                                             org.slf4j.Logger logger)
        Synchronize repeater from DOM
        Parameters:
        doc - the document
        sharedProgramNode - the shared program node
        mainProgram - the main program
        metadataDefinition - the metadata definition
        sharedMetadataHolder - the metadata composite holding shared metadata of subprograms
        logicalMetadataPath - The logical metadata path (to retrieve the definition)
        catalog - the catalog
        lang - the language
        logger - 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,
                                                        org.slf4j.Logger logger)
        Synchronize a simple metadata from DOM
        Parameters:
        doc - the document
        subProgram - the subProgram content
        metadataNode - The metadata DOM node
        metadataDefinition - the metadata definition
        logicalMetadataPath - The logical metadata path (to retrieve the definition)
        sharedMetadataHolder - the metadata composite holding shared metadata of subprograms
        metadataName - the metadata name
        catalog - the catalog
        lang - the language
        logger - The logger
        Returns:
        true if changes were made