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 TypeMethodDescriptionintGet number of Tasks in DB.voiddeleteTask(PerunSession sess, Task task) Delete Task and it's TaskResults.voiddeleteTaskResultById(PerunSession sess, int taskResultId) Delete TaskResult by its IDvoiddeleteTaskResults(PerunSession sess, Task task, Destination destination) Delete all TaskResults related to specified Task and DestinationvoiddeleteTaskResultsByIds(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.booleanCheck if propagating tasks to engine is suspended via the DB flag CAREFUL: even if not suspended though DB, can be disabled temporarily through synced fieldbooleanisThereSuchTask(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 statevoidsetPerunBl(PerunBl perunBl) voidsetTasksManagerBl(TasksManagerBl tasksManagerBl) voidsuspendTasksPropagation(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:TasksManagerGet number of Tasks in DB.- Specified by:
countTasksin interfaceTasksManager- Returns:
- Number of tasks.
-
deleteTask
Description copied from interface:TasksManagerDelete Task and it's TaskResults. Use this method only before deleting whole Facility.- Specified by:
deleteTaskin interfaceTasksManager- Parameters:
sess- PerunSessiontask- Task to delete- Throws:
PrivilegeException
-
deleteTaskResultById
Description copied from interface:TasksManagerDelete TaskResult by its ID- Specified by:
deleteTaskResultByIdin 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:TasksManagerDelete all TaskResults related to specified Task and Destination- Specified by:
deleteTaskResultsin 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:TasksManagerDelete TaskResults by their IDs. TaskResults are expected to be from the same facility.- Specified by:
deleteTaskResultsByIdsin interfaceTasksManager- Parameters:
sess- sesstaskResultIds- list of ids- Throws:
PrivilegeExceptionFacilityMismatchException- when the Tasks are not from the same facility
-
getAllFacilitiesStates
public List<FacilityState> getAllFacilitiesStates(PerunSession session) throws FacilityNotExistsException Description copied from interface:TasksManagerReturn propagation status of all facilities in Perun- Specified by:
getAllFacilitiesStatesin 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:TasksManagerReturn propagation status of all facilities related to VO resources- Specified by:
getAllFacilitiesStatesForVoin interfaceTasksManager- Parameters:
session- PerunSession- Returns:
- all facilities propagation statuses
- Throws:
PrivilegeExceptionVoNotExistsExceptionFacilityNotExistsException
-
getFacilityServicesState
public List<ServiceState> getFacilityServicesState(PerunSession sess, Facility facility) throws PrivilegeException, FacilityNotExistsException Description copied from interface:TasksManagerReturns 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:
getFacilityServicesStatein interfaceTasksManager- Parameters:
sess- PerunSessionfacility-- Returns:
- list of ServiceStates
- Throws:
PrivilegeExceptionFacilityNotExistsException
-
getFacilityState
public FacilityState getFacilityState(PerunSession session, Facility facility) throws PrivilegeException, FacilityNotExistsException Description copied from interface:TasksManagerReturn propagation status of facility- Specified by:
getFacilityStatein interfaceTasksManager- Parameters:
session-facility-- Returns:
- propagation status of facility
- Throws:
PrivilegeExceptionFacilityNotExistsException
-
getResourcesState
public List<ResourceState> getResourcesState(PerunSession session, Vo vo) throws PrivilegeException, VoNotExistsException Description copied from interface:TasksManagerReturns list of ResourceStates for VO.- Specified by:
getResourcesStatein interfaceTasksManager- Parameters:
session- PerunSessionvo- VirtualOrganization- Returns:
- list of ResourceStates
- Throws:
PrivilegeExceptionVoNotExistsException
-
getTask
public Task getTask(PerunSession perunSession, Service service, Facility facility) throws PrivilegeException, FacilityNotExistsException, ServiceNotExistsException Description copied from interface:TasksManagerFind Task for given Service and Facility.- Specified by:
getTaskin interfaceTasksManager- Parameters:
perunSession-service-facility-- Returns:
- Throws:
PrivilegeExceptionFacilityNotExistsExceptionServiceNotExistsException
-
getTaskById
Description copied from interface:TasksManagerRetrieve Task given its id.- Specified by:
getTaskByIdin interfaceTasksManager- Parameters:
perunSession-id-- Returns:
- Task with given id
- Throws:
PrivilegeException
-
getTaskResultById
Description copied from interface:TasksManagerGet TaskResult given its id.- Specified by:
getTaskResultByIdin interfaceTasksManager- Parameters:
perunSession-taskResultId-- Returns:
- TaskResult
-
getTaskResults
Description copied from interface:TasksManagerGet all TaskResults.- Specified by:
getTaskResultsin interfaceTasksManager- Parameters:
perunSession-- Returns:
- List of TaskResult
-
getTaskResultsByDestinations
public List<TaskResult> getTaskResultsByDestinations(PerunSession session, List<String> destinationsNames) Description copied from interface:TasksManagerReturns task results for defined destinations (string representation).- Specified by:
getTaskResultsByDestinationsin interfaceTasksManager- Parameters:
session-destinationsNames-- Returns:
- list of tasks results
-
getTaskResultsByTask
public List<TaskResult> getTaskResultsByTask(PerunSession sess, int taskId) throws PrivilegeException Description copied from interface:TasksManagerGet all TaskResult's for given Task- Specified by:
getTaskResultsByTaskin 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:TasksManagerFind all task results for given task and destination.- Specified by:
getTaskResultsByTaskAndDestinationin interfaceTasksManager- Parameters:
session-taskId-destinationId-- Returns:
- List of TaskResult
- Throws:
DestinationNotExistsExceptionFacilityNotExistsExceptionPrivilegeException
-
getTaskResultsByTaskOnlyNewest
public List<TaskResult> getTaskResultsByTaskOnlyNewest(PerunSession session, int taskId) throws PrivilegeException Description copied from interface:TasksManagerRetrieve the newest task results for given task.- Specified by:
getTaskResultsByTaskOnlyNewestin 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:TasksManagerCheck if if there is a task for given service and facility.- Specified by:
isThereSuchTaskin interfaceTasksManager- Parameters:
session-service-facility-- Returns:
- true if task exists, false otherwise
- Throws:
PrivilegeExceptionFacilityNotExistsExceptionServiceNotExistsException
-
isSuspendedTasksPropagationPersistently
public boolean isSuspendedTasksPropagationPersistently(PerunSession session) throws PrivilegeException Description copied from interface:TasksManagerCheck 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:
isSuspendedTasksPropagationPersistentlyin interfaceTasksManager- Returns:
- True if suspended in DB, false otherwise
- Throws:
PrivilegeException- insufficient rights
-
listAllTasks
Description copied from interface:TasksManagerRetrieve all task results.- Specified by:
listAllTasksin interfaceTasksManager- Parameters:
perunSession-- Returns:
- List of TaskResult
-
listAllTasksForFacility
public List<Task> listAllTasksForFacility(PerunSession session, int facilityId) throws PrivilegeException Description copied from interface:TasksManagerReturns all tasks associated with selected facility- Specified by:
listAllTasksForFacilityin 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:TasksManagerRetrieve all tasks in given state- Specified by:
listAllTasksInStatein 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:TasksManagerSuspends tasks propagation to engine.- Specified by:
suspendTasksPropagationin interfaceTasksManager- Parameters:
perunSession-suspend- True to suspend propagation, false to resume propagationpersistently- True for the change to persist even after Perun restart- Throws:
PrivilegeException
-