Changeset 15913 for branches/2839_HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HiveService.cs
- Timestamp:
- 04/20/18 11:52:33 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2839_HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HiveService.cs
r15908 r15913 795 795 } 796 796 } 797 798 public IDictionary<Guid, HashSet<Guid>> GetProjectGenealogy() { 799 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 800 var pm = PersistenceManager; 801 using(new PerformanceLogger("GetProjectGenealogy")) { 802 var projectDao = pm.ProjectDao; 803 var projectAncestors = new Dictionary<Guid, HashSet<Guid>>(); 804 return pm.UseTransaction(() => { 805 var projects = projectDao.GetAll().ToList(); 806 projects.ForEach(p => projectAncestors.Add(p.ProjectId, new HashSet<Guid>())); 807 foreach (var p in projects) { 808 var parentProject = p.ParentProject; 809 while(parentProject != null) { 810 projectAncestors[p.ProjectId].Add(parentProject.ProjectId); 811 parentProject = parentProject.ParentProject; 812 } 813 } 814 return projectAncestors; 815 }); 816 } 817 } 797 818 #endregion 798 819 … … 1245 1266 } 1246 1267 1268 public IDictionary<Guid, HashSet<Guid>> GetResourceGenealogy() { 1269 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 1270 var pm = PersistenceManager; 1271 using (new PerformanceLogger("GetResourceGenealogy")) { 1272 var resourceDao = pm.ResourceDao; 1273 var resourceAncestors = new Dictionary<Guid, HashSet<Guid>>(); 1274 return pm.UseTransaction(() => { 1275 var resources = resourceDao.GetAll().ToList(); 1276 resources.ForEach(r => resourceAncestors.Add(r.ResourceId, new HashSet<Guid>())); 1277 1278 foreach(var r in resources) { 1279 var parentResource = r.ParentResource; 1280 while(parentResource != null) { 1281 resourceAncestors[r.ResourceId].Add(parentResource.ResourceId); 1282 parentResource = parentResource.ParentResource; 1283 } 1284 } 1285 return resourceAncestors; 1286 }); 1287 } 1288 } 1289 1247 1290 public void UpdateSlave(DT.Slave slaveDto) { 1248 1291 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client);
Note: See TracChangeset
for help on using the changeset viewer.