Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/07/17 10:21:08 (7 years ago)
Author:
jkarder
Message:

#2839: worked on database model

Location:
branches/HiveProjectManagement
Files:
2 added
14 edited
1 moved

Legend:

Unmodified
Added
Removed
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/AssignedTaskResourceDao.cs

    r15410 r15411  
    2525
    2626namespace HeuristicLab.Services.Hive.DataAccess.Daos {
    27   public class AssignedResourceDao : GenericDao<Guid, AssignedResource> {
    28     public AssignedResourceDao(DataContext dataContext) : base(dataContext) { }
     27  public class AssignedTaskResourceDao : GenericDao<Guid, AssignedTaskResource> {
     28    public AssignedTaskResourceDao(DataContext dataContext) : base(dataContext) { }
    2929
    30     public override AssignedResource GetById(Guid id) {
     30    public override AssignedTaskResource GetById(Guid id) {
    3131      throw new NotImplementedException();
    3232    }
    3333
    34     public IQueryable<AssignedResource> GetByTaskId(Guid taskId) {
     34    public IQueryable<AssignedTaskResource> GetByTaskId(Guid taskId) {
    3535      return Table.Where(x => x.TaskId == taskId);
    3636    }
     
    5151      )
    5252      SELECT COUNT(ar.TaskId)
    53       FROM pr JOIN AssignedResources ar ON pr.ResourceId = ar.ResourceId
     53      FROM pr JOIN AssignedTaskResources ar ON pr.ResourceId = ar.ResourceId
    5454      WHERE ar.TaskId = {1}
    5555    ";
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/TaskDao.cs

    r14185 r15411  
    2727namespace HeuristicLab.Services.Hive.DataAccess.Daos {
    2828  public class TaskDao : GenericDao<Guid, Task> {
    29     private Table<AssignedResource> AssignedResourceTable {
    30       get { return DataContext.GetTable<AssignedResource>(); }
     29    private Table<AssignedTaskResource> AssignedTaskResourceTable {
     30      get { return DataContext.GetTable<AssignedTaskResource>(); }
    3131    }
    3232
     
    6565    /// <returns></returns>
    6666    public IEnumerable<Task> GetParentTasks(IEnumerable<Guid> resourceIds, int count, bool finished) {
    67       var query = from ar in AssignedResourceTable
     67      var query = from ar in AssignedTaskResourceTable
    6868                  where resourceIds.Contains(ar.ResourceId)
    6969                     && ar.Task.State == TaskState.Waiting
     
    106106      )
    107107      SELECT DISTINCT t.TaskId, t.JobId, t.Priority
    108       FROM pr JOIN AssignedResources ar ON ar.ResourceId = pr.ResourceId
     108      FROM pr JOIN AssignedTaskResources ar ON ar.ResourceId = pr.ResourceId
    109109          JOIN Task t ON t.TaskId = ar.TaskId
    110110      WHERE NOT (t.IsParentTask = 1 AND t.FinishWhenChildJobsFinished = 1)
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HeuristicLab.Services.Hive.DataAccess-3.3.csproj

    r15379 r15411  
    104104  <ItemGroup>
    105105    <None Include="Plugin.cs.frame" />
    106     <Compile Include="Daos\AssignedResourceDao.cs" />
     106    <Compile Include="Daos\AssignedProjectResourceDao.cs" />
     107    <Compile Include="Daos\AssignedTaskResourceDao.cs" />
    107108    <Compile Include="Daos\DowntimeDao.cs" />
    108109    <Compile Include="Daos\GenericDao.cs" />
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml

    r15399 r15411  
    11<?xml version="1.0" encoding="utf-8"?><Database Name="HeuristicLab.Hive" Class="HiveDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
    2   <Table Name="dbo.AssignedResource" Member="AssignedResources">
    3     <Type Name="AssignedResource">
     2  <Table Name="dbo.AssignedProjectResource" Member="AssignedProjectResources">
     3    <Type Name="AssignedProjectResource">
    44      <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
    55      <Column Name="ProjectId" Storage="_JobId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
     
    3737      <Column Name="HbInterval" Type="System.Int32" DbType="Int" CanBeNull="false" />
    3838      <Column Name="OwnerUserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" />
    39       <Association Name="Resource_AssignedResource" Member="AssignedResources" ThisKey="ResourceId" OtherKey="ResourceId" Type="AssignedResource" />
     39      <Association Name="Resource_AssignedResource" Member="AssignedProjectResources" Storage="_AssignedResources" ThisKey="ResourceId" OtherKey="ResourceId" Type="AssignedProjectResource" />
    4040      <Association Name="Resource_Resource" Member="ChildResources" ThisKey="ResourceId" OtherKey="ParentResourceId" Type="Resource" />
    4141      <Association Name="Resource_Downtime" Member="Downtimes" Storage="_UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="Downtime" />
    4242      <Association Name="Resource_StateLog" Member="StateLogs" ThisKey="ResourceId" OtherKey="SlaveId" Type="StateLog" />
    4343      <Association Name="Resource_ResourcePermission" Member="ResourcePermissions" ThisKey="ResourceId" OtherKey="ResourceId" Type="ResourcePermission" />
     44      <Association Name="Resource_AssignedTaskResource" Member="AssignedTaskResources" ThisKey="ResourceId" OtherKey="ResourceId" Type="AssignedTaskResource" />
    4445      <Association Name="Resource_Resource" Member="ParentResource" ThisKey="ParentResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" />
    4546      <Type Name="Slave" InheritanceCode="Slave" IsInheritanceDefault="true">
     
    7980      <Association Name="Task_TaskData" Member="JobData" ThisKey="TaskId" OtherKey="TaskId" Type="TaskData" Cardinality="One" />
    8081      <Association Name="Task_StateLog" Member="StateLogs" ThisKey="TaskId" OtherKey="TaskId" Type="StateLog" />
     82      <Association Name="Task_AssignedTaskResource" Member="AssignedTaskResources" ThisKey="TaskId" OtherKey="TaskId" Type="AssignedTaskResource" />
    8183      <Association Name="Task_Task" Member="ParentJob" Storage="_Job1" ThisKey="ParentTaskId" OtherKey="TaskId" Type="Task" IsForeignKey="true" />
    8284      <Association Name="Job_Task" Member="Job" Storage="_HiveExperiment" ThisKey="JobId" OtherKey="JobId" Type="Job" IsForeignKey="true" />
     
    266268      <Column Name="StartDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" />
    267269      <Column Name="EndDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" />
    268       <Association Name="Project_AssignedResource" Member="AssignedResources" ThisKey="ProjectId" OtherKey="ProjectId" Type="AssignedResource" />
     270      <Association Name="Project_AssignedResource" Member="AssignedProjectResources" Storage="_AssignedResources" ThisKey="ProjectId" OtherKey="ProjectId" Type="AssignedProjectResource" />
    269271      <Association Name="Project_Job" Member="Jobs" ThisKey="ProjectId" OtherKey="ProjectId" Type="Job" />
    270272      <Association Name="Project_Project" Member="ChildProjects" Storage="_Projects" ThisKey="ProjectId" OtherKey="ParentProjectId" Type="Project" />
     
    281283    </Type>
    282284  </Table>
     285  <Table Name="dbo.AssignedTaskResource" Member="AssignedTaskResources">
     286    <Type Name="AssignedTaskResource">
     287      <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
     288      <Column Name="TaskId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />
     289      <Association Name="Task_AssignedTaskResource" Member="Task" ThisKey="TaskId" OtherKey="TaskId" Type="Task" IsForeignKey="true" />
     290      <Association Name="Resource_AssignedTaskResource" Member="Resource" ThisKey="ResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" />
     291    </Type>
     292  </Table>
    283293</Database>
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml.layout

    r15378 r15411  
    44  <nestedChildShapes>
    55    <classShape Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" absoluteBounds="13.875, 8.25, 2, 1.1939925130208327">
    6       <DataClassMoniker Name="/HiveDataContext/AssignedResource" />
     6      <DataClassMoniker Name="/HiveDataContext/AssignedProjectResource" />
    77      <nestedChildShapes>
    88        <elementListCompartment Id="8b005775-f0ee-41b0-ae10-6d1151003708" absoluteBounds="13.89, 8.71, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     
    9595      </nodes>
    9696    </associationConnector>
    97     <associationConnector edgePoints="[(8.875 : 6.56814697265625); (8.5 : 6.56814697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     97    <associationConnector edgePoints="[(8.875 : 6.56814697265625); (8.5 : 6.56814697265625)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    9898      <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_RequiredPlugin" />
    9999      <nodes>
     
    313313      </nodes>
    314314    </associationConnector>
     315    <classShape Id="72ac5c1b-0fdf-43a1-bbe7-3774893b40af" absoluteBounds="8.875, 4.375, 2, 1.1939925130208327">
     316      <DataClassMoniker Name="/HiveDataContext/AssignedTaskResource" />
     317      <nestedChildShapes>
     318        <elementListCompartment Id="e9acd881-ab35-401c-b4f8-03dafc98422e" absoluteBounds="8.89, 4.835, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />
     319      </nestedChildShapes>
     320    </classShape>
     321    <associationConnector edgePoints="[(8.5 : 4.1170068359375); (8.875 : 4.375)]" fixedFrom="NotFixed" fixedTo="NotFixed">
     322      <AssociationMoniker Name="/HiveDataContext/Task/Task_AssignedTaskResource" />
     323      <nodes>
     324        <classShapeMoniker Id="695bfc39-59f3-4e60-8644-f847964bf62c" />
     325        <classShapeMoniker Id="72ac5c1b-0fdf-43a1-bbe7-3774893b40af" />
     326      </nodes>
     327    </associationConnector>
     328    <associationConnector edgePoints="[(12.25 : 2.9631982421875); (12.25 : 3.8125); (11.1875 : 3.8125); (11.1875 : 4.97199625651042); (10.875 : 4.97199625651042)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     329      <AssociationMoniker Name="/HiveDataContext/Resource/Resource_AssignedTaskResource" />
     330      <nodes>
     331        <classShapeMoniker Id="706a4581-6daf-4e71-ae2a-87d50b27a051" />
     332        <classShapeMoniker Id="72ac5c1b-0fdf-43a1-bbe7-3774893b40af" />
     333      </nodes>
     334    </associationConnector>
    315335  </nestedChildShapes>
    316336</ordesignerObjectsDiagram>
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs

    r15399 r15411  
    3131    #region Extensibility Method Definitions
    3232    partial void OnCreated();
    33     partial void InsertAssignedResource(AssignedResource instance);
    34     partial void UpdateAssignedResource(AssignedResource instance);
    35     partial void DeleteAssignedResource(AssignedResource instance);
     33    partial void InsertAssignedProjectResource(AssignedProjectResource instance);
     34    partial void UpdateAssignedProjectResource(AssignedProjectResource instance);
     35    partial void DeleteAssignedProjectResource(AssignedProjectResource instance);
    3636    partial void InsertPlugin(Plugin instance);
    3737    partial void UpdatePlugin(Plugin instance);
     
    9797    partial void UpdateProjectPermission(ProjectPermission instance);
    9898    partial void DeleteProjectPermission(ProjectPermission instance);
     99    partial void InsertAssignedTaskResource(AssignedTaskResource instance);
     100    partial void UpdateAssignedTaskResource(AssignedTaskResource instance);
     101    partial void DeleteAssignedTaskResource(AssignedTaskResource instance);
    99102    #endregion
    100103   
     
    123126    }
    124127   
    125     public System.Data.Linq.Table<AssignedResource> AssignedResources
    126     {
    127       get
    128       {
    129         return this.GetTable<AssignedResource>();
     128    public System.Data.Linq.Table<AssignedProjectResource> AssignedProjectResources
     129    {
     130      get
     131      {
     132        return this.GetTable<AssignedProjectResource>();
    130133      }
    131134    }
     
    296299      {
    297300        return this.GetTable<ProjectPermission>();
     301      }
     302    }
     303   
     304    public System.Data.Linq.Table<AssignedTaskResource> AssignedTaskResources
     305    {
     306      get
     307      {
     308        return this.GetTable<AssignedTaskResource>();
    298309      }
    299310    }
    300311  }
    301312 
    302   [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.AssignedResource")]
    303   public partial class AssignedResource : INotifyPropertyChanging, INotifyPropertyChanged
     313  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.AssignedProjectResource")]
     314  public partial class AssignedProjectResource : INotifyPropertyChanging, INotifyPropertyChanged
    304315  {
    305316   
     
    324335    #endregion
    325336   
    326     public AssignedResource()
     337    public AssignedProjectResource()
    327338    {
    328339      this._Resource = default(EntityRef<Resource>);
     
    379390    }
    380391   
    381     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")]
     392    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true, DeleteRule="CASCADE")]
    382393    public Resource Resource
    383394    {
     
    396407          {
    397408            this._Resource.Entity = null;
    398             previousValue.AssignedResources.Remove(this);
     409            previousValue.AssignedProjectResources.Remove(this);
    399410          }
    400411          this._Resource.Entity = value;
    401412          if ((value != null))
    402413          {
    403             value.AssignedResources.Add(this);
     414            value.AssignedProjectResources.Add(this);
    404415            this._ResourceId = value.ResourceId;
    405416          }
     
    413424    }
    414425   
    415     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedResource", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE")]
     426    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true, DeleteRule="CASCADE")]
    416427    public Project Project
    417428    {
     
    430441          {
    431442            this._Project.Entity = null;
    432             previousValue.AssignedResources.Remove(this);
     443            previousValue.AssignedProjectResources.Remove(this);
    433444          }
    434445          this._Project.Entity = value;
    435446          if ((value != null))
    436447          {
    437             value.AssignedResources.Add(this);
     448            value.AssignedProjectResources.Add(this);
    438449            this._JobId = value.ProjectId;
    439450          }
     
    919930    private System.Nullable<System.Guid> _OwnerUserId;
    920931   
    921     private EntitySet<AssignedResource> _AssignedResources;
     932    private EntitySet<AssignedProjectResource> _AssignedResources;
    922933   
    923934    private EntitySet<Resource> _ChildResources;
     
    928939   
    929940    private EntitySet<ResourcePermission> _ResourcePermissions;
     941   
     942    private EntitySet<AssignedTaskResource> _AssignedTaskResources;
    930943   
    931944    private EntityRef<Resource> _ParentResource;
     
    951964    public Resource()
    952965    {
    953       this._AssignedResources = new EntitySet<AssignedResource>(new Action<AssignedResource>(this.attach_AssignedResources), new Action<AssignedResource>(this.detach_AssignedResources));
     966      this._AssignedResources = new EntitySet<AssignedProjectResource>(new Action<AssignedProjectResource>(this.attach_AssignedResources), new Action<AssignedProjectResource>(this.detach_AssignedResources));
    954967      this._ChildResources = new EntitySet<Resource>(new Action<Resource>(this.attach_ChildResources), new Action<Resource>(this.detach_ChildResources));
    955968      this._UptimeCalendars = new EntitySet<Downtime>(new Action<Downtime>(this.attach_UptimeCalendars), new Action<Downtime>(this.detach_UptimeCalendars));
    956969      this._StateLogs = new EntitySet<StateLog>(new Action<StateLog>(this.attach_StateLogs), new Action<StateLog>(this.detach_StateLogs));
    957970      this._ResourcePermissions = new EntitySet<ResourcePermission>(new Action<ResourcePermission>(this.attach_ResourcePermissions), new Action<ResourcePermission>(this.detach_ResourcePermissions));
     971      this._AssignedTaskResources = new EntitySet<AssignedTaskResource>(new Action<AssignedTaskResource>(this.attach_AssignedTaskResources), new Action<AssignedTaskResource>(this.detach_AssignedTaskResources));
    958972      this._ParentResource = default(EntityRef<Resource>);
    959973      OnCreated();
     
    10841098    }
    10851099   
    1086     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedResource", Storage="_AssignedResources", ThisKey="ResourceId", OtherKey="ResourceId")]
    1087     public EntitySet<AssignedResource> AssignedResources
     1100    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ResourceId", OtherKey="ResourceId")]
     1101    public EntitySet<AssignedProjectResource> AssignedProjectResources
    10881102    {
    10891103      get
     
    11461160      {
    11471161        this._ResourcePermissions.Assign(value);
     1162      }
     1163    }
     1164   
     1165    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedTaskResource", Storage="_AssignedTaskResources", ThisKey="ResourceId", OtherKey="ResourceId")]
     1166    public EntitySet<AssignedTaskResource> AssignedTaskResources
     1167    {
     1168      get
     1169      {
     1170        return this._AssignedTaskResources;
     1171      }
     1172      set
     1173      {
     1174        this._AssignedTaskResources.Assign(value);
    11481175      }
    11491176    }
     
    12031230    }
    12041231   
    1205     private void attach_AssignedResources(AssignedResource entity)
     1232    private void attach_AssignedResources(AssignedProjectResource entity)
    12061233    {
    12071234      this.SendPropertyChanging();
     
    12091236    }
    12101237   
    1211     private void detach_AssignedResources(AssignedResource entity)
     1238    private void detach_AssignedResources(AssignedProjectResource entity)
    12121239    {
    12131240      this.SendPropertyChanging();
     
    12581285   
    12591286    private void detach_ResourcePermissions(ResourcePermission entity)
     1287    {
     1288      this.SendPropertyChanging();
     1289      entity.Resource = null;
     1290    }
     1291   
     1292    private void attach_AssignedTaskResources(AssignedTaskResource entity)
     1293    {
     1294      this.SendPropertyChanging();
     1295      entity.Resource = this;
     1296    }
     1297   
     1298    private void detach_AssignedTaskResources(AssignedTaskResource entity)
    12601299    {
    12611300      this.SendPropertyChanging();
     
    16441683    private EntitySet<StateLog> _StateLogs;
    16451684   
     1685    private EntitySet<AssignedTaskResource> _AssignedTaskResources;
     1686   
    16461687    private EntityRef<Task> _Job1;
    16471688   
     
    16841725      this._JobData = default(EntityRef<TaskData>);
    16851726      this._StateLogs = new EntitySet<StateLog>(new Action<StateLog>(this.attach_StateLogs), new Action<StateLog>(this.detach_StateLogs));
     1727      this._AssignedTaskResources = new EntitySet<AssignedTaskResource>(new Action<AssignedTaskResource>(this.attach_AssignedTaskResources), new Action<AssignedTaskResource>(this.detach_AssignedTaskResources));
    16861728      this._Job1 = default(EntityRef<Task>);
    16871729      this._HiveExperiment = default(EntityRef<Job>);
     
    20052047    }
    20062048   
     2049    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Task_AssignedTaskResource", Storage="_AssignedTaskResources", ThisKey="TaskId", OtherKey="TaskId")]
     2050    public EntitySet<AssignedTaskResource> AssignedTaskResources
     2051    {
     2052      get
     2053      {
     2054        return this._AssignedTaskResources;
     2055      }
     2056      set
     2057      {
     2058        this._AssignedTaskResources.Assign(value);
     2059      }
     2060    }
     2061   
    20072062    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Task_Task", Storage="_Job1", ThisKey="ParentTaskId", OtherKey="TaskId", IsForeignKey=true)]
    20082063    public Task ParentJob
     
    21242179   
    21252180    private void detach_StateLogs(StateLog entity)
     2181    {
     2182      this.SendPropertyChanging();
     2183      entity.Task = null;
     2184    }
     2185   
     2186    private void attach_AssignedTaskResources(AssignedTaskResource entity)
     2187    {
     2188      this.SendPropertyChanging();
     2189      entity.Task = this;
     2190    }
     2191   
     2192    private void detach_AssignedTaskResources(AssignedTaskResource entity)
    21262193    {
    21272194      this.SendPropertyChanging();
     
    56835750    private System.Nullable<System.DateTime> _EndDate;
    56845751   
    5685     private EntitySet<AssignedResource> _AssignedResources;
     5752    private EntitySet<AssignedProjectResource> _AssignedResources;
    56865753   
    56875754    private EntitySet<Job> _Jobs;
     
    57175784    public Project()
    57185785    {
    5719       this._AssignedResources = new EntitySet<AssignedResource>(new Action<AssignedResource>(this.attach_AssignedResources), new Action<AssignedResource>(this.detach_AssignedResources));
     5786      this._AssignedResources = new EntitySet<AssignedProjectResource>(new Action<AssignedProjectResource>(this.attach_AssignedResources), new Action<AssignedProjectResource>(this.detach_AssignedResources));
    57205787      this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs));
    57215788      this._Projects = new EntitySet<Project>(new Action<Project>(this.attach_Projects), new Action<Project>(this.detach_Projects));
     
    58895956    }
    58905957   
    5891     [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedResource", Storage="_AssignedResources", ThisKey="ProjectId", OtherKey="ProjectId")]
    5892     public EntitySet<AssignedResource> AssignedResources
     5958    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ProjectId", OtherKey="ProjectId")]
     5959    public EntitySet<AssignedProjectResource> AssignedProjectResources
    58935960    {
    58945961      get
     
    59956062    }
    59966063   
    5997     private void attach_AssignedResources(AssignedResource entity)
     6064    private void attach_AssignedResources(AssignedProjectResource entity)
    59986065    {
    59996066      this.SendPropertyChanging();
     
    60016068    }
    60026069   
    6003     private void detach_AssignedResources(AssignedResource entity)
     6070    private void detach_AssignedResources(AssignedProjectResource entity)
    60046071    {
    60056072      this.SendPropertyChanging();
     
    61946261    }
    61956262  }
     6263 
     6264  [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.AssignedTaskResource")]
     6265  public partial class AssignedTaskResource : INotifyPropertyChanging, INotifyPropertyChanged
     6266  {
     6267   
     6268    private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
     6269   
     6270    private System.Guid _ResourceId;
     6271   
     6272    private System.Guid _TaskId;
     6273   
     6274    private EntityRef<Task> _Task;
     6275   
     6276    private EntityRef<Resource> _Resource;
     6277   
     6278    #region Extensibility Method Definitions
     6279    partial void OnLoaded();
     6280    partial void OnValidate(System.Data.Linq.ChangeAction action);
     6281    partial void OnCreated();
     6282    partial void OnResourceIdChanging(System.Guid value);
     6283    partial void OnResourceIdChanged();
     6284    partial void OnTaskIdChanging(System.Guid value);
     6285    partial void OnTaskIdChanged();
     6286    #endregion
     6287   
     6288    public AssignedTaskResource()
     6289    {
     6290      this._Task = default(EntityRef<Task>);
     6291      this._Resource = default(EntityRef<Resource>);
     6292      OnCreated();
     6293    }
     6294   
     6295    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ResourceId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
     6296    public System.Guid ResourceId
     6297    {
     6298      get
     6299      {
     6300        return this._ResourceId;
     6301      }
     6302      set
     6303      {
     6304        if ((this._ResourceId != value))
     6305        {
     6306          if (this._Resource.HasLoadedOrAssignedValue)
     6307          {
     6308            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
     6309          }
     6310          this.OnResourceIdChanging(value);
     6311          this.SendPropertyChanging();
     6312          this._ResourceId = value;
     6313          this.SendPropertyChanged("ResourceId");
     6314          this.OnResourceIdChanged();
     6315        }
     6316      }
     6317    }
     6318   
     6319    [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TaskId", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true)]
     6320    public System.Guid TaskId
     6321    {
     6322      get
     6323      {
     6324        return this._TaskId;
     6325      }
     6326      set
     6327      {
     6328        if ((this._TaskId != value))
     6329        {
     6330          if (this._Task.HasLoadedOrAssignedValue)
     6331          {
     6332            throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
     6333          }
     6334          this.OnTaskIdChanging(value);
     6335          this.SendPropertyChanging();
     6336          this._TaskId = value;
     6337          this.SendPropertyChanged("TaskId");
     6338          this.OnTaskIdChanged();
     6339        }
     6340      }
     6341    }
     6342   
     6343    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Task_AssignedTaskResource", Storage="_Task", ThisKey="TaskId", OtherKey="TaskId", IsForeignKey=true)]
     6344    public Task Task
     6345    {
     6346      get
     6347      {
     6348        return this._Task.Entity;
     6349      }
     6350      set
     6351      {
     6352        Task previousValue = this._Task.Entity;
     6353        if (((previousValue != value)
     6354              || (this._Task.HasLoadedOrAssignedValue == false)))
     6355        {
     6356          this.SendPropertyChanging();
     6357          if ((previousValue != null))
     6358          {
     6359            this._Task.Entity = null;
     6360            previousValue.AssignedTaskResources.Remove(this);
     6361          }
     6362          this._Task.Entity = value;
     6363          if ((value != null))
     6364          {
     6365            value.AssignedTaskResources.Add(this);
     6366            this._TaskId = value.TaskId;
     6367          }
     6368          else
     6369          {
     6370            this._TaskId = default(System.Guid);
     6371          }
     6372          this.SendPropertyChanged("Task");
     6373        }
     6374      }
     6375    }
     6376   
     6377    [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedTaskResource", Storage="_Resource", ThisKey="ResourceId", OtherKey="ResourceId", IsForeignKey=true)]
     6378    public Resource Resource
     6379    {
     6380      get
     6381      {
     6382        return this._Resource.Entity;
     6383      }
     6384      set
     6385      {
     6386        Resource previousValue = this._Resource.Entity;
     6387        if (((previousValue != value)
     6388              || (this._Resource.HasLoadedOrAssignedValue == false)))
     6389        {
     6390          this.SendPropertyChanging();
     6391          if ((previousValue != null))
     6392          {
     6393            this._Resource.Entity = null;
     6394            previousValue.AssignedTaskResources.Remove(this);
     6395          }
     6396          this._Resource.Entity = value;
     6397          if ((value != null))
     6398          {
     6399            value.AssignedTaskResources.Add(this);
     6400            this._ResourceId = value.ResourceId;
     6401          }
     6402          else
     6403          {
     6404            this._ResourceId = default(System.Guid);
     6405          }
     6406          this.SendPropertyChanged("Resource");
     6407        }
     6408      }
     6409    }
     6410   
     6411    public event PropertyChangingEventHandler PropertyChanging;
     6412   
     6413    public event PropertyChangedEventHandler PropertyChanged;
     6414   
     6415    protected virtual void SendPropertyChanging()
     6416    {
     6417      if ((this.PropertyChanging != null))
     6418      {
     6419        this.PropertyChanging(this, emptyChangingEventArgs);
     6420      }
     6421    }
     6422   
     6423    protected virtual void SendPropertyChanged(String propertyName)
     6424    {
     6425      if ((this.PropertyChanged != null))
     6426      {
     6427        this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     6428      }
     6429    }
     6430  }
    61966431}
    61976432#pragma warning restore 1591
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Interfaces/IPersistenceManager.cs

    r15379 r15411  
    3131
    3232    #region Hive daos
    33     AssignedResourceDao AssignedResourceDao { get; }
     33    AssignedTaskResourceDao AssignedTaskResourceDao { get; }
     34    AssignedProjectResourceDao AssignedProjectResourceDao { get; }
    3435    DowntimeDao DowntimeDao { get; }
    3536    JobDao JobDao { get; }
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Manager/PersistenceManager.cs

    r15379 r15411  
    3838    #region Hive daos
    3939
    40     private AssignedResourceDao assignedResourceDao;
    41     public AssignedResourceDao AssignedResourceDao {
    42       get { return assignedResourceDao ?? (assignedResourceDao = new AssignedResourceDao(dataContext)); }
     40    private AssignedTaskResourceDao assignedTaskResourceDao;
     41    public AssignedTaskResourceDao AssignedTaskResourceDao {
     42      get { return assignedTaskResourceDao ?? (assignedTaskResourceDao = new AssignedTaskResourceDao(dataContext)); }
     43    }
     44
     45    private AssignedProjectResourceDao assignedProjectResourceDao;
     46    public AssignedProjectResourceDao AssignedProjectResourceDao {
     47      get { return assignedProjectResourceDao ?? (assignedProjectResourceDao = new AssignedProjectResourceDao(dataContext)); }
    4348    }
    4449
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Initialize Hive Database.sql

    r15399 r15411  
    2626SET ARITHABORT ON
    2727
    28 CREATE TABLE [dbo].[AssignedResource](
     28CREATE TABLE [dbo].[AssignedProjectResource](
    2929  [ResourceId] UniqueIdentifier NOT NULL,
    3030  [ProjectId] UniqueIdentifier NOT NULL,
    3131  CONSTRAINT [PK_dbo.ResourceIdProjectId] PRIMARY KEY ([ResourceId], [ProjectId])
     32  )
     33CREATE TABLE [dbo].[AssignedTaskResource](
     34  [ResourceId] UniqueIdentifier NOT NULL,
     35  [TaskId] UniqueIdentifier NOT NULL,
     36  CONSTRAINT [PK_dbo.ResourceIdTaskId] PRIMARY KEY ([ResourceId], [TaskId])
    3237  )
    3338CREATE TABLE [dbo].[Plugin](
     
    168173  )
    169174
    170 ALTER TABLE [dbo].[AssignedResource]
    171   ADD CONSTRAINT [Resource_AssignedResource] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
    172 ALTER TABLE [dbo].[AssignedResource]
    173   ADD CONSTRAINT [Project_AssignedResource] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project]([ProjectId])
     175ALTER TABLE [dbo].[AssignedProjectResource]
     176  ADD CONSTRAINT [Resource_AssignedProjectResource] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
     177ALTER TABLE [dbo].[AssignedProjectResource]
     178  ADD CONSTRAINT [Project_AssignedProjectResource] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project]([ProjectId])
     179ALTER TABLE [dbo].[AssignedTaskResource]
     180  ADD CONSTRAINT [Resource_AssignedTaskResource] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId])
     181ALTER TABLE [dbo].[AssignedTaskResource]
     182  ADD CONSTRAINT [Task_AssignedTaskResource] FOREIGN KEY ([TaskId]) REFERENCES [dbo].[Task]([TaskId])
    174183ALTER TABLE [dbo].[RequiredPlugins]
    175184  ADD CONSTRAINT [Plugin_RequiredPlugin] FOREIGN KEY ([PluginId]) REFERENCES [dbo].[Plugin]([PluginId])
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Prepare Hive Database.sql

    r15378 r15411  
    2121USE [HeuristicLab.Hive-3.3]
    2222
    23 ALTER TABLE [dbo].[AssignedResource]  DROP  CONSTRAINT [Project_AssignedResource]
    24 ALTER TABLE [dbo].[AssignedResource]  WITH CHECK ADD  CONSTRAINT [Project_AssignedResource] FOREIGN KEY([ProjectId])
     23ALTER TABLE [dbo].[AssignedProjectResource]  DROP  CONSTRAINT [Project_AssignedProjectResource]
     24ALTER TABLE [dbo].[AssignedProjectResource]  WITH CHECK ADD  CONSTRAINT [Project_AssignedProjectResource] FOREIGN KEY([ProjectId])
    2525REFERENCES [dbo].[Project] ([ProjectId])
    2626ON UPDATE CASCADE
    2727ON DELETE CASCADE
    2828GO
    29 ALTER TABLE [dbo].[AssignedResource]  DROP  CONSTRAINT [Resource_AssignedResource]
    30 ALTER TABLE [dbo].[AssignedResource]  WITH CHECK ADD  CONSTRAINT [Resource_AssignedResource] FOREIGN KEY([ResourceId])
     29ALTER TABLE [dbo].[AssignedProjectResource]  DROP  CONSTRAINT [Resource_AssignedProjectResource]
     30ALTER TABLE [dbo].[AssignedProjectResource]  WITH CHECK ADD  CONSTRAINT [Resource_AssignedProjectResource] FOREIGN KEY([ResourceId])
     31REFERENCES [dbo].[Resource] ([ResourceId])
     32ON UPDATE CASCADE
     33ON DELETE CASCADE
     34GO
     35
     36ALTER TABLE [dbo].[AssignedTaskResource]  DROP  CONSTRAINT [Task_AssignedTaskResource]
     37ALTER TABLE [dbo].[AssignedTaskResource]  WITH CHECK ADD  CONSTRAINT [Task_AssignedTaskResource] FOREIGN KEY([TaskId])
     38REFERENCES [dbo].[Task] ([TaskId])
     39ON UPDATE CASCADE
     40ON DELETE CASCADE
     41GO
     42ALTER TABLE [dbo].[AssignedTaskResource]  DROP  CONSTRAINT [Resource_AssignedTaskResource]
     43ALTER TABLE [dbo].[AssignedTaskResource]  WITH CHECK ADD  CONSTRAINT [Resource_AssignedTaskResource] FOREIGN KEY([ResourceId])
    3144REFERENCES [dbo].[Resource] ([ResourceId])
    3245ON UPDATE CASCADE
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/Converter.cs

    r15399 r15411  
    389389    #endregion
    390390
     391    #region AssignedProjectResource
     392    public static DT.AssignedProjectResource ToDto(this DA.AssignedProjectResource source) {
     393      if (source == null) return null;
     394      return new DT.AssignedProjectResource {
     395        ProjectId = source.ProjectId,
     396        ResourceId = source.ResourceId
     397      };
     398    }
     399    public static DA.AssignedProjectResource ToEntity(this DT.AssignedProjectResource source) {
     400      if (source == null) return null;
     401      var result = new DA.AssignedProjectResource();
     402      source.CopyToEntity(result);
     403      return result;
     404    }
     405    public static void CopyToEntity(this DT.AssignedProjectResource source, DA.AssignedProjectResource target) {
     406      if ((source == null) || (target == null)) return;
     407      target.ProjectId = source.ProjectId;
     408      target.ResourceId = source.ResourceId;
     409    }
     410    #endregion
     411
    391412    #region SlaveGroup
    392413    public static DT.SlaveGroup ToDto(this DA.SlaveGroup source) {
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HeuristicLab.Services.Hive-3.3.csproj

    r15379 r15411  
    119119  <ItemGroup>
    120120    <Compile Include="Converter.cs" />
     121    <Compile Include="DataTransfer\AssignedProjectResource.cs" />
    121122    <Compile Include="DataTransfer\Command.cs" />
    122123    <Compile Include="DataTransfer\Project.cs" />
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HiveService.cs

    r15380 r15411  
    7575        newTask.JobData = taskData.ToEntity();
    7676        newTask.JobData.LastUpdate = DateTime.Now;
    77         newTask.AssignedResources.AddRange(resourceIds.Select(
    78           x => new DA.AssignedResource {
     77        newTask.AssignedTaskResources.AddRange(resourceIds.Select(
     78          x => new DA.AssignedTaskResource {
    7979            ResourceId = x
    8080          }));
     
    102102      var pm = PersistenceManager;
    103103      using (new PerformanceLogger("AddChildTask")) {
    104         var assignedResourceDao = pm.AssignedResourceDao;
     104        var assignedTaskResourceDao = pm.AssignedTaskResourceDao;
    105105        resourceIds = pm.UseTransaction(() => {
    106           return assignedResourceDao.GetByTaskId(parentTaskId)
     106          return assignedTaskResourceDao.GetByTaskId(parentTaskId)
    107107            .Select(x => x.ResourceId)
    108108            .ToList();
     
    729729    #endregion
    730730
     731    #region AssignedProjectResource Methods
     732    public void AssignProjectResources(Guid projectId, Guid[] resourceIds) {
     733      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
     734      AuthorizationManager.AuthorizeForProjectAdministration(projectId);
     735      var pm = PersistenceManager;
     736      using (new PerformanceLogger("AssignProjectResources")) {
     737        pm.UseTransaction(() => {
     738          var project = AuthorizeForProject(pm, projectId);
     739          var assignedProjectResources = project.AssignedProjectResources.ToList();
     740          foreach (var id in resourceIds) {
     741            if (assignedProjectResources.All(x => x.ResourceId != id)) {
     742              project.AssignedProjectResources.Add(new DA.AssignedProjectResource {
     743                ResourceId = id
     744              });
     745            }
     746          }
     747          pm.SubmitChanges();
     748        });
     749      }
     750    }
     751
     752    public void UnassignProjectResources(Guid projectId, Guid[] resourceIds) {
     753      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
     754      AuthorizationManager.AuthorizeForProjectAdministration(projectId);
     755      var pm = PersistenceManager;
     756      using (new PerformanceLogger("UnassignProjectResources")) {
     757        var assignedProjectResourceDao = pm.AssignedProjectResourceDao;
     758        pm.UseTransaction(() => {
     759          assignedProjectResourceDao.DeleteByProjectAndGrantedUserId(projectId, resourceIds);
     760          pm.SubmitChanges();
     761        });
     762      }
     763    }
     764
     765    public IEnumerable<AssignedProjectResource> GetAssignedResourcesForProject(Guid projectId) {
     766      RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
     767      var pm = PersistenceManager;
     768      using (new PerformanceLogger("GetAssignedResourcesForProject")) {
     769        var assignedProjectResourceDao = pm.AssignedProjectResourceDao;
     770        return pm.UseTransaction(() => assignedProjectResourceDao.GetByProjectId(projectId)
     771          .Select(x => x.ToDto())
     772          .ToList()
     773        );
     774      }
     775    }
     776    #endregion
     777
    731778    #region Slave Methods
    732779    public Guid AddSlave(DT.Slave slaveDto) {
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs

    r14185 r15411  
    142142    private IEnumerable<MessageContainer> UpdateTasks(IPersistenceManager pm, Heartbeat heartbeat, bool isAllowedToCalculate) {
    143143      var taskDao = pm.TaskDao;
    144       var assignedResourceDao = pm.AssignedResourceDao;
     144      var assignedResourceDao = pm.AssignedTaskResourceDao;
    145145      var actions = new List<MessageContainer>();
    146146      if (heartbeat.JobProgress == null || !heartbeat.JobProgress.Any())
  • branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/ServiceContracts/IHiveService.cs

    r15380 r15411  
    160160    #endregion
    161161
     162    #region AssignedProjectResource Methods
     163    [OperationContract]
     164    void AssignProjectResources(Guid projectId, Guid[] resourceIds);
     165
     166    [OperationContract]
     167    void UnassignProjectResources(Guid projectId, Guid[] resourceIds);
     168
     169    [OperationContract]
     170    IEnumerable<AssignedProjectResource> GetAssignedResourcesForProject(Guid projectId);
     171    #endregion
     172
    162173    #region Slave Methods
    163174    [OperationContract]
Note: See TracChangeset for help on using the changeset viewer.