Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HiveService.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HiveService.cs	(revision 6725)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HiveService.cs	(revision 6743)
@@ -61,151 +61,151 @@
 
     #region Job Methods
-    public Guid AddJob(Task job, TaskData jobData, IEnumerable<Guid> resourceIds) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      return trans.UseTransaction(() => {
-        job.Id = dao.AddJob(job);
-        jobData.TaskId = job.Id;
-        jobData.LastUpdate = DateTime.Now;
+    public Guid AddTask(Task task, TaskData taskData, IEnumerable<Guid> resourceIds) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      return trans.UseTransaction(() => {
+        task.Id = dao.AddTask(task);
+        taskData.TaskId = task.Id;
+        taskData.LastUpdate = DateTime.Now;
         foreach (Guid slaveGroupId in resourceIds) {
-          dao.AssignJobToResource(job.Id, slaveGroupId);
-        }
-        dao.AddJobData(jobData);
-        dao.UpdateJobState(job.Id, DA.TaskState.Waiting, null, userManager.CurrentUserId, null);
-        return jobData.TaskId;
+          dao.AssignJobToResource(task.Id, slaveGroupId);
+        }
+        dao.AddTaskData(taskData);
+        dao.UpdateTaskState(task.Id, DA.TaskState.Waiting, null, userManager.CurrentUserId, null);
+        return taskData.TaskId;
       }, false, true);
     }
 
-    public Guid AddChildJob(Guid parentJobId, Task job, TaskData jobData) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      return trans.UseTransaction(() => {
-        job.ParentTaskId = parentJobId;
-        return AddJob(job, jobData, dao.GetAssignedResources(parentJobId).Select(x => x.Id));
+    public Guid AddChildTask(Guid parentTaskId, Task task, TaskData taskData) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      return trans.UseTransaction(() => {
+        task.ParentTaskId = parentTaskId;
+        return AddTask(task, taskData, dao.GetAssignedResources(parentTaskId).Select(x => x.Id));
       }, false, true);
     }
 
-    public Task GetJob(Guid jobId) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
+    public Task GetTask(Guid taskId) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
+      author.AuthorizeForTask(taskId, Permission.Read);
+      return dao.GetTask(taskId);
+    }
+
+    public IEnumerable<Task> GetTasks() {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      var tasks = dao.GetTasks(x => true);
+      foreach (var task in tasks)
+        author.AuthorizeForTask(task.Id, Permission.Read);
+      return tasks;
+    }
+
+    public IEnumerable<LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      var tasks = dao.GetTasks(x => taskIds.Contains(x.TaskId)).Select(x => new LightweightTask(x)).ToArray();
+      foreach (var task in tasks)
+        author.AuthorizeForTask(task.Id, Permission.Read);
+      return tasks;
+    }
+
+    public IEnumerable<LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      var tasks = GetChildTasks(parentTaskId, recursive, includeParent).Select(x => new LightweightTask(x)).ToArray();
+      foreach (var task in tasks)
+        author.AuthorizeForTask(task.Id, Permission.Read);
+      return tasks;
+    }
+
+    public IEnumerable<LightweightTask> GetLightweightJobTasks(Guid jobId) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
       author.AuthorizeForJob(jobId, Permission.Read);
-      return dao.GetJob(jobId);
-    }
-
-    public IEnumerable<Task> GetJobs() {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      var jobs = dao.GetJobs(x => true);
-      foreach (var job in jobs)
-        author.AuthorizeForJob(job.Id, Permission.Read);
-      return jobs;
-    }
-
-    public IEnumerable<LightweightTask> GetLightweightJobs(IEnumerable<Guid> jobIds) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      var jobs = dao.GetJobs(x => jobIds.Contains(x.TaskId)).Select(x => new LightweightTask(x)).ToArray();
-      foreach (var job in jobs)
-        author.AuthorizeForJob(job.Id, Permission.Read);
-      return jobs;
-    }
-
-    public IEnumerable<LightweightTask> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      var jobs = GetChildJobs(parentJobId, recursive, includeParent).Select(x => new LightweightTask(x)).ToArray();
-      foreach (var job in jobs)
-        author.AuthorizeForJob(job.Id, Permission.Read);
-      return jobs;
-    }
-
-    public IEnumerable<LightweightTask> GetLightweightExperimentJobs(Guid experimentId) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      author.AuthorizeForExperiment(experimentId, Permission.Read);
-      return dao.GetJobs(x => x.JobId == experimentId).Select(x => new LightweightTask(x)).ToArray();
-    }
-
-    public TaskData GetJobData(Guid jobId) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      author.AuthorizeForJob(jobId, Permission.Read);
-      return dao.GetJobData(jobId);
-    }
-
-    public void UpdateJob(Task job) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      author.AuthorizeForJob(job.Id, Permission.Full);
-      trans.UseTransaction(() => {
-        dao.UpdateJob(job);
-      });
-    }
-
-    public void UpdateJobData(Task job, TaskData jobData) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      author.AuthorizeForJob(job.Id, Permission.Full);
-      author.AuthorizeForJob(jobData.TaskId, Permission.Full);
+      return dao.GetTasks(x => x.JobId == jobId).Select(x => new LightweightTask(x)).ToArray();
+    }
+
+    public TaskData GetTaskData(Guid taskId) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
+      author.AuthorizeForTask(taskId, Permission.Read);
+      return dao.GetTaskData(taskId);
+    }
+
+    public void UpdateTask(Task taskDto) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
+      author.AuthorizeForTask(taskDto.Id, Permission.Full);
+      trans.UseTransaction(() => {
+        dao.UpdateTask(taskDto);
+      });
+    }
+
+    public void UpdateTaskData(Task task, TaskData taskData) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
+      author.AuthorizeForTask(task.Id, Permission.Full);
+      author.AuthorizeForTask(taskData.TaskId, Permission.Full);
       //trans.UseTransaction(() => { // cneumuel: try without transaction
