Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs	(revision 5458)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs	(revision 5511)
@@ -33,17 +33,12 @@
         Id = source.JobId,
         CoresNeeded = source.CoresNeeded,
-        DateCalculated = source.DateCalculated,
-        DateCreated = source.DateCreated,
-        DateFinished = source.DateFinished,
-        Exception = source.Exception,
-        ExecutionTime = source.ExecutionTime,
+        ExecutionTime = string.IsNullOrEmpty(source.ExecutionTime) ? TimeSpan.Zero : TimeSpan.Parse(source.ExecutionTime),
         MemoryNeeded = source.MemoryNeeded,
         ParentJobId = source.ParentJobId,
         Priority = source.Priority,
-        SlaveId = source.SlaveId,
-        JobState = source.JobState,
-        UserId = source.UserId,
         PluginsNeededIds = source.RequiredPlugins.Select(x => x.PluginId).ToList(),
-        LastHeartbeat = source.LastHeartbeat        
+        LastHeartbeat = source.LastHeartbeat,
+        State = source.State,
+        StateLog = source.StateLogs.Select(x => Convert.ToDto(x)).OrderBy(x => x.DateTime).ToList()
       };
     }
@@ -57,16 +52,12 @@
         target.JobId = source.Id;
         target.CoresNeeded = source.CoresNeeded;
-        target.DateCalculated = source.DateCalculated;
-        target.DateCreated = source.DateCreated;
-        target.DateFinished = source.DateFinished;
-        target.Exception = source.Exception;
-        target.ExecutionTime = source.ExecutionTime;
+        target.ExecutionTime = source.ExecutionTime.ToString();
         target.MemoryNeeded = source.MemoryNeeded;
         target.ParentJobId = source.ParentJobId;
         target.Priority = source.Priority;
-        target.SlaveId = source.SlaveId;
-        target.JobState = source.JobState;
-        target.UserId = source.UserId;
         target.LastHeartbeat = source.LastHeartbeat;
+        target.State = source.State;
+        if (target.StateLogs == null) target.StateLogs = new EntitySet<StateLog>();
+        target.StateLogs.AddRange(source.StateLog.Select(x => Convert.ToEntity(x)).OrderBy(x => x.DateTime));
         // RequiredPlugins are added by Dao
       }
@@ -91,8 +82,25 @@
     #endregion
 
+    #region StateLog
+    public static DT.StateLog ToDto(StateLog source) {
+      if (source == null) return null;
+      return new DT.StateLog { Id = source.StateLogId, DateTime = source.DateTime, Exception = source.Exception, JobId = source.JobId, SlaveId = source.SlaveId, State = source.State, UserId = source.UserId };
+    }
+    public static StateLog ToEntity(DT.StateLog source) {
+      if (source == null) return null;
+      var entity = new StateLog(); ToEntity(source, entity);
+      return entity;
+    }
+    public static void ToEntity(DT.StateLog source, StateLog target) {
+      if ((source != null) && (target != null)) {
+        target.StateLogId = source.Id; target.DateTime = source.DateTime; target.Exception = source.Exception; target.JobId = source.JobId; target.SlaveId = source.SlaveId; target.State = source.State; target.UserId = source.UserId;
+      }
+    }
+    #endregion
+
     #region HiveExperiment
     public static DT.HiveExperiment ToDto(HiveExperiment source) {
       if (source == null) return null;
-      return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, RootJobId = source.RootJobId, UserId = source.UserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds };
+      return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, RootJobId = source.RootJobId, OwnerUserId = source.OwnerUserId, DateCreated = source.DateCreated, ResourceNames = source.ResourceIds, LastAccessed = source.LastAccessed };
     }
     public static HiveExperiment ToEntity(DT.HiveExperiment source) {
@@ -103,5 +111,22 @@
     public static void ToEntity(DT.HiveExperiment source, HiveExperiment target) {
       if ((source != null) && (target != null)) {
-        target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.RootJobId = source.RootJobId; target.UserId = source.UserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames;
+        target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.RootJobId = source.RootJobId; target.OwnerUserId = source.OwnerUserId; target.DateCreated = source.DateCreated; target.ResourceIds = source.ResourceNames; target.LastAccessed = source.LastAccessed;
+      }
+    }
+    #endregion
+
+    #region HiveExperimentPermission
+    public static DT.HiveExperimentPermission ToDto(HiveExperimentPermission source) {
+      if (source == null) return null;
+      return new DT.HiveExperimentPermission { HiveExperimentId = source.HiveExperimentId, GrantedUserId = source.GrantedUserId, GrantedByUserId = source.GrantedByUserId, Permission = source.Permission };
+    }
+    public static HiveExperimentPermission ToEntity(DT.HiveExperimentPermission source) {
+      if (source == null) return null;
+      var entity = new HiveExperimentPermission(); ToEntity(source, entity);
+      return entity;
+    }
+    public static void ToEntity(DT.HiveExperimentPermission source, HiveExperimentPermission target) {
+      if ((source != null) && (target != null)) {
+        target.HiveExperimentId = source.HiveExperimentId; target.GrantedUserId = source.GrantedUserId; target.GrantedByUserId = source.GrantedByUserId; target.Permission = source.Permission;
       }
     }
@@ -145,16 +170,16 @@
     public static DT.Slave ToDto(Slave source) {
       if (source == null) return null;
-      return new DT.Slave { 
-        Id = source.ResourceId, 
-        ParentResourceId = source.ParentResourceId, 
+      return new DT.Slave {
+        Id = source.ResourceId,
+        ParentResourceId = source.ParentResourceId,
         Cores = source.Cores,
-        CpuSpeed = source.CpuSpeed, 
-        FreeCores = source.FreeCores, 
-        FreeMemory = source.FreeMemory, 
-        IsAllowedToCalculate = source.IsAllowedToCalculate, 
-        Memory = source.Memory, 
-        Name = source.Name, 
-        SlaveState = source.SlaveState, 
-        CpuArchitecture = source.CpuArchitecture, 
+        CpuSpeed = source.CpuSpeed,
+        FreeCores = source.FreeCores,
+        FreeMemory = source.FreeMemory,
+        IsAllowedToCalculate = source.IsAllowedToCalculate,
+        Memory = source.Memory,
+        Name = source.Name,
+        SlaveState = source.SlaveState,
+        CpuArchitecture = source.CpuArchitecture,
         OperatingSystem = source.OperatingSystem,
         LastHeartbeat = source.LastHeartbeat
@@ -170,13 +195,13 @@
         target.ResourceId = source.Id;
         target.ParentResourceId = source.ParentResourceId;
-        target.Cores = source.Cores; 
+        target.Cores = source.Cores;
         target.CpuSpeed = source.CpuSpeed;
         target.FreeCores = source.FreeCores;
-        target.FreeMemory = source.FreeMemory; 
+        target.FreeMemory = source.FreeMemory;
         target.IsAllowedToCalculate = source.IsAllowedToCalculate;
         target.Memory = source.Memory;
-        target.Name = source.Name; 
-        target.SlaveState = source.SlaveState; 
-        target.CpuArchitecture = source.CpuArchitecture; 
+        target.Name = source.Name;
+        target.SlaveState = source.SlaveState;
+        target.CpuArchitecture = source.CpuArchitecture;
         target.OperatingSystem = source.OperatingSystem;
         target.LastHeartbeat = source.LastHeartbeat;
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs	(revision 5458)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDao.cs	(revision 5511)
@@ -85,9 +85,10 @@
       using (var db = CreateContext()) {
         var query = from ar in db.AssignedResources
+                    join sl in db.StateLogs on ar.JobId equals sl.JobId
                     where resourceIds.Contains(ar.ResourceId)
-                       && ar.Job.JobState == JobState.WaitingForChildJobs
+                       && ar.Job.State == JobState.FinishOnChildJobsFinished
                        && (from child in db.Jobs
                            where child.ParentJobId == ar.Job.JobId
-                           select child.JobState == JobState.Finished).All(x => x)
+                           select child.State == JobState.Finished).All(x => x)
                        && (from child in db.Jobs // avoid returning WaitForChildJobs jobs where no child-jobs exist (yet)
                            where child.ParentJobId == ar.Job.JobId
@@ -107,5 +108,5 @@
         var query = from ar in db.AssignedResources
                     where resourceIds.Contains(ar.ResourceId)
-                       && ar.Job.JobState == JobState.Waiting
+                       && ar.Job.State == JobState.Waiting
                        && ar.Job.CoresNeeded <= slave.FreeCores
                        && ar.Job.MemoryNeeded <= slave.FreeMemory
@@ -197,4 +198,45 @@
       }
     }
+    #endregion
+
+    #region HiveExperimentPermission Methods
+
+    public DT.HiveExperimentPermission GetHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId) {
+      using (var db = CreateContext()) {
+        return Convert.ToDto(db.HiveExperimentPermissions.SingleOrDefault(x => x.HiveExperimentId == hiveExperimentId && x.GrantedUserId == grantedUserId));
+      }
+    }
+
+    public IEnumerable<DT.HiveExperimentPermission> GetHiveExperimentPermissions(Expression<Func<HiveExperimentPermission, bool>> predicate) {
+      using (var db = CreateContext()) {
+        return db.HiveExperimentPermissions.Where(predicate).Select(x => Convert.ToDto(x)).ToArray();
+      }
+    }
+
+    public void AddHiveExperimentPermission(DT.HiveExperimentPermission dto) {
+      using (var db = CreateContext()) {
+        var entity = Convert.ToEntity(dto);
+        db.HiveExperimentPermissions.InsertOnSubmit(entity);
+        db.SubmitChanges();
+      }
+    }
+
+    public void UpdateHiveExperimentPermission(DT.HiveExperimentPermission dto) {
+      using (var db = CreateContext()) {
+        var entity = db.HiveExperimentPermissions.FirstOrDefault(x => x.HiveExperimentId == dto.HiveExperimentId && x.GrantedUserId == dto.GrantedUserId);
+        if (entity == null) db.HiveExperimentPermissions.InsertOnSubmit(Convert.ToEntity(dto));
+        else Convert.ToEntity(dto, entity);
+        db.SubmitChanges();
+      }
+    }
+
+    public void DeleteHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId) {
+      using (var db = CreateContext()) {
+        var entity = db.HiveExperimentPermissions.FirstOrDefault(x => x.HiveExperimentId == hiveExperimentId && x.GrantedUserId == grantedUserId);
+        if (entity != null) db.HiveExperimentPermissions.DeleteOnSubmit(entity);
+        db.SubmitChanges();
+      }
+    }
+
     #endregion
 
@@ -440,12 +482,28 @@
 
     #region Authorization Methods
-    public bool IsUserAuthorizedForJobs(Guid userId, params Guid[] jobIds) {
-      using (var db = CreateContext()) {
-        var userIds = from job in db.Jobs // this needs to be fast!
-                      where jobIds.Contains(job.JobId)
-                      select job.UserId;
-        return userIds.All(x => x == userId);
-      }
-    }
+    public Permission GetPermissionForJob(Guid jobId, Guid userId) {
+      using (var db = CreateContext()) {
+        return GetPermissionForExperiment(GetExperimentForJob(jobId), userId);
+      }
+    }
+
+    public Permission GetPermissionForExperiment(Guid experimentId, Guid userId) {
+      using (var db = CreateContext()) {
+        HiveExperimentPermission permission = db.HiveExperimentPermissions.SingleOrDefault(p => p.HiveExperimentId == experimentId && p.GrantedUserId == userId);
+        return permission != null ? permission.Permission : Permission.NotAllowed;
+      }
+    }
+
+    public Guid GetExperimentForJob(Guid jobId) {
+      using (var db = CreateContext()) {
+        var job = db.Jobs.SingleOrDefault(j => j.JobId == jobId);
+        if (job.ParentJobId.HasValue) {
+          return GetExperimentForJob(job.ParentJobId.Value);
+        } else {
+          return db.HiveExperiments.SingleOrDefault(he => he.RootJobId == jobId).HiveExperimentId;
+        }
+      }
+    }
+
     #endregion
   }
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml	(revision 5458)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml	(revision 5511)
@@ -39,4 +39,5 @@
       <Association Name="Resource_Resource" Member="ChildResources" ThisKey="ResourceId" OtherKey="ParentResourceId" Type="Resource" />
       <Association Name="Resource_UptimeCalendar" Member="UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="UptimeCalendar" />
