Interface AgentDao
- All Superinterfaces:
BambooObjectDao
,bucket.core.persistence.ObjectDao
- All Known Implementing Classes:
AgentHibernateDao
Agent Definition Dao that can search on PipelineDefinitions as well as it sub classes.
-
Method Summary
Modifier and TypeMethodDescription@Nullable PipelineDefinition
findAgentByName
(@NotNull String name) Deprecated.@NotNull List<PipelineDefinition>
findAgentsByName
(@NotNull String name) RetrievePipelineDefinition
s by name.Retrieves all agents();findAllAgentsForAgentIds
(@NotNull Collection<Long> agentIds) Return a list of agents by their ids@NotNull List<PipelineDefinition>
findAllAgentsWithNameLike
(@NotNull String likeName) Retrun a list of agents whose name is like the provided string.@NotNull List<ElasticAgentDefinition>
findAllElasticAgents
(int firstResult, int maxResults) Retrieves n most recently terminated elastic agents, ordered by termination time, descending.@NotNull List<ElasticAgentDefinition>
findAllElasticAgents
(@NotNull Collection<String> instanceIds) Retrieves all elastic agentsRetrieves all ephemeral agents@NotNull List<LocalAgentDefinition>
Retrieves all local agentsRetrieves all remote agentsRetrieves all agents without a shutdown time defined@Nullable PipelineDefinition
getAgentById
(long id) Retrieve the agentDefinition object.long
getAgentCount
(Class<? extends PipelineDefinition> agentDefinitionClass) Retrieves the amount of agents of given type stored in the databasegetLocalAgentById
(long id) Retrieve the localAgentDefinitiongetRemoteAgentById
(long id) Retrieve the remoteAgentDefinition@NotNull PipelineDefinition
saveAndReturn
(@NotNull PipelineDefinition pipelineDefinition) Saves the passed definition and returns a new copy of the updated pipeline definitionvoid
updateAgentShutdownTime
(@NotNull PipelineDefinition agentDefinition) Updates agent shutdown time taking into account that passed object might not be in session.Methods inherited from interface com.atlassian.bamboo.persistence.BambooObjectDao
findById
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, getPersistentClass, refresh, remove, replicate, save, saveRaw
-
Method Details
-
saveAndReturn
@NotNull @NotNull PipelineDefinition saveAndReturn(@NotNull @NotNull PipelineDefinition pipelineDefinition) Saves the passed definition and returns a new copy of the updated pipeline definition- Parameters:
pipelineDefinition
- to save- Returns:
- the saved and updated (e.g with agentId) pipelineDefinition
-
getAgentById
Retrieve the agentDefinition object.- Parameters:
id
- - the id for the agent to be retrieved- Returns:
- agentDefinition associated with the agentId or null if it couldn't be found
-
getLocalAgentById
Retrieve the localAgentDefinition- Parameters:
id
- of the agent- Returns:
- LocalAgentDefintion associated with the id if no agent found, returns null
-
getRemoteAgentById
Retrieve the remoteAgentDefinition- Parameters:
id
- of the agent- Returns:
- RemoteAgentDefintion associated with the id if no agent found, returns null
-
findAllRemoteAgents
List<RemoteAgentDefinition> findAllRemoteAgents()Retrieves all remote agents- Returns:
- list of all remote agents
-
findAllEphemeralAgents
List<EphemeralAgentDefinition> findAllEphemeralAgents()Retrieves all ephemeral agents- Returns:
- list of all ephemeral agents
- Since:
- 9.5
-
findNotShutDownElasticAgents
List<ElasticAgentDefinition> findNotShutDownElasticAgents()Retrieves all agents without a shutdown time defined- Returns:
- all agents without a shutdown time defined
-
getAgentCount
Retrieves the amount of agents of given type stored in the database- Parameters:
agentDefinitionClass
- agent type- Returns:
- amount of agents
-
findAllLocalAgents
Retrieves all local agents- Returns:
- list of all local agents
-
findAllElasticAgents
@NotNull @NotNull List<ElasticAgentDefinition> findAllElasticAgents(int firstResult, int maxResults) Retrieves n most recently terminated elastic agents, ordered by termination time, descending. -
findAllElasticAgents
@NotNull @NotNull List<ElasticAgentDefinition> findAllElasticAgents(@NotNull @NotNull Collection<String> instanceIds) Retrieves all elastic agents- Parameters:
instanceIds
- the instances ids on which the agents were running
-
findAllAgents
List<PipelineDefinition> findAllAgents()Retrieves all agents();- Returns:
- list of all agents
-
findAllAgentsWithNameLike
@NotNull @NotNull List<PipelineDefinition> findAllAgentsWithNameLike(@NotNull @NotNull String likeName) Retrun a list of agents whose name is like the provided string. Uses hibernate's "like" so % to mark wild card.- Parameters:
likeName
- the string to match- Returns:
- List of Pipeline Definitions
-
findAllAgentsForAgentIds
Return a list of agents by their ids- Returns:
- List of
PipelineDefinition
-
findAgentByName
Deprecated.since 9.2, usefindAgentsByName(String)
insteadRetrieve aPipelineDefinition
by name. Names should be unique. If duplicated names exist, this method will throwNonUniqueResultException
exception.- Parameters:
name
- of the agent to find- Returns:
- the agent that has the given name.
-
findAgentsByName
RetrievePipelineDefinition
s by name. Names should be unique. However, duplicates are possible due to not properly handled unsuccessful registration attempts.- Parameters:
name
- of the agent to find- Returns:
- the list of agents that have the given name.
- Since:
- 9.2
-
updateAgentShutdownTime
Updates agent shutdown time taking into account that passed object might not be in session.- Since:
- 9.4
-
findAgentsByName(String)
instead