1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Linq.Expressions;
|
---|
25 | using HeuristicLab.Services.Hive.DataAccess;
|
---|
26 | using DT = HeuristicLab.Services.Hive.DataTransfer;
|
---|
27 |
|
---|
28 | namespace HeuristicLab.Services.Hive {
|
---|
29 | public interface IHiveDao {
|
---|
30 | #region Task Methods
|
---|
31 | DT.Task GetTask(Guid id);
|
---|
32 | IEnumerable<DT.Task> GetTasks(Expression<Func<Task, bool>> predicate);
|
---|
33 | Guid AddTask(DT.Task dto);
|
---|
34 | void UpdateTask(DT.Task dto);
|
---|
35 | void DeleteTask(Guid id);
|
---|
36 | IEnumerable<DT.Task> GetWaitingTasks(DT.Slave slave, int count);
|
---|
37 | IEnumerable<DT.Task> GetParentTasks(IEnumerable<Guid> resourceIds, int count, bool finished);
|
---|
38 | DT.Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception);
|
---|
39 | #endregion
|
---|
40 |
|
---|
41 | #region TaskData Methods
|
---|
42 | DT.TaskData GetTaskData(Guid id);
|
---|
43 | IEnumerable<DT.TaskData> GetTaskDatas(Expression<Func<TaskData, bool>> predicate);
|
---|
44 | Guid AddTaskData(DT.TaskData dto);
|
---|
45 | void UpdateTaskData(DT.TaskData dto);
|
---|
46 | void DeleteTaskData(Guid id);
|
---|
47 | #endregion
|
---|
48 |
|
---|
49 | #region StateLog Methods
|
---|
50 | DT.StateLog GetStateLog(Guid id);
|
---|
51 | IEnumerable<DT.StateLog> GetStateLogs(Expression<Func<StateLog, bool>> predicate);
|
---|
52 | Guid AddStateLog(DT.StateLog dto);
|
---|
53 | void UpdateStateLog(DT.StateLog dto);
|
---|
54 | void DeleteStateLog(Guid id);
|
---|
55 | #endregion
|
---|
56 |
|
---|
57 | #region Job Methods
|
---|
58 | DT.Job GetJob(Guid id);
|
---|
59 | IEnumerable<DT.Job> GetJobs(Expression<Func<Job, bool>> predicate);
|
---|
60 | Guid AddJob(DT.Job dto);
|
---|
61 | void UpdateJob(DT.Job dto);
|
---|
62 | void DeleteJob(Guid id);
|
---|
63 | #endregion
|
---|
64 |
|
---|
65 | #region JobPermission Methods
|
---|
66 | DT.JobPermission GetJobPermission(Guid jobId, Guid grantedUserId);
|
---|
67 | IEnumerable<DT.JobPermission> GetJobPermissions(Expression<Func<JobPermission, bool>> predicate);
|
---|
68 | void AddJobPermission(DT.JobPermission dto);
|
---|
69 | void UpdateJobPermission(DT.JobPermission dto);
|
---|
70 | void DeleteJobPermission(Guid jobId, Guid grantedUserId);
|
---|
71 | void SetJobPermission(Guid jobId, Guid grantedByUserId, Guid grantedUserId, Permission permission);
|
---|
72 | #endregion
|
---|
73 |
|
---|
74 | #region Plugin Methods
|
---|
75 | DT.Plugin GetPlugin(Guid id);
|
---|
76 | IEnumerable<DT.Plugin> GetPlugins(Expression<Func<Plugin, bool>> predicate);
|
---|
77 | Guid AddPlugin(DT.Plugin dto);
|
---|
78 | void UpdatePlugin(DT.Plugin dto);
|
---|
79 | void DeletePlugin(Guid id);
|
---|
80 | #endregion
|
---|
81 |
|
---|
82 | #region PluginData Methods
|
---|
83 | DT.PluginData GetPluginData(Guid id);
|
---|
84 | IEnumerable<DT.PluginData> GetPluginDatas(Expression<Func<PluginData, bool>> predicate);
|
---|
85 | Guid AddPluginData(DT.PluginData dto);
|
---|
86 | void UpdatePluginData(DT.PluginData dto);
|
---|
87 | void DeletePluginData(Guid id);
|
---|
88 | #endregion
|
---|
89 |
|
---|
90 | #region Slave Methods
|
---|
91 | DT.Slave GetSlave(Guid id);
|
---|
92 | IEnumerable<DT.Slave> GetSlaves(Expression<Func<Slave, bool>> predicate);
|
---|
93 | Guid AddSlave(DT.Slave dto);
|
---|
94 | void UpdateSlave(DT.Slave dto);
|
---|
95 | void DeleteSlave(Guid id);
|
---|
96 | #endregion
|
---|
97 |
|
---|
98 | #region SlaveGroup Methods
|
---|
99 | DT.SlaveGroup GetSlaveGroup(Guid id);
|
---|
100 | IEnumerable<DT.SlaveGroup> GetSlaveGroups(Expression<Func<SlaveGroup, bool>> predicate);
|
---|
101 | Guid AddSlaveGroup(DT.SlaveGroup dto);
|
---|
102 | void UpdateSlaveGroup(DT.SlaveGroup dto);
|
---|
103 | void DeleteSlaveGroup(Guid id);
|
---|
104 | #endregion
|
---|
105 |
|
---|
106 | #region Resource Methods
|
---|
107 | DT.Resource GetResource(Guid id);
|
---|
108 | IEnumerable<DT.Resource> GetResources(Expression<Func<Resource, bool>> predicate);
|
---|
109 | Guid AddResource(DT.Resource dto);
|
---|
110 | void UpdateResource(DT.Resource dto);
|
---|
111 | void DeleteResource(Guid id);
|
---|
112 | void AssignJobToResource(Guid jobId, Guid resourceId);
|
---|
113 | IEnumerable<DT.Resource> GetAssignedResources(Guid jobId);
|
---|
114 | IEnumerable<DT.Resource> GetParentResources(Guid resourceId);
|
---|
115 | IEnumerable<DT.Resource> GetChildResources(Guid resourceId);
|
---|
116 | IEnumerable<DT.Task> GetJobsByResourceId(Guid resourceId);
|
---|
117 | #endregion
|
---|
118 |
|
---|
119 | #region ResourcePermission Methods
|
---|
120 | DT.ResourcePermission GetResourcePermission(Guid resourceId, Guid grantedUserId);
|
---|
121 | IEnumerable<DT.ResourcePermission> GetResourcePermissions(Expression<Func<ResourcePermission, bool>> predicate);
|
---|
122 | void AddResourcePermission(DT.ResourcePermission dto);
|
---|
123 | void UpdateResourcePermission(DT.ResourcePermission dto);
|
---|
124 | void DeleteResourcePermission(Guid resourceId, Guid grantedUserId);
|
---|
125 | #endregion
|
---|
126 |
|
---|
127 | #region Authorization Methods
|
---|
128 | Permission GetPermissionForTask(Guid taskId, Guid userId);
|
---|
129 | Permission GetPermissionForJob(Guid jobId, Guid userId);
|
---|
130 | Guid GetJobForTask(Guid taskId);
|
---|
131 | #endregion
|
---|
132 |
|
---|
133 | #region Lifecycle Methods
|
---|
134 | DateTime GetLastCleanup();
|
---|
135 | void SetLastCleanup(DateTime datetime);
|
---|
136 | #endregion
|
---|
137 |
|
---|
138 | #region Downtime Methods
|
---|
139 | DT.Downtime GetDowntime(Guid id);
|
---|
140 | IEnumerable<DT.Downtime> GetDowntimes(Expression<Func<Downtime, bool>> predicate);
|
---|
141 | Guid AddDowntime(DT.Downtime dto);
|
---|
142 | void UpdateDowntime(DT.Downtime dto);
|
---|
143 | void DeleteDowntime(Guid id);
|
---|
144 | #endregion
|
---|
145 |
|
---|
146 | #region Statistics Methods
|
---|
147 | DT.Statistics GetStatistic(Guid id);
|
---|
148 | IEnumerable<DT.Statistics> GetStatistics(Expression<Func<Statistics, bool>> predicate);
|
---|
149 | Guid AddStatistics(DT.Statistics dto);
|
---|
150 | void DeleteStatistics(Guid id);
|
---|
151 | List<DT.UserStatistics> GetUserStatistics();
|
---|
152 | #endregion
|
---|
153 | }
|
---|
154 | }
|
---|