+      <Association Name="Resource_StateLog" Member="StateLogs" ThisKey="ResourceId" OtherKey="SlaveId" Type="StateLog" />
       <Association Name="Resource_Resource" Member="ParentResource" ThisKey="ParentResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" />
       <Type Name="Slave" InheritanceCode="Slave" IsInheritanceDefault="true">
@@ -52,5 +53,4 @@
         <Column Name="OperatingSystem" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" UpdateCheck="Never" />
         <Column Name="LastHeartbeat" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
-        <Association Name="Slave_Job" Member="Jobs" ThisKey="ResourceId" OtherKey="SlaveId" Type="Job" />
       </Type>
       <Type Name="SlaveGroup" InheritanceCode="GROUP" />
@@ -61,23 +61,16 @@
       <Column Name="JobId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
       <Column Name="ParentJobId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />
-      <Column Name="JobState" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState" DbType="VarChar(15)" CanBeNull="false" />
-      <Column Name="ResourceId" Member="SlaveId" Storage="_ResourceId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />
-      <Column Name="ExecutionTime" Type="System.TimeSpan" DbType="Time" CanBeNull="true" />
-      <Column Name="Exception" Type="System.String" DbType="VarChar(MAX)" CanBeNull="true" />
-      <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime" CanBeNull="false" />
-      <Column Name="DateCalculated" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
-      <Column Name="DateFinished" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
+      <Column Name="ExecutionTime" Type="System.String" DbType="VarChar(30)" CanBeNull="true" />
       <Column Name="Priority" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
-      <Column Name="ProjectId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />
-      <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
       <Column Name="CoresNeeded" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
       <Column Name="MemoryNeeded" Type="System.Int32" DbType="Int NOT NULL" CanBeNull="false" />
       <Column Name="LastHeartbeat" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
+      <Column Name="JobState" Member="State" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState" DbType="VarChar(30)" CanBeNull="false" />
       <Association Name="Job_AssignedResource" Member="AssignedResources" ThisKey="JobId" OtherKey="JobId" Type="AssignedResource" />
       <Association Name="Job_RequiredPlugin" Member="RequiredPlugins" ThisKey="JobId" OtherKey="JobId" Type="RequiredPlugin" />
       <Association Name="Job_Job" Member="ChildJobs" Storage="_Jobs" ThisKey="JobId" OtherKey="ParentJobId" Type="Job" />
       <Association Name="Job_JobData" Member="JobData" ThisKey="JobId" OtherKey="JobId" Type="JobData" Cardinality="One" />
+      <Association Name="Job_StateLog" Member="StateLogs" ThisKey="JobId" OtherKey="JobId" Type="StateLog" />
       <Association Name="Job_Job" Member="ParentJob" Storage="_Job1" ThisKey="ParentJobId" OtherKey="JobId" Type="Job" IsForeignKey="true" />
-      <Association Name="Slave_Job" Member="Slave" ThisKey="SlaveId" OtherKey="ResourceId" Type="Slave" IsForeignKey="true" DeleteRule="SET NULL" />
     </Type>
   </Table>
@@ -100,11 +93,14 @@
       <Column Name="Description" Type="System.String" DbType="VarChar(MAX)" CanBeNull="true" />
       <Column Name="ResourceIds" Type="System.String" DbType="VarChar(MAX)" CanBeNull="true" />
-      <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
+      <Column Name="OwnerUserId" Storage="_UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
       <Column Name="RootJobId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="false" />
       <Column Name="DateCreated" Type="System.DateTime" DbType="DateTime" CanBeNull="false" />
+      <Column Name="LastAccessed" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
+      <Column Name="IsHiveEngine" Type="System.Boolean" DbType="Bit" CanBeNull="false" />
+      <Association Name="HiveExperiment_HiveExperimentPermission" Member="HiveExperimentPermissions" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="HiveExperimentPermission" />
       <Association Name="Job_HiveExperiment" Member="RootJob" Storage="_Job" ThisKey="RootJobId" OtherKey="JobId" Type="Job" IsForeignKey="true" DeleteRule="CASCADE" />
     </Type>
   </Table>
