Class EsiRemoveKeepReferencesService


  • @OpenApiAll
    public class EsiRemoveKeepReferencesService
    extends java.lang.Object
    A service that is responsible for removing an ESI module with "Keeping References"
    • Constructor Detail

      • EsiRemoveKeepReferencesService

        public EsiRemoveKeepReferencesService()
    • Method Detail

      • detachModulesKeepAndReferencesOnTask

        public static boolean detachModulesKeepAndReferencesOnTask​(Project project,
                                                                   java.util.Collection<ModuleUsage> usages)
        Removes usages of modules and keeps references to existing objects from modules.
        Parameters:
        project - a project.
        usages - a collection of usages.
        Returns:
        true the operation was successful.
      • detachModulesKeepAndReferencesOnTask

        public static boolean detachModulesKeepAndReferencesOnTask​(Project project,
                                                                   @CheckForNull
                                                                   IAttachedProjectRemoverCallback removeConfirmation,
                                                                   java.util.Collection<ModuleUsage> usages)
        Removes usages of modules and keeps references to existing objects from modules.
        Parameters:
        project - a project.
        usages - a collection of usages.
        removeConfirmation - remove confirmation
        Returns:
        true the operation was successful.
      • detachModulesKeepReferences

        public static void detachModulesKeepReferences​(Project project,
                                                       java.util.Collection<ModuleUsage> usages,
                                                       ProgressStatus monitor)
                                                throws java.lang.Exception
        Removes usages of modules and keeps references to existing objects from modules.
        Parameters:
        project - a project.
        usages - a collection of usages.
        monitor - progress monitor
        Throws:
        java.lang.Exception
      • filterManualUsages

        private static void filterManualUsages​(IPrimaryProject primaryProject,
                                               java.util.Collection<IProject> projects)
        From the projects collection removes the all projects what are manually reachable from the primary project.
        Parameters:
        primaryProject - a primary project.
        projects - a collection of projects.
      • isProjectUsageManual

        private static boolean isProjectUsageManual​(IPrimaryProject primaryProject,
                                                    IProject iProject)
        Checks whether a project usage is manually reachable.
        Parameters:
        primaryProject - a primary project.
        iProject - a target project.
        Returns:
        true if manually reachable.
      • markProjectUsagesAsAutomatic

        private static java.util.Collection<IProject> markProjectUsagesAsAutomatic​(IPrimaryProject primaryProject,
                                                                                   java.util.Collection<ModuleUsage> usages)
                                                                            throws com.nomagic.ci.persistence.PersistenceException
        Marks all project usages which owner is the primary project as automatic.
        Parameters:
        primaryProject - a primary project.
        usages - a collection of usages.
        Returns:
        a collection of used projects which usages were marked as automatic.
        Throws:
        com.nomagic.ci.persistence.PersistenceException
      • getUsagesOfEmptyProjects

        private static java.util.Collection<ModuleUsage> getUsagesOfEmptyProjects​(IPrimaryProject primaryProject,
                                                                                  java.util.Collection<IProject> projects)
        Returns usages of projects that are empty.
        Parameters:
        primaryProject - a primary project.
        projects - a collection of projects.
        Returns:
        a collection module usages.