Interface ProjectManagerEx

    • Field Detail

      • ROOT_PROJECT_DESCRIPTION

        @NotNull
        static final String ROOT_PROJECT_DESCRIPTION
        The Root project description.
        Since:
        8.0
        See Also:
        Constant Field Values
    • Method Detail

      • findBuildTypeIdentityByInternalId

        @Nullable
        BuildTypeIdentity findBuildTypeIdentityByInternalId​(@NotNull
                                                            String intId)
      • persistAllProjects

        void persistAllProjects()
        Persists configuration of all projects (including archived).
      • checkCanCreateBuildTypes

        void checkCanCreateBuildTypes​(@NotNull
                                      SProject targetProject,
                                      int numOfBuildTypes)
                               throws MaxNumberOfBuildTypesReachedException
        Checks whether numOfBuildTypes build configurations can be created and throws exception if can't
        Parameters:
        targetProject - a project where build configurations will be created
        numOfBuildTypes - number of build types to create
        Throws:
        MaxNumberOfBuildTypesReachedException - if max number of build types reached
      • findBuildTypeTemplateByExternalId

        @Nullable
        BuildTypeTemplateEx findBuildTypeTemplateByExternalId​(@NotNull
                                                              String externalId)
        Description copied from interface: ProjectManager
        Searches for build type template by given external id. Since 8.1 the method also looks up the template by the previous external ids. So the result project can have a different external id after a call. But the later is impossible if there is a template that currently has a externalId.
        Specified by:
        findBuildTypeTemplateByExternalId in interface ProjectManager
        Parameters:
        externalId - the external id of template
        Returns:
        found template or null, if template can't be found or external id is null.
      • getProjectsDirectory

        File getProjectsDirectory()
      • ensureProjectsDirectoryExists

        File ensureProjectsDirectoryExists()
      • executeFSOperation

        void executeFSOperation​(@NotNull
                                String description,
                                @NotNull
                                Runnable persistAction)
      • lockProject

        void lockProject​(@NotNull
                         String internalId)
      • unlockProject

        void unlockProject​(@NotNull
                           String internalId)
      • findBuildTypeIdentityByExternalId

        @Nullable
        BuildTypeIdentity findBuildTypeIdentityByExternalId​(@NotNull
                                                            String extId)
      • getNumberOfVirtualBuildTypes

        int getNumberOfVirtualBuildTypes()
      • generateDefaultExternalIds

        ProjectManagerEx.IdsMaps generateDefaultExternalIds​(@NotNull
                                                            SProject project,
                                                            @Nullable
                                                            String changedExtId,
                                                            boolean useCurrentIds,
                                                            boolean generateForCopy)
                                                     throws InvalidIdentifierException
        Generates identifiers for all nested entities (subprojects, VCS roots, build types and templates) of the given project. Applicable to regenerate ids or to generate ids befor copying.
        Parameters:
        project - project to generate ids for its nested objects.
        changedExtId - the new external id for this project.
        useCurrentIds - use suffixes of the current external ids if possible.
        generateForCopy - false means regenerate ids for the existent objects; true - for copies.
        Returns:
        maps old id -> new id.
        Throws:
        InvalidIdentifierException - if the specified external id is invalid
        Since:
        8.0
      • getDirectSubProjectsMap

        @NotNull
        Map<String,​List<ProjectEx>> getDirectSubProjectsMap()
        Map where key is parent project internal id and value - all direct subprojects of this parent
        Returns:
      • getExistingProjectsIds

        @NotNull
        Set<String> getExistingProjectsIds​(@NotNull
                                           Collection<String> projectIds)
        Accepts a collection of project ids and and checks each of them for existence. Returns subset of project ids corresponding to existing projects.
        Parameters:
        projectIds - project ids to check
        Returns:
        subset of project ids corresponding to existing projects
      • runWithExclusiveProjectModelLock

        <T> T runWithExclusiveProjectModelLock​(@NotNull
                                               Supplier<T> supplier)
                                        throws TimeoutException,
                                               InterruptedException
        Runs the specified supplier with the exclusive project model lock and returns its result. The exclusive lock prevents model update from disk and entities addition/removal.
        Type Parameters:
        T - type of supplier's result
        Parameters:
        supplier - supplier to run
        Returns:
        see above
        Throws:
        TimeoutException - if exclusive lock cannot be acquired within the default timeout
        InterruptedException - if the thread was interrupted while waiting for a lock
      • updateEntitiesRemovedMark

        void updateEntitiesRemovedMark()
        Finds all removed project ids and marks them as removed in database. Also finds all which are marked as removed but no longer removed, and unmarks them.
      • findProjectsIds

        @NotNull
        Set<String> findProjectsIds​(@NotNull
                                    Collection<String> buildTypeIds)
        Accepts a collection of build type ids, returns ids of projects where these build types belong.
        Parameters:
        buildTypeIds -
        Returns:
        see above
        Since:
        2018.1.1
      • isProjectsModelInitialized

        boolean isProjectsModelInitialized()
        Returns:
        true if projects configuration files were loaded from disk at least once (during the server startup).
        Since:
        2021.2
      • internalBuildTypeIdToExternal

        @Nullable
        String internalBuildTypeIdToExternal​(@NotNull
                                             String buildTypeId)
        Returns:
        external identifier by the given internal one or null if external identifier was not found.
        Since:
        2023.11