-  <Table Name="" Member="JobDatas">
+  <Table Name="dbo.JobData" Member="JobDatas">
     <Type Name="JobData">
       <Column Name="JobId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
@@ -114,5 +110,5 @@
     </Type>
   </Table>
-  <Table Name="" Member="PluginDatas">
+  <Table Name="dbo.PluginData" Member="PluginDatas">
     <Type Name="PluginData">
       <Column Name="PluginDataId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
@@ -123,3 +119,25 @@
     </Type>
   </Table>
+  <Table Name="dbo.StateLog" Member="StateLogs">
+    <Type Name="StateLog">
+      <Column Name="StateLogId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" IsDbGenerated="true" CanBeNull="false" />
+      <Column Name="State" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState" DbType="VarChar(30) NOT NULL" CanBeNull="false" />
+      <Column Name="DateTime" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
+      <Column Name="JobId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
+      <Column Name="UserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />
+      <Column Name="SlaveId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />
+      <Column Name="Exception" Type="System.String" DbType="VarChar(MAX)" CanBeNull="false" />
+      <Association Name="Job_StateLog" Member="Job" ThisKey="JobId" OtherKey="JobId" Type="Job" IsForeignKey="true" />
+      <Association Name="Resource_StateLog" Member="Resource" ThisKey="SlaveId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" />
+    </Type>
+  </Table>
+  <Table Name="dbo.HiveExperimentPermission" Member="HiveExperimentPermissions">
+    <Type Name="HiveExperimentPermission">
+      <Column Name="HiveExperimentId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="GrantedUserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
+      <Column Name="GrantedByUserId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" CanBeNull="false" />
+      <Column Name="Permission" Type="global::HeuristicLab.Services.Hive.Common.DataTransfer.Permission" DbType="VarChar(15) NOT NULL" CanBeNull="false" />
+      <Association Name="HiveExperiment_HiveExperimentPermission" Member="HiveExperiment" ThisKey="HiveExperimentId" OtherKey="HiveExperimentId" Type="HiveExperiment" IsForeignKey="true" />
+    </Type>
+  </Table>
 </Database>
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout	(revision 5458)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.dbml.layout	(revision 5511)
@@ -3,14 +3,14 @@
   <DataContextMoniker Name="/HiveDataContext" />
   <nestedChildShapes>
-    <classShape Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" absoluteBounds="8.875, 3.75, 2, 1.3862939453124987">
+    <classShape Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" absoluteBounds="8.875, 3.875, 2, 1.3862939453124987">
       <DataClassMoniker Name="/HiveDataContext/AssignedResource" />
       <nestedChildShapes>
-        <elementListCompartment Id="8b005775-f0ee-41b0-ae10-6d1151003708" absoluteBounds="8.89, 4.2100000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+        <elementListCompartment Id="8b005775-f0ee-41b0-ae10-6d1151003708" absoluteBounds="8.89, 4.3350000000000009, 1.9700000000000002, 0.8262939453125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
       </nestedChildShapes>
     </classShape>
-    <classShape Id="7d998e56-4fba-41ca-a1a8-1dcdb9068edf" absoluteBounds="9, 5.5, 2, 1.9631982421874996">
+    <classShape Id="7d998e56-4fba-41ca-a1a8-1dcdb9068edf" absoluteBounds="8.875, 5.5, 2, 1.9631982421874996">
       <DataClassMoniker Name="/HiveDataContext/Plugin" />
       <nestedChildShapes>
-        <elementListCompartment Id="ec4ba325-6dff-4418-baad-59af81ae2024" absoluteBounds="9.015, 5.9600000000000009, 1.9700000000000002, 1.4031982421875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+        <elementListCompartment Id="ec4ba325-6dff-4418-baad-59af81ae2024" absoluteBounds="8.89, 5.9600000000000009, 1.9700000000000002, 1.4031982421875" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
       </nestedChildShapes>
     </classShape>
@@ -27,8 +27,8 @@
       </nestedChildShapes>
     </classShape>
-    <classShape Id="695bfc39-59f3-4e60-8644-f847964bf62c" absoluteBounds="6.5, 1, 2, 3.6939111328124996">
+    <classShape Id="695bfc39-59f3-4e60-8644-f847964bf62c" absoluteBounds="6.5, 1, 2, 2.3478011067708335">
       <DataClassMoniker Name="/HiveDataContext/Job" />
       <nestedChildShapes>
-        <elementListCompartment Id="a6a30e11-03d1-4869-82e6-b733f4ef9974" absoluteBounds="6.5150000000000006, 1.46, 1.9700000000000002, 3.1339111328125" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+        <elementListCompartment Id="a6a30e11-03d1-4869-82e6-b733f4ef9974" absoluteBounds="6.5150000000000006, 1.46, 1.9700000000000002, 1.7878011067708333" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
       </nestedChildShapes>
     </classShape>
@@ -39,8 +39,8 @@
       </nestedChildShapes>
     </classShape>
-    <classShape Id="e6f840cc-2968-4be1-b234-eef624ccacbb" absoluteBounds="4.125, 2.625, 2, 2.1554996744791666">
+    <classShape Id="e6f840cc-2968-4be1-b234-eef624ccacbb" absoluteBounds="4.125, 2.625, 2, 2.5401025390624996">
       <DataClassMoniker Name="/HiveDataContext/HiveExperiment" />
       <nestedChildShapes>
-        <elementListCompartment Id="0c65d4e1-256a-4a91-9a57-392f25e4de7f" absoluteBounds="4.1400000000000006, 3.0850000000000009, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+        <elementListCompartment Id="0c65d4e1-256a-4a91-9a57-392f25e4de7f" absoluteBounds="4.1400000000000006, 3.0850000000000009, 1.9700000000000002, 1.9801025390625" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
       </nestedChildShapes>
     </classShape>
@@ -69,5 +69,5 @@
       </nodes>
     </inheritanceConnector>
-    <associationConnector edgePoints="[(11.9843735 : 2.57859537760417); (11.9843735 : 4.44314697265625); (10.875 : 4.44314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
+    <associationConnector edgePoints="[(11.9843735 : 2.57859537760417); (11.9843735 : 4.56814697265625); (10.875 : 4.56814697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Resource/Resource_AssignedResource" />
       <nodes>
@@ -76,5 +76,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(8.5 : 4.22195556640625); (8.875 : 4.22195556640625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
+    <associationConnector edgePoints="[(8.5 : 3.34780110677083); (8.875 : 3.875)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Job/Job_AssignedResource" />
       <nodes>
@@ -83,5 +83,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(7.0898076923077 : 4.6939111328125); (7.0898076923077 : 5.5)]" fixedFrom="NotFixed" fixedTo="NotFixed">
+    <associationConnector edgePoints="[(7.4687475 : 3.34780110677083); (7.4687475 : 5.5)]" fixedFrom="Algorithm" fixedTo="Algorithm">
       <AssociationMoniker Name="/HiveDataContext/Job/Job_RequiredPlugin" />
       <nodes>
@@ -97,11 +97,4 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(8.875 : 2.33735270182292); (8.5 : 2.33735270182292)]" fixedFrom="NotFixed" fixedTo="NotFixed">
-      <AssociationMoniker Name="/HiveDataContext/Slave/Slave_Job" />
-      <nodes>
-        <classShapeMoniker Id="26f4edfa-91dd-4941-a058-359f89e567a8" />
-        <classShapeMoniker Id="695bfc39-59f3-4e60-8644-f847964bf62c" />
-      </nodes>
-    </associationConnector>
     <associationConnector edgePoints="[(12.781252 : 2.57859537760417); (12.781252 : 3.54212367513021); (13.5 : 3.54212367513021)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Resource/Resource_UptimeCalendar" />
