Package cz.metacentrum.perun.core.blImpl
Class TasksManagerBlImpl
java.lang.Object
cz.metacentrum.perun.core.blImpl.TasksManagerBlImpl
- All Implemented Interfaces:
TasksManagerBl
TasksManagerBlImpl
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Get number of tasks in DB.int
Delete all TaskResultsint
deleteOldTaskResults
(PerunSession sess, int numDays) Delete all TaskResults older than specified number of daysvoid
deleteTask
(PerunSession sess, Task task) Delete Task and it's TaskResults.void
deleteTaskResultById
(PerunSession sess, int taskResultId) Delete TaskResults by its IDint
deleteTaskResults
(PerunSession sess, int taskId) Delete all TaskResults for the particular Taskint
deleteTaskResults
(PerunSession sess, int taskId, int destinationId) Delete all TaskResults for the particular Task and Destination.getAllFacilitiesStates
(PerunSession session) Return propagation status of all facilities in PerungetAllFacilitiesStatesForVo
(PerunSession session, Vo vo) Return propagation status of all facilities related to VO resourcesgetFacilityServicesState
(PerunSession sess, Facility facility) Returns list of ServiceStates for given facility.getFacilityState
(PerunSession session, Facility facility) Return propagation status of facilitygetResourcesState
(PerunSession session, Vo vo) Returns list of ResourceStates for VO.getTask
(PerunSession perunSession, Service service, Facility facility) Find propagation task for given service and facility.getTaskById
(PerunSession perunSession, int id) Retrieve task given its id.getTaskResultById
(PerunSession sess, int taskResultId) Retrieve all task results for given task (by task id)getTaskResults
(PerunSession sess) Retrieve all task results from DB.getTaskResultsByDestinations
(PerunSession session, List<String> destinationsNames) Returns task results for defined destinations (string representation).getTaskResultsByTask
(PerunSession sess, int taskId) Retrieve all tasks results for given taskgetTaskResultsByTaskAndDestination
(PerunSession sess, int taskId, int destinationId) List newest TaskResults tied to a certain task and destinationgetTaskResultsByTaskOnlyNewest
(PerunSession sess, int taskId) List newest TaskResults tied to a certain taskint
insertNewTaskResult
(PerunSession sess, TaskResult taskResult) Insert TaskResult into DB.int
insertTask
(PerunSession sess, Task task) Insert Task into DB.boolean
Check if propagating tasks to engine is suspended.boolean
Check if propagating tasks to engine is suspended via the DB flag CAREFUL: even if not suspended though DB, can be disabled temporarily through synced fieldboolean
isThereSuchTask
(PerunSession sess, Service service, Facility facility) Check if there is a task for given service and facility.listAllTasks
(PerunSession perunSession) Retrieve all tasks from DB.listAllTasksForFacility
(PerunSession session, int facilityId) Returns all tasks associated with selected facility.listAllTasksForService
(PerunSession sess, int serviceId) Returns all tasks associated with given service.listAllTasksInState
(PerunSession perunSession, Task.TaskStatus state) Retrieve all tasks in given state.listAllTasksNotInState
(PerunSession sess, Task.TaskStatus state) Retrieve all tasks that are not in given state.void
removeAllTasksForService
(PerunSession sess, Service service) Removes all tasks associated with given service including the associated task resultsvoid
removeTask
(PerunSession sess, int id) Remove task with given id.void
removeTask
(PerunSession sess, Service service, Facility facility) Remove task for given service and facility.retrieveRunIdForTask
(PerunSession sess, Task task) Retrieves a new run id for the task propagation.void
setPerunBl
(PerunBlImpl perunBl) void
setServicesManagerBl
(ServicesManagerBl servicesManagerBl) void
suspendTasksPropagation
(PerunSession perunSession, boolean suspend, boolean persistently) Suspend propagating tasks to engine.void
updateTask
(PerunSession sess, Task task) Update DB record for given task.
-
Field Details
-
perun
-
tasksManagerImpl
-
-
Constructor Details
-
TasksManagerBlImpl
-
-
Method Details
-
countTasks
public int countTasks()Description copied from interface:TasksManagerBl
Get number of tasks in DB.- Specified by:
countTasks
in interfaceTasksManagerBl
- Returns:
- int number of tasks
-
deleteAllTaskResults
Description copied from interface:TasksManagerBl
Delete all TaskResults- Specified by:
deleteAllTaskResults
in interfaceTasksManagerBl
- Returns:
- number of deleted TaskResults
-
deleteOldTaskResults
Description copied from interface:TasksManagerBl
Delete all TaskResults older than specified number of days- Specified by:
deleteOldTaskResults
in interfaceTasksManagerBl
- Parameters:
numDays
- Number of days to keep- Returns:
- number of deleted TaskResults
-
deleteTask
Description copied from interface:TasksManagerBl
Delete Task and it's TaskResults. Use this method only before deleting whole Facility.- Specified by:
deleteTask
in interfaceTasksManagerBl
- Parameters:
sess
- PerunSessiontask
- Task to delete
-
deleteTaskResultById
Description copied from interface:TasksManagerBl
Delete TaskResults by its ID- Specified by:
deleteTaskResultById
in interfaceTasksManagerBl
- Parameters:
taskResultId
- ID of TaskResult to delete
-
deleteTaskResults
Description copied from interface:TasksManagerBl
Delete all TaskResults for the particular Task- Specified by:
deleteTaskResults
in interfaceTasksManagerBl
- Parameters:
taskId
- ID of Task to delete TaskResults- Returns:
- number of deleted TaskResults
-
deleteTaskResults
Description copied from interface:TasksManagerBl
Delete all TaskResults for the particular Task and Destination.- Specified by:
deleteTaskResults
in interfaceTasksManagerBl
- Parameters:
taskId
- ID of Task to delete TaskResultsdestinationId
- ID of Destination to delete TaskResults- Returns:
- number of deleted TaskResults
-
getAllFacilitiesStates
public List<FacilityState> getAllFacilitiesStates(PerunSession session) throws FacilityNotExistsException Description copied from interface:TasksManagerBl
Return propagation status of all facilities in Perun- Specified by:
getAllFacilitiesStates
in interfaceTasksManagerBl
- Parameters:
session
- PerunSession- Returns:
- all facilities propagation statuses
- Throws:
FacilityNotExistsException
-
getAllFacilitiesStatesForVo
public List<FacilityState> getAllFacilitiesStatesForVo(PerunSession session, Vo vo) throws VoNotExistsException, FacilityNotExistsException Description copied from interface:TasksManagerBl
Return propagation status of all facilities related to VO resources- Specified by:
getAllFacilitiesStatesForVo
in interfaceTasksManagerBl
- Parameters:
session
- PerunSession- Returns:
- all facilities propagation statuses
- Throws:
VoNotExistsException
FacilityNotExistsException
-
getFacilityServicesState
Description copied from interface:TasksManagerBl
Returns list of ServiceStates for given facility. It lists states for all services, which are currently assigned to the facility or has any Task related to this facility.So results are returned even when there was no previous propagation of such service or service is no longer assigned.
- Specified by:
getFacilityServicesState
in interfaceTasksManagerBl
- Parameters:
sess
-facility
-- Returns:
- list of ServiceStates
-
getFacilityState
public FacilityState getFacilityState(PerunSession session, Facility facility) throws FacilityNotExistsException Description copied from interface:TasksManagerBl
Return propagation status of facility- Specified by:
getFacilityState
in interfaceTasksManagerBl
- Parameters:
session
-facility
-- Returns:
- propagation status of facility
- Throws:
FacilityNotExistsException
-
getPerunBl
-
getResourcesState
public List<ResourceState> getResourcesState(PerunSession session, Vo vo) throws VoNotExistsException Description copied from interface:TasksManagerBl
Returns list of ResourceStates for VO.- Specified by:
getResourcesState
in interfaceTasksManagerBl
- Parameters:
session
- PerunSessionvo
- VirtualOrganization- Returns:
- list of ResourceStates
- Throws:
VoNotExistsException
-
getServicesManagerBl
-
getTask
Description copied from interface:TasksManagerBl
Find propagation task for given service and facility.- Specified by:
getTask
in interfaceTasksManagerBl
- Parameters:
perunSession
-service
-facility
-- Returns:
- Task
-
getTaskById
Description copied from interface:TasksManagerBl
Retrieve task given its id.- Specified by:
getTaskById
in interfaceTasksManagerBl
- Parameters:
perunSession
-id
-- Returns:
- Task
-
getTaskResultById
Description copied from interface:TasksManagerBl
Retrieve all task results for given task (by task id)- Specified by:
getTaskResultById
in interfaceTasksManagerBl
- Parameters:
sess
-taskResultId
-- Returns:
- TaskResult
-
getTaskResults
Description copied from interface:TasksManagerBl
Retrieve all task results from DB.- Specified by:
getTaskResults
in interfaceTasksManagerBl
- Parameters:
sess
-- Returns:
- List of TaskResult
-
getTaskResultsByDestinations
public List<TaskResult> getTaskResultsByDestinations(PerunSession session, List<String> destinationsNames) Description copied from interface:TasksManagerBl
Returns task results for defined destinations (string representation).- Specified by:
getTaskResultsByDestinations
in interfaceTasksManagerBl
- Parameters:
session
-destinationsNames
-- Returns:
- list of tasks results
-
getTaskResultsByTask
Description copied from interface:TasksManagerBl
Retrieve all tasks results for given task- Specified by:
getTaskResultsByTask
in interfaceTasksManagerBl
- Parameters:
sess
-taskId
-- Returns:
- List of TaskResult
-
getTaskResultsByTaskAndDestination
public List<TaskResult> getTaskResultsByTaskAndDestination(PerunSession sess, int taskId, int destinationId) Description copied from interface:TasksManagerBl
List newest TaskResults tied to a certain task and destination- Specified by:
getTaskResultsByTaskAndDestination
in interfaceTasksManagerBl
- Parameters:
taskId
-- Returns:
- List of TaskResult
-
getTaskResultsByTaskOnlyNewest
Description copied from interface:TasksManagerBl
List newest TaskResults tied to a certain task- Specified by:
getTaskResultsByTaskOnlyNewest
in interfaceTasksManagerBl
- Parameters:
taskId
-- Returns:
- List of TaskResult
-
getTasksManagerImpl
-
insertNewTaskResult
Description copied from interface:TasksManagerBl
Insert TaskResult into DB.- Specified by:
insertNewTaskResult
in interfaceTasksManagerBl
- Parameters:
sess
-taskResult
-- Returns:
- int id of the new task result
-
insertTask
Description copied from interface:TasksManagerBl
Insert Task into DB.- Specified by:
insertTask
in interfaceTasksManagerBl
- Parameters:
sess
-task
-- Returns:
- int id of the inserted task
-
isSuspendedTasksPropagation
public boolean isSuspendedTasksPropagation()Description copied from interface:TasksManagerBl
Check if propagating tasks to engine is suspended.- Specified by:
isSuspendedTasksPropagation
in interfaceTasksManagerBl
- Returns:
- True if suspended, false if propagating
-
isSuspendedTasksPropagationPersistently
public boolean isSuspendedTasksPropagationPersistently()Description copied from interface:TasksManagerBl
Check if propagating tasks to engine is suspended via the DB flag CAREFUL: even if not suspended though DB, can be disabled temporarily through synced field- Specified by:
isSuspendedTasksPropagationPersistently
in interfaceTasksManagerBl
- Returns:
- True if suspended in DB, false otherwise
-
isThereSuchTask
Description copied from interface:TasksManagerBl
Check if there is a task for given service and facility.- Specified by:
isThereSuchTask
in interfaceTasksManagerBl
- Parameters:
sess
-service
-facility
-- Returns:
- boolean true if there is a task, false otherwise
-
listAllTasks
Description copied from interface:TasksManagerBl
Retrieve all tasks from DB.- Specified by:
listAllTasks
in interfaceTasksManagerBl
- Parameters:
perunSession
-- Returns:
- List of Task
-
listAllTasksForFacility
Description copied from interface:TasksManagerBl
Returns all tasks associated with selected facility.- Specified by:
listAllTasksForFacility
in interfaceTasksManagerBl
- Parameters:
session
-facilityId
-- Returns:
- all tasks for facility
-
listAllTasksForService
Description copied from interface:TasksManagerBl
Returns all tasks associated with given service.- Specified by:
listAllTasksForService
in interfaceTasksManagerBl
- Parameters:
serviceId
-- Returns:
- tasks for service
-
listAllTasksInState
Description copied from interface:TasksManagerBl
Retrieve all tasks in given state.- Specified by:
listAllTasksInState
in interfaceTasksManagerBl
- Parameters:
perunSession
-state
-- Returns:
- List of Task
-
listAllTasksNotInState
Description copied from interface:TasksManagerBl
Retrieve all tasks that are not in given state.- Specified by:
listAllTasksNotInState
in interfaceTasksManagerBl
- Parameters:
sess
-state
-- Returns:
- List of Task
-
removeAllTasksForService
Description copied from interface:TasksManagerBl
Removes all tasks associated with given service including the associated task results- Specified by:
removeAllTasksForService
in interfaceTasksManagerBl
- Parameters:
service
-
-
removeTask
Description copied from interface:TasksManagerBl
Remove task with given id.- Specified by:
removeTask
in interfaceTasksManagerBl
- Parameters:
sess
-id
-
-
removeTask
Description copied from interface:TasksManagerBl
Remove task for given service and facility.- Specified by:
removeTask
in interfaceTasksManagerBl
- Parameters:
sess
-service
-facility
-
-
setPerunBl
-
setServicesManagerBl
-
suspendTasksPropagation
public void suspendTasksPropagation(PerunSession perunSession, boolean suspend, boolean persistently) Description copied from interface:TasksManagerBl
Suspend propagating tasks to engine.- Specified by:
suspendTasksPropagation
in interfaceTasksManagerBl
- Parameters:
perunSession
-suspend
- True for suspending propagation, false for resuming propagationpersistently
- True for the change to persist even after Perun restart
-
updateTask
Description copied from interface:TasksManagerBl
Update DB record for given task.- Specified by:
updateTask
in interfaceTasksManagerBl
- Parameters:
sess
-task
-
-
retrieveRunIdForTask
Description copied from interface:TasksManagerBl
Retrieves a new run id for the task propagation.- Specified by:
retrieveRunIdForTask
in interfaceTasksManagerBl
- Parameters:
sess
- sessiontask
- task to schedule- Returns:
- task with updated run id
-