Interface EnvironmentDao

  • All Known Implementing Classes:
    EnvironmentDaoImpl

    public interface EnvironmentDao
    Dao for interacting with Environments in DB.
    • Method Detail

      • getEnvironment

        @Nullable
        @Nullable MutableEnvironment getEnvironment​(long environmentId)
        Gets specific Environment by ID
        Parameters:
        environmentId - ID of the environment your looking for.
        Returns:
        environment with given id or null if one with that ID could not be found.
      • getEnvironment

        @Nullable
        @Nullable MutableEnvironment getEnvironment​(@NotNull
                                                    @NotNull DeploymentKey environmentKey)
        Gets specific Environment by key
        Parameters:
        environmentKey - ket of the environment to find
        Returns:
        Deployment Environment with given key or null if one with that key could not be found
      • save

        void save​(@NotNull
                  @NotNull MutableEnvironment environment)
        Save a new or existing environment.
        Parameters:
        environment - to save.
      • saveAll

        <E extends MutableEnvironment> void saveAll​(@NotNull
                                                    @NotNull Collection<E> environments)
        Save all items on the list;
        Parameters:
        environments -
      • getEnvironmentsForDeploymentProject

        @NotNull
        @NotNull List<MutableEnvironment> getEnvironmentsForDeploymentProject​(long deploymentProjectId)
        Retrieve all environments for a Deployment Project
        Parameters:
        deploymentProjectId - of the Deployment Project
        Returns:
        List of all environments in a Deployment Project
      • delete

        void delete​(@NotNull
                    @NotNull MutableEnvironment environment)
        Delete a specific Deployment Environment.
        Parameters:
        environment -
      • getEnvironmentStubsForDeploymentProject

        @NotNull
        @NotNull List<EnvironmentStub> getEnvironmentStubsForDeploymentProject​(long deploymentProjectId)
        Retrieve all environment stubs for a Deployment Project. Environment stubs contain only the data that is required for the UI.
        Parameters:
        deploymentProjectId - of the Deployment Project
        Returns:
        List of all environments in a Deployment Project
      • isEnvironmentNameConflicting

        boolean isEnvironmentNameConflicting​(@NotNull
                                             @NotNull MutableDeploymentProject deploymentProject,
                                             @NotNull
                                             @NotNull String name)
        Check if there is currently an environment with the given name in the given deployment Project.
        Parameters:
        deploymentProject - the project to check environments of
        name - to check for conflict
        Returns:
        true if the name is already being used by an environment in the project, false if not.
      • getLastEnvironmentPosition

        int getLastEnvironmentPosition​(long deploymentProjectId)
        Returns:
        position of the last environment associated with a deployment project or -1 if none.
      • getFirstEnvironmentPosition

        int getFirstEnvironmentPosition​(long deploymentProjectId)
        Returns:
        position of the first environment associated with a deployment project or -1 if none.
      • getEnvironmentCount

        int getEnvironmentCount()
        Returns:
        number of all Environments
      • getEnvironmentCountForProject

        int getEnvironmentCountForProject​(long deploymentProjectId)
        Parameters:
        deploymentProjectId -
        Returns:
        number of Environment defined for the project
      • countAll

        long countAll()
        Since:
        5.11
      • findAll

        @NotNull
        @NotNull List<? extends MutableEnvironment> findAll​(int firstResult,
                                                            int pageSize)
        Since:
        5.11
      • findAllInternalEnvironments

        @NotNull
        @NotNull List<InternalEnvironment> findAllInternalEnvironments​(int firstResult,
                                                                       int maxResults)
        Since:
        9.3
      • getInternalEnvironmentsForDeploymentProject

        @NotNull
        @NotNull List<InternalEnvironment> getInternalEnvironmentsForDeploymentProject​(long deploymentProjectId)
        Since:
        9.4
      • findInternalEnvironmentByName

        @Nullable
        @Nullable InternalEnvironment findInternalEnvironmentByName​(long deploymentProjectId,
                                                                    @NotNull
                                                                    @NotNull String name)
        Since:
        9.5
      • findAllStubs

        @NotNull
        @NotNull List<EnvironmentStub> findAllStubs​(int firstResult,
                                                    int pageSize)
      • findEnvironmentsByRequirementKey

        @NotNull
        @NotNull List<Pair<Requirement,​MutableEnvironment>> findEnvironmentsByRequirementKey​(@NotNull
                                                                                                   @NotNull String requirementKey)
        Get requirements to environment mapping by requirement key.
        Parameters:
        requirementKey - on which environments rely
        Returns:
        pairs of environments or empty list
        Since:
        5.13
      • createNewEnvironmentInstance

        @NotNull
        @NotNull MutableEnvironment createNewEnvironmentInstance()
      • findEnvironmentByName

        @Nullable
        @Nullable MutableEnvironment findEnvironmentByName​(long deploymentProjectId,
                                                           String name)
        Find environment with specified name in a deployment project
        Parameters:
        deploymentProjectId -
        name -
        Since:
        6.8
      • getPaginatedEnvironmentsForDeploymentProject

        @NotNull
        @NotNull List<MutableEnvironment> getPaginatedEnvironmentsForDeploymentProject​(long deploymentProjectId,
                                                                                       int start,
                                                                                       int limit,
                                                                                       String filter)
        Retrieve part of environments for a Deployment Project ordered by position
        Parameters:
        start - start
        limit - max size of result
        deploymentProjectId - of the Deployment Project
        Returns:
        List of environments in a Deployment Project no more than limit
      • getPaginatedDeploymentsWithEnvironmentsOnlyIdsAndRequirementSets

        List<EnvironmentWithProjectAndRequirementsDto> getPaginatedDeploymentsWithEnvironmentsOnlyIdsAndRequirementSets​(int start,
                                                                                                                        int limit,
                                                                                                                        String filter)
        Retrieve paginated pairs of deployment project and environment ids together with the environment requirements, sorted by project ids and environment positions, matching the filter string anywhere within the name of the project or environment
        Parameters:
        start - start
        limit - max size of result
        filter - string by which the names of project and environments will be filtered
        Returns:
        List of id pairs and requirement sets
      • shiftUpEnvPosition

        void shiftUpEnvPosition​(int fromPosition,
                                int toPosition,
                                long deploymentProjectId)
        Increment by one all environments positions for given deployment project for environments which have position greater than fromPosition and lower than toPosition. Position for environments which position is equal to fromPosition or toPosition won't be change.
        Parameters:
        fromPosition -
        toPosition -
        deploymentProjectId -
      • shiftDownEnvPosition

        void shiftDownEnvPosition​(int fromPosition,
                                  int toPosition,
                                  long deploymentProjectId)
        Decrement by one all environments positions for given deployment project for environments which have position greater than fromPosition and lower than toPosition. Position for environments which position is equal to fromPosition or toPosition won't be change.
        Parameters:
        fromPosition -
        toPosition -
        deploymentProjectId -
      • getNextEnvironment

        Optional<MutableEnvironment> getNextEnvironment​(long deploymentProjectId,
                                                        int position)
        Parameters:
        deploymentProjectId -
        position -
        Returns:
        sorted first MutableEnvironment in deploymentProject which has greater position than position
      • getPreviousEnvironment

        Optional<MutableEnvironment> getPreviousEnvironment​(long deploymentProjectId,
                                                            int position)
        Parameters:
        deploymentProjectId -
        position -
        Returns:
        sorted first MutableEnvironment in deploymentProject which has lower position than position
      • findAllByIds

        @NotNull
        @NotNull List<MutableEnvironment> findAllByIds​(Collection<Long> ids)
        Returns a list of Environments which id values are in the ids collection
        Parameters:
        ids - list of id values
        Returns:
        list of Environments
        Since:
        8.2