@@ -111,5 +104,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(6.5 : 3.65945556640625); (6.125 : 3.65945556640625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
+    <associationConnector edgePoints="[(6.5 : 2.98640055338542); (6.125 : 2.98640055338542)]" fixedFrom="Algorithm" fixedTo="Algorithm">
       <AssociationMoniker Name="/HiveDataContext/Job/Job_HiveExperiment" />
       <nodes>
@@ -124,11 +117,11 @@
       </nestedChildShapes>
     </classShape>
-    <classShape Id="ad25bd0f-80e8-4a06-abd8-190eb678eec7" absoluteBounds="11.625, 5.5, 2, 1.5785953776041666">
+    <classShape Id="ad25bd0f-80e8-4a06-abd8-190eb678eec7" absoluteBounds="11.25, 5.5, 2, 1.5785953776041666">
       <DataClassMoniker Name="/HiveDataContext/PluginData" />
       <nestedChildShapes>
-        <elementListCompartment Id="acddb513-7de6-4bb4-8335-d6982fb2ef35" absoluteBounds="11.64, 5.9600000000000009, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+        <elementListCompartment Id="acddb513-7de6-4bb4-8335-d6982fb2ef35" absoluteBounds="11.265, 5.9600000000000009, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
       </nestedChildShapes>
     </classShape>
-    <associationConnector edgePoints="[(11 : 6.28929768880208); (11.625 : 6.28929768880208)]" fixedFrom="NotFixed" fixedTo="NotFixed">
+    <associationConnector edgePoints="[(10.875 : 6.28929768880208); (11.25 : 6.28929768880208)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_PluginData" />
       <nodes>
@@ -137,5 +130,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
+    <associationConnector edgePoints="[(6.5 : 1.69314697265625); (6.125 : 1.69314697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
       <AssociationMoniker Name="/HiveDataContext/Job/Job_JobData" />
       <nodes>
@@ -144,5 +137,5 @@
       </nodes>
     </associationConnector>
-    <associationConnector edgePoints="[(9 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
+    <associationConnector edgePoints="[(8.875 : 6.19314697265625); (8.5 : 6.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
       <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_RequiredPlugin" />
       <nodes>
@@ -158,4 +151,37 @@
       </nodes>
     </associationConnector>
+    <classShape Id="00352397-340e-449a-8e23-6ddd216e8617" absoluteBounds="1.75, 1, 2, 2.1554996744791666">
+      <DataClassMoniker Name="/HiveDataContext/StateLog" />
+      <nestedChildShapes>
+        <elementListCompartment Id="9a003897-deef-4bb5-b180-4c4bcdb7fadc" absoluteBounds="1.765, 1.46, 1.9700000000000002, 1.5954996744791665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+      </nestedChildShapes>
+    </classShape>
+    <classShape Id="4d800dc9-1b18-469f-b02c-d4554757c5e1" absoluteBounds="1.75, 3.625, 2, 1.5785953776041666">
+      <DataClassMoniker Name="/HiveDataContext/HiveExperimentPermission" />
+      <nestedChildShapes>
+        <elementListCompartment Id="dedd97d3-a9a2-45a2-9b95-d7366fb65a7f" absoluteBounds="1.765, 4.085, 1.9700000000000002, 1.0185953776041665" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
+      </nestedChildShapes>
+    </classShape>
+    <associationConnector edgePoints="[(6.5 : 2.50564697265625); (3.75 : 2.50564697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+      <AssociationMoniker Name="/HiveDataContext/Job/Job_StateLog" />
+      <nodes>
+        <classShapeMoniker Id="695bfc39-59f3-4e60-8644-f847964bf62c" />
+        <classShapeMoniker Id="00352397-340e-449a-8e23-6ddd216e8617" />
+      </nodes>
+    </associationConnector>
+    <associationConnector edgePoints="[(11.25 : 1.78929768880208); (10.9375 : 1.78929768880208); (10.9375 : 0.6875); (2.75 : 0.6875); (2.75 : 1)]" fixedFrom="Algorithm" fixedTo="Algorithm">
+      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_StateLog" />
+      <nodes>
+        <classShapeMoniker Id="706a4581-6daf-4e71-ae2a-87d50b27a051" />
+        <classShapeMoniker Id="00352397-340e-449a-8e23-6ddd216e8617" />
+      </nodes>
+    </associationConnector>
+    <associationConnector edgePoints="[(4.125 : 4.39505126953125); (3.75 : 4.39505126953125)]" fixedFrom="NotFixed" fixedTo="NotFixed">
+      <AssociationMoniker Name="/HiveDataContext/HiveExperiment/HiveExperiment_HiveExperimentPermission" />
+      <nodes>
+        <classShapeMoniker Id="e6f840cc-2968-4be1-b234-eef624ccacbb" />
+        <classShapeMoniker Id="4d800dc9-1b18-469f-b02c-d4554757c5e1" />
+      </nodes>
+    </associationConnector>
   </nestedChildShapes>
 </ordesignerObjectsDiagram>
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs	(revision 5458)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/HiveDataContext.designer.cs	(revision 5511)
@@ -58,4 +58,10 @@
     partial void UpdatePluginData(PluginData instance);
     partial void DeletePluginData(PluginData instance);
+    partial void InsertStateLog(StateLog instance);
+    partial void UpdateStateLog(StateLog instance);
+    partial void DeleteStateLog(StateLog instance);
+    partial void InsertHiveExperimentPermission(HiveExperimentPermission instance);
+    partial void UpdateHiveExperimentPermission(HiveExperimentPermission instance);
+    partial void DeleteHiveExperimentPermission(HiveExperimentPermission instance);
     #endregion
 		
@@ -153,4 +159,20 @@
 			{
 				return this.GetTable<PluginData>();
+			}
+		}
+		
+		public System.Data.Linq.Table<StateLog> StateLogs
+		{
+			get
+			{
+				return this.GetTable<StateLog>();
+			}
+		}
+		
+		public System.Data.Linq.Table<HiveExperimentPermission> HiveExperimentPermissions
+		{
+			get
+			{
+				return this.GetTable<HiveExperimentPermission>();
 			}
 		}
@@ -788,5 +810,5 @@
 		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
 		
-		protected System.Guid _ResourceId;
+		private System.Guid _ResourceId;
 		
 		private string _Name;
@@ -801,4 +823,6 @@
 		
 		private EntitySet<UptimeCalendar> _UptimeCalendars;
+		
+		private EntitySet<StateLog> _StateLogs;
 		
 		private EntityRef<Resource> _ParentResource;
@@ -823,4 +847,5 @@
 			this._ChildResources = new EntitySet<Resource>(new Action<Resource>(this.attach_ChildResources), new Action<Resource>(this.detach_ChildResources));
 			this._UptimeCalendars = new EntitySet<UptimeCalendar>(new Action<UptimeCalendar>(this.attach_UptimeCalendars), new Action<UptimeCalendar>(this.detach_UptimeCalendars));
+			this._StateLogs = new EntitySet<StateLog>(new Action<StateLog>(this.attach_StateLogs), new Action<StateLog>(this.detach_StateLogs));
 			this._ParentResource = default(EntityRef<Resource>);
 			OnCreated();
@@ -950,4 +975,17 @@
 		}
 		
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_StateLog", Storage="_StateLogs", ThisKey="ResourceId", OtherKey="SlaveId")]
+		public EntitySet<StateLog> StateLogs
+		{
+			get
+			{
+				return this._StateLogs;
+			}
+			set
+			{
+				this._StateLogs.Assign(value);
+			}
+		}
+		
 		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_Resource", Storage="_ParentResource", ThisKey="ParentResourceId", OtherKey="ResourceId", IsForeignKey=true)]
 		public Resource ParentResource
@@ -1035,4 +1073,16 @@
 		
 		private void detach_UptimeCalendars(UptimeCalendar entity)
+		{
+			this.SendPropertyChanging();
+			entity.Resource = null;
+		}
+		
+		private void attach_StateLogs(StateLog entity)
+		{
+			this.SendPropertyChanging();
+			entity.Resource = this;
+		}
+		
+		private void detach_StateLogs(StateLog entity)
 		{
 			this.SendPropertyChanging();
@@ -1065,6 +1115,4 @@
 		
 		private System.Nullable<System.DateTime> _LastHeartbeat;
-		
-		private EntitySet<Job> _Jobs;
 		
     #region Extensibility Method Definitions
@@ -1098,5 +1146,4 @@
 		public Slave()
 		{
-			this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs));
 			OnCreated();
 		}