-      jobData.LastUpdate = DateTime.Now;
-      dao.UpdateJob(job);
-      dao.UpdateJobData(jobData);
+      taskData.LastUpdate = DateTime.Now;
+      dao.UpdateTask(task);
+      dao.UpdateTaskData(taskData);
       //}, false, true);
     }
 
-    public void DeleteJob(Guid jobId) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      author.AuthorizeForJob(jobId, Permission.Full);
-      trans.UseTransaction(() => {
-        dao.DeleteJob(jobId);
-      });
-    }
-
-    public void DeleteChildJobs(Guid parentJobId) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      author.AuthorizeForJob(parentJobId, Permission.Full);
-      trans.UseTransaction(() => {
-        var jobs = GetChildJobs(parentJobId, true, false);
-        foreach (var job in jobs) {
-          dao.DeleteJob(job.Id);
-          dao.DeleteJobData(job.Id);
+    public void DeleteTask(Guid taskId) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
+      author.AuthorizeForTask(taskId, Permission.Full);
+      trans.UseTransaction(() => {
+        dao.DeleteTask(taskId);
+      });
+    }
+
+    public void DeleteChildTasks(Guid parentTaskId) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
+      author.AuthorizeForTask(parentTaskId, Permission.Full);
+      trans.UseTransaction(() => {
+        var tasks = GetChildTasks(parentTaskId, true, false);
+        foreach (var task in tasks) {
+          dao.DeleteTask(task.Id);
+          dao.DeleteTaskData(task.Id);
         };
       });
     }
 
-    public Task UpdateJobState(Guid jobId, TaskState jobState, Guid? slaveId, Guid? userId, string exception) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      author.AuthorizeForJob(jobId, Permission.Full);
-      return trans.UseTransaction(() => {
-        Task job = dao.UpdateJobState(jobId, DataTransfer.Convert.ToEntity(jobState), slaveId, userId, exception);
-
-        if (job.Command.HasValue && job.Command.Value == Command.Pause && job.State == TaskState.Paused) {
-          job.Command = null;
-        } else if (job.Command.HasValue && job.Command.Value == Command.Abort && job.State == TaskState.Aborted) {
-          job.Command = null;
-        } else if (job.Command.HasValue && job.Command.Value == Command.Stop && job.State == TaskState.Aborted) {
-          job.Command = null;
-        } else if (jobState == TaskState.Paused && !job.Command.HasValue) {
-          // slave paused and uploaded the job (no user-command) -> set waiting.
-          job = dao.UpdateJobState(jobId, DataTransfer.Convert.ToEntity(TaskState.Waiting), slaveId, userId, exception);
-        }
-
-        dao.UpdateJob(job);
-        return job;
-      });
-    }
-
-    public IEnumerable<Task> GetJobsByResourceId(Guid resourceId) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
-      var jobs = trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId));
-      foreach (var job in jobs)
-        author.AuthorizeForJob(job.Id, Permission.Read);
-      return jobs;
+    public Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
+      author.AuthorizeForTask(taskId, Permission.Full);
+      return trans.UseTransaction(() => {
+        Task task = dao.UpdateTaskState(taskId, DataTransfer.Convert.ToEntity(taskState), slaveId, userId, exception);
+
+        if (task.Command.HasValue && task.Command.Value == Command.Pause && task.State == TaskState.Paused) {
+          task.Command = null;
+        } else if (task.Command.HasValue && task.Command.Value == Command.Abort && task.State == TaskState.Aborted) {
+          task.Command = null;
+        } else if (task.Command.HasValue && task.Command.Value == Command.Stop && task.State == TaskState.Aborted) {
+          task.Command = null;
+        } else if (taskState == TaskState.Paused && !task.Command.HasValue) {
+          // slave paused and uploaded the task (no user-command) -> set waiting.
+          task = dao.UpdateTaskState(taskId, DataTransfer.Convert.ToEntity(TaskState.Waiting), slaveId, userId, exception);
+        }
+
+        dao.UpdateTask(task);
+        return task;
+      });
+    }
+
+    public IEnumerable<Task> GetTasksByResourceId(Guid resourceId) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
+      var tasks = trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId));
+      foreach (var task in tasks)
+        author.AuthorizeForTask(task.Id, Permission.Read);
+      return tasks;
     }
     #endregion
 
     #region Task Control Methods
