Changeset 6723


Ignore:
Timestamp:
09/08/11 14:37:52 (8 years ago)
Author:
ascheibe
Message:

#1233 Review comments: renamed HiveEperiment to Job

Location:
branches/HeuristicLab.Hive-3.4/sources
Files:
25 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.3/Views/HiveExperimentPermissionListView.cs

    r6463 r6723  
    2727namespace HeuristicLab.Clients.Hive.ExperimentManager.Views {
    2828  [View("HiveExperimentPermissionList View")]
    29   [Content(typeof(HiveItemCollection<HiveExperimentPermission>), false)]
    30   public partial class HiveExperimentPermissionListView : ItemCollectionView<HiveExperimentPermission> {
     29  [Content(typeof(HiveItemCollection<JobPermission>), false)]
     30  public partial class HiveExperimentPermissionListView : ItemCollectionView<JobPermission> {
    3131
    3232    private Guid hiveExperimentId;
     
    4040    }
    4141
    42     protected override HiveExperimentPermission CreateItem() {
    43       return new HiveExperimentPermission() { HiveExperimentId = this.hiveExperimentId };
     42    protected override JobPermission CreateItem() {
     43      return new JobPermission() { JobId = this.hiveExperimentId };
    4444    }
    4545  }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.3/Views/HiveExperimentPermissionView.cs

    r6479 r6723  
    2525
    2626namespace HeuristicLab.Clients.Hive.ExperimentManager.Views {
    27   [View("HiveExperimentPermission View")]
    28   [Content(typeof(HiveExperimentPermission), true)]
     27  [View("JobPermission View")]
     28  [Content(typeof(JobPermission), true)]
    2929  public partial class HiveExperimentPermissionView : HiveItemView {
    30     public new HiveExperimentPermission Content {
    31       get { return (HiveExperimentPermission)base.Content; }
     30    public new JobPermission Content {
     31      get { return (JobPermission)base.Content; }
    3232      set { base.Content = value; }
    3333    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/HiveClient.cs

    r6721 r6723  
    8686        var oldExperiments = hiveExperiments ?? new ItemCollection<RefreshableHiveExperiment>();
    8787        hiveExperiments = new HiveItemCollection<RefreshableHiveExperiment>();
    88         var experimentsLoaded = ServiceLocator.Instance.CallHiveService<IEnumerable<HiveExperiment>>(s => s.GetHiveExperiments());
     88        var experimentsLoaded = ServiceLocator.Instance.CallHiveService<IEnumerable<Job>>(s => s.GetHiveExperiments());
    8989
    9090        foreach (var he in experimentsLoaded) {
     
    141141          HiveClient.Instance.UploadExperiment((RefreshableHiveExperiment)item, cancellationToken);
    142142        }
    143         if (item is HiveExperimentPermission) {
    144           var hep = (HiveExperimentPermission)item;
     143        if (item is JobPermission) {
     144          var hep = (JobPermission)item;
    145145          hep.GrantedUserId = ServiceLocator.Instance.CallHiveService((s) => s.GetUserIdByUsername(hep.GrantedUserName));
    146146          if (hep.GrantedUserId == Guid.Empty) {
    147147            throw new ArgumentException(string.Format("The user {0} was not found.", hep.GrantedUserName));
    148148          }
    149           ServiceLocator.Instance.CallHiveService((s) => s.GrantPermission(hep.HiveExperimentId, hep.GrantedUserId, hep.Permission));
     149          ServiceLocator.Instance.CallHiveService((s) => s.GrantPermission(hep.JobId, hep.GrantedUserId, hep.Permission));
    150150        }
    151151      } else {
    152         if (item is HiveExperiment)
    153           ServiceLocator.Instance.CallHiveService(s => s.UpdateHiveExperiment((HiveExperiment)item));
     152        if (item is Job)
     153          ServiceLocator.Instance.CallHiveService(s => s.UpdateHiveExperiment((Job)item));
    154154      }
    155155    }
     
    176176        return;
    177177
    178       if (item is HiveExperiment)
     178      if (item is Job)
    179179        ServiceLocator.Instance.CallHiveService(s => s.DeleteHiveExperiment(item.Id));
    180180      if (item is RefreshableHiveExperiment)
    181181        ServiceLocator.Instance.CallHiveService(s => s.DeleteHiveExperiment(item.Id));
    182       if (item is HiveExperimentPermission) {
    183         var hep = (HiveExperimentPermission)item;
    184         ServiceLocator.Instance.CallHiveService(s => s.RevokePermission(hep.HiveExperimentId, hep.GrantedUserId));
     182      if (item is JobPermission) {
     183        var hep = (JobPermission)item;
     184        ServiceLocator.Instance.CallHiveService(s => s.RevokePermission(hep.JobId, hep.GrantedUserId));
    185185      }
    186186      item.Id = Guid.Empty;
     
    258258        }
    259259
    260         // upload HiveExperiment
    261         refreshableHiveExperiment.Progress.Status = "Uploading HiveExperiment...";
     260        // upload Job
     261        refreshableHiveExperiment.Progress.Status = "Uploading Job...";
    262262        refreshableHiveExperiment.HiveExperiment.Id = ServiceLocator.Instance.CallHiveService((s) => s.AddHiveExperiment(refreshableHiveExperiment.HiveExperiment));
    263263        bool isPrivileged = refreshableHiveExperiment.HiveExperiment.IsPrivileged;
     
    365365        cancellationToken.ThrowIfCancellationRequested();
    366366        hiveJob.Job.PluginsNeededIds.Add(configPluginId);
    367         hiveJob.Job.HiveExperimentId = hiveExperimentId;
     367        hiveJob.Job.JobId = hiveExperimentId;
    368368        hiveJob.Job.IsPrivileged = isPrivileged;
    369369
     
    506506    }
    507507
    508     public static HiveItemCollection<HiveExperimentPermission> GetHiveExperimentPermissions(Guid hiveExperimentId) {
     508    public static HiveItemCollection<JobPermission> GetHiveExperimentPermissions(Guid hiveExperimentId) {
    509509      return ServiceLocator.Instance.CallHiveService((service) => {
    510         IEnumerable<HiveExperimentPermission> heps = service.GetHiveExperimentPermissions(hiveExperimentId);
     510        IEnumerable<JobPermission> heps = service.GetHiveExperimentPermissions(hiveExperimentId);
    511511        foreach (var hep in heps) {
    512512          hep.GrantedUserName = service.GetUsernameByUserId(hep.GrantedUserId);
    513513        }
    514         return new HiveItemCollection<HiveExperimentPermission>(heps);
     514        return new HiveItemCollection<JobPermission>(heps);
    515515      });
    516516    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/RefreshableHiveExperiment.cs

    r6721 r6723  
    3535    private static object locker = new object();
    3636
    37     private HiveExperiment hiveExperiment;
    38     public HiveExperiment HiveExperiment {
     37    private Job hiveExperiment;
     38    public Job HiveExperiment {
    3939      get { return hiveExperiment; }
    4040      set {
     
    192192    public RefreshableHiveExperiment() {
    193193      this.refreshAutomatically = true;
    194       this.HiveExperiment = new HiveExperiment();
     194      this.HiveExperiment = new Job();
    195195      this.log = new ThreadSafeLog(new Log());
    196196      this.jobDownloader = new ConcurrentJobDownloader<ItemJob>(2, 2);
     
    198198      this.HiveJobs = new ItemCollection<HiveJob>();
    199199    }
    200     public RefreshableHiveExperiment(HiveExperiment hiveExperiment) {
     200    public RefreshableHiveExperiment(Job hiveExperiment) {
    201201      this.refreshAutomatically = true;
    202202      this.HiveExperiment = hiveExperiment;
     
    350350    #endregion
    351351
    352     #region HiveExperiment Events
     352    #region Job Events
    353353    private void RegisterHiveExperimentEvents() {
    354354      hiveExperiment.ToStringChanged += new EventHandler(OnToStringChanged);
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/ServiceClients/HiveExperiment.cs

    r6479 r6723  
    2525
    2626namespace HeuristicLab.Clients.Hive {
    27   public partial class HiveExperiment : IDeepCloneable, IContent {
     27  public partial class Job : IDeepCloneable, IContent {
    2828
    2929    private bool isPrivileged;
     
    3434
    3535    #region Constructors and Cloning
    36     public HiveExperiment() {
     36    public Job() {
    3737      this.ResourceNames = "HEAL";
    3838      this.DateCreated = DateTime.Now;
     
    4040    }
    4141
    42     protected HiveExperiment(HiveExperiment original, Cloner cloner) {
     42    protected Job(Job original, Cloner cloner) {
    4343      cloner.RegisterClonedObject(original, this);
    4444      this.OwnerUserId = original.OwnerUserId;
     
    5353    }
    5454    public override IDeepCloneable Clone(Cloner cloner) {
    55       return new HiveExperiment(this, cloner);
     55      return new Job(this, cloner);
    5656    }
    5757    #endregion
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/ServiceClients/HiveExperimentPermission.cs

    r6479 r6723  
    2424
    2525namespace HeuristicLab.Clients.Hive {
    26   public partial class HiveExperimentPermission : IDeepCloneable, IContent {
     26  public partial class JobPermission : IDeepCloneable, IContent {
    2727
    2828    private string grantedUserName;
     
    3838
    3939    #region Constructors and Cloning
    40     public HiveExperimentPermission() {
     40    public JobPermission() {
    4141      this.Permission = Permission.Read;
    4242      this.PropertyChanged += new PropertyChangedEventHandler(HiveExperimentPermission_PropertyChanged);
    4343    }
    4444
    45     protected HiveExperimentPermission(HiveExperimentPermission original, Cloner cloner)
     45    protected JobPermission(JobPermission original, Cloner cloner)
    4646      : base(original, cloner) {
    4747      this.GrantedByUserId = original.GrantedByUserId;
    4848      this.GrantedUserId = original.GrantedUserId;
    49       this.HiveExperimentId = original.HiveExperimentId;
     49      this.JobId = original.JobId;
    5050      this.Permission = original.Permission;
    5151    }
    5252    public override IDeepCloneable Clone(Cloner cloner) {
    53       return new HiveExperimentPermission(this, cloner);
     53      return new JobPermission(this, cloner);
    5454    }
    5555    #endregion
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/ServiceClients/HiveServiceClient.cs

    r6721 r6723  
    2020  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Task))]
    2121  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Downtime))]
    22   [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.HiveExperimentPermission))]
     22  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.JobPermission))]
    2323  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.PluginData))]
    2424  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.NamedHiveItem))]
    25   [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.HiveExperiment))]
     25  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Job))]
    2626  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Plugin))]
    2727  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Resource))]
     
    281281
    282282    [System.Runtime.Serialization.OptionalFieldAttribute()]
    283     private System.Guid HiveExperimentIdField;
    284 
    285     [System.Runtime.Serialization.OptionalFieldAttribute()]
    286283    private bool IsParentJobField;
    287284
    288285    [System.Runtime.Serialization.OptionalFieldAttribute()]
    289286    private bool IsPrivilegedField;
     287
     288    [System.Runtime.Serialization.OptionalFieldAttribute()]
     289    private System.Guid JobIdField;
    290290
    291291    [System.Runtime.Serialization.OptionalFieldAttribute()]
     
    328328
    329329    [System.Runtime.Serialization.DataMemberAttribute()]
    330     public System.Guid HiveExperimentId {
    331       get {
    332         return this.HiveExperimentIdField;
    333       }
    334       set {
    335         if ((this.HiveExperimentIdField.Equals(value) != true)) {
    336           this.HiveExperimentIdField = value;
    337           this.RaisePropertyChanged("HiveExperimentId");
    338         }
    339       }
    340     }
    341 
    342     [System.Runtime.Serialization.DataMemberAttribute()]
    343330    public bool IsParentJob {
    344331      get {
     
    367354
    368355    [System.Runtime.Serialization.DataMemberAttribute()]
     356    public System.Guid JobId {
     357      get {
     358        return this.JobIdField;
     359      }
     360      set {
     361        if ((this.JobIdField.Equals(value) != true)) {
     362          this.JobIdField = value;
     363          this.RaisePropertyChanged("JobId");
     364        }
     365      }
     366    }
     367
     368    [System.Runtime.Serialization.DataMemberAttribute()]
    369369    public System.Nullable<System.DateTime> LastHeartbeat {
    370370      get {
     
    524524  [System.Diagnostics.DebuggerStepThroughAttribute()]
    525525  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    526   [System.Runtime.Serialization.DataContractAttribute(Name = "HiveExperimentPermission", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]
     526  [System.Runtime.Serialization.DataContractAttribute(Name = "JobPermission", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]
    527527  [System.SerializableAttribute()]
    528   public partial class HiveExperimentPermission : HeuristicLab.Clients.Hive.HiveItem {
     528  public partial class JobPermission : HeuristicLab.Clients.Hive.HiveItem {
    529529
    530530    [System.Runtime.Serialization.OptionalFieldAttribute()]
     
    535535
    536536    [System.Runtime.Serialization.OptionalFieldAttribute()]
    537     private System.Guid HiveExperimentIdField;
     537    private System.Guid JobIdField;
    538538
    539539    [System.Runtime.Serialization.OptionalFieldAttribute()]
     
    567567
    568568    [System.Runtime.Serialization.DataMemberAttribute()]
    569     public System.Guid HiveExperimentId {
    570       get {
    571         return this.HiveExperimentIdField;
    572       }
    573       set {
    574         if ((this.HiveExperimentIdField.Equals(value) != true)) {
    575           this.HiveExperimentIdField = value;
    576           this.RaisePropertyChanged("HiveExperimentId");
     569    public System.Guid JobId {
     570      get {
     571        return this.JobIdField;
     572      }
     573      set {
     574        if ((this.JobIdField.Equals(value) != true)) {
     575          this.JobIdField = value;
     576          this.RaisePropertyChanged("JobId");
    577577        }
    578578      }
     
    652652  [System.Runtime.Serialization.DataContractAttribute(Name = "NamedHiveItem", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]
    653653  [System.SerializableAttribute()]
    654   [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.HiveExperiment))]
     654  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Job))]
    655655  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Plugin))]
    656656  [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Resource))]
     
    694694  [System.Diagnostics.DebuggerStepThroughAttribute()]
    695695  [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    696   [System.Runtime.Serialization.DataContractAttribute(Name = "HiveExperiment", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]
     696  [System.Runtime.Serialization.DataContractAttribute(Name = "Job", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.DataTransfer")]
    697697  [System.SerializableAttribute()]
    698   public partial class HiveExperiment : HeuristicLab.Clients.Hive.NamedHiveItem {
     698  public partial class Job : HeuristicLab.Clients.Hive.NamedHiveItem {
    699699
    700700    [System.Runtime.Serialization.OptionalFieldAttribute()]
     
    16481648
    16491649    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetHiveExperiment", ReplyAction = "http://tempuri.org/IHiveService/GetHiveExperimentResponse")]
    1650     HeuristicLab.Clients.Hive.HiveExperiment GetHiveExperiment(System.Guid id);
     1650    HeuristicLab.Clients.Hive.Job GetHiveExperiment(System.Guid id);
    16511651
    16521652    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetHiveExperiments", ReplyAction = "http://tempuri.org/IHiveService/GetHiveExperimentsResponse")]
    1653     System.Collections.Generic.List<HeuristicLab.Clients.Hive.HiveExperiment> GetHiveExperiments();
     1653    System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetHiveExperiments();
    16541654
    16551655    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetAllHiveExperiments", ReplyAction = "http://tempuri.org/IHiveService/GetAllHiveExperimentsResponse")]
    1656     System.Collections.Generic.List<HeuristicLab.Clients.Hive.HiveExperiment> GetAllHiveExperiments();
     1656    System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetAllHiveExperiments();
    16571657
    16581658    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/AddHiveExperiment", ReplyAction = "http://tempuri.org/IHiveService/AddHiveExperimentResponse")]
    1659     System.Guid AddHiveExperiment(HeuristicLab.Clients.Hive.HiveExperiment hiveExperimentDto);
     1659    System.Guid AddHiveExperiment(HeuristicLab.Clients.Hive.Job hiveExperimentDto);
    16601660
    16611661    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/UpdateHiveExperiment", ReplyAction = "http://tempuri.org/IHiveService/UpdateHiveExperimentResponse")]
    1662     void UpdateHiveExperiment(HeuristicLab.Clients.Hive.HiveExperiment hiveExperimentDto);
     1662    void UpdateHiveExperiment(HeuristicLab.Clients.Hive.Job hiveExperimentDto);
    16631663
    16641664    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/DeleteHiveExperiment", ReplyAction = "http://tempuri.org/IHiveService/DeleteHiveExperimentResponse")]
     
    16721672
    16731673    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/GetHiveExperimentPermissions", ReplyAction = "http://tempuri.org/IHiveService/GetHiveExperimentPermissionsResponse")]
    1674     System.Collections.Generic.List<HeuristicLab.Clients.Hive.HiveExperimentPermission> GetHiveExperimentPermissions(System.Guid hiveExperimentId);
     1674    System.Collections.Generic.List<HeuristicLab.Clients.Hive.JobPermission> GetHiveExperimentPermissions(System.Guid hiveExperimentId);
    16751675
    16761676    [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IHiveService/IsAllowedPrivileged", ReplyAction = "http://tempuri.org/IHiveService/IsAllowedPrivilegedResponse")]
     
    18741874    }
    18751875
    1876     public HeuristicLab.Clients.Hive.HiveExperiment GetHiveExperiment(System.Guid id) {
     1876    public HeuristicLab.Clients.Hive.Job GetHiveExperiment(System.Guid id) {
    18771877      return base.Channel.GetHiveExperiment(id);
    18781878    }
    18791879
    1880     public System.Collections.Generic.List<HeuristicLab.Clients.Hive.HiveExperiment> GetHiveExperiments() {
     1880    public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetHiveExperiments() {
    18811881      return base.Channel.GetHiveExperiments();
    18821882    }
    18831883
    1884     public System.Collections.Generic.List<HeuristicLab.Clients.Hive.HiveExperiment> GetAllHiveExperiments() {
     1884    public System.Collections.Generic.List<HeuristicLab.Clients.Hive.Job> GetAllHiveExperiments() {
    18851885      return base.Channel.GetAllHiveExperiments();
    18861886    }
    18871887
    1888     public System.Guid AddHiveExperiment(HeuristicLab.Clients.Hive.HiveExperiment hiveExperimentDto) {
     1888    public System.Guid AddHiveExperiment(HeuristicLab.Clients.Hive.Job hiveExperimentDto) {
    18891889      return base.Channel.AddHiveExperiment(hiveExperimentDto);
    18901890    }
    18911891
    1892     public void UpdateHiveExperiment(HeuristicLab.Clients.Hive.HiveExperiment hiveExperimentDto) {
     1892    public void UpdateHiveExperiment(HeuristicLab.Clients.Hive.Job hiveExperimentDto) {
    18931893      base.Channel.UpdateHiveExperiment(hiveExperimentDto);
    18941894    }
     
    19061906    }
    19071907
    1908     public System.Collections.Generic.List<HeuristicLab.Clients.Hive.HiveExperimentPermission> GetHiveExperimentPermissions(System.Guid hiveExperimentId) {
     1908    public System.Collections.Generic.List<HeuristicLab.Clients.Hive.JobPermission> GetHiveExperimentPermissions(System.Guid hiveExperimentId) {
    19091909      return base.Channel.GetHiveExperimentPermissions(hiveExperimentId);
    19101910    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/ServiceClients/Task.cs

    r6721 r6723  
    3838      this.IsParentJob = original.IsParentJob;
    3939      this.FinishWhenChildJobsFinished = original.FinishWhenChildJobsFinished;
    40       this.HiveExperimentId = original.HiveExperimentId;
     40      this.JobId = original.JobId;
    4141      this.IsPrivileged = original.IsPrivileged;
    4242    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.3/Util/PluginUtil.cs

    r6452 r6723  
    3636    /// <param name="service">An active service-proxy</param>
    3737    /// <param name="onlinePlugins">List of plugins which are available online</param>
    38     /// <param name="alreadyUploadedPlugins">List of plugins which have been uploaded from this HiveExperiment</param>
     38    /// <param name="alreadyUploadedPlugins">List of plugins which have been uploaded from this Job</param>
    3939    /// <param name="neededPlugins">List of plugins which need to be uploaded</param>
    4040    /// <returns></returns>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.3/HiveEngine.cs

    r6721 r6723  
    7373    }
    7474
    75     // HiveExperiment can't be storable, so RefreshableHiveExperiment can't be stored. But as previous runs are only informative it does not matter (only execution time on hive will be wrong because of that -> Todo)
     75    // Job can't be storable, so RefreshableHiveExperiment can't be stored. But as previous runs are only informative it does not matter (only execution time on hive will be wrong because of that -> Todo)
    7676    private ItemCollection<RefreshableHiveExperiment> hiveExperiments = new ItemCollection<RefreshableHiveExperiment>();
    7777    public ItemCollection<RefreshableHiveExperiment> HiveExperiments {
     
    296296    private RefreshableHiveExperiment CreateHiveExperiment() {
    297297      lock (locker) {
    298         var hiveExperiment = new HiveExperiment();
     298        var hiveExperiment = new Job();
    299299        hiveExperiment.Name = "HiveEngine Run " + hiveExperiments.Count;
    300300        hiveExperiment.DateCreated = DateTime.Now;
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml

    r6721 r6723  
    7171      <Column Name="FinishWhenChildJobsFinished" Type="System.Boolean" DbType="Bit" CanBeNull="false" />
    7272      <Column Name="Command" Type="global::HeuristicLab.Services.Hive.DataAccess.Command?" DbType="VarChar(30)" CanBeNull="true" />
    73       <Column Name="HiveExperimentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
     73      <Column Name="JobId" Storage="_HiveExperimentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
    7474      <Column Name="IsPrivileged" Type="System.Boolean" DbType="Bit" CanBeNull="false" />
    7575      <Association Name="Task_AssignedResource" Member="AssignedResources" ThisKey="TaskId" OtherKey="TaskId" Type="AssignedResource" />
     
    7979      <Association Name="Task_StateLog" Member="StateLogs" ThisKey="TaskId" OtherKey="TaskId" Type="StateLog" />
    8080      <Association Name="Task_Task" Member="ParentJob" Storage="_Job1" ThisKey="ParentTaskId" OtherKey="TaskId" Type="Task" IsForeignKey="true" />
    81       <Association Name="HiveExperiment_Task" Member="HiveExperiment" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="HiveExperiment" IsForeignKey="true" />
     81      <Association Name="HiveExperiment_Task" Member="Job" Storage="_HiveExperiment" ThisKey="JobId" OtherKey="JobId" Type="Job" IsForeignKey="true" />
    8282    </Type>
    8383  </Table>
     
    9494    </Type>
    9595  </Table>
    96   <Table Name="dbo.HiveExperiment" Member="HiveExperiments">
    97     <Type Name="HiveExperiment">
    98       <Column Name="HiveExperimentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
     96  <Table Name="dbo.Job" Member="Jobs">
     97    <Type Name="Job">
     98      <Column Name="JobId" Storage="_HiveExperimentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
    9999      <Column Name="Name" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" />
    100100      <Column Name="Description" Type="System.String" DbType="VarChar(MAX)" CanBeNull="true" />
     
    104104      <Column Name="LastAccessed" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
    105105      <Column Name="IsHiveEngine" Type="System.Boolean" DbType="Bit" CanBeNull="false" />
    106       <Association Name="HiveExperiment_Task" Member="Tasks" Storage="_Jobs" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="Task" />
    107       <Association Name="HiveExperiment_HiveExperimentPermission" Member="HiveExperimentPermissions" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="HiveExperimentPermission" />
     106      <Association Name="HiveExperiment_Task" Member="Tasks" Storage="_Jobs" ThisKey="JobId" OtherKey="JobId" Type="Task" />
     107      <Association Name="HiveExperiment_HiveExperimentPermission" Member="JobPermissions" Storage="_HiveExperimentPermissions" ThisKey="JobId" OtherKey="JobId" Type="JobPermission" />
    108108    </Type>
    109109  </Table>
     
    138138    </Type>
    139139  </Table>
    140   <Table Name="dbo.HiveExperimentPermission" Member="HiveExperimentPermissions">
    141     <Type Name="HiveExperimentPermission">
    142       <Column Name="HiveExperimentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
     140  <Table Name="dbo.JobPermission" Member="JobPermissions">
     141    <Type Name="JobPermission">
     142      <Column Name="JobId" Storage="_HiveExperimentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    143143      <Column Name="GrantedUserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    144144      <Column Name="GrantedByUserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
    145145      <Column Name="Permission" Type="global::HeuristicLab.Services.Hive.DataAccess.Permission" DbType="VarChar(15) NOT NULL" CanBeNull="false" />
    146       <Association Name="HiveExperiment_HiveExperimentPermission" Member="HiveExperiment" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="HiveExperiment" IsForeignKey="true" />
     146      <Association Name="HiveExperiment_HiveExperimentPermission" Member="Job" Storage="_HiveExperiment" ThisKey="JobId" OtherKey="JobId" Type="Job" IsForeignKey="true" />
    147147    </Type>
    148148  </Table>
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml.layout

    r6721 r6723  
    4040    </classShape>
    4141    <classShape Id="e6f840cc-2968-4be1-b234-eef624ccacbb" absoluteBounds="4.125, 2.625, 2, 2.3478011067708326">
    42       <DataClassMoniker Name="/HiveDataContext/HiveExperiment" />
     42      <DataClassMoniker Name="/HiveDataContext/Job" />
    4343      <nestedChildShapes>
    4444        <elementListCompartment Id="0c65d4e1-256a-4a91-9a57-392f25e4de7f" absoluteBounds="4.1400000000000006, 3.0850000000000009, 1.9700000000000002, 1.7878011067708333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     
    116116    </classShape>
    117117    <classShape Id="4d800dc9-1b18-469f-b02c-d4554757c5e1" absoluteBounds="1.75, 3.625, 2, 1.5785953776041666">
    118       <DataClassMoniker Name="/HiveDataContext/HiveExperimentPermission" />
     118      <DataClassMoniker Name="/HiveDataContext/JobPermission" />
    119119      <nestedChildShapes>
    120120        <elementListCompartment Id="dedd97d3-a9a2-45a2-9b95-d7366fb65a7f" absoluteBounds="1.765, 4.085, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     
    129129    </associationConnector>
    130130    <associationConnector edgePoints="[(4.125 : 4.29890055338542); (3.75 : 4.29890055338542)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    131       <AssociationMoniker Name="/HiveDataContext/HiveExperiment/HiveExperiment_HiveExperimentPermission" />
     131      <AssociationMoniker Name="/HiveDataContext/Job/HiveExperiment_HiveExperimentPermission" />
    132132      <nodes>
    133133        <classShapeMoniker Id="e6f840cc-2968-4be1-b234-eef624ccacbb" />
     
    208208    </associationConnector>
    209209    <associationConnector edgePoints="[(6.125 : 3.46715413411458); (6.5 : 3.46715413411458)]" fixedFrom="NotFixed" fixedTo="NotFixed">
    210       <AssociationMoniker Name="/HiveDataContext/HiveExperiment/HiveExperiment_Task" />
     210      <AssociationMoniker Name="/HiveDataContext/Job/HiveExperiment_Task" />
    211211      <nodes>
    212212        <classShapeMoniker Id="e6f840cc-2968-4be1-b234-eef624ccacbb" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs

    r6721 r6723  
    4949    partial void UpdateDowntime(Downtime instance);
    5050    partial void DeleteDowntime(Downtime instance);
    51     partial void InsertHiveExperiment(HiveExperiment instance);
    52     partial void UpdateHiveExperiment(HiveExperiment instance);
    53     partial void DeleteHiveExperiment(HiveExperiment instance);
     51    partial void InsertJob(Job instance);
     52    partial void UpdateJob(Job instance);
     53    partial void DeleteJob(Job instance);
    5454    partial void InsertTaskData(TaskData instance);
    5555    partial void UpdateTaskData(TaskData instance);
     
    6161    partial void UpdateStateLog(StateLog instance);
    6262    partial void DeleteStateLog(StateLog instance);
    63     partial void InsertHiveExperimentPermission(HiveExperimentPermission instance);
    64     partial void UpdateHiveExperimentPermission(HiveExperimentPermission instance);
    65     partial void DeleteHiveExperimentPermission(HiveExperimentPermission instance);
     63    partial void InsertJobPermission(JobPermission instance);
     64    partial void UpdateJobPermission(JobPermission instance);
     65    partial void DeleteJobPermission(JobPermission instance);
    6666    partial void InsertLifecycle(Lifecycle instance);
    6767    partial void UpdateLifecycle(Lifecycle instance);
     
    159159    }
    160160   
    161     public System.Data.Linq.Table<HiveExperiment> HiveExperiments
    162     {
    163       get
    164       {
    165         return this.GetTable<HiveExperiment>();
     161    public System.Data.Linq.Table<Job> Jobs
     162    {
     163      get
     164      {
     165        return this.GetTable<Job>();
    166166      }
    167167    }
     
    191191    }
    192192   
    193     public System.Data.Linq.Table<HiveExperimentPermission> HiveExperimentPermissions
    194     {
    195       get
    196       {
    197         return this.GetTable<HiveExperimentPermission>();
     193    public System.Data.Linq.Table<JobPermission> JobPermissions
     194    {
     195      get
     196      {
     197        return this.GetTable<JobPermission>();
    198198      }
    199199    }
     
    14901490    private EntityRef<Task> _Job1;
    14911491   
    1492     private EntityRef<HiveExperiment> _HiveExperiment;
     1492    private EntityRef<Job> _HiveExperiment;
    14931493   
    14941494    #region Extensibility Method Definitions
     
    15181518    partial void OnCommandChanging(global::HeuristicLab.Services.Hive.DataAccess.Command? value);
    15191519    partial void OnCommandChanged();
    1520     partial void OnHiveExperimentIdChanging(System.Guid value);
    1521     partial void OnHiveExperimentIdChanged();
     1520    partial void OnJobIdChanging(System.Guid value);
     1521    partial void OnJobIdChanged();
    15221522    partial void OnIsPrivilegedChanging(bool value);
    15231523    partial void OnIsPrivilegedChanged();
     
    15321532      this._StateLogs = new EntitySet<StateLog>(new Action<StateLog>(this.attach_StateLogs), new Action<StateLog>(this.detach_StateLogs));
    15331533      this._Job1 = default(EntityRef<Task>);
    1534       this._HiveExperiment = default(EntityRef<HiveExperiment>);
     1534      this._HiveExperiment = default(EntityRef<Job>);
    15351535      OnCreated();
    15361536    }
     
    17611761   
    17621762    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HiveExperimentId", DbType="UniqueIdentifier NOT NULL")]
    1763     public System.Guid HiveExperimentId
     1763    public System.Guid JobId
    17641764    {
    17651765      get
     
    17751775            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
    17761776          }
    1777           this.OnHiveExperimentIdChanging(value);
     1777          this.OnJobIdChanging(value);
    17781778          this.SendPropertyChanging();
    17791779          this._HiveExperimentId = value;
    1780           this.SendPropertyChanged("HiveExperimentId");
    1781           this.OnHiveExperimentIdChanged();
     1780          this.SendPropertyChanged("JobId");
     1781          this.OnJobIdChanged();
    17821782        }
    17831783      }
     
    19191919    }
    19201920   
    1921     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_Task", Storage="_HiveExperiment", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId", IsForeignKey=true)]
    1922     public HiveExperiment HiveExperiment
     1921    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_Task", Storage="_HiveExperiment", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true)]
     1922    public Job Job
    19231923    {
    19241924      get
     
    19281928      set
    19291929      {
    1930         HiveExperiment previousValue = this._HiveExperiment.Entity;
     1930        Job previousValue = this._HiveExperiment.Entity;
    19311931        if (((previousValue != value)
    19321932              || (this._HiveExperiment.HasLoadedOrAssignedValue == false)))
     
    19421942          {
    19431943            value.Tasks.Add(this);
    1944             this._HiveExperimentId = value.HiveExperimentId;
     1944            this._HiveExperimentId = value.JobId;
    19451945          }
    19461946          else
     
    19481948            this._HiveExperimentId = default(System.Guid);
    19491949          }
    1950           this.SendPropertyChanged("HiveExperiment");
     1950          this.SendPropertyChanged("Job");
    19511951        }
    19521952      }
     
    22692269  }
    22702270 
    2271   [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.HiveExperiment")]
    2272   public partial class HiveExperiment : INotifyPropertyChanging, INotifyPropertyChanged
     2271  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Job")]
     2272  public partial class Job : INotifyPropertyChanging, INotifyPropertyChanged
    22732273  {
    22742274   
     
    22932293    private EntitySet<Task> _Jobs;
    22942294   
    2295     private EntitySet<HiveExperimentPermission> _HiveExperimentPermissions;
     2295    private EntitySet<JobPermission> _HiveExperimentPermissions;
    22962296   
    22972297    #region Extensibility Method Definitions
     
    22992299    partial void OnValidate(System.Data.Linq.ChangeAction action);
    23002300    partial void OnCreated();
    2301     partial void OnHiveExperimentIdChanging(System.Guid value);
    2302     partial void OnHiveExperimentIdChanged();
     2301    partial void OnJobIdChanging(System.Guid value);
     2302    partial void OnJobIdChanged();
    23032303    partial void OnNameChanging(string value);
    23042304    partial void OnNameChanged();
     
    23172317    #endregion
    23182318   
    2319     public HiveExperiment()
     2319    public Job()
    23202320    {
    23212321      this._Jobs = new EntitySet<Task>(new Action<Task>(this.attach_Jobs), new Action<Task>(this.detach_Jobs));
    2322       this._HiveExperimentPermissions = new EntitySet<HiveExperimentPermission>(new Action<HiveExperimentPermission>(this.attach_HiveExperimentPermissions), new Action<HiveExperimentPermission>(this.detach_HiveExperimentPermissions));
     2322      this._HiveExperimentPermissions = new EntitySet<JobPermission>(new Action<JobPermission>(this.attach_HiveExperimentPermissions), new Action<JobPermission>(this.detach_HiveExperimentPermissions));
    23232323      OnCreated();
    23242324    }
    23252325   
    23262326    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HiveExperimentId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
    2327     public System.Guid HiveExperimentId
     2327    public System.Guid JobId
    23282328    {
    23292329      get
     
    23352335        if ((this._HiveExperimentId != value))
    23362336        {
    2337           this.OnHiveExperimentIdChanging(value);
     2337          this.OnJobIdChanging(value);
    23382338          this.SendPropertyChanging();
    23392339          this._HiveExperimentId = value;
    2340           this.SendPropertyChanged("HiveExperimentId");
    2341           this.OnHiveExperimentIdChanged();
     2340          this.SendPropertyChanged("JobId");
     2341          this.OnJobIdChanged();
    23422342        }
    23432343      }
     
    24842484    }
    24852485   
    2486     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_Task", Storage="_Jobs", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId")]
     2486    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_Task", Storage="_Jobs", ThisKey="JobId", OtherKey="JobId")]
    24872487    public EntitySet<Task> Tasks
    24882488    {
     
    24972497    }
    24982498   
    2499     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_HiveExperimentPermission", Storage="_HiveExperimentPermissions", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId")]
    2500     public EntitySet<HiveExperimentPermission> HiveExperimentPermissions
     2499    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_HiveExperimentPermission", Storage="_HiveExperimentPermissions", ThisKey="JobId", OtherKey="JobId")]
     2500    public EntitySet<JobPermission> JobPermissions
    25012501    {
    25022502      get
     
    25332533    {
    25342534      this.SendPropertyChanging();
    2535       entity.HiveExperiment = this;
     2535      entity.Job = this;
    25362536    }
    25372537   
     
    25392539    {
    25402540      this.SendPropertyChanging();
    2541       entity.HiveExperiment = null;
    2542     }
    2543    
    2544     private void attach_HiveExperimentPermissions(HiveExperimentPermission entity)
     2541      entity.Job = null;
     2542    }
     2543   
     2544    private void attach_HiveExperimentPermissions(JobPermission entity)
    25452545    {
    25462546      this.SendPropertyChanging();
    2547       entity.HiveExperiment = this;
    2548     }
    2549    
    2550     private void detach_HiveExperimentPermissions(HiveExperimentPermission entity)
     2547      entity.Job = this;
     2548    }
     2549   
     2550    private void detach_HiveExperimentPermissions(JobPermission entity)
    25512551    {
    25522552      this.SendPropertyChanging();
    2553       entity.HiveExperiment = null;
     2553      entity.Job = null;
    25542554    }
    25552555  }
     
    31693169  }
    31703170 
    3171   [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.HiveExperimentPermission")]
    3172   public partial class HiveExperimentPermission : INotifyPropertyChanging, INotifyPropertyChanged
     3171  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.JobPermission")]
     3172  public partial class JobPermission : INotifyPropertyChanging, INotifyPropertyChanged
    31733173  {
    31743174   
     
    31833183    private global::HeuristicLab.Services.Hive.DataAccess.Permission _Permission;
    31843184   
    3185     private EntityRef<HiveExperiment> _HiveExperiment;
     3185    private EntityRef<Job> _HiveExperiment;
    31863186   
    31873187    #region Extensibility Method Definitions
     
    31893189    partial void OnValidate(System.Data.Linq.ChangeAction action);
    31903190    partial void OnCreated();
    3191     partial void OnHiveExperimentIdChanging(System.Guid value);
    3192     partial void OnHiveExperimentIdChanged();
     3191    partial void OnJobIdChanging(System.Guid value);
     3192    partial void OnJobIdChanged();
    31933193    partial void OnGrantedUserIdChanging(System.Guid value);
    31943194    partial void OnGrantedUserIdChanged();
     
    31993199    #endregion
    32003200   
    3201     public HiveExperimentPermission()
    3202     {
    3203       this._HiveExperiment = default(EntityRef<HiveExperiment>);
     3201    public JobPermission()
     3202    {
     3203      this._HiveExperiment = default(EntityRef<Job>);
    32043204      OnCreated();
    32053205    }
    32063206   
    32073207    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HiveExperimentId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
    3208     public System.Guid HiveExperimentId
     3208    public System.Guid JobId
    32093209    {
    32103210      get
     
    32203220            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
    32213221          }
    3222           this.OnHiveExperimentIdChanging(value);
     3222          this.OnJobIdChanging(value);
    32233223          this.SendPropertyChanging();
    32243224          this._HiveExperimentId = value;
    3225           this.SendPropertyChanged("HiveExperimentId");
    3226           this.OnHiveExperimentIdChanged();
     3225          this.SendPropertyChanged("JobId");
     3226          this.OnJobIdChanged();
    32273227        }
    32283228      }
     
    32893289    }
    32903290   
    3291     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_HiveExperimentPermission", Storage="_HiveExperiment", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId", IsForeignKey=true)]
    3292     public HiveExperiment HiveExperiment
     3291    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_HiveExperimentPermission", Storage="_HiveExperiment", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true)]
     3292    public Job Job
    32933293    {
    32943294      get
     
    32983298      set
    32993299      {
    3300         HiveExperiment previousValue = this._HiveExperiment.Entity;
     3300        Job previousValue = this._HiveExperiment.Entity;
    33013301        if (((previousValue != value)
    33023302              || (this._HiveExperiment.HasLoadedOrAssignedValue == false)))
     
    33063306          {
    33073307            this._HiveExperiment.Entity = null;
    3308             previousValue.HiveExperimentPermissions.Remove(this);
     3308            previousValue.JobPermissions.Remove(this);
    33093309          }
    33103310          this._HiveExperiment.Entity = value;
    33113311          if ((value != null))
    33123312          {
    3313             value.HiveExperimentPermissions.Add(this);
    3314             this._HiveExperimentId = value.HiveExperimentId;
     3313            value.JobPermissions.Add(this);
     3314            this._HiveExperimentId = value.JobId;
    33153315          }
    33163316          else
     
    33183318            this._HiveExperimentId = default(System.Guid);
    33193319          }
    3320           this.SendPropertyChanged("HiveExperiment");
     3320          this.SendPropertyChanged("Job");
    33213321        }
    33223322      }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Initialize Hive Database.sql

    r6721 r6723  
    44SET ARITHABORT ON
    55CREATE TABLE [dbo].[AssignedResources](
    6   [ResourceId] UniqueIdentifier NOT NULL, 
     6  [ResourceId] UniqueIdentifier NOT NULL,
    77  [TaskId] UniqueIdentifier NOT NULL,   
    88  CONSTRAINT [PK_dbo.ResourceIdTaskId] PRIMARY KEY ([ResourceId], [TaskId])
     
    5454  [FinishWhenChildJobsFinished] Bit,
    5555  [Command] VarChar(30),
    56   [HiveExperimentId] UniqueIdentifier NOT NULL,
     56  [JobId] UniqueIdentifier NOT NULL,
    5757  [IsPrivileged] Bit,
    5858  CONSTRAINT [PK_dbo.Task] PRIMARY KEY ([TaskId])
     
    6868  CONSTRAINT [PK_dbo.Downtime] PRIMARY KEY ([DowntimeId])
    6969  )
    70 CREATE TABLE [dbo].[HiveExperiment](
    71   [HiveExperimentId] UniqueIdentifier NOT NULL,
     70CREATE TABLE [dbo].[Job](
     71  [JobId] UniqueIdentifier NOT NULL,
    7272  [Name] VarChar(MAX),
    7373  [Description] VarChar(MAX),
     
    7777  [LastAccessed] DateTime,
    7878  [IsHiveEngine] Bit,
    79   CONSTRAINT [PK_dbo.HiveExperiment] PRIMARY KEY ([HiveExperimentId])
     79  CONSTRAINT [PK_dbo.Job] PRIMARY KEY ([JobId])
    8080  )
    8181CREATE TABLE [dbo].[TaskData](
     
    102102  CONSTRAINT [PK_dbo.StateLog] PRIMARY KEY ([StateLogId])
    103103  )
    104 CREATE TABLE [dbo].[HiveExperimentPermission](
    105   [HiveExperimentId] UniqueIdentifier NOT NULL,
     104CREATE TABLE [dbo].[JobPermission](
     105  [JobId] UniqueIdentifier NOT NULL,
    106106  [GrantedUserId] UniqueIdentifier NOT NULL,
    107107  [GrantedByUserId] UniqueIdentifier NOT NULL,
    108108  [Permission] VarChar(15) NOT NULL,
    109   CONSTRAINT [PK_dbo.HiveExperimentPermission] PRIMARY KEY ([HiveExperimentId], [GrantedUserId])
     109  CONSTRAINT [PK_dbo.JobPermission] PRIMARY KEY ([JobId], [GrantedUserId])
    110110  )
    111111CREATE TABLE [Lifecycle](
     
    159159  ADD CONSTRAINT [Task_Task] FOREIGN KEY ([ParentTaskId]) REFERENCES [dbo].[Task]([TaskId])
    160160ALTER TABLE [dbo].[Task]
    161   ADD CONSTRAINT [HiveExperiment_Job] FOREIGN KEY ([HiveExperimentId]) REFERENCES [dbo].[HiveExperiment]([HiveExperimentId])
     161  ADD CONSTRAINT [Job_Job] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
    162162ALTER TABLE [dbo].[Downtime]
    163163  ADD CONSTRAINT [Resource_Downtime] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
     
    170170ALTER TABLE [dbo].[StateLog]
    171171  ADD CONSTRAINT [Resource_StateLog] FOREIGN KEY ([SlaveId]) REFERENCES [dbo].[Resource]([ResourceId])
    172 ALTER TABLE [dbo].[HiveExperimentPermission]
    173   ADD CONSTRAINT [HiveExperiment_HiveExperimentPermission] FOREIGN KEY ([HiveExperimentId]) REFERENCES [dbo].[HiveExperiment]([HiveExperimentId])
     172ALTER TABLE [dbo].[JobPermission]
     173  ADD CONSTRAINT [Job_JobPermission] FOREIGN KEY ([JobId]) REFERENCES [dbo].[Job]([JobId])
    174174ALTER TABLE [UserStatistics]
    175175  ADD CONSTRAINT [Statistics_UserStatistics] FOREIGN KEY ([StatisticsId]) REFERENCES [Statistics]([StatisticsId])
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Prepare Hive Database.sql

    r6721 r6723  
    7474ALTER TABLE dbo.Downtime WITH NOCHECK ADD CONSTRAINT [DF_Downtime_DowntimeId] DEFAULT (NEWSEQUENTIALID()) FOR DowntimeId;
    7575
    76 ALTER TABLE dbo.HiveExperiment ALTER COLUMN HiveExperimentId ADD ROWGUIDCOL;
    77 ALTER TABLE dbo.HiveExperiment WITH NOCHECK ADD CONSTRAINT [DF_HiveExperiment_HiveExperimentId] DEFAULT (NEWSEQUENTIALID()) FOR HiveExperimentId;
     76ALTER TABLE dbo.Job ALTER COLUMN JobId ADD ROWGUIDCOL;
     77ALTER TABLE dbo.Job WITH NOCHECK ADD CONSTRAINT [DF_Job_JobId] DEFAULT (NEWSEQUENTIALID()) FOR JobId;
    7878
    7979ALTER TABLE dbo.StateLog ALTER COLUMN StateLogId ADD ROWGUIDCOL;
    8080ALTER TABLE dbo.StateLog WITH NOCHECK ADD CONSTRAINT [DF_StateLog_StateLogId] DEFAULT (NEWSEQUENTIALID()) FOR StateLogId;
    8181
    82 ALTER TABLE [dbo].[HiveExperimentPermission]  DROP  CONSTRAINT [HiveExperiment_HiveExperimentPermission]
    83 ALTER TABLE [dbo].[HiveExperimentPermission]  WITH CHECK ADD CONSTRAINT [HiveExperiment_HiveExperimentPermission] FOREIGN KEY([HiveExperimentId])
    84 REFERENCES [dbo].[HiveExperiment] ([HiveExperimentId])
     82ALTER TABLE [dbo].[JobPermission]  DROP  CONSTRAINT [Job_JobPermission]
     83ALTER TABLE [dbo].[JobPermission]  WITH CHECK ADD CONSTRAINT [Job_JobPermission] FOREIGN KEY([JobId])
     84REFERENCES [dbo].[Job] ([JobId])
    8585ON UPDATE CASCADE
    8686ON DELETE CASCADE
     
    161161/* triggers */
    162162GO
    163 /****** Object:  Trigger [dbo].[tr_HiveExperimentDeleteCascade]    Script Date: 04/19/2011 16:31:53 ******/
     163/****** Object:  Trigger [dbo].[tr_JobDeleteCascade]    Script Date: 04/19/2011 16:31:53 ******/
    164164SET ANSI_NULLS ON
    165165GO
     
    174174--              is not compatible with cascading deletes.
    175175-- =============================================
    176 CREATE TRIGGER [dbo].[tr_HiveExperimentDeleteCascade] ON [dbo].[HiveExperiment] INSTEAD OF DELETE AS
     176CREATE TRIGGER [dbo].[tr_JobDeleteCascade] ON [dbo].[Job] INSTEAD OF DELETE AS
    177177BEGIN
    178   DELETE Task FROM deleted, Task WHERE deleted.HiveExperimentId = Task.HiveExperimentId
    179   DELETE HiveExperiment FROM deleted, HiveExperiment WHERE deleted.HiveExperimentId = HiveExperiment.HiveExperimentId
     178  DELETE Task FROM deleted, Task WHERE deleted.JobId = Task.JobId
     179  DELETE Job FROM deleted, Job WHERE deleted.JobId = Job.JobId
    180180END
    181181GO
     
    186186-- Description: Recursively deletes all child-jobs of a job when it is deleted. (Source: http://devio.wordpress.com/2008/05/23/recursive-delete-in-sql-server/)
    187187-- =============================================
    188 CREATE TRIGGER [dbo].[tr_JobDeleteCascade] ON [dbo].[Task] INSTEAD OF DELETE AS
     188CREATE TRIGGER [dbo].[tr_TaskDeleteCascade] ON [dbo].[Task] INSTEAD OF DELETE AS
    189189BEGIN
    190190  -- add statistics
     
    197197  FROM
    198198    deleted j,
    199     HiveExperiment he,
     199    Job he,
    200200    view_FirstState fs,
    201201    view_LastState ls
    202202  WHERE
    203     he.HiveExperimentId = j.HiveExperimentId AND
     203    he.JobId = j.JobId AND
    204204    fs.TaskId = j.TaskId AND
    205205    ls.TaskId = j.TaskId
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Query Jobs.sql

    r6721 r6723  
    1616      ,j.[FinishWhenChildJobsFinished]
    1717      ,j.[ParentTaskId]
    18       , he.HiveExperimentId
     18      , he.JobId
    1919  FROM
    2020  [HeuristicLab.Hive-3.3].[dbo].[Task] j
    21   ,[HeuristicLab.Hive-3.3].[dbo].[HiveExperiment] he
     21  ,[HeuristicLab.Hive-3.3].[dbo].[Job] he
    2222  ,[HeuristicLab.Authentication].dbo.aspnet_Users u
    2323  ,[HeuristicLab.Hive-3.3].dbo.TaskData jd
    2424  WHERE
    25   j.HiveExperimentId = he.HiveExperimentId
     25  j.JobId = he.JobId
    2626  AND j.TaskId = jd.TaskId
    2727  AND he.OwnerUserId = u.UserId
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs

    r6721 r6723  
    4444      IHiveDao dao = ServiceLocator.Instance.HiveDao;
    4545
    46       DT.HiveExperiment he = new DT.HiveExperiment();
     46      DT.Job he = new DT.Job();
    4747      he.DateCreated = DateTime.Now;
    4848      he.Name = "TestExperiment";
     
    5555      job1.StateLog.Add(new DT.StateLog { State = DT.TaskState.Offline, DateTime = DateTime.Now });
    5656      job1.Command = DT.Command.Pause;
    57       job1.HiveExperimentId = he.Id;
     57      job1.JobId = he.Id;
    5858      job1.IsPrivileged = true;
    5959
     
    9292      Assert.AreEqual(job1.StateLog.Count, job1loaded.StateLog.Count);
    9393      Assert.AreEqual(job1.Command, job1loaded.Command);
    94       Assert.AreEqual(job1.HiveExperimentId, job1loaded.HiveExperimentId);
     94      Assert.AreEqual(job1.JobId, job1loaded.JobId);
    9595      Assert.AreEqual(job1.IsPrivileged, job1loaded.IsPrivileged);
    9696      Assert.IsTrue(Math.Abs((job1loaded.LastJobDataUpdate - jobData1.LastUpdate).TotalSeconds) < 1);
     
    215215      IHiveDao dao = ServiceLocator.Instance.HiveDao;
    216216
    217       DT.HiveExperiment he = new DT.HiveExperiment();
     217      DT.Job he = new DT.Job();
    218218      he.DateCreated = DateTime.Now;
    219219      he.Name = "TestExperiment";
     
    225225      job.State = DT.TaskState.Offline;
    226226      job.StateLog.Add(new DT.StateLog { State = DT.TaskState.Offline, DateTime = DateTime.Now });
    227       job.HiveExperimentId = he.Id;
     227      job.JobId = he.Id;
    228228      job.Id = dao.AddJob(job);
    229229
    230       DT.HiveExperimentPermission perm = new DT.HiveExperimentPermission();
    231       perm.HiveExperimentId = he.Id;
     230      DT.JobPermission perm = new DT.JobPermission();
     231      perm.JobId = he.Id;
    232232      perm.GrantedByUserId = he.OwnerUserId;
    233233      perm.GrantedUserId = Guid.NewGuid();
     
    235235      dao.AddHiveExperimentPermission(perm);
    236236
    237       DT.HiveExperiment heLoaded = dao.GetHiveExperiment(he.Id);
     237      DT.Job heLoaded = dao.GetHiveExperiment(he.Id);
    238238      Assert.AreEqual(he.Id, heLoaded.Id);
    239239      Assert.AreEqual(he.Name, heLoaded.Name);
     
    245245      Assert.AreEqual(job.Id, jobLoaded.Id);
    246246      Assert.AreEqual(job.State, jobLoaded.State);
    247       Assert.AreEqual(job.HiveExperimentId, jobLoaded.HiveExperimentId);
    248 
    249       DT.HiveExperimentPermission permLoaded = dao.GetHiveExperimentPermission(he.Id, perm.GrantedUserId);
    250       Assert.AreEqual(perm.HiveExperimentId, permLoaded.HiveExperimentId);
     247      Assert.AreEqual(job.JobId, jobLoaded.JobId);
     248
     249      DT.JobPermission permLoaded = dao.GetHiveExperimentPermission(he.Id, perm.GrantedUserId);
     250      Assert.AreEqual(perm.JobId, permLoaded.JobId);
    251251      Assert.AreEqual(perm.GrantedUserId, permLoaded.GrantedUserId);
    252252      Assert.AreEqual(perm.GrantedByUserId, permLoaded.GrantedByUserId);
     
    256256      Assert.AreEqual(null, dao.GetHiveExperiment(he.Id));
    257257      Assert.AreEqual(null, dao.GetJob(job.Id));
    258       Assert.AreEqual(null, dao.GetHiveExperimentPermission(perm.HiveExperimentId, perm.GrantedUserId));
     258      Assert.AreEqual(null, dao.GetHiveExperimentPermission(perm.JobId, perm.GrantedUserId));
    259259
    260260    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs

    r6721 r6723  
    4949
    5050      // create hive experiment
    51       DT.HiveExperiment experiment = new DT.HiveExperiment() { Name = "TestExperiment", Description = "" };
     51      DT.Job experiment = new DT.Job() { Name = "TestExperiment", Description = "" };
    5252
    5353      // create job
     
    101101
    102102      // add job
    103       job.HiveExperimentId = experiment.Id;
     103      job.JobId = experiment.Id;
    104104      job.Id = service.AddJob(job, jobData, new List<Guid> { slave.Id });
    105105
     
    112112      Assert.AreEqual(DT.TaskState.Waiting, jobLoaded.State);
    113113      Assert.IsTrue(job.PluginsNeededIds.SequenceEqual(jobLoaded.PluginsNeededIds));
    114       Assert.AreEqual(job.HiveExperimentId, jobLoaded.HiveExperimentId);
     114      Assert.AreEqual(job.JobId, jobLoaded.JobId);
    115115
    116116      DT.TaskData jobDataLoaded = service.GetJobData(job.Id);
     
    119119
    120120      // test hive experiment
    121       DT.HiveExperiment experimentLoaded = service.GetHiveExperiment(experiment.Id);
     121      DT.Job experimentLoaded = service.GetHiveExperiment(experiment.Id);
    122122      Assert.AreEqual(experiment.Id, experimentLoaded.Id);
    123123      Assert.AreEqual(experiment.Name, experimentLoaded.Name);
     
    201201
    202202      // create hive experiment
    203       DT.HiveExperiment experiment = new DT.HiveExperiment() { Name = "TestExperiment", Description = "" };
     203      DT.Job experiment = new DT.Job() { Name = "TestExperiment", Description = "" };
    204204
    205205      // create parent job
     
    244244
    245245      // add parent job
    246       parentJob.HiveExperimentId = experiment.Id;
     246      parentJob.JobId = experiment.Id;
    247247      parentJob.Id = service.AddJob(parentJob, parentJobData, new List<Guid> { slave.Id });
    248248
    249249      // add child job
    250       childJob.HiveExperimentId = experiment.Id;
     250      childJob.JobId = experiment.Id;
    251251      childJob.Id = service.AddChildJob(parentJob.Id, childJob, childJobData);
    252252      childJob.ParentTaskId = parentJob.Id;
     
    255255      var childJobLoaded = service.GetJob(childJob.Id);
    256256      Assert.AreEqual(childJob.ParentTaskId, childJobLoaded.ParentTaskId);
    257       Assert.AreEqual(childJob.HiveExperimentId, childJobLoaded.HiveExperimentId);
     257      Assert.AreEqual(childJob.JobId, childJobLoaded.JobId);
    258258      Assert.AreEqual(DT.TaskState.Waiting, childJobLoaded.State);
    259259      Assert.AreEqual(false, childJobLoaded.FinishWhenChildJobsFinished);
     
    262262      // test parent job
    263263      var parentJobLoaded = service.GetJob(parentJob.Id);
    264       Assert.AreEqual(parentJob.HiveExperimentId, parentJobLoaded.HiveExperimentId);
     264      Assert.AreEqual(parentJob.JobId, parentJobLoaded.JobId);
    265265      Assert.AreEqual(TaskState.Waiting, parentJobLoaded.State);
    266266      Assert.AreEqual(true, parentJobLoaded.FinishWhenChildJobsFinished);
     
    304304
    305305      // create hive experiment
    306       DT.HiveExperiment e1 = new DT.HiveExperiment() { Name = "TestExperiment", Description = "" };
     306      DT.Job e1 = new DT.Job() { Name = "TestExperiment", Description = "" };
    307307      e1.Id = service.AddHiveExperiment(e1);
    308308
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Convert.cs

    r6721 r6723  
    4848        Command = Convert.ToDto(source.Command),
    4949        LastJobDataUpdate = (source.JobData == null ? DateTime.MinValue : source.JobData.LastUpdate),
    50         HiveExperimentId = source.HiveExperimentId,
     50        JobId = source.JobId,
    5151        IsPrivileged = source.IsPrivileged
    5252      };
     
    7676        target.Command = Convert.ToEntity(source.Command);
    7777        // RequiredPlugins are added by Dao
    78         target.HiveExperimentId = source.HiveExperimentId;
     78        target.JobId = source.JobId;
    7979        target.IsPrivileged = source.IsPrivileged;
    8080      }
     
    134134
    135135    #region HiveExperiment
    136     public static DT.HiveExperiment ToDto(DB.HiveExperiment source) {
    137       if (source == null) return null;
    138       return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds, LastAccessed = source.LastAccessed };
    139     }
    140     public static DB.HiveExperiment ToEntity(DT.HiveExperiment source) {
    141       if (source == null) return null;
    142       var entity = new DB.HiveExperiment(); ToEntity(source, entity);
    143       return entity;
    144     }
    145     public static void ToEntity(DT.HiveExperiment source, DB.HiveExperiment target) {
    146       if ((source != null) && (target != null)) {
    147         target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; target.LastAccessed = source.LastAccessed;
     136    public static DT.Job ToDto(DB.Job source) {
     137      if (source == null) return null;
     138      return new DT.Job { Id = source.JobId, Description = source.Description, Name = source.Name, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds, LastAccessed = source.LastAccessed };
     139    }
     140    public static DB.Job ToEntity(DT.Job source) {
     141      if (source == null) return null;
     142      var entity = new DB.Job(); ToEntity(source, entity);
     143      return entity;
     144    }
     145    public static void ToEntity(DT.Job source, DB.Job target) {
     146      if ((source != null) && (target != null)) {
     147        target.JobId = source.Id; target.Description = source.Description; target.Name = source.Name; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; target.LastAccessed = source.LastAccessed;
    148148      }
    149149    }
     
    151151
    152152    #region HiveExperimentPermission
    153     public static DT.HiveExperimentPermission ToDto(DB.HiveExperimentPermission source) {
    154       if (source == null) return null;
    155       return new DT.HiveExperimentPermission { HiveExperimentId = source.HiveExperimentId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId, Permission = Convert.ToDto(source.Permission) };
    156     }
    157     public static DB.HiveExperimentPermission ToEntity(DT.HiveExperimentPermission source) {
    158       if (source == null) return null;
    159       var entity = new DB.HiveExperimentPermission(); ToEntity(source, entity);
    160       return entity;
    161     }
    162     public static void ToEntity(DT.HiveExperimentPermission source, DB.HiveExperimentPermission target) {
    163       if ((source != null) && (target != null)) {
    164         target.HiveExperimentId = source.HiveExperimentId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId; target.Permission = Convert.ToEntity(source.Permission);
     153    public static DT.JobPermission ToDto(DB.JobPermission source) {
     154      if (source == null) return null;
     155      return new DT.JobPermission { JobId = source.JobId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId, Permission = Convert.ToDto(source.Permission) };
     156    }
     157    public static DB.JobPermission ToEntity(DT.JobPermission source) {
     158      if (source == null) return null;
     159      var entity = new DB.JobPermission(); ToEntity(source, entity);
     160      return entity;
     161    }
     162    public static void ToEntity(DT.JobPermission source, DB.JobPermission target) {
     163      if ((source != null) && (target != null)) {
     164        target.JobId = source.JobId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId; target.Permission = Convert.ToEntity(source.Permission);
    165165      }
    166166    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/Job.cs

    r6717 r6723  
    2626  [DataContract]
    2727  [Serializable]
    28   public class HiveExperiment : NamedHiveItem {
     28  public class Job : NamedHiveItem {
    2929    [DataMember]
    3030    public Guid OwnerUserId { get; set; }
     
    4949    /* ================================== */
    5050
    51     public HiveExperiment() { }
     51    public Job() { }
    5252
    5353    public override string ToString() {
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/JobPermission.cs

    r6717 r6723  
    2626  [DataContract]
    2727  [Serializable]
    28   public class HiveExperimentPermission : HiveItem {
     28  public class JobPermission : HiveItem {
    2929    // info: this class is derived from HiveItem to simplify handling on the client side, altough it does not have a Id.
    3030    [DataMember]
    31     public Guid HiveExperimentId { get; set; }
     31    public Guid JobId { get; set; }
    3232    [DataMember]
    3333    public Guid GrantedUserId { get; set; }
     
    3737    public Permission Permission { get; set; }
    3838
    39     public HiveExperimentPermission() { }
     39    public JobPermission() { }
    4040  }
    4141}
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/DataTransfer/Task.cs

    r6721 r6723  
    4343    public bool FinishWhenChildJobsFinished { get; set; }
    4444    [DataMember]
    45     public Guid HiveExperimentId { get; set; }
     45    public Guid JobId { get; set; }
    4646    [DataMember]
    4747    public bool IsPrivileged { get; set; }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HeuristicLab.Services.Hive-3.3.csproj

    r6721 r6723  
    108108    <Compile Include="DataTransfer\Downtime.cs" />
    109109    <Compile Include="DataTransfer\Heartbeat.cs" />
    110     <Compile Include="DataTransfer\HiveExperiment.cs" />
    111     <Compile Include="DataTransfer\HiveExperimentPermission.cs" />
     110    <Compile Include="DataTransfer\Job.cs" />
     111    <Compile Include="DataTransfer\JobPermission.cs" />
    112112    <Compile Include="DataTransfer\HiveItem.cs" />
    113113    <Compile Include="DataTransfer\Task.cs" />
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HiveDao.cs

    r6721 r6723  
    231231
    232232    #region HiveExperiment Methods
    233     public DT.HiveExperiment GetHiveExperiment(Guid id) {
    234       using (var db = CreateContext()) {
    235         return AddStatsToExperiment(db, DT.Convert.ToDto(db.HiveExperiments.SingleOrDefault(x => x.HiveExperimentId == id)));
    236       }
    237     }
    238 
    239     private DT.HiveExperiment AddStatsToExperiment(HiveDataContext db, DT.HiveExperiment exp) {
     233    public DT.Job GetHiveExperiment(Guid id) {
     234      using (var db = CreateContext()) {
     235        return AddStatsToExperiment(db, DT.Convert.ToDto(db.Jobs.SingleOrDefault(x => x.JobId == id)));
     236      }
     237    }
     238
     239    private DT.Job AddStatsToExperiment(HiveDataContext db, DT.Job exp) {
    240240      if (exp == null)
    241241        return null;
    242242
    243       var jobs = db.Tasks.Where(j => j.HiveExperimentId == exp.Id);
     243      var jobs = db.Tasks.Where(j => j.JobId == exp.Id);
    244244      exp.JobCount = jobs.Count();
    245245      exp.CalculatingCount = jobs.Count(j => j.State == TaskState.Calculating);
     
    248248    }
    249249
    250     public IEnumerable<DT.HiveExperiment> GetHiveExperiments(Expression<Func<HiveExperiment, bool>> predicate) {
    251       using (var db = CreateContext()) {
    252         return db.HiveExperiments.Where(predicate).Select(x => AddStatsToExperiment(db, DT.Convert.ToDto(x))).ToArray();
    253       }
    254     }
    255 
    256     public Guid AddHiveExperiment(DT.HiveExperiment dto) {
    257       using (var db = CreateContext()) {
    258         var entity = DT.Convert.ToEntity(dto);
    259         db.HiveExperiments.InsertOnSubmit(entity);
    260         db.SubmitChanges();
    261         return entity.HiveExperimentId;
    262       }
    263     }
    264 
    265     public void UpdateHiveExperiment(DT.HiveExperiment dto) {
    266       using (var db = CreateContext()) {
    267         var entity = db.HiveExperiments.FirstOrDefault(x => x.HiveExperimentId == dto.Id);
    268         if (entity == null) db.HiveExperiments.InsertOnSubmit(DT.Convert.ToEntity(dto));
     250    public IEnumerable<DT.Job> GetHiveExperiments(Expression<Func<Job, bool>> predicate) {
     251      using (var db = CreateContext()) {
     252        return db.Jobs.Where(predicate).Select(x => AddStatsToExperiment(db, DT.Convert.ToDto(x))).ToArray();
     253      }
     254    }
     255
     256    public Guid AddHiveExperiment(DT.Job dto) {
     257      using (var db = CreateContext()) {
     258        var entity = DT.Convert.ToEntity(dto);
     259        db.Jobs.InsertOnSubmit(entity);
     260        db.SubmitChanges();
     261        return entity.JobId;
     262      }
     263    }
     264
     265    public void UpdateHiveExperiment(DT.Job dto) {
     266      using (var db = CreateContext()) {
     267        var entity = db.Jobs.FirstOrDefault(x => x.JobId == dto.Id);
     268        if (entity == null) db.Jobs.InsertOnSubmit(DT.Convert.ToEntity(dto));
    269269        else DT.Convert.ToEntity(dto, entity);
    270270        db.SubmitChanges();
     
    274274    public void DeleteHiveExperiment(Guid id) {
    275275      using (var db = CreateContext()) {
    276         var entity = db.HiveExperiments.FirstOrDefault(x => x.HiveExperimentId == id);
    277         if (entity != null) db.HiveExperiments.DeleteOnSubmit(entity);
    278         db.SubmitChanges();
    279       }
    280     }
    281     #endregion
    282 
    283     #region HiveExperimentPermission Methods
    284     public DT.HiveExperimentPermission GetHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId) {
    285       using (var db = CreateContext()) {
    286         return DT.Convert.ToDto(db.HiveExperimentPermissions.SingleOrDefault(x => x.HiveExperimentId == hiveExperimentId && x.GrantedUserId == grantedUserId));
    287       }
    288     }
    289 
    290     public IEnumerable<DT.HiveExperimentPermission> GetHiveExperimentPermissions(Expression<Func<HiveExperimentPermission, bool>> predicate) {
    291       using (var db = CreateContext()) {
    292         return db.HiveExperimentPermissions.Where(predicate).Select(x => DT.Convert.ToDto(x)).ToArray();
    293       }
    294     }
    295 
    296     public void AddHiveExperimentPermission(DT.HiveExperimentPermission dto) {
    297       using (var db = CreateContext()) {
    298         var entity = DT.Convert.ToEntity(dto);
    299         db.HiveExperimentPermissions.InsertOnSubmit(entity);
    300         db.SubmitChanges();
    301       }
    302     }
    303 
    304     public void UpdateHiveExperimentPermission(DT.HiveExperimentPermission dto) {
    305       using (var db = CreateContext()) {
    306         var entity = db.HiveExperimentPermissions.FirstOrDefault(x => x.HiveExperimentId == dto.HiveExperimentId && x.GrantedUserId == dto.GrantedUserId);
    307         if (entity == null) db.HiveExperimentPermissions.InsertOnSubmit(DT.Convert.ToEntity(dto));
     276        var entity = db.Jobs.FirstOrDefault(x => x.JobId == id);
     277        if (entity != null) db.Jobs.DeleteOnSubmit(entity);
     278        db.SubmitChanges();
     279      }
     280    }
     281    #endregion
     282
     283    #region JobPermission Methods
     284    public DT.JobPermission GetHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId) {
     285      using (var db = CreateContext()) {
     286        return DT.Convert.ToDto(db.JobPermissions.SingleOrDefault(x => x.JobId == hiveExperimentId && x.GrantedUserId == grantedUserId));
     287      }
     288    }
     289
     290    public IEnumerable<DT.JobPermission> GetHiveExperimentPermissions(Expression<Func<JobPermission, bool>> predicate) {
     291      using (var db = CreateContext()) {
     292        return db.JobPermissions.Where(predicate).Select(x => DT.Convert.ToDto(x)).ToArray();
     293      }
     294    }
     295
     296    public void AddHiveExperimentPermission(DT.JobPermission dto) {
     297      using (var db = CreateContext()) {
     298        var entity = DT.Convert.ToEntity(dto);
     299        db.JobPermissions.InsertOnSubmit(entity);
     300        db.SubmitChanges();
     301      }
     302    }
     303
     304    public void UpdateHiveExperimentPermission(DT.JobPermission dto) {
     305      using (var db = CreateContext()) {
     306        var entity = db.JobPermissions.FirstOrDefault(x => x.JobId == dto.JobId && x.GrantedUserId == dto.GrantedUserId);
     307        if (entity == null) db.JobPermissions.InsertOnSubmit(DT.Convert.ToEntity(dto));
    308308        else DT.Convert.ToEntity(dto, entity);
    309309        db.SubmitChanges();
     
    313313    public void DeleteHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId) {
    314314      using (var db = CreateContext()) {
    315         var entity = db.HiveExperimentPermissions.FirstOrDefault(x => x.HiveExperimentId == hiveExperimentId && x.GrantedUserId == grantedUserId);
    316         if (entity != null) db.HiveExperimentPermissions.DeleteOnSubmit(entity);
     315        var entity = db.JobPermissions.FirstOrDefault(x => x.JobId == hiveExperimentId && x.GrantedUserId == grantedUserId);
     316        if (entity != null) db.JobPermissions.DeleteOnSubmit(entity);
    317317        db.SubmitChanges();
    318318      }
     
    324324    public void SetHiveExperimentPermission(Guid hiveExperimentId, Guid grantedByUserId, Guid grantedUserId, Permission permission) {
    325325      using (var db = CreateContext()) {
    326         HiveExperimentPermission hiveExperimentPermission = db.HiveExperimentPermissions.SingleOrDefault(x => x.HiveExperimentId == hiveExperimentId && x.GrantedUserId == grantedUserId);
     326        JobPermission hiveExperimentPermission = db.JobPermissions.SingleOrDefault(x => x.JobId == hiveExperimentId && x.GrantedUserId == grantedUserId);
    327327        if (hiveExperimentPermission != null) {
    328328          if (permission == Permission.NotAllowed) {
    329329            // not allowed, delete
    330             db.HiveExperimentPermissions.DeleteOnSubmit(hiveExperimentPermission);
     330            db.JobPermissions.DeleteOnSubmit(hiveExperimentPermission);
    331331          } else {
    332332            // update
     
    337337          // insert
    338338          if (permission != Permission.NotAllowed) {
    339             hiveExperimentPermission = new HiveExperimentPermission() { HiveExperimentId = hiveExperimentId, GrantedByUserId = grantedByUserId, GrantedUserId = grantedUserId, Permission = permission };
    340             db.HiveExperimentPermissions.InsertOnSubmit(hiveExperimentPermission);
     339            hiveExperimentPermission = new JobPermission() { JobId = hiveExperimentId, GrantedByUserId = grantedByUserId, GrantedUserId = grantedUserId, Permission = permission };
     340            db.JobPermissions.InsertOnSubmit(hiveExperimentPermission);
    341341          }
    342342        }
     
    621621    public Permission GetPermissionForExperiment(Guid experimentId, Guid userId) {
    622622      using (var db = CreateContext()) {
    623         HiveExperiment hiveExperiment = db.HiveExperiments.SingleOrDefault(x => x.HiveExperimentId == experimentId);
     623        Job hiveExperiment = db.Jobs.SingleOrDefault(x => x.JobId == experimentId);
    624624        if (hiveExperiment == null) return Permission.NotAllowed;
    625625        if (hiveExperiment.OwnerUserId == userId) return Permission.Full;
    626         HiveExperimentPermission permission = db.HiveExperimentPermissions.SingleOrDefault(p => p.HiveExperimentId == experimentId && p.GrantedUserId == userId);
     626        JobPermission permission = db.JobPermissions.SingleOrDefault(p => p.JobId == experimentId && p.GrantedUserId == userId);
    627627        return permission != null ? permission.Permission : Permission.NotAllowed;
    628628      }
     
    631631    public Guid GetExperimentForJob(Guid jobId) {
    632632      using (var db = CreateContext()) {
    633         return db.Tasks.Single(j => j.TaskId == jobId).HiveExperimentId;
     633        return db.Tasks.Single(j => j.TaskId == jobId).JobId;
    634634      }
    635635    }
     
    745745        var usedCoresByUser = from job in db.Tasks
    746746                              where job.State == TaskState.Calculating
    747                               group job by job.HiveExperiment.OwnerUserId into g
     747                              group job by job.Job.OwnerUserId into g
    748748                              select new { UserId = g.Key, UsedCores = g.Count() };
    749749
     
    756756
    757757        var executionTimesByUser = from job in db.Tasks
    758                                    group job by job.HiveExperiment.OwnerUserId into g
     758                                   group job by job.Job.OwnerUserId into g
    759759                                   select new { UserId = g.Key, ExecutionTime = TimeSpan.FromMilliseconds(g.Select(x => x.ExecutionTimeMs).Sum()) };
    760760        foreach (var item in executionTimesByUser) {
     
    768768        var executionTimesFinishedJobs = from job in db.Tasks
    769769                                         where job.State == TaskState.Finished
    770                                          group job by job.HiveExperiment.OwnerUserId into g
     770                                         group job by job.Job.OwnerUserId into g
    771771                                         select new { UserId = g.Key, ExecutionTimeFinishedJobs = TimeSpan.FromMilliseconds(g.Select(x => x.ExecutionTimeMs).Sum()) };
    772772
     
    781781        var startToEndTimesFinishedJobs = from job in db.Tasks
    782782                                          where job.State == TaskState.Finished
    783                                           group job by job.HiveExperiment.OwnerUserId into g
     783                                          group job by job.Job.OwnerUserId into g
    784784                                          select new {
    785785                                            UserId = g.Key,
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/HiveService.cs

    r6721 r6723  
    117117      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    118118      author.AuthorizeForExperiment(experimentId, Permission.Read);
    119       return dao.GetJobs(x => x.HiveExperimentId == experimentId).Select(x => new LightweightTask(x)).ToArray();
     119      return dao.GetJobs(x => x.JobId == experimentId).Select(x => new LightweightTask(x)).ToArray();
    120120    }
    121121
     
    239239
    240240    #region HiveExperiment Methods
    241     public HiveExperiment GetHiveExperiment(Guid id) {
     241    public Job GetHiveExperiment(Guid id) {
    242242      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    243243      author.AuthorizeForExperiment(id, Permission.Read);
    244244      var hiveExperiment = dao.GetHiveExperiments(x =>
    245             x.HiveExperimentId == id
    246             && (x.OwnerUserId == userManager.CurrentUserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != DA.Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0)
     245            x.JobId == id
     246            && (x.OwnerUserId == userManager.CurrentUserId || x.JobPermissions.Count(hep => hep.Permission != DA.Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0)
    247247          ).FirstOrDefault();
    248248      if (hiveExperiment != null) {
     
    253253    }
    254254
    255     public IEnumerable<HiveExperiment> GetHiveExperiments() {
    256       authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    257       var hiveExperiments = dao.GetHiveExperiments(x => x.OwnerUserId == userManager.CurrentUserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != DA.Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0);
     255    public IEnumerable<Job> GetHiveExperiments() {
     256      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
     257      var hiveExperiments = dao.GetHiveExperiments(x => x.OwnerUserId == userManager.CurrentUserId || x.JobPermissions.Count(hep => hep.Permission != DA.Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0);
    258258      foreach (var he in hiveExperiments) {
    259259        author.AuthorizeForExperiment(he.Id, Permission.Read);
     
    264264    }
    265265
    266     public IEnumerable<HiveExperiment> GetAllHiveExperiments() {
     266    public IEnumerable<Job> GetAllHiveExperiments() {
    267267      authen.AuthenticateForAnyRole(HiveRoles.Administrator);
    268268      var hiveExperiments = dao.GetHiveExperiments(x => true);
     
    274274    }
    275275
    276     public Guid AddHiveExperiment(HiveExperiment hiveExperimentDto) {
     276    public Guid AddHiveExperiment(Job hiveExperimentDto) {
    277277      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    278278      return trans.UseTransaction(() => {
     
    283283    }
    284284
    285     public void UpdateHiveExperiment(HiveExperiment hiveExperimentDto) {
     285    public void UpdateHiveExperiment(Job hiveExperimentDto) {
    286286      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    287287      author.AuthorizeForExperiment(hiveExperimentDto.Id, Permission.Full);
     
    304304      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    305305      trans.UseTransaction(() => {
    306         HiveExperiment he = dao.GetHiveExperiment(hiveExperimentId);
     306        Job he = dao.GetHiveExperiment(hiveExperimentId);
    307307        if (he == null) throw new FaultException<FaultReason>(new FaultReason("Could not find hiveExperiment with id " + hiveExperimentId));
    308308        Permission perm = DT.Convert.ToDto(dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId));
     
    315315      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    316316      trans.UseTransaction(() => {
    317         HiveExperiment he = dao.GetHiveExperiment(hiveExperimentId);
     317        Job he = dao.GetHiveExperiment(hiveExperimentId);
    318318        if (he == null) throw new FaultException<FaultReason>(new FaultReason("Could not find hiveExperiment with id " + hiveExperimentId));
    319319        DA.Permission perm = dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId);
     
    322322      });
    323323    }
    324     public IEnumerable<HiveExperimentPermission> GetHiveExperimentPermissions(Guid hiveExperimentId) {
     324    public IEnumerable<JobPermission> GetHiveExperimentPermissions(Guid hiveExperimentId) {
    325325      authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
    326326      return trans.UseTransaction(() => {
    327327        DA.Permission currentUserPermission = dao.GetPermissionForExperiment(hiveExperimentId, userManager.CurrentUserId);
    328328        if (currentUserPermission != DA.Permission.Full) throw new FaultException<FaultReason>(new FaultReason("Not allowed to list permissions for this experiment"));
    329         return dao.GetHiveExperimentPermissions(x => x.HiveExperimentId == hiveExperimentId);
     329        return dao.GetHiveExperimentPermissions(x => x.JobId == hiveExperimentId);
    330330      });
    331331    }
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/Interfaces/IHiveDao.cs

    r6721 r6723  
    5656
    5757    #region HiveExperiment Methods
    58     DT.HiveExperiment GetHiveExperiment(Guid id);
    59     IEnumerable<DT.HiveExperiment> GetHiveExperiments(Expression<Func<HiveExperiment, bool>> predicate);
    60     Guid AddHiveExperiment(DT.HiveExperiment dto);
    61     void UpdateHiveExperiment(DT.HiveExperiment dto);
     58    DT.Job GetHiveExperiment(Guid id);
     59    IEnumerable<DT.Job> GetHiveExperiments(Expression<Func<Job, bool>> predicate);
     60    Guid AddHiveExperiment(DT.Job dto);
     61    void UpdateHiveExperiment(DT.Job dto);
    6262    void DeleteHiveExperiment(Guid id);
    6363    #endregion
    6464
    6565    #region HiveExperimentPermission Methods
    66     DT.HiveExperimentPermission GetHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId);
    67     IEnumerable<DT.HiveExperimentPermission> GetHiveExperimentPermissions(Expression<Func<HiveExperimentPermission, bool>> predicate);
    68     void AddHiveExperimentPermission(DT.HiveExperimentPermission dto);
    69     void UpdateHiveExperimentPermission(DT.HiveExperimentPermission dto);
     66    DT.JobPermission GetHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId);
     67    IEnumerable<DT.JobPermission> GetHiveExperimentPermissions(Expression<Func<JobPermission, bool>> predicate);
     68    void AddHiveExperimentPermission(DT.JobPermission dto);
     69    void UpdateHiveExperimentPermission(DT.JobPermission dto);
    7070    void DeleteHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId);
    7171    void SetHiveExperimentPermission(Guid hiveExperimentId, Guid grantedByUserId, Guid grantedUserId, Permission permission);
  • branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.3/ServiceContracts/IHiveService.cs

    r6721 r6723  
    8585    #region HiveExperiment Methods
    8686    [OperationContract]
    87     HiveExperiment GetHiveExperiment(Guid id);
     87    Job GetHiveExperiment(Guid id);
    8888
    8989    /// <summary>
     
    9191    /// </summary>
    9292    [OperationContract]
    93     IEnumerable<HiveExperiment> GetHiveExperiments();
     93    IEnumerable<Job> GetHiveExperiments();
    9494
    9595    /// <summary>
     
    9898    /// <returns></returns>
    9999    [OperationContract]
    100     IEnumerable<HiveExperiment> GetAllHiveExperiments();
    101 
    102     [OperationContract]
    103     Guid AddHiveExperiment(HiveExperiment hiveExperimentDto);
    104 
    105     [OperationContract]
    106     void UpdateHiveExperiment(HiveExperiment hiveExperimentDto);
     100    IEnumerable<Job> GetAllHiveExperiments();
     101
     102    [OperationContract]
     103    Guid AddHiveExperiment(Job hiveExperimentDto);
     104
     105    [OperationContract]
     106    void UpdateHiveExperiment(Job hiveExperimentDto);
    107107
    108108    [OperationContract]
     
    118118
    119119    [OperationContract]
    120     IEnumerable<HiveExperimentPermission> GetHiveExperimentPermissions(Guid hiveExperimentId);
     120    IEnumerable<JobPermission> GetHiveExperimentPermissions(Guid hiveExperimentId);
    121121
    122122    [OperationContract]
Note: See TracChangeset for help on using the changeset viewer.