Interface EnvironmentDao
- All Known Implementing Classes:
EnvironmentDaoImpl
public interface EnvironmentDao
Dao for interacting with Environments in DB.
-
Method Summary
Modifier and TypeMethodDescriptionlong
countAll()
@NotNull MutableEnvironment
void
delete
(@NotNull MutableEnvironment environment) Delete a specific Deployment Environment.findAll()
@NotNull List<? extends MutableEnvironment>
findAll
(int firstResult, int pageSize) @NotNull List<MutableEnvironment>
findAllByIds
(Collection<Long> ids) Returns a list of Environments which id values are in the ids collection@NotNull List<InternalEnvironment>
findAllInternalEnvironments
(int firstResult, int maxResults) @NotNull List<EnvironmentStub>
findAllStubs
(int firstResult, int pageSize) @Nullable MutableEnvironment
findEnvironmentByName
(long deploymentProjectId, String name) Find environment with specified name in a deployment project@NotNull List<Pair<Requirement,
MutableEnvironment>> findEnvironmentsByRequirementKey
(@NotNull String requirementKey) Get requirements to environment mapping by requirement key.@Nullable InternalEnvironment
findInternalEnvironmentByName
(long deploymentProjectId, @NotNull String name) @NotNull List<InternalEnvironment>
findInternalEnvironmentsByIds
(@NotNull List<Long> ids) Returns a list ofInternalEnvironment
which id values are in the ids collection@Nullable MutableEnvironment
getEnvironment
(long environmentId) Gets specific Environment by ID@Nullable MutableEnvironment
getEnvironment
(@NotNull DeploymentKey environmentKey) Gets specific Environment by keyint
int
getEnvironmentCountForProject
(long deploymentProjectId) @NotNull List<MutableEnvironment>
getEnvironmentsForDeploymentProject
(long deploymentProjectId) Retrieve all environments for a Deployment Project@NotNull List<EnvironmentStub>
getEnvironmentStubsForDeploymentProject
(long deploymentProjectId) Retrieve all environment stubs for a Deployment Project.int
getFirstEnvironmentPosition
(long deploymentProjectId) @NotNull List<InternalEnvironment>
getInternalEnvironmentsForDeploymentProject
(long deploymentProjectId) int
getLastEnvironmentPosition
(long deploymentProjectId) getNextEnvironment
(long deploymentProjectId, int position) 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@NotNull List<MutableEnvironment>
getPaginatedEnvironmentsForDeploymentProject
(long deploymentProjectId, int start, int limit, String filter) Retrieve part of environments for a Deployment Project ordered by positiongetPreviousEnvironment
(long deploymentProjectId, int position) boolean
isEnvironmentNameConflicting
(@NotNull MutableDeploymentProject deploymentProject, @NotNull String name) Check if there is currently an environment with the given name in the given deployment Project.void
save
(@NotNull MutableEnvironment environment) Save a new or existing environment.<E extends MutableEnvironment>
voidsaveAll
(@NotNull Collection<E> environments) Save all items on the list;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.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.
-
Method Details
-
getEnvironment
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
Save a new or existing environment.- Parameters:
environment
- to save.
-
saveAll
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
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 ofname
- to check for conflict- Returns:
- true if the name is already being used by an environment in the project, false if not.
-
findAll
List<MutableEnvironment> findAll() -
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
Environment
s
-
getEnvironmentCountForProject
int getEnvironmentCountForProject(long deploymentProjectId) - Parameters:
deploymentProjectId
-- Returns:
- number of
Environment
defined for the project
-
countAll
long countAll()- Since:
- 5.11
-
findAll
- 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
-
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
-
findEnvironmentByName
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
- startlimit
- max size of resultdeploymentProjectId
- 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
- startlimit
- max size of resultfilter
- 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
- Parameters:
deploymentProjectId
-position
-- Returns:
- sorted first
MutableEnvironment
in deploymentProject which has greater position than position
-
getPreviousEnvironment
- Parameters:
deploymentProjectId
-position
-- Returns:
- sorted first
MutableEnvironment
in deploymentProject which has lower position than position
-
findAllByIds
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
-
findInternalEnvironmentsByIds
@NotNull @NotNull List<InternalEnvironment> findInternalEnvironmentsByIds(@NotNull @NotNull List<Long> ids) Returns a list ofInternalEnvironment
which id values are in the ids collection- Since:
- 9.4
-