@@ -1320,29 +1367,4 @@
 				}
 			}
-		}
-		
-		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Slave_Job", Storage="_Jobs", ThisKey="ResourceId", OtherKey="SlaveId")]
-		public EntitySet<Job> Jobs
-		{
-			get
-			{
-				return this._Jobs;
-			}
-			set
-			{
-				this._Jobs.Assign(value);
-			}
-		}
-		
-		private void attach_Jobs(Job entity)
-		{
-			this.SendPropertyChanging();
-			entity.Slave = this;
-		}
-		
-		private void detach_Jobs(Job entity)
-		{
-			this.SendPropertyChanging();
-			entity.Slave = null;
 		}
 	}
@@ -1373,24 +1395,8 @@
 		private System.Nullable<System.Guid> _ParentJobId;
 		
-		private global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState _JobState;
-		
-		private System.Nullable<System.Guid> _ResourceId;
-		
-		private System.Nullable<System.TimeSpan> _ExecutionTime;
-		
-		private string _Exception;
-		
-		private System.DateTime _DateCreated;
-		
-		private System.Nullable<System.DateTime> _DateCalculated;
-		
-		private System.Nullable<System.DateTime> _DateFinished;
+		private string _ExecutionTime;
 		
 		private int _Priority;
 		
-		private System.Nullable<System.Guid> _ProjectId;
-		
-		private System.Guid _UserId;
-		
 		private int _CoresNeeded;
 		
@@ -1399,4 +1405,6 @@
 		private System.Nullable<System.DateTime> _LastHeartbeat;
 		
+		private global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState _State;
+		
 		private EntitySet<AssignedResource> _AssignedResources;
 		
@@ -1407,7 +1415,7 @@
 		private EntityRef<JobData> _JobData;
 		
+		private EntitySet<StateLog> _StateLogs;
+		
 		private EntityRef<Job> _Job1;
-		
-		private EntityRef<Slave> _Slave;
 		
     #region Extensibility Method Definitions
@@ -1419,24 +1427,8 @@
     partial void OnParentJobIdChanging(System.Nullable<System.Guid> value);
     partial void OnParentJobIdChanged();
-    partial void OnJobStateChanging(global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState value);
-    partial void OnJobStateChanged();
-    partial void OnSlaveIdChanging(System.Nullable<System.Guid> value);
-    partial void OnSlaveIdChanged();
-    partial void OnExecutionTimeChanging(System.Nullable<System.TimeSpan> value);
+    partial void OnExecutionTimeChanging(string value);
     partial void OnExecutionTimeChanged();
-    partial void OnExceptionChanging(string value);
-    partial void OnExceptionChanged();
-    partial void OnDateCreatedChanging(System.DateTime value);
-    partial void OnDateCreatedChanged();
-    partial void OnDateCalculatedChanging(System.Nullable<System.DateTime> value);
-    partial void OnDateCalculatedChanged();
-    partial void OnDateFinishedChanging(System.Nullable<System.DateTime> value);
-    partial void OnDateFinishedChanged();
     partial void OnPriorityChanging(int value);
     partial void OnPriorityChanged();
-    partial void OnProjectIdChanging(System.Nullable<System.Guid> value);
-    partial void OnProjectIdChanged();
-    partial void OnUserIdChanging(System.Guid value);
-    partial void OnUserIdChanged();
     partial void OnCoresNeededChanging(int value);
     partial void OnCoresNeededChanged();
@@ -1445,4 +1437,6 @@
     partial void OnLastHeartbeatChanging(System.Nullable<System.DateTime> value);
     partial void OnLastHeartbeatChanged();
+    partial void OnStateChanging(global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState value);
+    partial void OnStateChanged();
     #endregion
 		
@@ -1453,6 +1447,6 @@
 			this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs));
 			this._JobData = default(EntityRef<JobData>);
+			this._StateLogs = new EntitySet<StateLog>(new Action<StateLog>(this.attach_StateLogs), new Action<StateLog>(this.detach_StateLogs));
 			this._Job1 = default(EntityRef<Job>);
-			this._Slave = default(EntityRef<Slave>);
 			OnCreated();
 		}
@@ -1502,46 +1496,6 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobState", DbType="VarChar(15)", CanBeNull=false)]
-		public global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState JobState
-		{
-			get
-			{
-				return this._JobState;
-			}
-			set
-			{
-				if ((this._JobState != value))
-				{
-					this.OnJobStateChanging(value);
-					this.SendPropertyChanging();
-					this._JobState = value;
-					this.SendPropertyChanged("JobState");
-					this.OnJobStateChanged();
-				}
-			}
-		}
-		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Name="ResourceId", Storage="_ResourceId", DbType="UniqueIdentifier")]
-		public System.Nullable<System.Guid> SlaveId
-		{
-			get
-			{
-				return this._ResourceId;
-			}
-			set
-			{
-				if ((this._ResourceId != value))
-				{
-					this.OnSlaveIdChanging(value);
-					this.SendPropertyChanging();
-					this._ResourceId = value;
-					this.SendPropertyChanged("SlaveId");
-					this.OnSlaveIdChanged();
-				}
-			}
-		}
-		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="Time")]
-		public System.Nullable<System.TimeSpan> ExecutionTime
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ExecutionTime", DbType="VarChar(30)")]
+		public string ExecutionTime
 		{
 			get
@@ -1562,84 +1516,4 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Exception", DbType="VarChar(MAX)")]
-		public string Exception
-		{
-			get
-			{
-				return this._Exception;
-			}
-			set
-			{
-				if ((this._Exception != value))
-				{
-					this.OnExceptionChanging(value);
-					this.SendPropertyChanging();
-					this._Exception = value;
-					this.SendPropertyChanged("Exception");
-					this.OnExceptionChanged();
-				}
-			}
-		}
-		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateCreated", DbType="DateTime")]
-		public System.DateTime DateCreated
-		{
-			get
-			{
-				return this._DateCreated;
-			}
-			set
-			{
-				if ((this._DateCreated != value))
-				{
-					this.OnDateCreatedChanging(value);
-					this.SendPropertyChanging();
-					this._DateCreated = value;
-					this.SendPropertyChanged("DateCreated");
-					this.OnDateCreatedChanged();
-				}
-			}
-		}
-		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateCalculated", DbType="DateTime")]
-		public System.Nullable<System.DateTime> DateCalculated
-		{
-			get
-			{
-				return this._DateCalculated;
-			}
-			set
-			{
-				if ((this._DateCalculated != value))
-				{
-					this.OnDateCalculatedChanging(value);
-					this.SendPropertyChanging();
-					this._DateCalculated = value;
-					this.SendPropertyChanged("DateCalculated");
-					this.OnDateCalculatedChanged();
-				}
-			}
-		}
-		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateFinished", DbType="DateTime")]
-		public System.Nullable<System.DateTime> DateFinished
-		{
-			get
-			{
-				return this._DateFinished;
-			}
-			set
-			{
-				if ((this._DateFinished != value))
-				{
-					this.OnDateFinishedChanging(value);
-					this.SendPropertyChanging();
-					this._DateFinished = value;
-					this.SendPropertyChanged("DateFinished");
-					this.OnDateFinishedChanged();
-				}
-			}
-		}
-		
 		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Priority", DbType="Int NOT NULL")]
 		public int Priority
@@ -1662,44 +1536,4 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="UniqueIdentifier")]
-		public System.Nullable<System.Guid> ProjectId
-		{
-			get
-			{
-				return this._ProjectId;
-			}
-			set
-			{
-				if ((this._ProjectId != value))
-				{
-					this.OnProjectIdChanging(value);
-					this.SendPropertyChanging();
-					this._ProjectId = value;
-					this.SendPropertyChanged("ProjectId");
-					this.OnProjectIdChanged();
-				}
-			}
-		}
-		
-		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier")]
-		public System.Guid UserId
-		{
-			get
-			{
-				return this._UserId;
-			}
-			set
-			{
-				if ((this._UserId != value))
-				{
-					this.OnUserIdChanging(value);
-					this.SendPropertyChanging();
-					this._UserId = value;
-					this.SendPropertyChanged("UserId");
-					this.OnUserIdChanged();
-				}
-			}
-		}
-		
 		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CoresNeeded", DbType="Int NOT NULL")]
 		public int CoresNeeded
