Interface DeploymentResultDao

All Known Implementing Classes:
DeploymentResultDaoImpl

public interface DeploymentResultDao
  • Method Details

    • getDeploymentResult

      @Nullable @Nullable MutableDeploymentResult getDeploymentResult(long deploymentResultId)
      Get DeploymentResult by id
    • getDeploymentResultsByLifeCycleState

      @NotNull @NotNull List<MutableDeploymentResult> getDeploymentResultsByLifeCycleState(Collection<LifeCycleState> lifeCycleStates)
    • save

      void save(MutableDeploymentResult deploymentResult)
      Save DeploymentResult
    • getDeploymentResultsForEnvironment

      @NotNull @NotNull List<MutableDeploymentResult> getDeploymentResultsForEnvironment(long environmentId)
      Get a list of DeploymentResults for a Environment WARNING: This method will fetch all results, potentially creating performance problem.
      Parameters:
      environmentId - id of Environment
    • getDeploymentResultsForEnvironment

      @NotNull @NotNull List<MutableDeploymentResult> getDeploymentResultsForEnvironment(long environmentId, int offset, int maxResults)
      Get a list of DeploymentResults for a Environment
      Parameters:
      environmentId - id of Environment
      offset -
      maxResults -
      Since:
      5.1.2
    • getSuccessfulDeploymentResultsForEnvironment

      @NotNull @NotNull List<MutableDeploymentResult> getSuccessfulDeploymentResultsForEnvironment(long environmentId, int offset, int maxResults)
      Get a list of DeploymentResults successfully deployed to an Environment
      Parameters:
      environmentId - id of Environment
      offset -
      maxResults -
      Since:
      5.7
    • countDeploymentResultsForEnvironment

      int countDeploymentResultsForEnvironment(long environmentId)
      Count deployment results for deployment.
      Parameters:
      environmentId -
      Returns:
      Since:
      5.1.2
    • getLatestDeploymentResultsForEnvironment

      @NotNull @NotNull List<MutableDeploymentResult> getLatestDeploymentResultsForEnvironment(long environmentId, int startIndex, int maxResults)
      Get the latest deployment results for an Environment, limited to requested amount starting from requested start index.
      Parameters:
      environmentId - of the environment
      startIndex - the index to which start. Latest deployment is at index 0; (ignored if below zero)
      maxResults - how many results to retrieve, (ignored if equal to or below zero)
      Returns:
      subset of latest deployment results
    • getDeploymentResultsForDeploymentVersion

      @NotNull @NotNull List<MutableDeploymentResult> getDeploymentResultsForDeploymentVersion(long deploymentVersionId)
      Get a list of DeploymentResults for a DeploymentVersion. Records are sorted by deployment start date. TODO: this method is a potential problem due to performance reasons
      Parameters:
      deploymentVersionId - id of DeploymentVersion
    • getDeploymentResultsForDeploymentVersionFinishedBefore

      @NotNull @Deprecated @NotNull List<MutableDeploymentResult> getDeploymentResultsForDeploymentVersionFinishedBefore(long deploymentVersionId, Date finishDate)
      Deprecated.
      since 5.10 avoid due to performance. Consider getDeploymentResultIdsForDeploymentVersionFinishedBefore(long, Date) instead.
      Get a list of DeploymentResults for a DeploymentVersion. Records are sorted by deployment start date.
      Parameters:
      deploymentVersionId - id of DeploymentVersion
      finishDate - only select results finished before this date
    • getDeploymentResultIdsForDeploymentVersionFinishedBefore

      @NotNull @NotNull List<Long> getDeploymentResultIdsForDeploymentVersionFinishedBefore(long deploymentVersionId, @NotNull @NotNull Date finishDate)
      Get a list of result ids for a DeploymentVersion. Records are sorted by deployment start date (oldest first).
      Parameters:
      deploymentVersionId - id of DeploymentVersion
      finishDate - only select results finished before this date
    • getDeploymentResults

      @NotNull @NotNull List<MutableDeploymentResult> getDeploymentResults(long environmentId, long deploymentVersionId)
      Retrieve all deployment results that exist for an environment and version. There are no restrictions for how many times. Performance should not be a huge problem with this method as we do not expect too many results for one version going to an specific environment you can deploy a version to an environment.
      Parameters:
      environmentId - of the environment
      deploymentVersionId - of the version
      Returns:
      deployment result for a version against an environment.
    • getLatestDeploymentResult

      @Nullable @Nullable MutableDeploymentResult getLatestDeploymentResult(long environmentId, long deploymentVersionId)
      Retrieve the latest deployment result that exists for a version on an environment.
      Parameters:
      environmentId - of the environment
      deploymentVersionId - of the version
      Returns:
      Latest deployment result if exists
    • getLatestDeploymentResultForEnvironment

      @Nullable @Nullable MutableDeploymentResult getLatestDeploymentResultForEnvironment(long environmentId)
      Get the latest result that ran against an environment
      Parameters:
      environmentId - id of the environment
      Returns:
      the latest result. Null if not run
    • getLatestKnownDeploymentResultForEnvironment

      MutableDeploymentResult getLatestKnownDeploymentResultForEnvironment(long environmentId)
      Get the latest result that *actually* ran against an environments. Any NOT_BUILT results are skipped, so you can see the latest known state of that particular environment. Consider getLatestKnownDeploymentResultDtoForEnvironment(long), which scales better.
      Parameters:
      environmentId - id of the environment
      Returns:
      the latest results.
    • getLatestKnownDeploymentResultDtoForEnvironment

      @Nullable @Nullable DeploymentResultDto getLatestKnownDeploymentResultDtoForEnvironment(long environmentId)
      Get the latest result that *actually* ran against an environments. Any NOT_BUILT results are skipped, so you can see the latest known state of that particular environment. This version scales better than getLatestKnownDeploymentResultForEnvironment(long)
      Parameters:
      environmentId - id of the environment
      Returns:
      the latest results.
    • delete

      void delete(MutableDeploymentResult deploymentResult)
      Delete Deployment Result.
      Parameters:
      deploymentResult - to be deleted
    • delete

      int delete(@NotNull @NotNull DeploymentResultDeletionAdapter deletionAdapter)
      Delete DeploymentResults records limited by DeletionSQLAdapter.getInClause(). This will only attempt to remove DeploymentResults and data that is normally cascaded by Hibernate. For complete DeploymentResult deletion please see DeploymentResultDeletionService.delete(long). Deletion is performed using DELETE queries.
      Parameters:
      deletionAdapter - DeletionSQLAdapter.getInClause() should provide range of DeploymentResults
      Returns:
      number of deleted records
    • delete

      int delete(@NotNull @NotNull EnvironmentDeletionAdapter environmentDeletionAdapter)
      Delete DeploymentResults records limited by EnvironmentDeletionAdapter. This will only attempt to remove DeploymentResults and data that is normally cascaded by Hibernate. For complete DeploymentResult deletion please see DeploymentResultDeletionService.delete(long). Deletion is performed using DELETE queries.
      Parameters:
      environmentDeletionAdapter - EnvironmentDeletionAdapter should provide range of DeploymentResults
      Returns:
      number of deleted records
    • unlinkFromVersion

      int unlinkFromVersion(@NotNull @NotNull DeploymentVersionDeletionAdapter deletionAdapter)
      Unlink DeploymentResults records limited by DeletionSQLAdapter.getInClause() from deployment version. Unlinking is performed using UPDATE queries
      Parameters:
      deletionAdapter - DeletionSQLAdapter.getInClause() should provide range of DeploymentVersions to unlink from
      Returns:
      number of unlinked records
    • iterateResultsForExport

      long iterateResultsForExport(@NotNull @NotNull Consumer<MutableDeploymentResult> consumer)
      Iterate through and execute function for each of MutableDeploymentResult
      Parameters:
      consumer - consumer to accept each of the MutableDeploymentResult
      Returns:
      number of traversed rows
    • getRollbackDeploymentResultForEnvironment

      @Nullable @Nullable MutableDeploymentResult getRollbackDeploymentResultForEnvironment(long environmentId, long latestVersionId)
      Find the result that you are trying to replicate by doing a rollback. Looks back until it finds a successful result that is not the same version as the one currently deployed
      Parameters:
      environmentId - if the environment to find rollback for
      latestVersionId - id of the version currently on the environment
      Returns:
      result
    • getRollbackDeploymentResultBeforeStartedDate

      @Nullable @Nullable MutableDeploymentResult getRollbackDeploymentResultBeforeStartedDate(@NotNull @NotNull DeploymentResult deploymentResult)
      Find the result successfully deployed on same environment before given deployment result coming from different deployment version
      Parameters:
      deploymentResult -
      Returns:
    • findEnvironmentIdsVersionWasDeployedOn

      @NotNull @NotNull Set<Long> findEnvironmentIdsVersionWasDeployedOn(long deploymentVersionId)
      Parameters:
      deploymentVersionId -
      Returns:
      ids of all environments a version was ever deployed on
    • getLastResultBefore

      @Nullable @Nullable MutableDeploymentResult getLastResultBefore(@NotNull @NotNull DeploymentResult deploymentResult)
      Returns:
      result of the last deployment performed on an environment before given result
    • getLastResultInStatesBefore

      @Nullable @Nullable MutableDeploymentResult getLastResultInStatesBefore(@NotNull @NotNull DeploymentResult deploymentResult, @NotNull @NotNull EnumSet<BuildState> buildStates)
      Returns:
      result of the last deployment performed on an environment before given result in one of given build states
    • updateVersionName

      void updateVersionName(long deploymentVersionId, @NotNull @NotNull String newVersionName)
      Updates version name in all results related to a vesion
      Parameters:
      deploymentVersionId -
      newVersionName -
    • getLatestDeploymentResultsForAllEnvironments

      Collection<DeploymentResultDto> getLatestDeploymentResultsForAllEnvironments()
      Retrieve the latest deployment result for every deployment environment.
      Since:
      5.10
    • getLatestDeploymentResultsForEnvironments

      Collection<DeploymentResultDto> getLatestDeploymentResultsForEnvironments(@NotNull @NotNull List<Long> environmentIds)
      Retrieve the latest deployment result for deployment environments.
      Since:
      6.8
    • getDeploymentResultsDtosForEnvironment

      @NotNull @NotNull List<DeploymentResultDto> getDeploymentResultsDtosForEnvironment(long environmentId, int offset, int maxResults)
      Get the latest deployment results for an Environment, limited to requested amount starting from requested start index.
      Since:
      6.7
    • getLatestStatusForEnvironments

      @NotNull @NotNull Collection<EnvironmentStatusForDashboard> getLatestStatusForEnvironments(@NotNull @NotNull List<Long> environmentIds)
      Get minimum status data for listed environment ids.
      Since:
      9.3