Package cz.metacentrum.perun.core.entry
Class TasksManagerEntry
java.lang.Object
cz.metacentrum.perun.core.entry.TasksManagerEntry
- All Implemented Interfaces:
TasksManager
TasksManager
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Get number of Tasks in DB.void
deleteTask
(PerunSession sess, Task task) Delete Task and it's TaskResults.void
deleteTaskResultById
(PerunSession sess, int taskResultId) Delete TaskResult by its IDvoid
deleteTaskResults
(PerunSession sess, Task task, Destination destination) Delete all TaskResults related to specified Task and Destinationvoid
deleteTaskResultsByIds
(PerunSession sess, List<Integer> taskResultIds) Delete TaskResults by their IDs.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 Task for given Service and Facility.getTaskById
(PerunSession perunSession, int id) Retrieve Task given its id.getTaskResultById
(PerunSession perunSession, int taskResultId) Get TaskResult given its id.getTaskResults
(PerunSession perunSession) Get all TaskResults.getTaskResultsByDestinations
(PerunSession session, List<String> destinationsNames) Returns task results for defined destinations (string representation).getTaskResultsByTask
(PerunSession sess, int taskId) Get all TaskResult's for given TaskgetTaskResultsByTaskAndDestination
(PerunSession session, int taskId, int destinationId) Find all task results for given task and destination.getTaskResultsByTaskOnlyNewest
(PerunSession session, int taskId) Retrieve the newest task results for given task.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 session, Service service, Facility facility) Check if if there is a task for given service and facility.listAllTasks
(PerunSession perunSession) Retrieve all task results.listAllTasksForFacility
(PerunSession session, int facilityId) Returns all tasks associated with selected facilitylistAllTasksInState
(PerunSession perunSession, Task.TaskStatus state) Retrieve all tasks in given statevoid
setPerunBl
(PerunBl perunBl) void
setTasksManagerBl
(TasksManagerBl tasksManagerBl) void
suspendTasksPropagation
(PerunSession perunSession, boolean suspend, boolean persistently) Suspends tasks propagation to engine.
-
Field Details
-
perun
-
-
Constructor Details
-
TasksManagerEntry
public TasksManagerEntry()
-
-
Method Details
-
countTasks
public int countTasks()Description copied from interface:TasksManager
Get number of Tasks in DB.- Specified by:
countTasks
in interfaceTasksManager
- Returns:
- Number of tasks.
-
deleteTask
Description copied from interface:TasksManager
Delete Task and it's TaskResults. Use this method only before deleting whole Facility.- Specified by:
deleteTask
in interfaceTasksManager
- Parameters:
sess
- PerunSessiontask
- Task to delete- Throws:
PrivilegeException
-
deleteTaskResultById
Description copied from interface:TasksManager
Delete TaskResult by its ID- Specified by:
deleteTaskResultById
in interfaceTasksManager
- Parameters:
sess
- PerunSessiontaskResultId
- Id of TaskResults to be deleted- Throws:
PrivilegeException
-
deleteTaskResults
public void deleteTaskResults(PerunSession sess, Task task, Destination destination) throws PrivilegeException Description copied from interface:TasksManager
Delete all TaskResults related to specified Task and Destination- Specified by:
deleteTaskResults
in interfaceTasksManager
- Parameters:
sess
- PerunSessiontask
- Task to have TaskResults deleteddestination
- Destination to have TasksResults deleted- Throws:
PrivilegeException
-
deleteTaskResultsByIds
public void deleteTaskResultsByIds(PerunSession sess, List<Integer> taskResultIds) throws PrivilegeException, FacilityMismatchException Description copied from interface:TasksManager
Delete TaskResults by their IDs. TaskResults are expected to be from the same facility.- Specified by:
deleteTaskResultsByIds
in interfaceTasksManager
- Parameters:
sess
- sesstaskResultIds
- list of ids- Throws:
PrivilegeException
FacilityMismatchException
- when the Tasks are not from the same facility
-
getAllFacilitiesStates
public List<FacilityState> getAllFacilitiesStates(PerunSession session) throws FacilityNotExistsException Description copied from interface:TasksManager
Return propagation status of all facilities in Perun- Specified by:
getAllFacilitiesStates
in interfaceTasksManager
- Parameters:
session
- PerunSession- Returns:
- all facilities propagation statuses
- Throws:
FacilityNotExistsException
-
getAllFacilitiesStatesForVo
public List<FacilityState> getAllFacilitiesStatesForVo(PerunSession session, Vo vo) throws PrivilegeException, VoNotExistsException, FacilityNotExistsException Description copied from interface:TasksManager
Return propagation status of all facilities related to VO resources- Specified by:
getAllFacilitiesStatesForVo
in interfaceTasksManager
- Parameters:
session
- PerunSession- Returns:
- all facilities propagation statuses
- Throws:
PrivilegeException
VoNotExistsException
FacilityNotExistsException
-
getFacilityServicesState
public List<ServiceState> getFacilityServicesState(PerunSession sess, Facility facility) throws PrivilegeException, FacilityNotExistsException Description copied from interface:TasksManager
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 interfaceTasksManager
- Parameters:
sess
- PerunSessionfacility
-- Returns:
- list of ServiceStates
- Throws:
PrivilegeException
FacilityNotExistsException
-
getFacilityState
public FacilityState getFacilityState(PerunSession session, Facility facility) throws PrivilegeException, FacilityNotExistsException Description copied from interface:TasksManager
Return propagation status of facility- Specified by:
getFacilityState
in interfaceTasksManager
- Parameters:
session
-facility
-- Returns:
- propagation status of facility
- Throws:
PrivilegeException
FacilityNotExistsException
-
getResourcesState
public List<ResourceState> getResourcesState(PerunSession session, Vo vo) throws PrivilegeException, VoNotExistsException Description copied from interface:TasksManager
Returns list of ResourceStates for VO.- Specified by:
getResourcesState
in interfaceTasksManager
- Parameters:
session
- PerunSessionvo
- VirtualOrganization- Returns:
- list of ResourceStates
- Throws:
PrivilegeException
VoNotExistsException
-
getTask
public Task getTask(PerunSession perunSession, Service service, Facility facility) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException Description copied from interface:TasksManager
Find Task for given Service and Facility.- Specified by:
getTask
in interfaceTasksManager
- Parameters:
perunSession
-service
-facility
-- Returns:
- Throws:
PrivilegeException
FacilityNotExistsException
ServiceNotExistsException
-
getTaskById
Description copied from interface:TasksManager
Retrieve Task given its id.- Specified by:
getTaskById
in interfaceTasksManager
- Parameters:
perunSession
-id
-- Returns:
- Task with given id
- Throws:
PrivilegeException
-
getTaskResultById
Description copied from interface:TasksManager
Get TaskResult given its id.- Specified by:
getTaskResultById
in interfaceTasksManager
- Parameters:
perunSession
-taskResultId
-- Returns:
- TaskResult
-
getTaskResults
Description copied from interface:TasksManager
Get all TaskResults.- Specified by:
getTaskResults
in interfaceTasksManager
- Parameters:
perunSession
-- Returns:
- List of TaskResult
-
getTaskResultsByDestinations
public List<TaskResult> getTaskResultsByDestinations(PerunSession session, List<String> destinationsNames) Description copied from interface:TasksManager
Returns task results for defined destinations (string representation).- Specified by:
getTaskResultsByDestinations
in interfaceTasksManager
- Parameters:
session
-destinationsNames
-- Returns:
- list of tasks results
-
getTaskResultsByTask
public List<TaskResult> getTaskResultsByTask(PerunSession sess, int taskId) throws PrivilegeException Description copied from interface:TasksManager
Get all TaskResult's for given Task- Specified by:
getTaskResultsByTask
in interfaceTasksManager
- Parameters:
sess
-taskId
-- Returns:
- List of TaskResult
- Throws:
PrivilegeException
-
getTaskResultsByTaskAndDestination
public List<TaskResult> getTaskResultsByTaskAndDestination(PerunSession session, int taskId, int destinationId) throws DestinationNotExistsException, FacilityNotExistsException, PrivilegeException Description copied from interface:TasksManager
Find all task results for given task and destination.- Specified by:
getTaskResultsByTaskAndDestination
in interfaceTasksManager
- Parameters:
session
-taskId
-destinationId
-- Returns:
- List of TaskResult
- Throws:
DestinationNotExistsException
FacilityNotExistsException
PrivilegeException
-
getTaskResultsByTaskOnlyNewest
public List<TaskResult> getTaskResultsByTaskOnlyNewest(PerunSession session, int taskId) throws PrivilegeException Description copied from interface:TasksManager
Retrieve the newest task results for given task.- Specified by:
getTaskResultsByTaskOnlyNewest
in interfaceTasksManager
- Parameters:
session
-taskId
-- Returns:
- List of TaskResult
- Throws:
PrivilegeException
-
isThereSuchTask
public boolean isThereSuchTask(PerunSession session, Service service, Facility facility) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException Description copied from interface:TasksManager
Check if if there is a task for given service and facility.- Specified by:
isThereSuchTask
in interfaceTasksManager
- Parameters:
session
-service
-facility
-- Returns:
- true if task exists, false otherwise
- Throws:
PrivilegeException
FacilityNotExistsException
ServiceNotExistsException
-
isSuspendedTasksPropagationPersistently
public boolean isSuspendedTasksPropagationPersistently(PerunSession session) throws PrivilegeException Description copied from interface:TasksManager
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 interfaceTasksManager
- Returns:
- True if suspended in DB, false otherwise
- Throws:
PrivilegeException
- insufficient rights
-
listAllTasks
Description copied from interface:TasksManager
Retrieve all task results.- Specified by:
listAllTasks
in interfaceTasksManager
- Parameters:
perunSession
-- Returns:
- List of TaskResult
-
listAllTasksForFacility
public List<Task> listAllTasksForFacility(PerunSession session, int facilityId) throws PrivilegeException Description copied from interface:TasksManager
Returns all tasks associated with selected facility- Specified by:
listAllTasksForFacility
in interfaceTasksManager
- Parameters:
session
-facilityId
-- Returns:
- all tasks for facility
- Throws:
PrivilegeException
-
listAllTasksInState
public List<Task> listAllTasksInState(PerunSession perunSession, Task.TaskStatus state) throws PrivilegeException Description copied from interface:TasksManager
Retrieve all tasks in given state- Specified by:
listAllTasksInState
in interfaceTasksManager
- Parameters:
perunSession
-state
-- Returns:
- List of Task
- Throws:
PrivilegeException
-
setPerunBl
-
setTasksManagerBl
-
suspendTasksPropagation
public void suspendTasksPropagation(PerunSession perunSession, boolean suspend, boolean persistently) throws PrivilegeException Description copied from interface:TasksManager
Suspends tasks propagation to engine.- Specified by:
suspendTasksPropagation
in interfaceTasksManager
- Parameters:
perunSession
-suspend
- True to suspend propagation, false to resume propagationpersistently
- True for the change to persist even after Perun restart- Throws:
PrivilegeException
-