@@ -1762,4 +1596,24 @@
 		}
 		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Name="JobState", Storage="_State", DbType="VarChar(30)", CanBeNull=false)]
+		public global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState State
+		{
+			get
+			{
+				return this._State;
+			}
+			set
+			{
+				if ((this._State != value))
+				{
+					this.OnStateChanging(value);
+					this.SendPropertyChanging();
+					this._State = value;
+					this.SendPropertyChanged("State");
+					this.OnStateChanged();
+				}
+			}
+		}
+		
 		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_AssignedResource", Storage="_AssignedResources", ThisKey="JobId", OtherKey="JobId")]
 		public EntitySet<AssignedResource> AssignedResources
@@ -1830,4 +1684,17 @@
 		}
 		
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_StateLog", Storage="_StateLogs", ThisKey="JobId", OtherKey="JobId")]
+		public EntitySet<StateLog> StateLogs
+		{
+			get
+			{
+				return this._StateLogs;
+			}
+			set
+			{
+				this._StateLogs.Assign(value);
+			}
+		}
+		
 		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_Job", Storage="_Job1", ThisKey="ParentJobId", OtherKey="JobId", IsForeignKey=true)]
 		public Job ParentJob
@@ -1864,38 +1731,4 @@
 		}
 		
-		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Slave_Job", Storage="_Slave", ThisKey="SlaveId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="SET NULL")]
-		public Slave Slave
-		{
-			get
-			{
-				return this._Slave.Entity;
-			}
-			set
-			{
-				Slave previousValue = this._Slave.Entity;
-				if (((previousValue != value) 
-							|| (this._Slave.HasLoadedOrAssignedValue == false)))
-				{
-					this.SendPropertyChanging();
-					if ((previousValue != null))
-					{
-						this._Slave.Entity = null;
-						previousValue.Jobs.Remove(this);
-					}
-					this._Slave.Entity = value;
-					if ((value != null))
-					{
-						value.Jobs.Add(this);
-						this._ResourceId = value.ResourceId;
-					}
-					else
-					{
-						this._ResourceId = default(Nullable<System.Guid>);
-					}
-					this.SendPropertyChanged("Slave");
-				}
-			}
-		}
-		
 		public event PropertyChangingEventHandler PropertyChanging;
 		
@@ -1952,4 +1785,16 @@
 			this.SendPropertyChanging();
 			entity.ParentJob = null;
+		}
+		
+		private void attach_StateLogs(StateLog entity)
+		{
+			this.SendPropertyChanging();
+			entity.Job = this;
+		}
+		
+		private void detach_StateLogs(StateLog entity)
+		{
+			this.SendPropertyChanging();
+			entity.Job = null;
 		}
 	}
@@ -2222,4 +2067,10 @@
 		private System.DateTime _DateCreated;
 		
+		private System.Nullable<System.DateTime> _LastAccessed;
+		
+		private bool _IsHiveEngine;
+		
+		private EntitySet<HiveExperimentPermission> _HiveExperimentPermissions;
+		
 		private EntityRef<Job> _Job;
 		
@@ -2236,14 +2087,19 @@
     partial void OnResourceIdsChanging(string value);
     partial void OnResourceIdsChanged();
-    partial void OnUserIdChanging(System.Guid value);
-    partial void OnUserIdChanged();
+    partial void OnOwnerUserIdChanging(System.Guid value);
+    partial void OnOwnerUserIdChanged();
     partial void OnRootJobIdChanging(System.Guid value);
     partial void OnRootJobIdChanged();
     partial void OnDateCreatedChanging(System.DateTime value);
     partial void OnDateCreatedChanged();
+    partial void OnLastAccessedChanging(System.Nullable<System.DateTime> value);
+    partial void OnLastAccessedChanged();
+    partial void OnIsHiveEngineChanging(bool value);
+    partial void OnIsHiveEngineChanged();
     #endregion
 		
 		public HiveExperiment()
 		{
+			this._HiveExperimentPermissions = new EntitySet<HiveExperimentPermission>(new Action<HiveExperimentPermission>(this.attach_HiveExperimentPermissions), new Action<HiveExperimentPermission>(this.detach_HiveExperimentPermissions));
 			this._Job = default(EntityRef<Job>);
 			OnCreated();
@@ -2331,5 +2187,5 @@
 		
 		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier")]
-		public System.Guid UserId
+		public System.Guid OwnerUserId
 		{
 			get
@@ -2341,9 +2197,9 @@
 				if ((this._UserId != value))
 				{
-					this.OnUserIdChanging(value);
+					this.OnOwnerUserIdChanging(value);
 					this.SendPropertyChanging();
 					this._UserId = value;
-					this.SendPropertyChanged("UserId");
-					this.OnUserIdChanged();
+					this.SendPropertyChanged("OwnerUserId");
+					this.OnOwnerUserIdChanged();
 				}
 			}
@@ -2394,4 +2250,57 @@
 		}
 		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LastAccessed", DbType="DateTime")]
