Modifier and Type | Class and Description |
---|---|
static class |
RequestDAO.StageEntityPK |
Constructor and Description |
---|
RequestDAO() |
Modifier and Type | Method and Description |
---|---|
protected <T> int |
cleanTableByIds(Set<Long> ids,
String paramName,
String entityName,
Long beforeDateMillis,
String entityQuery,
Class<T> type)
In this method we are removing entities using passed ids,
To prevent issues we are using batch request to remove limited
count of entities.
|
protected <T> int |
cleanTableByStageEntityPK(List<RequestDAO.StageEntityPK> ids,
LinkedList<String> paramNames,
String entityName,
Long beforeDateMillis,
String entityQuery,
Class<T> type)
In this method we are removing entities using passed few ids,
To prevent issues we are using batch request to remove limited
count of entities.
|
long |
cleanup(TimeBasedCleanupPolicy policy)
Performs the cleanup for the entiries the implementing DAO is responsible for.
|
void |
create(RequestEntity requestEntity) |
List<RequestEntity> |
findAll() |
List<Long> |
findAllRequestIds(int limit,
boolean ascending) |
List<Long> |
findAllRequestIds(int limit,
boolean sortAscending,
Long clusterId)
Retrieves from the database for a cluster, or specifically for non-cluster requests.
|
List<RequestResourceFilterEntity> |
findAllResourceFilters() |
RequestEntity |
findByPK(Long requestId) |
List<RequestEntity> |
findByPks(Collection<Long> requestIds) |
List<RequestEntity> |
findByPks(Collection<Long> requestIds,
boolean refreshHint)
Given a collection of request ids, load the corresponding entities
|
List<RequestDAO.StageEntityPK> |
findRequestAndStageIdsInClusterBeforeDate(Long clusterId,
long beforeDateMillis)
Search for all request and stage ids in Request and Stage tables
|
Long |
getLastStageId(long requestId) |
boolean |
isAllTasksCompleted(long requestId) |
RequestEntity |
merge(RequestEntity requestEntity) |
void |
remove(RequestEntity requestEntity) |
void |
removeByPK(Long requestId) |
RequestEntity |
updateStatus(long requestId,
HostRoleStatus status,
HostRoleStatus displayStatus) |
public RequestEntity findByPK(Long requestId)
public List<RequestEntity> findByPks(Collection<Long> requestIds)
public List<RequestEntity> findByPks(Collection<Long> requestIds, boolean refreshHint)
requestIds
- the collection of request idsrefreshHint
- true
to hint JPA that the list should be refreshedpublic List<RequestEntity> findAll()
public List<RequestResourceFilterEntity> findAllResourceFilters()
public boolean isAllTasksCompleted(long requestId)
public Long getLastStageId(long requestId)
public RequestEntity updateStatus(long requestId, HostRoleStatus status, HostRoleStatus displayStatus)
public void create(RequestEntity requestEntity)
public RequestEntity merge(RequestEntity requestEntity)
public void remove(RequestEntity requestEntity)
public void removeByPK(Long requestId)
public List<Long> findAllRequestIds(int limit, boolean sortAscending, Long clusterId)
limit
- the max number to returnsortAscending
- true
to sort by requestId ascending, false
for descendingclusterId
- the cluster to find, or null
to search for requests without clusterpublic List<RequestDAO.StageEntityPK> findRequestAndStageIdsInClusterBeforeDate(Long clusterId, long beforeDateMillis)
protected <T> int cleanTableByIds(Set<Long> ids, String paramName, String entityName, Long beforeDateMillis, String entityQuery, Class<T> type)
ids
- list of ids that we are using to remove rows from tableparamName
- name of parameter that we are using in sql query (taskIds, stageIds)entityName
- name of entity which we will removebeforeDateMillis
- timestamp which was set by user (remove all entities that were created before),
we are using it only for loggingentityQuery
- name of NamedQuery which we will use to remove needed entitiestype
- type of entity class which we will use for casting query resultprotected <T> int cleanTableByStageEntityPK(List<RequestDAO.StageEntityPK> ids, LinkedList<String> paramNames, String entityName, Long beforeDateMillis, String entityQuery, Class<T> type)
ids
- list of ids pairs that we are using to remove rows from tableparamNames
- list of two names of parameters that we are using in sql query (taskIds, stageIds)entityName
- name of entity which we will removebeforeDateMillis
- timestamp which was set by user (remove all entities that were created before),
we are using it only for loggingentityQuery
- name of NamedQuery which we will use to remove needed entitiestype
- type of entity class which we will use for casting query resultpublic long cleanup(TimeBasedCleanupPolicy policy)
Cleanable
Copyright © 2022 Apache Software Foundation. All rights reserved.