Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/15/18 12:07:16 (6 years ago)
Author:
gkronber
Message:

#2925 merged changes r15972:16382 from trunk to branch

Location:
branches/2925_AutoDiffForDynamicalModels
Files:
10 edited
3 copied

Legend:

Unmodified
Added
Removed
  • branches/2925_AutoDiffForDynamicalModels

  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive

  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive/3.3/HeuristicLab.Clients.Hive-3.3.csproj

    r14738 r16386  
    125125    <Compile Include="HiveAdminClient.cs" />
    126126    <Compile Include="HiveClient.cs" />
     127    <Compile Include="ServiceClients\AssignedJobResource.cs" />
     128    <Compile Include="ServiceClients\AssignedProjectResource.cs" />
     129    <Compile Include="ServiceClients\Project.cs" />
    127130    <Compile Include="ServiceClients\UserPriority.cs" />
    128131    <Compile Include="ServiceClients\ResourcePermission.cs" />
     
    194197  </ItemGroup>
    195198  <ItemGroup>
     199    <ProjectReference Include="..\..\HeuristicLab.Clients.Access\3.3\HeuristicLab.Clients.Access-3.3.csproj">
     200      <Project>{494F87F4-0F25-4D33-A382-10CDB2174D48}</Project>
     201      <Name>HeuristicLab.Clients.Access-3.3</Name>
     202    </ProjectReference>
    196203    <ProjectReference Include="..\..\HeuristicLab.Clients.Common\3.3\HeuristicLab.Clients.Common-3.3.csproj">
    197204      <Project>{730A9104-D4D1-4360-966B-E49B7571DDA3}</Project>
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive/3.3/HiveAdminClient.cs

    r15583 r16386  
    2424using HeuristicLab.Common;
    2525using HeuristicLab.Core;
     26using System.Collections.Generic;
     27using System.Linq;
     28using HeuristicLab.Clients.Access;
    2629
    2730namespace HeuristicLab.Clients.Hive {
     
    3639    }
    3740
     41    #region Properties
    3842    private IItemList<Resource> resources;
    3943    public IItemList<Resource> Resources {
     
    5761    }
    5862
     63    private IItemList<Project> projects;
     64    public IItemList<Project> Projects {
     65      get { return projects; }
     66    }
     67
     68    private IItemList<AssignedProjectResource> projectResourceAssignments;
     69    public IItemList<AssignedProjectResource> ProjectResourceAssignments {
     70      get { return projectResourceAssignments; }
     71    }
     72
     73    private Dictionary<Guid, HiveItemCollection<RefreshableJob>> jobs;
     74    public Dictionary<Guid, HiveItemCollection<RefreshableJob>> Jobs {
     75      get { return jobs; }
     76      set {
     77        if (value != jobs)
     78          jobs = value;
     79        }
     80    }
     81
     82    private Dictionary<Guid, List<LightweightTask>> tasks;
     83    public Dictionary<Guid, List<LightweightTask>> Tasks {
     84      get { return tasks; }
     85    }
     86
     87    private Dictionary<Guid, HashSet<Guid>> projectAncestors;
     88    public Dictionary<Guid, HashSet<Guid>> ProjectAncestors {
     89      get { return projectAncestors; }
     90    }
     91
     92    private Dictionary<Guid, HashSet<Guid>> projectDescendants;
     93    public Dictionary<Guid, HashSet<Guid>> ProjectDescendants {
     94      get { return projectDescendants; }
     95    }
     96
     97    private Dictionary<Guid, HashSet<Guid>> resourceAncestors;
     98    public Dictionary<Guid, HashSet<Guid>> ResourceAncestors {
     99      get { return resourceAncestors; }
     100    }
     101
     102    private Dictionary<Guid, HashSet<Guid>> resourceDescendants;
     103    public Dictionary<Guid, HashSet<Guid>> ResourceDescendants {
     104      get { return resourceDescendants; }
     105    }
     106
     107    private Dictionary<Guid, string> projectNames;
     108    public Dictionary<Guid, string> ProjectNames {
     109      get { return projectNames; }
     110    }
     111
     112    private HashSet<Project> disabledParentProjects;
     113    public HashSet<Project> DisabledParentProjects {
     114      get { return disabledParentProjects; }
     115    }
     116
     117    private Dictionary<Guid, string> resourceNames;
     118    public Dictionary<Guid, string> ResourceNames {
     119      get { return resourceNames; }
     120    }
     121
     122    private HashSet<Resource> disabledParentResources;
     123    public HashSet<Resource> DisabledParentResources {
     124      get { return disabledParentResources; }
     125    }
     126    #endregion
     127
    59128    #region Events
    60129    public event EventHandler Refreshing;
     
    78147      try {
    79148        resources = new ItemList<Resource>();
     149        projects = new ItemList<Project>();
     150        projectResourceAssignments = new ItemList<AssignedProjectResource>();
     151        jobs = new Dictionary<Guid, HiveItemCollection<RefreshableJob>>();
     152        tasks = new Dictionary<Guid, List<LightweightTask>>();
     153        projectNames = new Dictionary<Guid, string>();
     154        resourceNames = new Dictionary<Guid, string>();
     155
     156        projectAncestors = new Dictionary<Guid, HashSet<Guid>>();
     157        projectDescendants = new Dictionary<Guid, HashSet<Guid>>();
     158        resourceAncestors = new Dictionary<Guid, HashSet<Guid>>();
     159        resourceDescendants = new Dictionary<Guid, HashSet<Guid>>();
    80160
    81161        HiveServiceLocator.Instance.CallHiveService(service => {
    82           service.GetSlaveGroups().ForEach(g => resources.Add(g));
    83           service.GetSlaves().ForEach(s => resources.Add(s));
     162          service.GetSlaveGroupsForAdministration().ForEach(g => resources.Add(g));
     163          service.GetSlavesForAdministration().ForEach(s => resources.Add(s));
     164          service.GetProjectsForAdministration().ForEach(p => projects.Add(p));
     165          var projectIds = projects.Select(p => p.Id).ToList();
     166          if (projectIds.Any()) {
     167            service.GetAssignedResourcesForProjectsAdministration(projectIds)
     168              .ForEach(a => projectResourceAssignments.Add(a));
     169            projectIds.ForEach(p => jobs.Add(p, new HiveItemCollection<RefreshableJob>()));
     170            var unsortedJobs = service.GetJobsByProjectIds(projectIds)
     171              .OrderBy(x => x.DateCreated).ToList();
     172
     173            unsortedJobs.Where(j => j.State == JobState.DeletionPending).ToList().ForEach(j => jobs[j.ProjectId].Add(new RefreshableJob(j)));
     174            unsortedJobs.Where(j => j.State == JobState.StatisticsPending).ToList().ForEach(j => jobs[j.ProjectId].Add(new RefreshableJob(j)));
     175            unsortedJobs.Where(j => j.State == JobState.Online).ToList().ForEach(j => jobs[j.ProjectId].Add(new RefreshableJob(j)));
     176
     177            foreach (var job in jobs.SelectMany(x => x.Value))
     178              LoadLightweightJob(job);
     179
     180            projectNames = service.GetProjectNames();
     181            resourceNames = service.GetResourceNames();
     182          }
    84183        });
     184
     185        UpdateResourceGenealogy();
     186        UpdateProjectGenealogy();
     187        RefreshDisabledParentProjects();
     188        RefreshDisabledParentResources();
    85189      }
    86190      catch {
     
    91195      }
    92196    }
     197
     198    //public void UpdateResourceGenealogy(IItemList<Resource> resources) {
     199    //  resourceAncestors.Clear();
     200    //  resourceDescendants.Clear();
     201
     202    //  foreach (var r in resources) {
     203    //    resourceAncestors.Add(r.Id, new HashSet<Resource>());
     204    //    resourceDescendants.Add(r.Id, new HashSet<Resource>());
     205    //  }
     206
     207    //  foreach (var r in resources) {
     208    //    var parentResourceId = r.ParentResourceId;
     209    //    while (parentResourceId != null) {
     210    //      var parent = resources.SingleOrDefault(x => x.Id == parentResourceId);
     211    //      if (parent != null) {
     212    //        resourceAncestors[r.Id].Add(parent);
     213    //        resourceDescendants[parent.Id].Add(r);
     214    //        parentResourceId = parent.ParentResourceId;
     215    //      } else {
     216    //        parentResourceId = null;
     217    //      }
     218    //    }
     219    //  }
     220    //}
     221
     222    //public void UpdateProjectGenealogy(IItemList<Project> projects) {
     223    //  projectAncestors.Clear();
     224    //  projectDescendants.Clear();
     225
     226    //  foreach (var p in projects) {
     227    //    projectAncestors.Add(p.Id, new HashSet<Project>());
     228    //    projectDescendants.Add(p.Id, new HashSet<Project>());
     229    //  }
     230
     231    //  foreach (var p in projects) {
     232    //    var parentProjectId = p.ParentProjectId;
     233    //    while (parentProjectId != null) {
     234    //      var parent = projects.SingleOrDefault(x => x.Id == parentProjectId);
     235    //      if (parent != null) {
     236    //        projectAncestors[p.Id].Add(parent);
     237    //        projectDescendants[parent.Id].Add(p);
     238    //        parentProjectId = parent.ParentProjectId;
     239    //      } else {
     240    //        parentProjectId = null;
     241    //      }
     242    //    }
     243    //  }
     244    //}
     245
     246    private void UpdateResourceGenealogy() {
     247      resourceAncestors.Clear();
     248      resourceDescendants.Clear();
     249
     250      // fetch resource ancestor set
     251      HiveServiceLocator.Instance.CallHiveService(service => {
     252        var ra = service.GetResourceGenealogy();
     253        ra.Keys.ToList().ForEach(k => resourceAncestors.Add(k, new HashSet<Guid>()));
     254        resourceAncestors.Keys.ToList().ForEach(k => resourceAncestors[k].UnionWith(ra[k]));
     255      });
     256
     257      // build resource descendant set
     258      resourceAncestors.Keys.ToList().ForEach(k => resourceDescendants.Add(k, new HashSet<Guid>()));
     259      foreach (var ra in resourceAncestors) {
     260        foreach (var ancestor in ra.Value) {
     261          resourceDescendants[ancestor].Add(ra.Key);
     262        }
     263      }
     264    }
     265
     266    private void UpdateProjectGenealogy() {
     267      projectAncestors.Clear();
     268      projectDescendants.Clear();
     269
     270      // fetch project ancestor list
     271      HiveServiceLocator.Instance.CallHiveService(service => {
     272        var pa = service.GetProjectGenealogy();
     273        pa.Keys.ToList().ForEach(k => projectAncestors.Add(k, new HashSet<Guid>()));
     274        projectAncestors.Keys.ToList().ForEach(k => projectAncestors[k].UnionWith(pa[k]));
     275      });
     276
     277      // build project descendant list
     278      projectAncestors.Keys.ToList().ForEach(k => projectDescendants.Add(k, new HashSet<Guid>()));
     279      foreach (var pa in projectAncestors) {
     280        foreach (var ancestor in pa.Value) {
     281          projectDescendants[ancestor].Add(pa.Key);
     282        }
     283      }
     284    }
     285
     286    private void RefreshDisabledParentProjects() {
     287      disabledParentProjects = new HashSet<Project>();
     288
     289      foreach (var pid in projects
     290        .Where(x => x.ParentProjectId.HasValue)
     291        .SelectMany(x => projectAncestors[x.Id]).Distinct()
     292        .Where(x => !projects.Select(y => y.Id).Contains(x))) {
     293        var p = new Project();
     294        p.Id = pid;
     295        p.ParentProjectId = projectAncestors[pid].FirstOrDefault();
     296        p.Name = projectNames[pid];
     297        disabledParentProjects.Add(p);
     298      }
     299    }
     300
     301    private void RefreshDisabledParentResources() {
     302      disabledParentResources = new HashSet<Resource>();
     303
     304      foreach (var rid in resources
     305        .Where(x => x.ParentResourceId.HasValue)
     306        .SelectMany(x => resourceAncestors[x.Id]).Distinct()
     307        .Where(x => !resources.Select(y => y.Id).Contains(x))) {
     308        var r = new SlaveGroup();
     309        r.Id = rid;
     310        r.ParentResourceId = resourceAncestors[rid].FirstOrDefault();
     311        r.Name = resourceNames[rid];
     312        disabledParentResources.Add(r);
     313      }
     314    }
     315
     316    public void RefreshJobs() {
     317      var projectIds = new List<Guid>();
     318      jobs = new Dictionary<Guid, HiveItemCollection<RefreshableJob>>();
     319      tasks = new Dictionary<Guid, List<LightweightTask>>();
     320
     321      HiveServiceLocator.Instance.CallHiveService(service => {
     322        service.GetProjectsForAdministration().ForEach(p => projectIds.Add(p.Id));
     323        if(projectIds.Any()) {
     324          projectIds.ForEach(p => jobs.Add(p, new HiveItemCollection<RefreshableJob>()));
     325          var unsortedJobs = service.GetJobsByProjectIds(projectIds)
     326            .OrderBy(x => x.DateCreated).ToList();
     327         
     328          unsortedJobs.Where(j => j.State == JobState.DeletionPending).ToList().ForEach(j => jobs[j.ProjectId].Add(new RefreshableJob(j)));
     329          unsortedJobs.Where(j => j.State == JobState.StatisticsPending).ToList().ForEach(j => jobs[j.ProjectId].Add(new RefreshableJob(j)));
     330          unsortedJobs.Where(j => j.State == JobState.Online).ToList().ForEach(j => jobs[j.ProjectId].Add(new RefreshableJob(j)));
     331
     332          foreach(var job in jobs.SelectMany(x => x.Value))
     333            LoadLightweightJob(job);
     334        }
     335      });
     336    }
     337
     338    public void LoadLightweightJob(RefreshableJob refreshableJob) {
     339      var job = refreshableJob.Job;
     340      var lightweightTasks = HiveServiceLocator.Instance.CallHiveService(s => s.GetLightweightJobTasksWithoutStateLog(job.Id));
     341
     342      if (tasks.ContainsKey(job.Id)) {
     343        tasks[job.Id].Clear();
     344        tasks[job.Id].AddRange(lightweightTasks);
     345      } else {
     346        tasks.Add(job.Id, new List<LightweightTask>(lightweightTasks));       
     347      }
     348
     349      if (lightweightTasks != null && lightweightTasks.Count > 0 && lightweightTasks.All(x => x.Id != Guid.Empty)) {
     350        if (lightweightTasks.All(x =>
     351          x.State == TaskState.Finished
     352          || x.State == TaskState.Aborted
     353          || x.State == TaskState.Failed)) {
     354          refreshableJob.ExecutionState = ExecutionState.Stopped;
     355          refreshableJob.RefreshAutomatically = false;
     356        } else if (
     357          lightweightTasks
     358            .Where(x => x.ParentTaskId != null)
     359            .All(x =>
     360              x.State != TaskState.Waiting
     361              || x.State != TaskState.Transferring
     362              || x.State != TaskState.Calculating)
     363          && lightweightTasks
     364             .Where(x => x.ParentTaskId != null)
     365             .Any(x => x.State == TaskState.Paused)) {
     366          refreshableJob.ExecutionState = ExecutionState.Paused;
     367          refreshableJob.RefreshAutomatically = false;
     368        } else if (lightweightTasks.Any(x => x.State == TaskState.Calculating
     369                                  || x.State == TaskState.Transferring
     370                                  || x.State == TaskState.Waiting)) {
     371          refreshableJob.ExecutionState = ExecutionState.Started;
     372        }
     373
     374        refreshableJob.ExecutionTime = TimeSpan.FromMilliseconds(lightweightTasks.Sum(x => x.ExecutionTime.TotalMilliseconds));
     375      }
     376    }
     377
     378    public void SortJobs() {
     379      for(int i = 0; i < jobs.Count; i++) {
     380        var projectId = jobs.Keys.ElementAt(i);
     381        var unsortedJobs = jobs.Values.ElementAt(i);
     382
     383        var sortedJobs = new HiveItemCollection<RefreshableJob>();
     384        sortedJobs.AddRange(unsortedJobs.Where(j => j.Job.State == JobState.DeletionPending));
     385        sortedJobs.AddRange(unsortedJobs.Where(j => j.Job.State == JobState.StatisticsPending));
     386        sortedJobs.AddRange(unsortedJobs.Where(j => j.Job.State == JobState.Online));
     387
     388        jobs[projectId] = sortedJobs;
     389      }
     390    }
     391
    93392    #endregion
    94393
     
    127426          item.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddDowntime((Downtime)item));
    128427        }
     428        if (item is Project) {
     429          item.Id = HiveServiceLocator.Instance.CallHiveService(s => s.AddProject((Project)item));
     430        }
    129431      } else {
    130432        if (item is SlaveGroup) {
     
    136438        if (item is Downtime) {
    137439          HiveServiceLocator.Instance.CallHiveService((s) => s.UpdateDowntime((Downtime)item));
     440        }
     441        if (item is Project) {
     442          HiveServiceLocator.Instance.CallHiveService((s) => s.UpdateProject((Project)item));
    138443        }
    139444      }
     
    149454      } else if (item is Downtime) {
    150455        HiveServiceLocator.Instance.CallHiveService((s) => s.DeleteDowntime(item.Id));
    151       }
     456      } else if (item is Project) {
     457        HiveServiceLocator.Instance.CallHiveService((s) => s.DeleteProject(item.Id));
     458      }
     459    }
     460
     461    public static void RemoveJobs(List<Guid> jobIds) {
     462      HiveServiceLocator.Instance.CallHiveService((s) => s.UpdateJobStates(jobIds, JobState.StatisticsPending));
     463    }
     464    #endregion
     465
     466    #region Job Handling
     467
     468    public static void ResumeJob(RefreshableJob refreshableJob) {
     469      HiveServiceLocator.Instance.CallHiveService(service => {
     470        var tasks = service.GetLightweightJobTasksWithoutStateLog(refreshableJob.Id);
     471        foreach (var task in tasks) {
     472          if (task.State == TaskState.Paused) {
     473            service.RestartTask(task.Id);
     474          }
     475        }
     476      });
     477      refreshableJob.ExecutionState = ExecutionState.Started;
     478    }
     479
     480    public static void PauseJob(RefreshableJob refreshableJob) {
     481      HiveServiceLocator.Instance.CallHiveService(service => {
     482        var tasks = service.GetLightweightJobTasksWithoutStateLog(refreshableJob.Id);
     483        foreach (var task in tasks) {
     484          if (task.State != TaskState.Finished && task.State != TaskState.Aborted && task.State != TaskState.Failed)
     485            service.PauseTask(task.Id);
     486        }
     487      });
     488      refreshableJob.ExecutionState = ExecutionState.Paused;
     489    }
     490
     491    public static void StopJob(RefreshableJob refreshableJob) {
     492      HiveServiceLocator.Instance.CallHiveService(service => {
     493        var tasks = service.GetLightweightJobTasksWithoutStateLog(refreshableJob.Id);
     494        foreach (var task in tasks) {
     495          if (task.State != TaskState.Finished && task.State != TaskState.Aborted && task.State != TaskState.Failed)
     496            service.StopTask(task.Id);
     497        }
     498      });
     499      refreshableJob.ExecutionState = ExecutionState.Stopped;
     500    }
     501
     502    public static void RemoveJob(RefreshableJob refreshableJob) {
     503      HiveServiceLocator.Instance.CallHiveService((service) => {
     504        service.UpdateJobState(refreshableJob.Id, JobState.StatisticsPending);
     505      });
    152506    }
    153507    #endregion
     
    159513      }
    160514    }
     515
     516    #region Helper
     517    public IEnumerable<Project> GetAvailableProjectAncestors(Guid id) {
     518      if (projectAncestors.ContainsKey(id)) return projects.Where(x => projectAncestors[id].Contains(x.Id));
     519      else return Enumerable.Empty<Project>();
     520    }
     521
     522    public IEnumerable<Project> GetAvailableProjectDescendants(Guid id) {
     523      if(projectDescendants.ContainsKey(id)) return projects.Where(x => projectDescendants[id].Contains(x.Id));
     524      else return Enumerable.Empty<Project>();
     525    }
     526
     527    public IEnumerable<Resource> GetAvailableResourceAncestors(Guid id) {
     528      if (resourceAncestors.ContainsKey(id)) return resources.Where(x => resourceAncestors[id].Contains(x.Id));
     529      else return Enumerable.Empty<Resource>();
     530    }
     531
     532    public IEnumerable<Resource> GetAvailableResourceDescendants(Guid id) {
     533      if (resourceDescendants.ContainsKey(id)) return resources.Where(x => resourceDescendants[id].Contains(x.Id));
     534      else return Enumerable.Empty<Resource>();
     535    }
     536
     537    public IEnumerable<Resource> GetDisabledResourceAncestors(IEnumerable<Resource> availableResources) {
     538      var missingParentIds = availableResources
     539        .Where(x => x.ParentResourceId.HasValue)
     540        .SelectMany(x => resourceAncestors[x.Id]).Distinct()
     541        .Where(x => !availableResources.Select(y => y.Id).Contains(x));
     542
     543      return resources.OfType<SlaveGroup>().Union(disabledParentResources).Where(x => missingParentIds.Contains(x.Id));
     544    }
     545
     546    public bool CheckAccessToAdminAreaGranted() {
     547      if(projects != null) {
     548        return projects.Count > 0;
     549      } else {
     550        bool accessGranted = false;
     551        HiveServiceLocator.Instance.CallHiveService(s => {
     552          accessGranted = s.CheckAccessToAdminAreaGranted();
     553        });
     554        return accessGranted;
     555      }
     556    }
     557
     558    public bool CheckOwnershipOfResource(Resource res, Guid userId) {
     559      if (res == null || userId == Guid.Empty) return false;
     560
     561      if (res.OwnerUserId == userId) {
     562        return true;
     563      } else if(resourceAncestors.ContainsKey(res.Id)) {
     564        return GetAvailableResourceAncestors(res.Id).Where(x => x.OwnerUserId == userId).Any();
     565      }
     566
     567      return false;
     568    }
     569
     570    public bool CheckOwnershipOfProject(Project pro, Guid userId) {
     571      if (pro == null || userId == Guid.Empty) return false;
     572
     573      if (pro.OwnerUserId == userId) {
     574        return true;
     575      } else if (projectAncestors.ContainsKey(pro.Id)) {
     576        return GetAvailableProjectAncestors(pro.Id).Where(x => x.OwnerUserId == userId).Any();
     577      }
     578
     579      return false;
     580    }
     581
     582    public bool CheckOwnershipOfParentProject(Project pro, Guid userId) {
     583      if (pro == null || userId == Guid.Empty) return false;
     584
     585      if(projectAncestors.ContainsKey(pro.Id)) {
     586        return GetAvailableProjectAncestors(pro.Id).Any(x => x.OwnerUserId == userId);
     587      }
     588
     589      if (pro.ParentProjectId != null && pro.ParentProjectId != Guid.Empty) {
     590        var parent = projects.FirstOrDefault(x => x.Id == pro.ParentProjectId.Value);
     591        if (parent != null)
     592          return parent.OwnerUserId == userId || GetAvailableProjectAncestors(parent.Id).Any(x => x.OwnerUserId == userId);
     593      }
     594
     595      return false;
     596    }
     597
     598    public bool CheckParentChange(Project child, Project parent) {
     599      bool changePossible = true;
     600
     601      // change is not possible...
     602      // ... if the moved project is null
     603      // ... or the new parent is not stored yet
     604      // ... or there is not parental change
     605      if (child == null
     606          || (parent != null && parent.Id == Guid.Empty)
     607          || (parent != null && parent.Id == child.ParentProjectId)) {
     608        changePossible = false;
     609      } else if (parent == null && !IsAdmin()) {
     610        // ... if parent is null, but user is no admin (only admins are allowed to create root projects)
     611        changePossible = false;
     612      } else if (parent != null && (!IsAdmin() && parent.OwnerUserId != UserInformation.Instance.User.Id && !CheckOwnershipOfParentProject(parent, UserInformation.Instance.User.Id))) {
     613        // ... if the user is no admin nor owner of the new parent or grand..grandparents
     614        changePossible = false;
     615      } else if(parent != null && projectDescendants.ContainsKey(child.Id)) {
     616        // ... if the new parent is among the moved project's descendants
     617        changePossible = !GetAvailableProjectDescendants(child.Id).Where(x => x.Id == parent.Id).Any();
     618      }
     619
     620      return changePossible;
     621    }
     622
     623    public bool CheckParentChange(Resource child, Resource parent) {
     624      bool changePossible = true;
     625
     626      // change is not possisble...
     627      // ... if the child resource is null
     628      // ... or the child resource equals the parent
     629      // ... or the new parent is not stored yet
     630      // ... or the new parent is a slave
     631      // ... or there is not parental change
     632      if (child == null
     633        || child == parent
     634        || (parent != null && parent.Id == Guid.Empty)
     635        || (parent != null && parent is Slave)
     636        || (parent != null && parent.Id == child.ParentResourceId)) {
     637        changePossible = false;
     638      } else if (parent != null && resourceDescendants.ContainsKey(child.Id)) {
     639        // ... or if the new parent is among the moved resource's descendants
     640        changePossible = !GetAvailableResourceDescendants(child.Id).Where(x => x.Id == parent.Id).Any();
     641      }
     642
     643      return changePossible;
     644    }
     645
     646    public IEnumerable<Resource> GetAssignedResourcesForJob(Guid jobId) {
     647      var assignedJobResource =  HiveServiceLocator.Instance.CallHiveService(service => service.GetAssignedResourcesForJob(jobId));
     648      return Resources.Where(x => assignedJobResource.Select(y => y.ResourceId).Contains(x.Id));
     649    }
     650
     651    private bool IsAdmin() {
     652      return HiveRoles.CheckAdminUserPermissions();
     653    }
     654    #endregion
    161655  }
    162656}
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r15583 r16386  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    5757    }
    5858
     59    private IItemList<Project> projects;
     60    public IItemList<Project> Projects {
     61      get { return projects; }
     62    }
     63
     64    private IItemList<Resource> resources;
     65    public IItemList<Resource> Resources {
     66      get { return resources; }
     67    }
     68
     69    private Dictionary<Guid, HashSet<Guid>> projectAncestors;
     70    public Dictionary<Guid, HashSet<Guid>> ProjectAncestors {
     71      get { return projectAncestors; }
     72    }
     73
     74    private Dictionary<Guid, HashSet<Guid>> projectDescendants;
     75    public Dictionary<Guid, HashSet<Guid>> ProjectDescendants {
     76      get { return projectDescendants; }
     77    }
     78
     79    private Dictionary<Guid, HashSet<Guid>> resourceAncestors;
     80    public Dictionary<Guid, HashSet<Guid>> ResourceAncestors {
     81      get { return resourceAncestors; }
     82    }
     83
     84    private Dictionary<Guid, HashSet<Guid>> resourceDescendants;
     85    public Dictionary<Guid, HashSet<Guid>> ResourceDescendants {
     86      get { return resourceDescendants; }
     87    }
     88
     89    private Dictionary<Guid, string> projectNames;
     90    public Dictionary<Guid, string> ProjectNames {
     91      get { return projectNames; }
     92    }
     93
     94    private HashSet<Project> disabledParentProjects;
     95    public HashSet<Project> DisabledParentProjects {
     96      get { return disabledParentProjects; }
     97    }
     98
     99    private Dictionary<Guid, string> resourceNames;
     100    public Dictionary<Guid, string> ResourceNames {
     101      get { return resourceNames; }
     102    }
     103
     104    private HashSet<Resource> disabledParentResources;
     105    public HashSet<Resource> DisabledParentResources {
     106      get { return disabledParentResources; }
     107    }
     108
    59109    private List<Plugin> onlinePlugins;
    60110    public List<Plugin> OnlinePlugins {
     
    93143
    94144      try {
     145        projects = new ItemList<Project>();
     146        resources = new ItemList<Resource>();
    95147        jobs = new HiveItemCollection<RefreshableJob>();
    96         var jobsLoaded = HiveServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetJobs());
    97 
    98         try {
    99           foreach (var j in jobsLoaded) {
    100             jobs.Add(new RefreshableJob(j));
    101           }
    102         } catch (NullReferenceException) {
    103           // jobs was set to null during ClearHiveClient
    104         }
     148        projectNames = new Dictionary<Guid, string>();
     149        resourceNames = new Dictionary<Guid, string>();
     150
     151        projectAncestors = new Dictionary<Guid, HashSet<Guid>>();
     152        projectDescendants = new Dictionary<Guid, HashSet<Guid>>();
     153        resourceAncestors = new Dictionary<Guid, HashSet<Guid>>();
     154        resourceDescendants = new Dictionary<Guid, HashSet<Guid>>();
     155
     156        HiveServiceLocator.Instance.CallHiveService(service => {
     157          service.GetProjects().ForEach(p => projects.Add(p));
     158          service.GetSlaveGroups().ForEach(g => resources.Add(g));
     159          service.GetSlaves().ForEach(s => resources.Add(s));
     160          service.GetJobs().ForEach(p => jobs.Add(new RefreshableJob(p)));
     161          projectNames = service.GetProjectNames();
     162          resourceNames = service.GetResourceNames();
     163        });
     164
     165        RefreshResourceGenealogy();
     166        RefreshProjectGenealogy();
     167        RefreshDisabledParentProjects();
     168        RefreshDisabledParentResources();
     169      }
     170      catch {
     171        jobs = null;
     172        projects = null;
     173        resources = null;
     174        throw;
     175      }
     176      finally {
     177        OnRefreshed();
     178      }
     179    }
     180
     181    public void RefreshProjectsAndResources() {
     182      OnRefreshing();
     183
     184      try {
     185        projects = new ItemList<Project>();
     186        projectNames = new Dictionary<Guid, string>();
     187        resources = new ItemList<Resource>();
     188        resourceNames = new Dictionary<Guid, string>();
     189
     190        projectAncestors = new Dictionary<Guid, HashSet<Guid>>();
     191        projectDescendants = new Dictionary<Guid, HashSet<Guid>>();
     192        resourceAncestors = new Dictionary<Guid, HashSet<Guid>>();
     193        resourceDescendants = new Dictionary<Guid, HashSet<Guid>>();
     194
     195        HiveServiceLocator.Instance.CallHiveService(service => {
     196          service.GetProjects().ForEach(p => projects.Add(p));
     197          service.GetSlaveGroups().ForEach(g => resources.Add(g));
     198          service.GetSlaves().ForEach(s => resources.Add(s));
     199          projectNames = service.GetProjectNames();
     200          resourceNames = service.GetResourceNames();
     201        });
     202
     203        RefreshResourceGenealogy();
     204        RefreshProjectGenealogy();
     205        RefreshDisabledParentProjects();
     206        RefreshDisabledParentResources();
    105207      } catch {
    106         jobs = null;
     208        projects = null;
     209        resources = null;
    107210        throw;
    108211      } finally {
    109212        OnRefreshed();
    110213      }
     214    }
     215
     216    public void RefreshAsync(Action<Exception> exceptionCallback) {
     217      var call = new Func<Exception>(delegate() {
     218        try {
     219          Refresh();
     220        }
     221        catch (Exception ex) {
     222          return ex;
     223        }
     224        return null;
     225      });
     226      call.BeginInvoke(delegate(IAsyncResult result) {
     227        Exception ex = call.EndInvoke(result);
     228        if (ex != null) exceptionCallback(ex);
     229      }, null);
     230    }
     231
     232    private void RefreshResourceGenealogy() {
     233      resourceAncestors.Clear();
     234      resourceDescendants.Clear();
     235
     236      // fetch resource ancestor set
     237      HiveServiceLocator.Instance.CallHiveService(service => {
     238        var ra = service.GetResourceGenealogy();
     239        ra.Keys.ToList().ForEach(k => resourceAncestors.Add(k, new HashSet<Guid>()));
     240        resourceAncestors.Keys.ToList().ForEach(k => resourceAncestors[k].UnionWith(ra[k]));
     241      });
     242
     243      // build resource descendant set
     244      resourceAncestors.Keys.ToList().ForEach(k => resourceDescendants.Add(k, new HashSet<Guid>()));
     245      foreach (var ra in resourceAncestors) {
     246        foreach(var ancestor in ra.Value) {
     247          resourceDescendants[ancestor].Add(ra.Key);
     248        }
     249      }
     250    }
     251
     252    private void RefreshProjectGenealogy() {
     253      projectAncestors.Clear();
     254      projectDescendants.Clear();
     255
     256      // fetch project ancestor list
     257      HiveServiceLocator.Instance.CallHiveService(service => {
     258        var pa = service.GetProjectGenealogy();
     259        pa.Keys.ToList().ForEach(k => projectAncestors.Add(k, new HashSet<Guid>()));
     260        projectAncestors.Keys.ToList().ForEach(k => projectAncestors[k].UnionWith(pa[k]));
     261      });
     262
     263      // build project descendant list
     264      projectAncestors.Keys.ToList().ForEach(k => projectDescendants.Add(k, new HashSet<Guid>()));
     265      foreach(var pa in projectAncestors) {
     266        foreach(var ancestor in pa.Value) {
     267          projectDescendants[ancestor].Add(pa.Key);
     268        }
     269      }
     270    }
     271
     272    private void RefreshDisabledParentProjects() {
     273      disabledParentProjects = new HashSet<Project>();
     274
     275      foreach (var pid in projects
     276        .Where(x => x.ParentProjectId.HasValue)
     277        .SelectMany(x => projectAncestors[x.Id]).Distinct()
     278        .Where(x => !projects.Select(y => y.Id).Contains(x))) {
     279        var p = new Project();
     280        p.Id = pid;
     281        p.ParentProjectId = projectAncestors[pid].FirstOrDefault();
     282        p.Name = projectNames[pid];
     283        disabledParentProjects.Add(p);
     284      }
     285    }
     286
     287    private void RefreshDisabledParentResources() {
     288      disabledParentResources = new HashSet<Resource>();
     289
     290      foreach (var rid in resources
     291        .Where(x => x.ParentResourceId.HasValue)
     292        .SelectMany(x => resourceAncestors[x.Id]).Distinct()
     293        .Where(x => !resources.Select(y => y.Id).Contains(x))) {
     294        var r = new SlaveGroup();
     295        r.Id = rid;
     296        r.ParentResourceId = resourceAncestors[rid].FirstOrDefault();
     297        r.Name = resourceNames[rid];
     298        disabledParentResources.Add(r);
     299      }
     300    }
     301
     302    public IEnumerable<Project> GetAvailableProjectAncestors(Guid id) {
     303      if (projectAncestors.ContainsKey(id)) return projects.Where(x => projectAncestors[id].Contains(x.Id));
     304      else return Enumerable.Empty<Project>();
     305    }
     306
     307    public IEnumerable<Project> GetAvailableProjectDescendants(Guid id) {
     308      if (projectDescendants.ContainsKey(id)) return projects.Where(x => projectDescendants[id].Contains(x.Id));
     309      else return Enumerable.Empty<Project>();
     310    }
     311
     312    public IEnumerable<Resource> GetAvailableResourceAncestors(Guid id) {
     313      if (resourceAncestors.ContainsKey(id)) return resources.Where(x => resourceAncestors[id].Contains(x.Id));
     314      else return Enumerable.Empty<Resource>();
     315    }
     316
     317    public IEnumerable<Resource> GetAvailableResourceDescendants(Guid id) {
     318      if (resourceDescendants.ContainsKey(id)) return resources.Where(x => resourceDescendants[id].Contains(x.Id));
     319      else return Enumerable.Empty<Resource>();
     320    }
     321
     322    public IEnumerable<Resource> GetAvailableResourcesForProject(Guid id) {
     323      var assignedProjectResources = HiveServiceLocator.Instance.CallHiveService(s => s.GetAssignedResourcesForProject(id));
     324      return resources.Where(x => assignedProjectResources.Select(y => y.ResourceId).Contains(x.Id));
     325    }
     326
     327    public IEnumerable<Resource> GetDisabledResourceAncestors(IEnumerable<Resource> availableResources) {
     328      var missingParentIds = availableResources
     329        .Where(x => x.ParentResourceId.HasValue)
     330        .SelectMany(x => resourceAncestors[x.Id]).Distinct()
     331        .Where(x => !availableResources.Select(y => y.Id).Contains(x));
     332
     333      return resources.OfType<SlaveGroup>().Union(disabledParentResources).Where(x => missingParentIds.Contains(x.Id));
    111334    }
    112335    #endregion
     
    116339      if (item.Id == Guid.Empty) {
    117340        if (item is RefreshableJob) {
    118           HiveClient.Instance.UploadJob((RefreshableJob)item, cancellationToken);
     341          item.Id = HiveClient.Instance.UploadJob((RefreshableJob)item, cancellationToken);
    119342        }
    120343        if (item is JobPermission) {
     
    126349          HiveServiceLocator.Instance.CallHiveService((s) => s.GrantPermission(hep.JobId, hep.GrantedUserId, hep.Permission));
    127350        }
     351        if (item is Project) {
     352          item.Id = HiveServiceLocator.Instance.CallHiveService(s => s.AddProject((Project)item));
     353        }
    128354      } else {
    129         if (item is Job)
    130           HiveServiceLocator.Instance.CallHiveService(s => s.UpdateJob((Job)item));
     355        if (item is Job) {
     356          var job = (Job)item;
     357          HiveServiceLocator.Instance.CallHiveService(s => s.UpdateJob(job, job.ResourceIds));
     358        }
     359        if (item is Project)
     360          HiveServiceLocator.Instance.CallHiveService(s => s.UpdateProject((Project)item));
    131361      }
    132362    }
    133363    public static void StoreAsync(Action<Exception> exceptionCallback, IHiveItem item, CancellationToken cancellationToken) {
    134       var call = new Func<Exception>(delegate () {
     364      var call = new Func<Exception>(delegate() {
    135365        try {
    136366          Store(item, cancellationToken);
    137         } catch (Exception ex) {
     367        }
     368        catch (Exception ex) {
    138369          return ex;
    139370        }
    140371        return null;
    141372      });
    142       call.BeginInvoke(delegate (IAsyncResult result) {
     373      call.BeginInvoke(delegate(IAsyncResult result) {
    143374        Exception ex = call.EndInvoke(result);
    144375        if (ex != null) exceptionCallback(ex);
     
    153384
    154385      if (item is Job)
    155         HiveServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id));
     386        HiveServiceLocator.Instance.CallHiveService(s => s.UpdateJobState(item.Id, JobState.StatisticsPending));
    156387      if (item is RefreshableJob) {
    157388        RefreshableJob job = (RefreshableJob)item;
     
    159390          job.StopResultPolling();
    160391        }
    161         HiveServiceLocator.Instance.CallHiveService(s => s.DeleteJob(item.Id));
     392        HiveServiceLocator.Instance.CallHiveService(s => s.UpdateJobState(item.Id, JobState.StatisticsPending));
    162393      }
    163394      if (item is JobPermission) {
     
    227458    }
    228459
     460    public static void UpdateJob(Action<Exception> exceptionCallback, RefreshableJob refreshableJob, CancellationToken cancellationToken) {
     461      refreshableJob.IsProgressing = true;
     462      refreshableJob.Progress.Status = "Saving Job...";
     463      HiveClient.StoreAsync(
     464        new Action<Exception>((Exception ex) => {
     465          exceptionCallback(ex);
     466        }), refreshableJob.Job, cancellationToken);
     467      refreshableJob.IsProgressing = false;
     468      refreshableJob.Progress.Finish();
     469    }
     470
     471    public static void UpdateJob(RefreshableJob refreshableJob) {
     472      refreshableJob.IsProgressing = true;
     473
     474      try {
     475        refreshableJob.Progress.Start("Saving Job...");
     476        HiveClient.StoreAsync(new Action<Exception>((Exception ex) => {
     477          throw new Exception("Update failed.", ex);
     478        }), refreshableJob.Job, new CancellationToken());
     479      } finally {
     480        refreshableJob.IsProgressing = false;
     481        refreshableJob.Progress.Finish();
     482      }
     483    }
     484
     485
     486
    229487    #region Upload Job
    230488    private Semaphore taskUploadSemaphore = new Semaphore(Settings.Default.MaxParallelUploads, Settings.Default.MaxParallelUploads);
    231489    private static object jobCountLocker = new object();
    232490    private static object pluginLocker = new object();
    233     private void UploadJob(RefreshableJob refreshableJob, CancellationToken cancellationToken) {
     491    private Guid UploadJob(RefreshableJob refreshableJob, CancellationToken cancellationToken) {
    234492      try {
    235493        refreshableJob.IsProgressing = true;
    236494        refreshableJob.Progress.Start("Connecting to server...");
    237         IEnumerable<string> resourceNames = ToResourceNameList(refreshableJob.Job.ResourceNames);
    238         var resourceIds = new List<Guid>();
    239         foreach (var resourceName in resourceNames) {
    240           Guid resourceId = HiveServiceLocator.Instance.CallHiveService((s) => s.GetResourceId(resourceName));
    241           if (resourceId == Guid.Empty) {
    242             throw new ResourceNotFoundException(string.Format("Could not find the resource '{0}'", resourceName));
    243           }
    244           resourceIds.Add(resourceId);
    245         }
    246495
    247496        foreach (OptimizerHiveTask hiveJob in refreshableJob.HiveTasks.OfType<OptimizerHiveTask>()) {
     
    251500        // upload Job
    252501        refreshableJob.Progress.Status = "Uploading Job...";
    253         refreshableJob.Job.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddJob(refreshableJob.Job));
     502        refreshableJob.Job.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddJob(refreshableJob.Job, refreshableJob.Job.ResourceIds));
    254503        refreshableJob.Job = HiveServiceLocator.Instance.CallHiveService((s) => s.GetJob(refreshableJob.Job.Id)); // update owner and permissions
    255504        cancellationToken.ThrowIfCancellationRequested();
     
    273522        foreach (HiveTask hiveTask in refreshableJob.HiveTasks) {
    274523          var task = TS.Task.Factory.StartNew((hj) => {
    275             UploadTaskWithChildren(refreshableJob.Progress, (HiveTask)hj, null, resourceIds, jobCount, totalJobCount, configFilePlugin.Id, refreshableJob.Job.Id, refreshableJob.Log, cancellationToken);
     524            UploadTaskWithChildren(refreshableJob.Progress, (HiveTask)hj, null, jobCount, totalJobCount, configFilePlugin.Id, refreshableJob.Job.Id, refreshableJob.Log, cancellationToken);
    276525          }, hiveTask);
    277526          task.ContinueWith((x) => refreshableJob.Log.LogException(x.Exception), TaskContinuationOptions.OnlyOnFaulted);
     
    279528        }
    280529        TS.Task.WaitAll(tasks.ToArray());
    281       } finally {
     530      }
     531      finally {
    282532        refreshableJob.Job.Modified = false;
    283533        refreshableJob.IsProgressing = false;
    284534        refreshableJob.Progress.Finish();
    285535      }
     536      return (refreshableJob.Job != null) ? refreshableJob.Job.Id : Guid.Empty;
    286537    }
    287538
     
    317568    /// </summary>
    318569    /// <param name="parentHiveTask">shall be null if its the root task</param>
    319     private void UploadTaskWithChildren(IProgress progress, HiveTask hiveTask, HiveTask parentHiveTask, IEnumerable<Guid> groups, int[] taskCount, int totalJobCount, Guid configPluginId, Guid jobId, ILog log, CancellationToken cancellationToken) {
     570    private void UploadTaskWithChildren(IProgress progress, HiveTask hiveTask, HiveTask parentHiveTask, int[] taskCount, int totalJobCount, Guid configPluginId, Guid jobId, ILog log, CancellationToken cancellationToken) {
    320571      taskUploadSemaphore.WaitOne();
    321572      bool semaphoreReleased = false;
     
    356607              hiveTask.Task.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddChildTask(parentHiveTask.Task.Id, hiveTask.Task, taskData));
    357608            } else {
    358               hiveTask.Task.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddTask(hiveTask.Task, taskData, groups.ToList()));
     609              hiveTask.Task.Id = HiveServiceLocator.Instance.CallHiveService((s) => s.AddTask(hiveTask.Task, taskData));
    359610            }
    360611          }
     
    371622          var task = TS.Task.Factory.StartNew((tuple) => {
    372623            var arguments = (Tuple<HiveTask, HiveTask>)tuple;
    373             UploadTaskWithChildren(progress, arguments.Item1, arguments.Item2, groups, taskCount, totalJobCount, configPluginId, jobId, log, cancellationToken);
     624            UploadTaskWithChildren(progress, arguments.Item1, arguments.Item2, taskCount, totalJobCount, configPluginId, jobId, log, cancellationToken);
    374625          }, new Tuple<HiveTask, HiveTask>(child, hiveTask));
    375626          task.ContinueWith((x) => log.LogException(x.Exception), TaskContinuationOptions.OnlyOnFaulted);
     
    426677        } else if (refreshableJob.IsPaused()) {
    427678          refreshableJob.ExecutionState = Core.ExecutionState.Paused;
    428         } else {
     679        } else { 
    429680          refreshableJob.ExecutionState = Core.ExecutionState.Started;
    430681        }
    431682        refreshableJob.OnLoaded();
    432       } finally {
     683      }
     684      finally {
    433685        refreshableJob.IsProgressing = false;
    434686        refreshableJob.Progress.Finish();
     
    467719      try {
    468720        return PersistenceUtil.Deserialize<ItemTask>(taskData.Data);
    469       } catch {
     721      }
     722      catch {
    470723        return null;
    471724      }
     
    478731    public static void TryAndRepeat(Action action, int repetitions, string errorMessage, ILog log = null) {
    479732      while (true) {
    480         try { action(); return; } catch (Exception e) {
     733        try { action(); return; }
     734        catch (Exception e) {
    481735          if (repetitions == 0) throw new HiveException(errorMessage, e);
    482736          if (log != null) log.LogMessage(string.Format("{0}: {1} - will try again!", errorMessage, e.ToString()));
     
    495749      });
    496750    }
     751
     752    public string GetProjectAncestry(Guid projectId) {
     753      if (projectId == null || projectId == Guid.Empty) return "";
     754      var projects = projectAncestors[projectId].Reverse().ToList();
     755      projects.Add(projectId);
     756      return string.Join(" » ", projects.Select(x => ProjectNames[x]).ToArray());
     757    }
     758
     759    public IEnumerable<Resource> GetAssignedResourcesForJob(Guid jobId) {
     760      var assignedJobResource = HiveServiceLocator.Instance.CallHiveService(service => service.GetAssignedResourcesForJob(jobId));
     761      return Resources.Where(x => assignedJobResource.Select(y => y.ResourceId).Contains(x.Id));
     762    }
    497763  }
    498764}
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive/3.3/Plugin.cs.frame

    r15589 r16386  
    3030  [PluginFile("HeuristicLab.Clients.Hive-3.3.dll", PluginFileType.Assembly)]
    3131  [PluginDependency("HeuristicLab.Clients.Common", "3.3")]
     32  [PluginDependency("HeuristicLab.Clients.Access", "3.3")] 
    3233  [PluginDependency("HeuristicLab.Collections", "3.3")]
    3334  [PluginDependency("HeuristicLab.Common", "3.3")]
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive/3.3/ServiceClients/HiveServiceClient.cs

    r14738 r16386  
    2626    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.SlaveGroup))]
    2727    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Plugin))]
     28    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Project))]
     29    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.AssignedJobResource))]
    2830    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.JobPermission))]
    2931    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.PluginData))]
    30     [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.ResourcePermission))]
     32    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.ProjectPermission))]
     33    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.AssignedProjectResource))]
    3134    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Downtime))]
    3235    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.UserPriority))]
     
    211214    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.SlaveGroup))]
    212215    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Plugin))]
     216    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Project))]
    213217    public partial class NamedHiveItem : HeuristicLab.Clients.Hive.HiveItem
    214218    {
     
    284288       
    285289        [System.Runtime.Serialization.OptionalFieldAttribute()]
    286         private string ResourceNamesField;
     290        private System.Guid ProjectIdField;
     291       
     292        [System.Runtime.Serialization.OptionalFieldAttribute()]
     293        private HeuristicLab.Clients.Hive.JobState StateField;
    287294       
    288295        [System.Runtime.Serialization.DataMemberAttribute()]
     
    406413       
    407414        [System.Runtime.Serialization.DataMemberAttribute()]
    408         public string ResourceNames
    409         {
    410             get
    411             {
    412                 return this.ResourceNamesField;
    413             }
    414             set
    415             {
    416                 if ((object.ReferenceEquals(this.ResourceNamesField, value) != true))
    417                 {
    418                     this.ResourceNamesField = value;
    419                     this.RaisePropertyChanged("ResourceNames");
     415        public System.Guid ProjectId
     416        {
     417            get
     418            {
     419                return this.ProjectIdField;
     420            }
     421            set
     422            {
     423                if ((this.ProjectIdField.Equals(value) != true))
     424                {
     425                    this.ProjectIdField = value;
     426                    this.RaisePropertyChanged("ProjectId");
     427                }
     428            }
     429        }
     430       
     431        [System.Runtime.Serialization.DataMemberAttribute()]
     432        public HeuristicLab.Clients.Hive.JobState State
     433        {
     434            get
     435            {
     436                return this.StateField;
     437            }
     438            set
     439            {
     440                if ((this.StateField.Equals(value) != true))
     441                {
     442                    this.StateField = value;
     443                    this.RaisePropertyChanged("State");
    420444                }
    421445            }
     
    839863    [System.Diagnostics.DebuggerStepThroughAttribute()]
    840864    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
     865    [System.Runtime.Serialization.DataContractAttribute(Name="Project", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]
     866    [System.SerializableAttribute()]
     867    public partial class Project : HeuristicLab.Clients.Hive.NamedHiveItem
     868    {
     869       
     870        [System.Runtime.Serialization.OptionalFieldAttribute()]
     871        private System.DateTime DateCreatedField;
     872       
     873        [System.Runtime.Serialization.OptionalFieldAttribute()]
     874        private System.Nullable<System.DateTime> EndDateField;
     875       
     876        [System.Runtime.Serialization.OptionalFieldAttribute()]
     877        private System.Guid OwnerUserIdField;
     878       
     879        [System.Runtime.Serialization.OptionalFieldAttribute()]
     880        private System.Nullable<System.Guid> ParentProjectIdField;
     881       
     882        [System.Runtime.Serialization.OptionalFieldAttribute()]
     883        private System.DateTime StartDateField;
     884       
     885        [System.Runtime.Serialization.DataMemberAttribute()]
     886        public System.DateTime DateCreated
     887        {
     888            get
     889            {
     890                return this.DateCreatedField;
     891            }
     892            set
     893            {
     894                if ((this.DateCreatedField.Equals(value) != true))
     895                {
     896                    this.DateCreatedField = value;
     897                    this.RaisePropertyChanged("DateCreated");
     898                }
     899            }
     900        }
     901       
     902        [System.Runtime.Serialization.DataMemberAttribute()]
     903        public System.Nullable<System.DateTime> EndDate
     904        {
     905            get
     906            {
     907                return this.EndDateField;
     908            }
     909            set
     910            {
     911                if ((this.EndDateField.Equals(value) != true))
     912                {
     913                    this.EndDateField = value;
     914                    this.RaisePropertyChanged("EndDate");
     915                }
     916            }
     917        }
     918       
     919        [System.Runtime.Serialization.DataMemberAttribute()]
     920        public System.Guid OwnerUserId
     921        {
     922            get
     923            {
     924                return this.OwnerUserIdField;
     925            }
     926            set
     927            {
     928                if ((this.OwnerUserIdField.Equals(value) != true))
     929                {
     930                    this.OwnerUserIdField = value;
     931                    this.RaisePropertyChanged("OwnerUserId");
     932                }
     933            }
     934        }
     935       
     936        [System.Runtime.Serialization.DataMemberAttribute()]
     937        public System.Nullable<System.Guid> ParentProjectId
     938        {
     939            get
     940            {
     941                return this.ParentProjectIdField;
     942            }
     943            set
     944            {
     945                if ((this.ParentProjectIdField.Equals(value) != true))
     946                {
     947                    this.ParentProjectIdField = value;
     948                    this.RaisePropertyChanged("ParentProjectId");
     949                }
     950            }
     951        }
     952       
     953        [System.Runtime.Serialization.DataMemberAttribute()]
     954        public System.DateTime StartDate
     955        {
     956            get
     957            {
     958                return this.StartDateField;
     959            }
     960            set
     961            {
     962                if ((this.StartDateField.Equals(value) != true))
     963                {
     964                    this.StartDateField = value;
     965                    this.RaisePropertyChanged("StartDate");
     966                }
     967            }
     968        }
     969    }
     970   
     971    [System.Diagnostics.DebuggerStepThroughAttribute()]
     972    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
     973    [System.Runtime.Serialization.DataContractAttribute(Name="AssignedJobResource", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]
     974    [System.SerializableAttribute()]
     975    public partial class AssignedJobResource : HeuristicLab.Clients.Hive.HiveItem
     976    {
     977       
     978        [System.Runtime.Serialization.OptionalFieldAttribute()]
     979        private System.Guid JobIdField;
     980       
     981        [System.Runtime.Serialization.OptionalFieldAttribute()]
     982        private System.Guid ResourceIdField;
     983       
     984        [System.Runtime.Serialization.DataMemberAttribute()]
     985        public System.Guid JobId
     986        {
     987            get
     988            {
     989                return this.JobIdField;
     990            }
     991            set
     992            {
     993                if ((this.JobIdField.Equals(value) != true))
     994                {
     995                    this.JobIdField = value;
     996                    this.RaisePropertyChanged("JobId");
     997                }
     998            }
     999        }
     1000       
     1001        [System.Runtime.Serialization.DataMemberAttribute()]
     1002        public System.Guid ResourceId
     1003        {
     1004            get
     1005            {
     1006                return this.ResourceIdField;
     1007            }
     1008            set
     1009            {
     1010                if ((this.ResourceIdField.Equals(value) != true))
     1011                {
     1012                    this.ResourceIdField = value;
     1013                    this.RaisePropertyChanged("ResourceId");
     1014                }
     1015            }
     1016        }
     1017    }
     1018   
     1019    [System.Diagnostics.DebuggerStepThroughAttribute()]
     1020    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    8411021    [System.Runtime.Serialization.DataContractAttribute(Name="JobPermission", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]
    8421022    [System.SerializableAttribute()]
     
    9951175    [System.Diagnostics.DebuggerStepThroughAttribute()]
    9961176    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    997     [System.Runtime.Serialization.DataContractAttribute(Name="ResourcePermission", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]
     1177    [System.Runtime.Serialization.DataContractAttribute(Name="ProjectPermission", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]
    9981178    [System.SerializableAttribute()]
    999     public partial class ResourcePermission : HeuristicLab.Clients.Hive.HiveItem
     1179    public partial class ProjectPermission : HeuristicLab.Clients.Hive.HiveItem
    10001180    {
    10011181       
     
    10071187       
    10081188        [System.Runtime.Serialization.OptionalFieldAttribute()]
    1009         private System.Guid ResourceIdField;
     1189        private System.Guid ProjectIdField;
    10101190       
    10111191        [System.Runtime.Serialization.DataMemberAttribute()]
     
    10391219                    this.GrantedUserIdField = value;
    10401220                    this.RaisePropertyChanged("GrantedUserId");
     1221                }
     1222            }
     1223        }
     1224       
     1225        [System.Runtime.Serialization.DataMemberAttribute()]
     1226        public System.Guid ProjectId
     1227        {
     1228            get
     1229            {
     1230                return this.ProjectIdField;
     1231            }
     1232            set
     1233            {
     1234                if ((this.ProjectIdField.Equals(value) != true))
     1235                {
     1236                    this.ProjectIdField = value;
     1237                    this.RaisePropertyChanged("ProjectId");
     1238                }
     1239            }
     1240        }
     1241    }
     1242   
     1243    [System.Diagnostics.DebuggerStepThroughAttribute()]
     1244    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
     1245    [System.Runtime.Serialization.DataContractAttribute(Name="AssignedProjectResource", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]
     1246    [System.SerializableAttribute()]
     1247    public partial class AssignedProjectResource : HeuristicLab.Clients.Hive.HiveItem
     1248    {
     1249       
     1250        [System.Runtime.Serialization.OptionalFieldAttribute()]
     1251        private System.Guid ProjectIdField;
     1252       
     1253        [System.Runtime.Serialization.OptionalFieldAttribute()]
     1254        private System.Guid ResourceIdField;
     1255       
     1256        [System.Runtime.Serialization.DataMemberAttribute()]
     1257        public System.Guid ProjectId
     1258        {
     1259            get
     1260            {
     1261                return this.ProjectIdField;
     1262            }
     1263            set
     1264            {
     1265                if ((this.ProjectIdField.Equals(value) != true))
     1266                {
     1267                    this.ProjectIdField = value;
     1268                    this.RaisePropertyChanged("ProjectId");
    10411269                }
    10421270            }
     
    16121840        [System.Runtime.Serialization.EnumMemberAttribute()]
    16131841        Full = 2,
     1842    }
     1843   
     1844    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
     1845    [System.Runtime.Serialization.DataContractAttribute(Name="JobState", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]
     1846    public enum JobState : int
     1847    {
     1848       
     1849        [System.Runtime.Serialization.EnumMemberAttribute()]
     1850        Online = 0,
     1851       
     1852        [System.Runtime.Serialization.EnumMemberAttribute()]
     1853        StatisticsPending = 1,
     1854       
     1855        [System.Runtime.Serialization.EnumMemberAttribute()]
     1856        DeletionPending = 2,
    16141857    }
    16151858   
     
    21002343       
    21012344        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddTask", ReplyAction="http://tempuri.org/IHiveService/AddTaskResponse")]
    2102         System.Guid AddTask(HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData, System.Collections.Generic.List<System.Guid> resourceIds);
     2345        System.Guid AddTask(HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData);
    21032346       
    21042347        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddChildTask", ReplyAction="http://tempuri.org/IHiveService/AddChildTaskResponse")]
     
    21412384        System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetJobs();
    21422385       
     2386        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetJobsByProjectId", ReplyAction="http://tempuri.org/IHiveService/GetJobsByProjectIdResponse")]
     2387        System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetJobsByProjectId(System.Guid projectId);
     2388       
     2389        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetJobsByProjectIds", ReplyAction="http://tempuri.org/IHiveService/GetJobsByProjectIdsResponse")]
     2390        System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetJobsByProjectIds(System.Collections.Generic.List<System.Guid> projectIds);
     2391       
    21432392        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddJob", ReplyAction="http://tempuri.org/IHiveService/AddJobResponse")]
    2144         System.Guid AddJob(HeuristicLab.Clients.Hive.Job jobDto);
     2393        System.Guid AddJob(HeuristicLab.Clients.Hive.Job jobDto, System.Collections.Generic.List<System.Guid> resourceIds);
    21452394       
    21462395        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/UpdateJob", ReplyAction="http://tempuri.org/IHiveService/UpdateJobResponse")]
    2147         void UpdateJob(HeuristicLab.Clients.Hive.Job jobDto);
    2148        
    2149         [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/DeleteJob", ReplyAction="http://tempuri.org/IHiveService/DeleteJobResponse")]
    2150         void DeleteJob(System.Guid JobId);
     2396        void UpdateJob(HeuristicLab.Clients.Hive.Job jobDto, System.Collections.Generic.List<System.Guid> resourceIds);
     2397       
     2398        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/UpdateJobState", ReplyAction="http://tempuri.org/IHiveService/UpdateJobStateResponse")]
     2399        void UpdateJobState(System.Guid JobId, HeuristicLab.Clients.Hive.JobState jobState);
     2400       
     2401        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/UpdateJobStates", ReplyAction="http://tempuri.org/IHiveService/UpdateJobStatesResponse")]
     2402        void UpdateJobStates(System.Collections.Generic.List<System.Guid> jobIds, HeuristicLab.Clients.Hive.JobState jobState);
     2403       
     2404        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetAssignedResourcesForJob", ReplyAction="http://tempuri.org/IHiveService/GetAssignedResourcesForJobResponse")]
     2405        System.Collections.Generic.List<HeuristicLab.Clients.Hive.AssignedJobResource> GetAssignedResourcesForJob(System.Guid jobId);
    21512406       
    21522407        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GrantPermission", ReplyAction="http://tempuri.org/IHiveService/GrantPermissionResponse")]
     
    21842439        System.Collections.Generic.List<HeuristicLab.Clients.Hive.PluginData> GetPluginDatas(System.Collections.Generic.List<System.Guid> pluginIds);
    21852440       
    2186         [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GrantResourcePermissions", ReplyAction="http://tempuri.org/IHiveService/GrantResourcePermissionsResponse")]
    2187         void GrantResourcePermissions(System.Guid resourceId, System.Collections.Generic.List<System.Guid> grantedUserIds);
    2188        
    2189         [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/RevokeResourcePermissions", ReplyAction="http://tempuri.org/IHiveService/RevokeResourcePermissionsResponse")]
    2190         void RevokeResourcePermissions(System.Guid resourceId, System.Collections.Generic.List<System.Guid> grantedUserIds);
    2191        
    2192         [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetResourcePermissions", ReplyAction="http://tempuri.org/IHiveService/GetResourcePermissionsResponse")]
    2193         System.Collections.Generic.List<HeuristicLab.Clients.Hive.ResourcePermission> GetResourcePermissions(System.Guid resourceId);
     2441        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddProject", ReplyAction="http://tempuri.org/IHiveService/AddProjectResponse")]
     2442        System.Guid AddProject(HeuristicLab.Clients.Hive.Project projectDto);
     2443       
     2444        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/UpdateProject", ReplyAction="http://tempuri.org/IHiveService/UpdateProjectResponse")]
     2445        void UpdateProject(HeuristicLab.Clients.Hive.Project projectDto);
     2446       
     2447        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/DeleteProject", ReplyAction="http://tempuri.org/IHiveService/DeleteProjectResponse")]
     2448        void DeleteProject(System.Guid projectId);
     2449       
     2450        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetProject", ReplyAction="http://tempuri.org/IHiveService/GetProjectResponse")]
     2451        HeuristicLab.Clients.Hive.Project GetProject(System.Guid projectId);
     2452       
     2453        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetProjects", ReplyAction="http://tempuri.org/IHiveService/GetProjectsResponse")]
     2454        System.Collections.Generic.List<HeuristicLab.Clients.Hive.Project> GetProjects();
     2455       
     2456        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetProjectsForAdministration", ReplyAction="http://tempuri.org/IHiveService/GetProjectsForAdministrationResponse")]
     2457        System.Collections.Generic.List<HeuristicLab.Clients.Hive.Project> GetProjectsForAdministration();
     2458       
     2459        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetProjectGenealogy", ReplyAction="http://tempuri.org/IHiveService/GetProjectGenealogyResponse")]
     2460        System.Collections.Generic.Dictionary<System.Guid, System.Collections.Generic.List<System.Guid>> GetProjectGenealogy();
     2461       
     2462        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetProjectNames", ReplyAction="http://tempuri.org/IHiveService/GetProjectNamesResponse")]
     2463        System.Collections.Generic.Dictionary<System.Guid, string> GetProjectNames();
     2464       
     2465        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/SaveProjectPermissions", ReplyAction="http://tempuri.org/IHiveService/SaveProjectPermissionsResponse")]
     2466        void SaveProjectPermissions(System.Guid projectId, System.Collections.Generic.List<System.Guid> grantedUserIds, bool reassign, bool cascading, bool reassignCascading);
     2467       
     2468        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetProjectPermissions", ReplyAction="http://tempuri.org/IHiveService/GetProjectPermissionsResponse")]
     2469        System.Collections.Generic.List<HeuristicLab.Clients.Hive.ProjectPermission> GetProjectPermissions(System.Guid projectId);
     2470       
     2471        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/SaveProjectResourceAssignments", ReplyAction="http://tempuri.org/IHiveService/SaveProjectResourceAssignmentsResponse")]
     2472        void SaveProjectResourceAssignments(System.Guid projectId, System.Collections.Generic.List<System.Guid> resourceIds, bool reassign, bool cascading, bool reassignCascading);
     2473       
     2474        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetAssignedResourcesForProject", ReplyAction="http://tempuri.org/IHiveService/GetAssignedResourcesForProjectResponse")]
     2475        System.Collections.Generic.List<HeuristicLab.Clients.Hive.AssignedProjectResource> GetAssignedResourcesForProject(System.Guid projectId);
     2476       
     2477        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetAssignedResourcesForProjectAdministration", ReplyAction="http://tempuri.org/IHiveService/GetAssignedResourcesForProjectAdministrationRespo" +
     2478            "nse")]
     2479        System.Collections.Generic.List<HeuristicLab.Clients.Hive.AssignedProjectResource> GetAssignedResourcesForProjectAdministration(System.Guid projectId);
     2480       
     2481        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetAssignedResourcesForProjectsAdministration", ReplyAction="http://tempuri.org/IHiveService/GetAssignedResourcesForProjectsAdministrationResp" +
     2482            "onse")]
     2483        System.Collections.Generic.List<HeuristicLab.Clients.Hive.AssignedProjectResource> GetAssignedResourcesForProjectsAdministration(System.Collections.Generic.List<System.Guid> projectIds);
    21942484       
    21952485        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddSlave", ReplyAction="http://tempuri.org/IHiveService/AddSlaveResponse")]
     
    22082498        System.Collections.Generic.List<HeuristicLab.Clients.Hive.SlaveGroup> GetSlaveGroups();
    22092499       
     2500        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetSlavesForAdministration", ReplyAction="http://tempuri.org/IHiveService/GetSlavesForAdministrationResponse")]
     2501        System.Collections.Generic.List<HeuristicLab.Clients.Hive.Slave> GetSlavesForAdministration();
     2502       
     2503        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetSlaveGroupsForAdministration", ReplyAction="http://tempuri.org/IHiveService/GetSlaveGroupsForAdministrationResponse")]
     2504        System.Collections.Generic.List<HeuristicLab.Clients.Hive.SlaveGroup> GetSlaveGroupsForAdministration();
     2505       
     2506        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetResourceGenealogy", ReplyAction="http://tempuri.org/IHiveService/GetResourceGenealogyResponse")]
     2507        System.Collections.Generic.Dictionary<System.Guid, System.Collections.Generic.List<System.Guid>> GetResourceGenealogy();
     2508       
     2509        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetResourceNames", ReplyAction="http://tempuri.org/IHiveService/GetResourceNamesResponse")]
     2510        System.Collections.Generic.Dictionary<System.Guid, string> GetResourceNames();
     2511       
    22102512        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/UpdateSlave", ReplyAction="http://tempuri.org/IHiveService/UpdateSlaveResponse")]
    22112513        void UpdateSlave(HeuristicLab.Clients.Hive.Slave slave);
     
    22522554        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetUserIdByUsername", ReplyAction="http://tempuri.org/IHiveService/GetUserIdByUsernameResponse")]
    22532555        System.Guid GetUserIdByUsername(string username);
     2556       
     2557        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetUserGroupTree", ReplyAction="http://tempuri.org/IHiveService/GetUserGroupTreeResponse")]
     2558        System.Collections.Generic.Dictionary<System.Guid, System.Collections.Generic.List<System.Guid>> GetUserGroupTree();
     2559       
     2560        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/CheckAccessToAdminAreaGranted", ReplyAction="http://tempuri.org/IHiveService/CheckAccessToAdminAreaGrantedResponse")]
     2561        bool CheckAccessToAdminAreaGranted();
    22542562       
    22552563        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetUserPriorities", ReplyAction="http://tempuri.org/IHiveService/GetUserPrioritiesResponse")]
     
    22912599        }
    22922600       
    2293         public System.Guid AddTask(HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData, System.Collections.Generic.List<System.Guid> resourceIds)
    2294         {
    2295             return base.Channel.AddTask(task, taskData, resourceIds);
     2601        public System.Guid AddTask(HeuristicLab.Clients.Hive.Task task, HeuristicLab.Clients.Hive.TaskData taskData)
     2602        {
     2603            return base.Channel.AddTask(task, taskData);
    22962604        }
    22972605       
     
    23612669        }
    23622670       
    2363         public System.Guid AddJob(HeuristicLab.Clients.Hive.Job jobDto)
    2364         {
    2365             return base.Channel.AddJob(jobDto);
    2366         }
    2367        
    2368         public void UpdateJob(HeuristicLab.Clients.Hive.Job jobDto)
    2369         {
    2370             base.Channel.UpdateJob(jobDto);
    2371         }
    2372        
    2373         public void DeleteJob(System.Guid JobId)
    2374         {
    2375             base.Channel.DeleteJob(JobId);
     2671        public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetJobsByProjectId(System.Guid projectId)
     2672        {
     2673            return base.Channel.GetJobsByProjectId(projectId);
     2674        }
     2675       
     2676        public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetJobsByProjectIds(System.Collections.Generic.List<System.Guid> projectIds)
     2677        {
     2678            return base.Channel.GetJobsByProjectIds(projectIds);
     2679        }
     2680       
     2681        public System.Guid AddJob(HeuristicLab.Clients.Hive.Job jobDto, System.Collections.Generic.List<System.Guid> resourceIds)
     2682        {
     2683            return base.Channel.AddJob(jobDto, resourceIds);
     2684        }
     2685       
     2686        public void UpdateJob(HeuristicLab.Clients.Hive.Job jobDto, System.Collections.Generic.List<System.Guid> resourceIds)
     2687        {
     2688            base.Channel.UpdateJob(jobDto, resourceIds);
     2689        }
     2690       
     2691        public void UpdateJobState(System.Guid JobId, HeuristicLab.Clients.Hive.JobState jobState)
     2692        {
     2693            base.Channel.UpdateJobState(JobId, jobState);
     2694        }
     2695       
     2696        public void UpdateJobStates(System.Collections.Generic.List<System.Guid> jobIds, HeuristicLab.Clients.Hive.JobState jobState)
     2697        {
     2698            base.Channel.UpdateJobStates(jobIds, jobState);
     2699        }
     2700       
     2701        public System.Collections.Generic.List<HeuristicLab.Clients.Hive.AssignedJobResource> GetAssignedResourcesForJob(System.Guid jobId)
     2702        {
     2703            return base.Channel.GetAssignedResourcesForJob(jobId);
    23762704        }
    23772705       
     
    24312759        }
    24322760       
    2433         public void GrantResourcePermissions(System.Guid resourceId, System.Collections.Generic.List<System.Guid> grantedUserIds)
    2434         {
    2435             base.Channel.GrantResourcePermissions(resourceId, grantedUserIds);
    2436         }
    2437        
    2438         public void RevokeResourcePermissions(System.Guid resourceId, System.Collections.Generic.List<System.Guid> grantedUserIds)
    2439         {
    2440             base.Channel.RevokeResourcePermissions(resourceId, grantedUserIds);
    2441         }
    2442        
    2443         public System.Collections.Generic.List<HeuristicLab.Clients.Hive.ResourcePermission> GetResourcePermissions(System.Guid resourceId)
    2444         {
    2445             return base.Channel.GetResourcePermissions(resourceId);
     2761        public System.Guid AddProject(HeuristicLab.Clients.Hive.Project projectDto)
     2762        {
     2763            return base.Channel.AddProject(projectDto);
     2764        }
     2765       
     2766        public void UpdateProject(HeuristicLab.Clients.Hive.Project projectDto)
     2767        {
     2768            base.Channel.UpdateProject(projectDto);
     2769        }
     2770       
     2771        public void DeleteProject(System.Guid projectId)
     2772        {
     2773            base.Channel.DeleteProject(projectId);
     2774        }
     2775       
     2776        public HeuristicLab.Clients.Hive.Project GetProject(System.Guid projectId)
     2777        {
     2778            return base.Channel.GetProject(projectId);
     2779        }
     2780       
     2781        public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Project> GetProjects()
     2782        {
     2783            return base.Channel.GetProjects();
     2784        }
     2785       
     2786        public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Project> GetProjectsForAdministration()
     2787        {
     2788            return base.Channel.GetProjectsForAdministration();
     2789        }
     2790       
     2791        public System.Collections.Generic.Dictionary<System.Guid, System.Collections.Generic.List<System.Guid>> GetProjectGenealogy()
     2792        {
     2793            return base.Channel.GetProjectGenealogy();
     2794        }
     2795       
     2796        public System.Collections.Generic.Dictionary<System.Guid, string> GetProjectNames()
     2797        {
     2798            return base.Channel.GetProjectNames();
     2799        }
     2800       
     2801        public void SaveProjectPermissions(System.Guid projectId, System.Collections.Generic.List<System.Guid> grantedUserIds, bool reassign, bool cascading, bool reassignCascading)
     2802        {
     2803            base.Channel.SaveProjectPermissions(projectId, grantedUserIds, reassign, cascading, reassignCascading);
     2804        }
     2805       
     2806        public System.Collections.Generic.List<HeuristicLab.Clients.Hive.ProjectPermission> GetProjectPermissions(System.Guid projectId)
     2807        {
     2808            return base.Channel.GetProjectPermissions(projectId);
     2809        }
     2810       
     2811        public void SaveProjectResourceAssignments(System.Guid projectId, System.Collections.Generic.List<System.Guid> resourceIds, bool reassign, bool cascading, bool reassignCascading)
     2812        {
     2813            base.Channel.SaveProjectResourceAssignments(projectId, resourceIds, reassign, cascading, reassignCascading);
     2814        }
     2815       
     2816        public System.Collections.Generic.List<HeuristicLab.Clients.Hive.AssignedProjectResource> GetAssignedResourcesForProject(System.Guid projectId)
     2817        {
     2818            return base.Channel.GetAssignedResourcesForProject(projectId);
     2819        }
     2820       
     2821        public System.Collections.Generic.List<HeuristicLab.Clients.Hive.AssignedProjectResource> GetAssignedResourcesForProjectAdministration(System.Guid projectId)
     2822        {
     2823            return base.Channel.GetAssignedResourcesForProjectAdministration(projectId);
     2824        }
     2825       
     2826        public System.Collections.Generic.List<HeuristicLab.Clients.Hive.AssignedProjectResource> GetAssignedResourcesForProjectsAdministration(System.Collections.Generic.List<System.Guid> projectIds)
     2827        {
     2828            return base.Channel.GetAssignedResourcesForProjectsAdministration(projectIds);
    24462829        }
    24472830       
     
    24712854        }
    24722855       
     2856        public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Slave> GetSlavesForAdministration()
     2857        {
     2858            return base.Channel.GetSlavesForAdministration();
     2859        }
     2860       
     2861        public System.Collections.Generic.List<HeuristicLab.Clients.Hive.SlaveGroup> GetSlaveGroupsForAdministration()
     2862        {
     2863            return base.Channel.GetSlaveGroupsForAdministration();
     2864        }
     2865       
     2866        public System.Collections.Generic.Dictionary<System.Guid, System.Collections.Generic.List<System.Guid>> GetResourceGenealogy()
     2867        {
     2868            return base.Channel.GetResourceGenealogy();
     2869        }
     2870       
     2871        public System.Collections.Generic.Dictionary<System.Guid, string> GetResourceNames()
     2872        {
     2873            return base.Channel.GetResourceNames();
     2874        }
     2875       
    24732876        public void UpdateSlave(HeuristicLab.Clients.Hive.Slave slave)
    24742877        {
     
    25462949        }
    25472950       
     2951        public System.Collections.Generic.Dictionary<System.Guid, System.Collections.Generic.List<System.Guid>> GetUserGroupTree()
     2952        {
     2953            return base.Channel.GetUserGroupTree();
     2954        }
     2955       
     2956        public bool CheckAccessToAdminAreaGranted()
     2957        {
     2958            return base.Channel.CheckAccessToAdminAreaGranted();
     2959        }
     2960       
    25482961        public System.Collections.Generic.List<HeuristicLab.Clients.Hive.UserPriority> GetUserPriorities()
    25492962        {
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive/3.3/ServiceClients/Job.cs

    r15583 r16386  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.ComponentModel;
    2425using HeuristicLab.Common;
     
    2627namespace HeuristicLab.Clients.Hive {
    2728  public partial class Job : IDeepCloneable, IContent {
     29    public List<Guid> ResourceIds { get; set; }
    2830
    2931    #region Constructors and Cloning
    3032    public Job() {
    31       ResourceNames = "HEAL";
     33      ProjectId = Guid.Empty;
    3234      DateCreated = DateTime.Now;
    3335      Permission = Permission.Full;
     
    3840      this.OwnerUserId = original.OwnerUserId;
    3941      this.DateCreated = original.DateCreated;
    40       this.ResourceNames = original.ResourceNames;
     42      this.ProjectId = original.ProjectId;
    4143      this.Name = original.Name;
    4244      this.Description = original.Description;
    4345      this.Id = original.Id;
    4446      this.Permission = original.Permission;
     47      this.ResourceIds = original.ResourceIds;
    4548    }
    4649    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive/3.3/ServiceClients/ResourcePermission.cs

    r15583 r16386  
    2424
    2525namespace HeuristicLab.Clients.Hive {
    26   public partial class ResourcePermission : IDeepCloneable, IContent {
     26  public partial class ProjectPermission : IDeepCloneable, IContent {
    2727
    2828    private string grantedUserName;
     
    4141    }
    4242
    43     public ResourcePermission() { }
     43    public ProjectPermission() { }
    4444
    4545    protected override void OnPropertyChanged(PropertyChangedEventArgs e) {
     
    5050    }
    5151
    52     protected ResourcePermission(ResourcePermission original, Cloner cloner)
     52    protected ProjectPermission(ProjectPermission original, Cloner cloner)
    5353      : base(original, cloner) {
    5454      this.GrantedByUserId = original.GrantedByUserId;
    5555      this.GrantedUserId = original.GrantedUserId;
    56       this.ResourceId = original.ResourceId;
     56      this.ProjectId = original.ProjectId;
    5757    }
    5858
    5959    public override IDeepCloneable Clone(Cloner cloner) {
    60       return new ResourcePermission(this, cloner);
     60      return new ProjectPermission(this, cloner);
    6161    }
    6262
  • branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Clients.Hive/3.3/app.config

    r15361 r16386  
    7171    </bindings>
    7272    <client>
    73       <endpoint address="http://services.heuristiclab.com/Hive-3.3/HiveService.svc"
     73      <endpoint address="http://services.heuristiclab.com/Hive-3.4/HiveService.svc"
    7474        binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHiveService"
    7575        contract="HeuristicLab.Clients.Hive.IHiveService" name="WSHttpBinding_IHiveService">
     
    7878        </identity>
    7979      </endpoint>
    80       <endpoint address="net.tcp://services.heuristiclab.com/Hive-3.3/HiveService.svc"
     80      <endpoint address="net.tcp://services.heuristiclab.com/Hive-3.4/HiveService.svc"
    8181        binding="netTcpBinding" bindingConfiguration="NetBinding_IHiveService"
    8282        contract="HeuristicLab.Clients.Hive.IHiveService" name="NetBinding_IHiveService">
Note: See TracChangeset for help on using the changeset viewer.