+		public System.Nullable<System.DateTime> LastAccessed
+		{
+			get
+			{
+				return this._LastAccessed;
+			}
+			set
+			{
+				if ((this._LastAccessed != value))
+				{
+					this.OnLastAccessedChanging(value);
+					this.SendPropertyChanging();
+					this._LastAccessed = value;
+					this.SendPropertyChanged("LastAccessed");
+					this.OnLastAccessedChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_IsHiveEngine", DbType="Bit")]
+		public bool IsHiveEngine
+		{
+			get
+			{
+				return this._IsHiveEngine;
+			}
+			set
+			{
+				if ((this._IsHiveEngine != value))
+				{
+					this.OnIsHiveEngineChanging(value);
+					this.SendPropertyChanging();
+					this._IsHiveEngine = value;
+					this.SendPropertyChanged("IsHiveEngine");
+					this.OnIsHiveEngineChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_HiveExperimentPermission", Storage="_HiveExperimentPermissions", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId")]
+		public EntitySet<HiveExperimentPermission> HiveExperimentPermissions
+		{
+			get
+			{
+				return this._HiveExperimentPermissions;
+			}
+			set
+			{
+				this._HiveExperimentPermissions.Assign(value);
+			}
+		}
+		
 		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_HiveExperiment", Storage="_Job", ThisKey="RootJobId", OtherKey="JobId", IsForeignKey=true, DeleteRule="CASCADE")]
 		public Job RootJob
@@ -2431,7 +2340,19 @@
 			}
 		}
+		
+		private void attach_HiveExperimentPermissions(HiveExperimentPermission entity)
+		{
+			this.SendPropertyChanging();
+			entity.HiveExperiment = this;
+		}
+		
+		private void detach_HiveExperimentPermissions(HiveExperimentPermission entity)
+		{
+			this.SendPropertyChanging();
+			entity.HiveExperiment = null;
+		}
 	}
 	
-	[global::System.Data.Linq.Mapping.TableAttribute(Name="")]
+	[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.JobData")]
 	public partial class JobData : INotifyPropertyChanging, INotifyPropertyChanged
 	{
@@ -2584,5 +2505,5 @@
 	}
 	
-	[global::System.Data.Linq.Mapping.TableAttribute(Name="")]
+	[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.PluginData")]
 	public partial class PluginData : INotifyPropertyChanging, INotifyPropertyChanged
 	{
@@ -2758,4 +2679,467 @@
 		}
 	}
+	
+	[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.StateLog")]
+	public partial class StateLog : INotifyPropertyChanging, INotifyPropertyChanged
+	{
+		
+		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
+		
+		private System.Guid _StateLogId;
+		
+		private global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState _State;
+		
+		private System.DateTime _DateTime;
+		
+		private System.Guid _JobId;
+		
+		private System.Nullable<System.Guid> _UserId;
+		
+		private System.Nullable<System.Guid> _SlaveId;
+		
+		private string _Exception;
+		
+		private EntityRef<Job> _Job;
+		
+		private EntityRef<Resource> _Resource;
+		
+    #region Extensibility Method Definitions
+    partial void OnLoaded();
+    partial void OnValidate(System.Data.Linq.ChangeAction action);
+    partial void OnCreated();
+    partial void OnStateLogIdChanging(System.Guid value);
+    partial void OnStateLogIdChanged();
+    partial void OnStateChanging(global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState value);
+    partial void OnStateChanged();
+    partial void OnDateTimeChanging(System.DateTime value);
+    partial void OnDateTimeChanged();
+    partial void OnJobIdChanging(System.Guid value);
+    partial void OnJobIdChanged();
+    partial void OnUserIdChanging(System.Nullable<System.Guid> value);
+    partial void OnUserIdChanged();
+    partial void OnSlaveIdChanging(System.Nullable<System.Guid> value);
+    partial void OnSlaveIdChanged();
+    partial void OnExceptionChanging(string value);
+    partial void OnExceptionChanged();
+    #endregion
+		
+		public StateLog()
+		{
+			this._Job = default(EntityRef<Job>);
+			this._Resource = default(EntityRef<Resource>);
+			OnCreated();
+		}
+		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StateLogId", AutoSync=AutoSync.OnInsert, DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]
+		public System.Guid StateLogId
+		{
+			get
+			{
+				return this._StateLogId;
+			}
+			set
+			{
+				if ((this._StateLogId != value))
+				{
+					this.OnStateLogIdChanging(value);
+					this.SendPropertyChanging();
+					this._StateLogId = value;
+					this.SendPropertyChanged("StateLogId");
+					this.OnStateLogIdChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_State", DbType="VarChar(30) NOT NULL", CanBeNull=false)]
+		public global::HeuristicLab.Services.Hive.Common.DataTransfer.JobState State
+		{
+			get
+			{
+				return this._State;
+			}
+			set
+			{
+				if ((this._State != value))
+				{
+					this.OnStateChanging(value);
+					this.SendPropertyChanging();
+					this._State = value;
+					this.SendPropertyChanged("State");
+					this.OnStateChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DateTime", DbType="DateTime NOT NULL")]
+		public System.DateTime DateTime
+		{
+			get
+			{
+				return this._DateTime;
+			}
+			set
+			{
+				if ((this._DateTime != value))
+				{
+					this.OnDateTimeChanging(value);
+					this.SendPropertyChanging();
+					this._DateTime = value;
+					this.SendPropertyChanged("DateTime");
+					this.OnDateTimeChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobId", DbType="UniqueIdentifier NOT NULL")]
+		public System.Guid JobId
+		{
+			get
+			{
+				return this._JobId;
+			}
+			set
+			{
+				if ((this._JobId != value))
+				{
+					if (this._Job.HasLoadedOrAssignedValue)
+					{
+						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+					}
+					this.OnJobIdChanging(value);
+					this.SendPropertyChanging();
+					this._JobId = value;
+					this.SendPropertyChanged("JobId");
+					this.OnJobIdChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserId", DbType="UniqueIdentifier")]
+		public System.Nullable<System.Guid> UserId
+		{
+			get
+			{
+				return this._UserId;
+			}
+			set
+			{
+				if ((this._UserId != value))
+				{
+					this.OnUserIdChanging(value);
+					this.SendPropertyChanging();
+					this._UserId = value;
+					this.SendPropertyChanged("UserId");
+					this.OnUserIdChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SlaveId", DbType="UniqueIdentifier")]
+		public System.Nullable<System.Guid> SlaveId
+		{
+			get
+			{
+				return this._SlaveId;
+			}
+			set
+			{
+				if ((this._SlaveId != value))
+				{
+					if (this._Resource.HasLoadedOrAssignedValue)
+					{
+						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+					}
+					this.OnSlaveIdChanging(value);
+					this.SendPropertyChanging();
+					this._SlaveId = value;
+					this.SendPropertyChanged("SlaveId");
+					this.OnSlaveIdChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Exception", DbType="VarChar(MAX)", CanBeNull=false)]
+		public string Exception
+		{
+			get
+			{
+				return this._Exception;
+			}
+			set
+			{
+				if ((this._Exception != value))
+				{
+					this.OnExceptionChanging(value);
+					this.SendPropertyChanging();
+					this._Exception = value;
+					this.SendPropertyChanged("Exception");
+					this.OnExceptionChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Job_StateLog", Storage="_Job", ThisKey="JobId", OtherKey="JobId", IsForeignKey=true)]
+		public Job Job
+		{
+			get
+			{
+				return this._Job.Entity;
+			}
+			set
+			{
+				Job previousValue = this._Job.Entity;
+				if (((previousValue != value) 
+							|| (this._Job.HasLoadedOrAssignedValue == false)))
+				{
+					this.SendPropertyChanging();
+					if ((previousValue != null))
+					{
+						this._Job.Entity = null;
+						previousValue.StateLogs.Remove(this);
+					}
+					this._Job.Entity = value;
+					if ((value != null))
+					{
+						value.StateLogs.Add(this);
+						this._JobId = value.JobId;
+					}
+					else
+					{
+						this._JobId = default(System.Guid);
+					}
+					this.SendPropertyChanged("Job");
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_StateLog", Storage="_Resource", ThisKey="SlaveId", OtherKey="ResourceId", IsForeignKey=true)]
+		public Resource Resource
+		{
+			get
+			{
+				return this._Resource.Entity;
+			}
+			set
+			{
+				Resource previousValue = this._Resource.Entity;
+				if (((previousValue != value) 
+							|| (this._Resource.HasLoadedOrAssignedValue == false)))
+				{
+					this.SendPropertyChanging();
+					if ((previousValue != null))
+					{
+						this._Resource.Entity = null;
+						previousValue.StateLogs.Remove(this);
+					}
+					this._Resource.Entity = value;
+					if ((value != null))
+					{
+						value.StateLogs.Add(this);
+						this._SlaveId = value.ResourceId;
+					}
+					else
+					{
+						this._SlaveId = default(Nullable<System.Guid>);
+					}
+					this.SendPropertyChanged("Resource");
+				}
+			}
+		}
+		
+		public event PropertyChangingEventHandler PropertyChanging;
+		
+		public event PropertyChangedEventHandler PropertyChanged;
+		
+		protected virtual void SendPropertyChanging()
+		{
+			if ((this.PropertyChanging != null))
+			{
+				this.PropertyChanging(this, emptyChangingEventArgs);
+			}
+		}
+		
+		protected virtual void SendPropertyChanged(String propertyName)
+		{
+			if ((this.PropertyChanged != null))
+			{
+				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+			}
+		}
+	}
+	
+	[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.HiveExperimentPermission")]
+	public partial class HiveExperimentPermission : INotifyPropertyChanging, INotifyPropertyChanged
+	{
+		
+		private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
+		
+		private System.Guid _HiveExperimentId;
+		
+		private System.Guid _GrantedUserId;
+		
+		private System.Guid _GrantedByUserId;
+		
+		private global::HeuristicLab.Services.Hive.Common.DataTransfer.Permission _Permission;
+		
+		private EntityRef<HiveExperiment> _HiveExperiment;
+		
+    #region Extensibility Method Definitions
+    partial void OnLoaded();
+    partial void OnValidate(System.Data.Linq.ChangeAction action);
+    partial void OnCreated();
+    partial void OnHiveExperimentIdChanging(System.Guid value);
+    partial void OnHiveExperimentIdChanged();
+    partial void OnGrantedUserIdChanging(System.Guid value);
+    partial void OnGrantedUserIdChanged();
+    partial void OnGrantedByUserIdChanging(System.Guid value);
+    partial void OnGrantedByUserIdChanged();
+    partial void OnPermissionChanging(global::HeuristicLab.Services.Hive.Common.DataTransfer.Permission value);
+    partial void OnPermissionChanged();
+    #endregion
+		
+		public HiveExperimentPermission()
+		{
+			this._HiveExperiment = default(EntityRef<HiveExperiment>);
+			OnCreated();
+		}
+		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_HiveExperimentId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
+		public System.Guid HiveExperimentId
+		{
+			get
+			{
+				return this._HiveExperimentId;
+			}
+			set
+			{
+				if ((this._HiveExperimentId != value))
+				{
+					if (this._HiveExperiment.HasLoadedOrAssignedValue)
+					{
+						throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
+					}
+					this.OnHiveExperimentIdChanging(value);
+					this.SendPropertyChanging();
+					this._HiveExperimentId = value;
+					this.SendPropertyChanged("HiveExperimentId");
+					this.OnHiveExperimentIdChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GrantedUserId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
+		public System.Guid GrantedUserId
+		{
+			get
+			{
+				return this._GrantedUserId;
+			}
+			set
+			{
+				if ((this._GrantedUserId != value))
+				{
+					this.OnGrantedUserIdChanging(value);
+					this.SendPropertyChanging();
+					this._GrantedUserId = value;
+					this.SendPropertyChanged("GrantedUserId");
+					this.OnGrantedUserIdChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_GrantedByUserId", DbType="UniqueIdentifier NOT NULL")]
+		public System.Guid GrantedByUserId
+		{
+			get
+			{
+				return this._GrantedByUserId;
+			}
+			set
+			{
+				if ((this._GrantedByUserId != value))
+				{
+					this.OnGrantedByUserIdChanging(value);
+					this.SendPropertyChanging();
+					this._GrantedByUserId = value;
+					this.SendPropertyChanged("GrantedByUserId");
+					this.OnGrantedByUserIdChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Permission", DbType="VarChar(15) NOT NULL", CanBeNull=false)]
+		public global::HeuristicLab.Services.Hive.Common.DataTransfer.Permission Permission
+		{
+			get
+			{
+				return this._Permission;
+			}
+			set
+			{
+				if ((this._Permission != value))
+				{
+					this.OnPermissionChanging(value);
+					this.SendPropertyChanging();
+					this._Permission = value;
+					this.SendPropertyChanged("Permission");
+					this.OnPermissionChanged();
+				}
+			}
+		}
+		
+		[global::System.Data.Linq.Mapping.AssociationAttribute(Name="HiveExperiment_HiveExperimentPermission", Storage="_HiveExperiment", ThisKey="HiveExperimentId", OtherKey="HiveExperimentId", IsForeignKey=true)]
+		public HiveExperiment HiveExperiment
+		{
+			get
+			{
+				return this._HiveExperiment.Entity;
+			}
+			set
+			{
+				HiveExperiment previousValue = this._HiveExperiment.Entity;
+				if (((previousValue != value) 
+							|| (this._HiveExperiment.HasLoadedOrAssignedValue == false)))
+				{
+					this.SendPropertyChanging();
+					if ((previousValue != null))
+					{
+						this._HiveExperiment.Entity = null;
+						previousValue.HiveExperimentPermissions.Remove(this);
+					}
+					this._HiveExperiment.Entity = value;
+					if ((value != null))
+					{
+						value.HiveExperimentPermissions.Add(this);
+						this._HiveExperimentId = value.HiveExperimentId;
+					}
+					else
+					{
+						this._HiveExperimentId = default(System.Guid);
+					}
+					this.SendPropertyChanged("HiveExperiment");
+				}
+			}
+		}
+		
+		public event PropertyChangingEventHandler PropertyChanging;
+		
+		public event PropertyChangedEventHandler PropertyChanged;
+		
+		protected virtual void SendPropertyChanging()
+		{
+			if ((this.PropertyChanging != null))
+			{
+				this.PropertyChanging(this, emptyChangingEventArgs);
+			}
+		}
+		
+		protected virtual void SendPropertyChanged(String propertyName)
+		{
+			if ((this.PropertyChanged != null))
+			{
+				this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+			}
+		}
+	}
 }
 #pragma warning restore 1591
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs	(revision 5458)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Interfaces/IHiveDao.cs	(revision 5511)
@@ -1,9 +1,8 @@
 ﻿using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Linq.Expressions;
 
 namespace HeuristicLab.Services.Hive.DataAccess {
+  using HeuristicLab.Services.Hive.Common.DataTransfer;
   using DT = HeuristicLab.Services.Hive.Common.DataTransfer;
 
@@ -32,4 +31,12 @@
     void UpdateHiveExperiment(DT.HiveExperiment dto);
     void DeleteHiveExperiment(Guid id);
+    #endregion
+
+    #region HiveExperimentPermission Methods
+    DT.HiveExperimentPermission GetHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId);
+    IEnumerable<DT.HiveExperimentPermission> GetHiveExperimentPermissions(Expression<Func<HiveExperimentPermission, bool>> predicate);
+    void AddHiveExperimentPermission(DT.HiveExperimentPermission dto);
+    void UpdateHiveExperimentPermission(DT.HiveExperimentPermission dto);
+    void DeleteHiveExperimentPermission(Guid hiveExperimentId, Guid grantedUserId);
     #endregion
 
@@ -80,5 +87,7 @@
 
     #region Authorization Methods
-    bool IsUserAuthorizedForJobs(Guid userId, params Guid[] jobIds);
+    Permission GetPermissionForJob(Guid jobId, Guid userId);
+    Permission GetPermissionForExperiment(Guid experimentId, Guid userId);
+    Guid GetExperimentForJob(Guid jobId);
     #endregion
   }
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/CreateHiveDatabaseApplication.cs
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/CreateHiveDatabaseApplication.cs	(revision 5458)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/CreateHiveDatabaseApplication.cs	(revision 5511)
@@ -28,5 +28,5 @@
   class CreateHiveDatabaseApplication : ApplicationBase {
 
-    public override void Run() {
+    public override void Run() { 
       using (var db = HiveDao.CreateContext()) {
         if (db.DatabaseExists())
Index: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/prepareHiveDatabase.sql
===================================================================
--- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/prepareHiveDatabase.sql	(revision 5458)
+++ branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Tools/prepareHiveDatabase.sql	(revision 5511)
@@ -40,11 +40,12 @@
 ALTER TABLE dbo.Job ALTER COLUMN JobId ADD ROWGUIDCOL;
 ALTER TABLE dbo.Job WITH NOCHECK ADD CONSTRAINT [DF_Job_JobId] DEFAULT (newid()) FOR JobId;
+GO
 
---ALTER TABLE [dbo].[Job]  DROP  CONSTRAINT [Slave_Job]
---ALTER TABLE [dbo].[Job]  WITH CHECK ADD  CONSTRAINT [Slave_Job] FOREIGN KEY([ResourceId])
---REFERENCES [dbo].[Resource] ([ResourceId])
---ON UPDATE CASCADE
---ON DELETE SET NULL
---GO
+ALTER TABLE [dbo].[StateLog]  DROP  CONSTRAINT [Job_StateLog]
+ALTER TABLE [dbo].[StateLog]  WITH CHECK ADD CONSTRAINT [Job_StateLog] FOREIGN KEY([JobId])
+REFERENCES [dbo].[Job] ([JobId])
+ON UPDATE CASCADE
+ON DELETE CASCADE
+GO
 
 ALTER TABLE dbo.Plugin ALTER COLUMN PluginId ADD ROWGUIDCOL;
@@ -79,4 +80,14 @@
 ALTER TABLE dbo.HiveExperiment ALTER COLUMN HiveExperimentId ADD ROWGUIDCOL;
 ALTER TABLE dbo.HiveExperiment WITH NOCHECK ADD CONSTRAINT [DF_HiveExperiment_HiveExperimentId] DEFAULT (newid()) FOR HiveExperimentId;
+
+ALTER TABLE dbo.StateLog ALTER COLUMN StateLogId ADD ROWGUIDCOL;
+ALTER TABLE dbo.StateLog WITH NOCHECK ADD CONSTRAINT [DF_StateLog_StateLogId] DEFAULT (newid()) FOR StateLogId;
+
+ALTER TABLE [dbo].[HiveExperimentPermission]  DROP  CONSTRAINT [HiveExperiment_HiveExperimentPermission]
+ALTER TABLE [dbo].[HiveExperimentPermission]  WITH CHECK ADD CONSTRAINT [HiveExperiment_HiveExperimentPermission] FOREIGN KEY([HiveExperimentId])
+REFERENCES [dbo].[HiveExperiment] ([HiveExperimentId])
+ON UPDATE CASCADE
+ON DELETE CASCADE
+GO
 
 /* create indices */