-    public void StopJob(Guid jobId) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      author.AuthorizeForJob(jobId, Permission.Full);
-      trans.UseTransaction(() => {
-        var job = dao.GetJob(jobId);
-        if (job.State == TaskState.Calculating || job.State == TaskState.Transferring) {
-          job.Command = Command.Stop;
-          dao.UpdateJob(job);
+    public void StopTask(Guid taskId) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
+      author.AuthorizeForTask(taskId, Permission.Full);
+      trans.UseTransaction(() => {
+        var task = dao.GetTask(taskId);
+        if (task.State == TaskState.Calculating || task.State == TaskState.Transferring) {
+          task.Command = Command.Stop;
+          dao.UpdateTask(task);
         } else {
-          if (job.State != TaskState.Aborted && job.State != TaskState.Finished && job.State != TaskState.Failed) {
-            job = UpdateJobState(jobId, TaskState.Aborted, null, null, string.Empty);
+          if (task.State != TaskState.Aborted && task.State != TaskState.Finished && task.State != TaskState.Failed) {
+            task = UpdateTaskState(taskId, TaskState.Aborted, null, null, string.Empty);
           }
         }
@@ -213,25 +213,25 @@
     }
 
-    public void PauseJob(Guid jobId) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      author.AuthorizeForJob(jobId, Permission.Full);
-      trans.UseTransaction(() => {
-        var job = dao.GetJob(jobId);
+    public void PauseTask(Guid taskId) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
+      author.AuthorizeForTask(taskId, Permission.Full);
+      trans.UseTransaction(() => {
+        var job = dao.GetTask(taskId);
         if (job.State == TaskState.Calculating || job.State == TaskState.Transferring) {
           job.Command = Command.Pause;
-          dao.UpdateJob(job);
+          dao.UpdateTask(job);
         } else {
-          job = UpdateJobState(jobId, TaskState.Paused, null, null, string.Empty);
-        }
-      });
-    }
-
-    public void RestartJob(Guid jobId) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
-      author.AuthorizeForJob(jobId, Permission.Full);
-      trans.UseTransaction(() => {
-        Task job = dao.UpdateJobState(jobId, DA.TaskState.Waiting, null, userManager.CurrentUserId, string.Empty);
-        job.Command = null;
-        dao.UpdateJob(job);
+          job = UpdateTaskState(taskId, TaskState.Paused, null, null, string.Empty);
+        }
+      });
+    }
+
+    public void RestartTask(Guid taskId) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave);
+      author.AuthorizeForTask(taskId, Permission.Full);
+      trans.UseTransaction(() => {
+        Task task = dao.UpdateTaskState(taskId, DA.TaskState.Waiting, null, userManager.CurrentUserId, string.Empty);
+        task.Command = null;
+        dao.UpdateTask(task);
       });
     }
@@ -239,93 +239,93 @@
 
     #region Job Methods
-    public Job GetHiveExperiment(Guid id) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      author.AuthorizeForExperiment(id, Permission.Read);
-      var hiveExperiment = dao.GetHiveExperiments(x =>
+    public Job GetJob(Guid id) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      author.AuthorizeForJob(id, Permission.Read);
+      var job = dao.GetJobs(x =>
             x.JobId == id
             && (x.OwnerUserId == userManager.CurrentUserId || x.JobPermissions.Count(hep => hep.Permission != DA.Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0)
           ).FirstOrDefault();
-      if (hiveExperiment != null) {
-        hiveExperiment.Permission = DT.Convert.ToDto(dao.GetPermissionForExperiment(hiveExperiment.Id, userManager.CurrentUserId));
-        hiveExperiment.OwnerUsername = userManager.GetUserById(hiveExperiment.OwnerUserId).UserName;
+      if (job != null) {
+        job.Permission = DT.Convert.ToDto(dao.GetPermissionForJob(job.Id, userManager.CurrentUserId));
+        job.OwnerUsername = userManager.GetUserById(job.OwnerUserId).UserName;
       }
-      return hiveExperiment;
-    }
-
-    public IEnumerable<Job> GetHiveExperiments() {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      var hiveExperiments = dao.GetHiveExperiments(x => x.OwnerUserId == userManager.CurrentUserId || x.JobPermissions.Count(hep => hep.Permission != DA.Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0);
-      foreach (var he in hiveExperiments) {
-        author.AuthorizeForExperiment(he.Id, Permission.Read);
-        he.Permission = DT.Convert.ToDto(dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId));
-        he.OwnerUsername = userManager.GetUserById(he.OwnerUserId).UserName;
+      return job;
+    }
+
+    public IEnumerable<Job> GetJobs() {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      var jobs = dao.GetJobs(x => x.OwnerUserId == userManager.CurrentUserId || x.JobPermissions.Count(hep => hep.Permission != DA.Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0);
+      foreach (var job in jobs) {
+        author.AuthorizeForJob(job.Id, Permission.Read);
+        job.Permission = DT.Convert.ToDto(dao.GetPermissionForJob(job.Id, userManager.CurrentUserId));
+        job.OwnerUsername = userManager.GetUserById(job.OwnerUserId).UserName;
       }
-      return hiveExperiments;
-    }
-
-    public IEnumerable<Job> GetAllHiveExperiments() {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
-      var hiveExperiments = dao.GetHiveExperiments(x => true);
-      foreach (var he in hiveExperiments) { // no authorization here, since this method is admin-only! (admin is allowed to read all jobs)
-        he.Permission = DT.Convert.ToDto(dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId));
-        he.OwnerUsername = userManager.GetUserById(he.OwnerUserId).UserName;
+      return jobs;
+    }
+
+    public IEnumerable<Job> GetAllJobs() {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
+      var jobs = dao.GetJobs(x => true);
+      foreach (var job in jobs) { // no authorization here, since this method is admin-only! (admin is allowed to read all task)
+        job.Permission = DT.Convert.ToDto(dao.GetPermissionForJob(job.Id, userManager.CurrentUserId));
+        job.OwnerUsername = userManager.GetUserById(job.OwnerUserId).UserName;
       }
-      return hiveExperiments;
-    }
-
-    public Guid AddHiveExperiment(Job hiveExperimentDto) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      return trans.UseTransaction(() => {
-        hiveExperimentDto.OwnerUserId = userManager.CurrentUserId;
-        hiveExperimentDto.DateCreated = DateTime.Now;
-        return dao.AddHiveExperiment(hiveExperimentDto);
-      });
-    }
-
-    public void UpdateHiveExperiment(Job hiveExperimentDto) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      author.AuthorizeForExperiment(hiveExperimentDto.Id, Permission.Full);
-      trans.UseTransaction(() => {
-        dao.UpdateHiveExperiment(hiveExperimentDto);
-      });
-    }
-
-    public void DeleteHiveExperiment(Guid hiveExperimentId) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      author.AuthorizeForExperiment(hiveExperimentId, Permission.Full);
-      trans.UseTransaction(() => {
-        dao.DeleteHiveExperiment(hiveExperimentId); // child jobs will be deleted by db-trigger
-      });
-    }
-    #endregion
-
-    #region HiveExperimentPermission Methods
-    public void GrantPermission(Guid hiveExperimentId, Guid grantedUserId, Permission permission) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      trans.UseTransaction(() => {
-        Job he = dao.GetHiveExperiment(hiveExperimentId);
-        if (he == null) throw new FaultException<FaultReason>(new FaultReason("Could not find hiveExperiment with id " + hiveExperimentId));
-        Permission perm = DT.Convert.ToDto(dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId));
+      return jobs;
+    }
+
+    public Guid AddJob(Job jobDto) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      return trans.UseTransaction(() => {
+        jobDto.OwnerUserId = userManager.CurrentUserId;
+        jobDto.DateCreated = DateTime.Now;
+        return dao.AddJob(jobDto);
+      });
+    }
+
+    public void UpdateJob(Job jobDto) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      author.AuthorizeForJob(jobDto.Id, Permission.Full);
+      trans.UseTransaction(() => {
+        dao.UpdateJob(jobDto);
+      });
+    }
+
+    public void DeleteJob(Guid jobId) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      author.AuthorizeForJob(jobId, Permission.Full);
+      trans.UseTransaction(() => {
+        dao.DeleteJob(jobId); // child task will be deleted by db-trigger
+      });
+    }
+    #endregion
+
+    #region JobPermission Methods
+    public void GrantPermission(Guid jobId, Guid grantedUserId, Permission permission) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      trans.UseTransaction(() => {
+        Job job = dao.GetJob(jobId);
+        if (job == null) throw new FaultException<FaultReason>(new FaultReason("Could not find task with id " + jobId));
+        Permission perm = DT.Convert.ToDto(dao.GetPermissionForJob(job.Id, userManager.CurrentUserId));
         if (perm != Permission.Full) throw new FaultException<FaultReason>(new FaultReason("Not allowed to grant permissions for this experiment"));
-        dao.SetHiveExperimentPermission(hiveExperimentId, userManager.CurrentUserId, grantedUserId, DT.Convert.ToEntity(permission));
-      });
-    }
-
-    public void RevokePermission(Guid hiveExperimentId, Guid grantedUserId) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      trans.UseTransaction(() => {
-        Job he = dao.GetHiveExperiment(hiveExperimentId);
-        if (he == null) throw new FaultException<FaultReason>(new FaultReason("Could not find hiveExperiment with id " + hiveExperimentId));
-        DA.Permission perm = dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId);
+        dao.SetJobPermission(jobId, userManager.CurrentUserId, grantedUserId, DT.Convert.ToEntity(permission));
+      });
+    }
+
+    public void RevokePermission(Guid jobId, Guid grantedUserId) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      trans.UseTransaction(() => {
+        Job job = dao.GetJob(jobId);
+        if (job == null) throw new FaultException<FaultReason>(new FaultReason("Could not find task with id " + jobId));
+        DA.Permission perm = dao.GetPermissionForJob(job.Id, userManager.CurrentUserId);
         if (perm != DA.Permission.Full) throw new FaultException<FaultReason>(new FaultReason("Not allowed to grant permissions for this experiment"));
-        dao.SetHiveExperimentPermission(hiveExperimentId, userManager.CurrentUserId, grantedUserId, DA.Permission.NotAllowed);
-      });
-    }
-    public IEnumerable<JobPermission> GetHiveExperimentPermissions(Guid hiveExperimentId) {
-      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
-      return trans.UseTransaction(() => {
-        DA.Permission currentUserPermission = dao.GetPermissionForExperiment(hiveExperimentId, userManager.CurrentUserId);
+        dao.SetJobPermission(jobId, userManager.CurrentUserId, grantedUserId, DA.Permission.NotAllowed);
+      });
+    }
+    public IEnumerable<JobPermission> GetJobPermissions(Guid jobId) {
+      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
+      return trans.UseTransaction(() => {
+        DA.Permission currentUserPermission = dao.GetPermissionForJob(jobId, userManager.CurrentUserId);
         if (currentUserPermission != DA.Permission.Full) throw new FaultException<FaultReason>(new FaultReason("Not allowed to list permissions for this experiment"));
-        return dao.GetHiveExperimentPermissions(x => x.JobId == hiveExperimentId);
+        return dao.GetJobPermissions(x => x.JobId == jobId);
       });
     }
@@ -591,17 +591,17 @@
 
     #region Helper Methods
-    private IEnumerable<Task> GetChildJobs(Guid? parentJobId, bool recursive, bool includeParent) {
-      var jobs = new List<Task>(dao.GetJobs(x => parentJobId == null ? !x.ParentTaskId.HasValue : x.ParentTaskId.Value == parentJobId));
+    private IEnumerable<Task> GetChildTasks(Guid? parentTaskId, bool recursive, bool includeParent) {
+      var tasks = new List<Task>(dao.GetTasks(x => parentTaskId == null ? !x.ParentTaskId.HasValue : x.ParentTaskId.Value == parentTaskId));
 
       if (recursive) {
         var childs = new List<Task>();
-        foreach (var job in jobs) {
-          childs.AddRange(GetChildJobs(job.Id, recursive, false));
-        }
-        jobs.AddRange(childs);
+        foreach (var task in tasks) {
+          childs.AddRange(GetChildTasks(task.Id, recursive, false));
+        }
+        tasks.AddRange(childs);
       }
 
-      if (includeParent) jobs.Add(GetJob(parentJobId.Value));
-      return jobs;
+      if (includeParent) tasks.Add(GetTask(parentTaskId.Value));
+      return tasks;
     }
     #endregion
