public void run() {

        try {
            CmsObject cms = m_moduleData.getCms();
            CmsModule module = m_moduleData.getModule();
            CmsModule oldModule = OpenCms.getModuleManager().getModule(module.getName());
            Map<CmsUUID, CmsUUID> conflictingIds = m_moduleData.getConflictingIds();
            if (!conflictingIds.isEmpty()) {
                deleteConflictingResources(cms, module, conflictingIds);
            }
            CmsProject importProject = createAndSetModuleImportProject(cms, module);
            CmsModuleImportExportHandler.reportBeginImport(m_report, module.getName());

            Map<CmsUUID, CmsResourceImportData> importResourcesById = new HashMap<>();
            for (CmsResourceImportData resData : m_moduleData.getResourceData()) {
                importResourcesById.put(resData.getResource().getStructureId(), resData);
            }
            Set<CmsResource> oldModuleResources = getAllResourcesInModule(cms, oldModule);
            List<CmsResource> toDelete = new ArrayList<>();
            Set<String> immutables = OpenCms.getImportExportManager().getImmutableResources().stream().flatMap(
                path -> Arrays.asList(
                    CmsFileUtil.removeTrailingSeparator(path),
                    CmsFileUtil.addTrailingSeparator(path)).stream()).collect(Collectors.toSet());
            for (CmsResource oldRes : oldModuleResources) {
                if (immutables.contains(oldRes.getRootPath())) {
                    continue;
                }
                CmsResourceImportData newRes = importResourcesById.get(oldRes.getStructureId());
                if (newRes == null) {
                    toDelete.add(oldRes);
                }
            }
            int index = 0;
            for (CmsResourceImportData resData1 : m_moduleData.getResourceData()) {
                index += 1;
                processImportResource(cms, resData1, index);
            }
            processDeletions(cms, toDelete);
            parseLinks(cms);

            importRelations(cms);
            if (!CmsStringUtil.isEmptyOrWhitespaceOnly(module.getImportScript())) {
                runImportScript(cms, module);
            }
            cms.unlockProject(importProject.getUuid());
            OpenCms.getModuleManager().updateModule(cms, module);
            module.setCheckpointTime(System.currentTimeMillis());
            // reinitialize the resource manager with additional module resource types if necessary
            if (module.getResourceTypes() != Collections.EMPTY_LIST) {
                OpenCms.getResourceManager().initialize(cms);
            }
            // reinitialize the workplace manager with additional module explorer types if necessary
            if (module.getExplorerTypes() != Collections.EMPTY_LIST) {
                OpenCms.getWorkplaceManager().addExplorerTypeSettings(module);
            }
            OpenCms.getPublishManager().publishProject(cms, m_report);
            OpenCms.getPublishManager().waitWhileRunning();
            CmsModuleImportExportHandler.reportEndImport(m_report);
        } catch (Exception e) {
            m_report.println(e);
        } finally {
            cleanUp();
        }
    }
public void run ( ) { try { CmsObject cms = m_moduleData . getCms ( ) ; CmsModule module = m_moduleData . getModule ( ) ; CmsModule oldModule = OpenCms . getModuleManager ( ) . getModule ( module . getName ( ) ) ; Map < CmsUUID , CmsUUID > conflictingIds = m_moduleData . getConflictingIds ( ) ; if ( ! conflictingIds . isEmpty ( ) ) { deleteConflictingResources ( cms , module , conflictingIds ) ; } CmsProject importProject = createAndSetModuleImportProject ( cms , module ) ; CmsModuleImportExportHandler . reportBeginImport ( m_report , module . getName ( ) ) ; Map < CmsUUID , CmsResourceImportData > importResourcesById = new HashMap < > ( ) ; for ( CmsResourceImportData resData : m_moduleData . getResourceData ( ) ) { importResourcesById . put ( resData . getResource ( ) . getStructureId ( ) , resData ) ; } Set < CmsResource > oldModuleResources = getAllResourcesInModule ( cms , oldModule ) ; List < CmsResource > toDelete = new ArrayList < > ( ) ; Set < String > immutables = OpenCms . getImportExportManager ( ) . getImmutableResources ( ) . stream ( ) . flatMap ( path -> Arrays . asList ( CmsFileUtil . removeTrailingSeparator ( path ) , CmsFileUtil . addTrailingSeparator ( path ) ) . stream ( ) ) . collect ( Collectors . toSet ( ) ) ; for ( CmsResource oldRes : oldModuleResources ) { if ( immutables . contains ( oldRes . getRootPath ( ) ) ) { continue ; } CmsResourceImportData newRes = importResourcesById . get ( oldRes . getStructureId ( ) ) ; if ( newRes == null ) { toDelete . add ( oldRes ) ; } } int index = 0 ; for ( CmsResourceImportData resData1 : m_moduleData . getResourceData ( ) ) { index += 1 ; processImportResource ( cms , resData1 , index ) ; } processDeletions ( cms , toDelete ) ; parseLinks ( cms ) ; importRelations ( cms ) ; if ( ! CmsStringUtil . isEmptyOrWhitespaceOnly ( module . getImportScript ( ) ) ) { runImportScript ( cms , module ) ; } cms . unlockProject ( importProject . getUuid ( ) ) ; OpenCms . getModuleManager ( ) . updateModule ( cms , module ) ; module . setCheckpointTime ( System . currentTimeMillis ( ) ) ; if ( module . getResourceTypes ( ) != Collections . EMPTY_LIST ) { OpenCms . getResourceManager ( ) . initialize ( cms ) ; } if ( module . getExplorerTypes ( ) != Collections . EMPTY_LIST ) { OpenCms . getWorkplaceManager ( ) . addExplorerTypeSettings ( module ) ; } OpenCms . getPublishManager ( ) . publishProject ( cms , m_report ) ; OpenCms . getPublishManager ( ) . waitWhileRunning ( ) ; CmsModuleImportExportHandler . reportEndImport ( m_report ) ; } catch ( Exception e ) { m_report . println ( e ) ; } finally { cleanUp ( ) ; } }
Performs the module update.<p>