Changeset 15411 for branches/HiveProjectManagement
- Timestamp:
- 10/07/17 10:21:08 (7 years ago)
- 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 25 25 26 26 namespace HeuristicLab.Services.Hive.DataAccess.Daos { 27 public class Assigned ResourceDao : GenericDao<Guid, AssignedResource> {28 public Assigned ResourceDao(DataContext dataContext) : base(dataContext) { }27 public class AssignedTaskResourceDao : GenericDao<Guid, AssignedTaskResource> { 28 public AssignedTaskResourceDao(DataContext dataContext) : base(dataContext) { } 29 29 30 public override Assigned Resource GetById(Guid id) {30 public override AssignedTaskResource GetById(Guid id) { 31 31 throw new NotImplementedException(); 32 32 } 33 33 34 public IQueryable<Assigned Resource> GetByTaskId(Guid taskId) {34 public IQueryable<AssignedTaskResource> GetByTaskId(Guid taskId) { 35 35 return Table.Where(x => x.TaskId == taskId); 36 36 } … … 51 51 ) 52 52 SELECT COUNT(ar.TaskId) 53 FROM pr JOIN Assigned Resources ar ON pr.ResourceId = ar.ResourceId53 FROM pr JOIN AssignedTaskResources ar ON pr.ResourceId = ar.ResourceId 54 54 WHERE ar.TaskId = {1} 55 55 "; -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/TaskDao.cs
r14185 r15411 27 27 namespace HeuristicLab.Services.Hive.DataAccess.Daos { 28 28 public class TaskDao : GenericDao<Guid, Task> { 29 private Table<Assigned Resource> AssignedResourceTable {30 get { return DataContext.GetTable<Assigned Resource>(); }29 private Table<AssignedTaskResource> AssignedTaskResourceTable { 30 get { return DataContext.GetTable<AssignedTaskResource>(); } 31 31 } 32 32 … … 65 65 /// <returns></returns> 66 66 public IEnumerable<Task> GetParentTasks(IEnumerable<Guid> resourceIds, int count, bool finished) { 67 var query = from ar in Assigned ResourceTable67 var query = from ar in AssignedTaskResourceTable 68 68 where resourceIds.Contains(ar.ResourceId) 69 69 && ar.Task.State == TaskState.Waiting … … 106 106 ) 107 107 SELECT DISTINCT t.TaskId, t.JobId, t.Priority 108 FROM pr JOIN Assigned Resources ar ON ar.ResourceId = pr.ResourceId108 FROM pr JOIN AssignedTaskResources ar ON ar.ResourceId = pr.ResourceId 109 109 JOIN Task t ON t.TaskId = ar.TaskId 110 110 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 104 104 <ItemGroup> 105 105 <None Include="Plugin.cs.frame" /> 106 <Compile Include="Daos\AssignedResourceDao.cs" /> 106 <Compile Include="Daos\AssignedProjectResourceDao.cs" /> 107 <Compile Include="Daos\AssignedTaskResourceDao.cs" /> 107 108 <Compile Include="Daos\DowntimeDao.cs" /> 108 109 <Compile Include="Daos\GenericDao.cs" /> -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml
r15399 r15411 1 1 <?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.Assigned Resource" Member="AssignedResources">3 <Type Name="Assigned Resource">2 <Table Name="dbo.AssignedProjectResource" Member="AssignedProjectResources"> 3 <Type Name="AssignedProjectResource"> 4 4 <Column Name="ResourceId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" /> 5 5 <Column Name="ProjectId" Storage="_JobId" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" /> … … 37 37 <Column Name="HbInterval" Type="System.Int32" DbType="Int" CanBeNull="false" /> 38 38 <Column Name="OwnerUserId" Type="System.Guid" DbType="UniqueIdentifier" CanBeNull="true" /> 39 <Association Name="Resource_AssignedResource" Member="Assigned Resources" ThisKey="ResourceId" OtherKey="ResourceId" Type="AssignedResource" />39 <Association Name="Resource_AssignedResource" Member="AssignedProjectResources" Storage="_AssignedResources" ThisKey="ResourceId" OtherKey="ResourceId" Type="AssignedProjectResource" /> 40 40 <Association Name="Resource_Resource" Member="ChildResources" ThisKey="ResourceId" OtherKey="ParentResourceId" Type="Resource" /> 41 41 <Association Name="Resource_Downtime" Member="Downtimes" Storage="_UptimeCalendars" ThisKey="ResourceId" OtherKey="ResourceId" Type="Downtime" /> 42 42 <Association Name="Resource_StateLog" Member="StateLogs" ThisKey="ResourceId" OtherKey="SlaveId" Type="StateLog" /> 43 43 <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" /> 44 45 <Association Name="Resource_Resource" Member="ParentResource" ThisKey="ParentResourceId" OtherKey="ResourceId" Type="Resource" IsForeignKey="true" /> 45 46 <Type Name="Slave" InheritanceCode="Slave" IsInheritanceDefault="true"> … … 79 80 <Association Name="Task_TaskData" Member="JobData" ThisKey="TaskId" OtherKey="TaskId" Type="TaskData" Cardinality="One" /> 80 81 <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" /> 81 83 <Association Name="Task_Task" Member="ParentJob" Storage="_Job1" ThisKey="ParentTaskId" OtherKey="TaskId" Type="Task" IsForeignKey="true" /> 82 84 <Association Name="Job_Task" Member="Job" Storage="_HiveExperiment" ThisKey="JobId" OtherKey="JobId" Type="Job" IsForeignKey="true" /> … … 266 268 <Column Name="StartDate" Type="System.DateTime" DbType="DateTime NOT NULL" CanBeNull="false" /> 267 269 <Column Name="EndDate" Type="System.DateTime" DbType="DateTime" CanBeNull="true" /> 268 <Association Name="Project_AssignedResource" Member="Assigned Resources" ThisKey="ProjectId" OtherKey="ProjectId" Type="AssignedResource" />270 <Association Name="Project_AssignedResource" Member="AssignedProjectResources" Storage="_AssignedResources" ThisKey="ProjectId" OtherKey="ProjectId" Type="AssignedProjectResource" /> 269 271 <Association Name="Project_Job" Member="Jobs" ThisKey="ProjectId" OtherKey="ProjectId" Type="Job" /> 270 272 <Association Name="Project_Project" Member="ChildProjects" Storage="_Projects" ThisKey="ProjectId" OtherKey="ParentProjectId" Type="Project" /> … … 281 283 </Type> 282 284 </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> 283 293 </Database> -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.dbml.layout
r15378 r15411 4 4 <nestedChildShapes> 5 5 <classShape Id="a929c9dc-69f4-4488-ba1c-a2342bf81d89" absoluteBounds="13.875, 8.25, 2, 1.1939925130208327"> 6 <DataClassMoniker Name="/HiveDataContext/Assigned Resource" />6 <DataClassMoniker Name="/HiveDataContext/AssignedProjectResource" /> 7 7 <nestedChildShapes> 8 8 <elementListCompartment Id="8b005775-f0ee-41b0-ae10-6d1151003708" absoluteBounds="13.89, 8.71, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" /> … … 95 95 </nodes> 96 96 </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"> 98 98 <AssociationMoniker Name="/HiveDataContext/Plugin/Plugin_RequiredPlugin" /> 99 99 <nodes> … … 313 313 </nodes> 314 314 </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> 315 335 </nestedChildShapes> 316 336 </ordesignerObjectsDiagram> -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/HiveDataContext.designer.cs
r15399 r15411 31 31 #region Extensibility Method Definitions 32 32 partial void OnCreated(); 33 partial void InsertAssigned Resource(AssignedResource instance);34 partial void UpdateAssigned Resource(AssignedResource instance);35 partial void DeleteAssigned Resource(AssignedResource instance);33 partial void InsertAssignedProjectResource(AssignedProjectResource instance); 34 partial void UpdateAssignedProjectResource(AssignedProjectResource instance); 35 partial void DeleteAssignedProjectResource(AssignedProjectResource instance); 36 36 partial void InsertPlugin(Plugin instance); 37 37 partial void UpdatePlugin(Plugin instance); … … 97 97 partial void UpdateProjectPermission(ProjectPermission instance); 98 98 partial void DeleteProjectPermission(ProjectPermission instance); 99 partial void InsertAssignedTaskResource(AssignedTaskResource instance); 100 partial void UpdateAssignedTaskResource(AssignedTaskResource instance); 101 partial void DeleteAssignedTaskResource(AssignedTaskResource instance); 99 102 #endregion 100 103 … … 123 126 } 124 127 125 public System.Data.Linq.Table<Assigned Resource> AssignedResources126 { 127 get 128 { 129 return this.GetTable<Assigned Resource>();128 public System.Data.Linq.Table<AssignedProjectResource> AssignedProjectResources 129 { 130 get 131 { 132 return this.GetTable<AssignedProjectResource>(); 130 133 } 131 134 } … … 296 299 { 297 300 return this.GetTable<ProjectPermission>(); 301 } 302 } 303 304 public System.Data.Linq.Table<AssignedTaskResource> AssignedTaskResources 305 { 306 get 307 { 308 return this.GetTable<AssignedTaskResource>(); 298 309 } 299 310 } 300 311 } 301 312 302 [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Assigned Resource")]303 public partial class Assigned Resource : INotifyPropertyChanging, INotifyPropertyChanged313 [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.AssignedProjectResource")] 314 public partial class AssignedProjectResource : INotifyPropertyChanging, INotifyPropertyChanged 304 315 { 305 316 … … 324 335 #endregion 325 336 326 public Assigned Resource()337 public AssignedProjectResource() 327 338 { 328 339 this._Resource = default(EntityRef<Resource>); … … 379 390 } 380 391 381 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_Assigned Resource", 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")] 382 393 public Resource Resource 383 394 { … … 396 407 { 397 408 this._Resource.Entity = null; 398 previousValue.Assigned Resources.Remove(this);409 previousValue.AssignedProjectResources.Remove(this); 399 410 } 400 411 this._Resource.Entity = value; 401 412 if ((value != null)) 402 413 { 403 value.Assigned Resources.Add(this);414 value.AssignedProjectResources.Add(this); 404 415 this._ResourceId = value.ResourceId; 405 416 } … … 413 424 } 414 425 415 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_Assigned Resource", 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")] 416 427 public Project Project 417 428 { … … 430 441 { 431 442 this._Project.Entity = null; 432 previousValue.Assigned Resources.Remove(this);443 previousValue.AssignedProjectResources.Remove(this); 433 444 } 434 445 this._Project.Entity = value; 435 446 if ((value != null)) 436 447 { 437 value.Assigned Resources.Add(this);448 value.AssignedProjectResources.Add(this); 438 449 this._JobId = value.ProjectId; 439 450 } … … 919 930 private System.Nullable<System.Guid> _OwnerUserId; 920 931 921 private EntitySet<Assigned Resource> _AssignedResources;932 private EntitySet<AssignedProjectResource> _AssignedResources; 922 933 923 934 private EntitySet<Resource> _ChildResources; … … 928 939 929 940 private EntitySet<ResourcePermission> _ResourcePermissions; 941 942 private EntitySet<AssignedTaskResource> _AssignedTaskResources; 930 943 931 944 private EntityRef<Resource> _ParentResource; … … 951 964 public Resource() 952 965 { 953 this._AssignedResources = new EntitySet<Assigned Resource>(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)); 954 967 this._ChildResources = new EntitySet<Resource>(new Action<Resource>(this.attach_ChildResources), new Action<Resource>(this.detach_ChildResources)); 955 968 this._UptimeCalendars = new EntitySet<Downtime>(new Action<Downtime>(this.attach_UptimeCalendars), new Action<Downtime>(this.detach_UptimeCalendars)); 956 969 this._StateLogs = new EntitySet<StateLog>(new Action<StateLog>(this.attach_StateLogs), new Action<StateLog>(this.detach_StateLogs)); 957 970 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)); 958 972 this._ParentResource = default(EntityRef<Resource>); 959 973 OnCreated(); … … 1084 1098 } 1085 1099 1086 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_Assigned Resource", Storage="_AssignedResources", ThisKey="ResourceId", OtherKey="ResourceId")]1087 public EntitySet<Assigned Resource> AssignedResources1100 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Resource_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ResourceId", OtherKey="ResourceId")] 1101 public EntitySet<AssignedProjectResource> AssignedProjectResources 1088 1102 { 1089 1103 get … … 1146 1160 { 1147 1161 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); 1148 1175 } 1149 1176 } … … 1203 1230 } 1204 1231 1205 private void attach_AssignedResources(Assigned Resource entity)1232 private void attach_AssignedResources(AssignedProjectResource entity) 1206 1233 { 1207 1234 this.SendPropertyChanging(); … … 1209 1236 } 1210 1237 1211 private void detach_AssignedResources(Assigned Resource entity)1238 private void detach_AssignedResources(AssignedProjectResource entity) 1212 1239 { 1213 1240 this.SendPropertyChanging(); … … 1258 1285 1259 1286 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) 1260 1299 { 1261 1300 this.SendPropertyChanging(); … … 1644 1683 private EntitySet<StateLog> _StateLogs; 1645 1684 1685 private EntitySet<AssignedTaskResource> _AssignedTaskResources; 1686 1646 1687 private EntityRef<Task> _Job1; 1647 1688 … … 1684 1725 this._JobData = default(EntityRef<TaskData>); 1685 1726 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)); 1686 1728 this._Job1 = default(EntityRef<Task>); 1687 1729 this._HiveExperiment = default(EntityRef<Job>); … … 2005 2047 } 2006 2048 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 2007 2062 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Task_Task", Storage="_Job1", ThisKey="ParentTaskId", OtherKey="TaskId", IsForeignKey=true)] 2008 2063 public Task ParentJob … … 2124 2179 2125 2180 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) 2126 2193 { 2127 2194 this.SendPropertyChanging(); … … 5683 5750 private System.Nullable<System.DateTime> _EndDate; 5684 5751 5685 private EntitySet<Assigned Resource> _AssignedResources;5752 private EntitySet<AssignedProjectResource> _AssignedResources; 5686 5753 5687 5754 private EntitySet<Job> _Jobs; … … 5717 5784 public Project() 5718 5785 { 5719 this._AssignedResources = new EntitySet<Assigned Resource>(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)); 5720 5787 this._Jobs = new EntitySet<Job>(new Action<Job>(this.attach_Jobs), new Action<Job>(this.detach_Jobs)); 5721 5788 this._Projects = new EntitySet<Project>(new Action<Project>(this.attach_Projects), new Action<Project>(this.detach_Projects)); … … 5889 5956 } 5890 5957 5891 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_Assigned Resource", Storage="_AssignedResources", ThisKey="ProjectId", OtherKey="ProjectId")]5892 public EntitySet<Assigned Resource> AssignedResources5958 [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Project_AssignedProjectResource", Storage="_AssignedResources", ThisKey="ProjectId", OtherKey="ProjectId")] 5959 public EntitySet<AssignedProjectResource> AssignedProjectResources 5893 5960 { 5894 5961 get … … 5995 6062 } 5996 6063 5997 private void attach_AssignedResources(Assigned Resource entity)6064 private void attach_AssignedResources(AssignedProjectResource entity) 5998 6065 { 5999 6066 this.SendPropertyChanging(); … … 6001 6068 } 6002 6069 6003 private void detach_AssignedResources(Assigned Resource entity)6070 private void detach_AssignedResources(AssignedProjectResource entity) 6004 6071 { 6005 6072 this.SendPropertyChanging(); … … 6194 6261 } 6195 6262 } 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 } 6196 6431 } 6197 6432 #pragma warning restore 1591 -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Interfaces/IPersistenceManager.cs
r15379 r15411 31 31 32 32 #region Hive daos 33 AssignedResourceDao AssignedResourceDao { get; } 33 AssignedTaskResourceDao AssignedTaskResourceDao { get; } 34 AssignedProjectResourceDao AssignedProjectResourceDao { get; } 34 35 DowntimeDao DowntimeDao { get; } 35 36 JobDao JobDao { get; } -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Manager/PersistenceManager.cs
r15379 r15411 38 38 #region Hive daos 39 39 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)); } 43 48 } 44 49 -
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/SQL Scripts/Initialize Hive Database.sql
r15399 r15411 26 26 SET ARITHABORT ON 27 27 28 CREATE TABLE [dbo].[Assigned Resource](28 CREATE TABLE [dbo].[AssignedProjectResource]( 29 29 [ResourceId] UniqueIdentifier NOT NULL, 30 30 [ProjectId] UniqueIdentifier NOT NULL, 31 31 CONSTRAINT [PK_dbo.ResourceIdProjectId] PRIMARY KEY ([ResourceId], [ProjectId]) 32 ) 33 CREATE TABLE [dbo].[AssignedTaskResource]( 34 [ResourceId] UniqueIdentifier NOT NULL, 35 [TaskId] UniqueIdentifier NOT NULL, 36 CONSTRAINT [PK_dbo.ResourceIdTaskId] PRIMARY KEY ([ResourceId], [TaskId]) 32 37 ) 33 38 CREATE TABLE [dbo].[Plugin]( … … 168 173 ) 169 174 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]) 175 ALTER TABLE [dbo].[AssignedProjectResource] 176 ADD CONSTRAINT [Resource_AssignedProjectResource] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId]) 177 ALTER TABLE [dbo].[AssignedProjectResource] 178 ADD CONSTRAINT [Project_AssignedProjectResource] FOREIGN KEY ([ProjectId]) REFERENCES [dbo].[Project]([ProjectId]) 179 ALTER TABLE [dbo].[AssignedTaskResource] 180 ADD CONSTRAINT [Resource_AssignedTaskResource] FOREIGN KEY ([ResourceId]) REFERENCES [dbo].[Resource]([ResourceId]) 181 ALTER TABLE [dbo].[AssignedTaskResource] 182 ADD CONSTRAINT [Task_AssignedTaskResource] FOREIGN KEY ([TaskId]) REFERENCES [dbo].[Task]([TaskId]) 174 183 ALTER TABLE [dbo].[RequiredPlugins] 175 184 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 21 21 USE [HeuristicLab.Hive-3.3] 22 22 23 ALTER TABLE [dbo].[Assigned Resource] DROP CONSTRAINT [Project_AssignedResource]24 ALTER TABLE [dbo].[Assigned Resource] WITH CHECK ADD CONSTRAINT [Project_AssignedResource] FOREIGN KEY([ProjectId])23 ALTER TABLE [dbo].[AssignedProjectResource] DROP CONSTRAINT [Project_AssignedProjectResource] 24 ALTER TABLE [dbo].[AssignedProjectResource] WITH CHECK ADD CONSTRAINT [Project_AssignedProjectResource] FOREIGN KEY([ProjectId]) 25 25 REFERENCES [dbo].[Project] ([ProjectId]) 26 26 ON UPDATE CASCADE 27 27 ON DELETE CASCADE 28 28 GO 29 ALTER TABLE [dbo].[AssignedResource] DROP CONSTRAINT [Resource_AssignedResource] 30 ALTER TABLE [dbo].[AssignedResource] WITH CHECK ADD CONSTRAINT [Resource_AssignedResource] FOREIGN KEY([ResourceId]) 29 ALTER TABLE [dbo].[AssignedProjectResource] DROP CONSTRAINT [Resource_AssignedProjectResource] 30 ALTER TABLE [dbo].[AssignedProjectResource] WITH CHECK ADD CONSTRAINT [Resource_AssignedProjectResource] FOREIGN KEY([ResourceId]) 31 REFERENCES [dbo].[Resource] ([ResourceId]) 32 ON UPDATE CASCADE 33 ON DELETE CASCADE 34 GO 35 36 ALTER TABLE [dbo].[AssignedTaskResource] DROP CONSTRAINT [Task_AssignedTaskResource] 37 ALTER TABLE [dbo].[AssignedTaskResource] WITH CHECK ADD CONSTRAINT [Task_AssignedTaskResource] FOREIGN KEY([TaskId]) 38 REFERENCES [dbo].[Task] ([TaskId]) 39 ON UPDATE CASCADE 40 ON DELETE CASCADE 41 GO 42 ALTER TABLE [dbo].[AssignedTaskResource] DROP CONSTRAINT [Resource_AssignedTaskResource] 43 ALTER TABLE [dbo].[AssignedTaskResource] WITH CHECK ADD CONSTRAINT [Resource_AssignedTaskResource] FOREIGN KEY([ResourceId]) 31 44 REFERENCES [dbo].[Resource] ([ResourceId]) 32 45 ON UPDATE CASCADE -
branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/Converter.cs
r15399 r15411 389 389 #endregion 390 390 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 391 412 #region SlaveGroup 392 413 public static DT.SlaveGroup ToDto(this DA.SlaveGroup source) { -
branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HeuristicLab.Services.Hive-3.3.csproj
r15379 r15411 119 119 <ItemGroup> 120 120 <Compile Include="Converter.cs" /> 121 <Compile Include="DataTransfer\AssignedProjectResource.cs" /> 121 122 <Compile Include="DataTransfer\Command.cs" /> 122 123 <Compile Include="DataTransfer\Project.cs" /> -
branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HiveService.cs
r15380 r15411 75 75 newTask.JobData = taskData.ToEntity(); 76 76 newTask.JobData.LastUpdate = DateTime.Now; 77 newTask.Assigned Resources.AddRange(resourceIds.Select(78 x => new DA.Assigned Resource {77 newTask.AssignedTaskResources.AddRange(resourceIds.Select( 78 x => new DA.AssignedTaskResource { 79 79 ResourceId = x 80 80 })); … … 102 102 var pm = PersistenceManager; 103 103 using (new PerformanceLogger("AddChildTask")) { 104 var assigned ResourceDao = pm.AssignedResourceDao;104 var assignedTaskResourceDao = pm.AssignedTaskResourceDao; 105 105 resourceIds = pm.UseTransaction(() => { 106 return assigned ResourceDao.GetByTaskId(parentTaskId)106 return assignedTaskResourceDao.GetByTaskId(parentTaskId) 107 107 .Select(x => x.ResourceId) 108 108 .ToList(); … … 729 729 #endregion 730 730 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 731 778 #region Slave Methods 732 779 public Guid AddSlave(DT.Slave slaveDto) { -
branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/Manager/HeartbeatManager.cs
r14185 r15411 142 142 private IEnumerable<MessageContainer> UpdateTasks(IPersistenceManager pm, Heartbeat heartbeat, bool isAllowedToCalculate) { 143 143 var taskDao = pm.TaskDao; 144 var assignedResourceDao = pm.Assigned ResourceDao;144 var assignedResourceDao = pm.AssignedTaskResourceDao; 145 145 var actions = new List<MessageContainer>(); 146 146 if (heartbeat.JobProgress == null || !heartbeat.JobProgress.Any()) -
branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/ServiceContracts/IHiveService.cs
r15380 r15411 160 160 #endregion 161 161 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 162 173 #region Slave Methods 163 174 [OperationContract]
Note: See TracChangeset
for help on using the changeset viewer.