Changeset 5106 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs
- Timestamp:
- 12/14/10 16:52:55 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.DataAccess/3.4/Convert.cs
r4905 r5106 42 42 ParentJobId = source.ParentJobId, 43 43 Priority = source.Priority, 44 ProjectId = source.ProjectId,45 44 SlaveId = source.SlaveId, 46 45 JobState = source.JobState, … … 66 65 target.ParentJobId = source.ParentJobId; 67 66 target.Priority = source.Priority; 68 target.ProjectId = source.ProjectId;69 67 target.SlaveId = source.SlaveId; 70 68 target.JobState = source.JobState; 71 69 target.UserId = source.UserId; 72 // target.RequiredPlugins = db.Plugins.Select(x => source.PluginsNeededIds.Contains(x.PluginId)); - this is difficult70 // target.RequiredPlugins = db.Plugins.Select(x => source.PluginsNeededIds.Contains(x.PluginId)); - this is difficult 73 71 } 74 72 } … … 78 76 public static DT.JobData ToDto(JobData source) { 79 77 if (source == null) return null; 80 return new DT.JobData { JobId = source.JobId, Data = source.Data.ToArray() };78 return new DT.JobData { JobId = source.JobId, Data = source.Data.ToArray(), LastUpdate = source.LastUpdate }; 81 79 } 82 80 public static JobData ToEntity(DT.JobData source) { … … 87 85 public static void ToEntity(DT.JobData source, JobData target) { 88 86 if ((source != null) && (target != null)) { 89 target.JobId = source.JobId; target.Data = new Binary(source.Data); 87 target.JobId = source.JobId; target.Data = new Binary(source.Data); target.LastUpdate = source.LastUpdate; 90 88 } 91 89 } … … 95 93 public static DT.HiveExperiment ToDto(HiveExperiment source) { 96 94 if (source == null) return null; 97 return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, RootJobId = source.RootJobId, UserId = source.UserId };95 return new DT.HiveExperiment { Id = source.HiveExperimentId, Description = source.Description, Name = source.Name, RootJobId = source.RootJobId, UserId = source.UserId, DateCreated = source.DateCreated }; 98 96 } 99 97 public static HiveExperiment ToEntity(DT.HiveExperiment source) { … … 104 102 public static void ToEntity(DT.HiveExperiment source, HiveExperiment target) { 105 103 if ((source != null) && (target != null)) { 106 target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.RootJobId = source.RootJobId; target.UserId = source.UserId; 104 target.HiveExperimentId = source.Id; target.Description = source.Description; target.Name = source.Name; target.RootJobId = source.RootJobId; target.UserId = source.UserId; target.DateCreated = source.DateCreated; 107 105 } 108 106 } … … 146 144 public static DT.Slave ToDto(Slave source) { 147 145 if (source == null) return null; 148 return new DT.Slave { Id = source.ResourceId, CalendarSyncState = source.CalendarSyncState, Cores = source.Cores, CpuSpeed = source.CpuSpeed, FreeCores = source.FreeCores, FreeMemory = source.FreeMemory, IsAllowedToCalculate = source.IsAllowedToCalculate, Memory = source.Memory, Name = source.Name, SlaveConfigId = source.SlaveConfigId, SlaveState = source.SlaveState };146 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 }; 149 147 } 150 148 public static Slave ToEntity(DT.Slave source) { … … 155 153 public static void ToEntity(DT.Slave source, Slave target) { 156 154 if ((source != null) && (target != null)) { 157 target.ResourceId = source.Id; target. CalendarSyncState = source.CalendarSyncState; target.Cores = source.Cores; target.CpuSpeed = source.CpuSpeed; target.FreeCores = source.FreeCores; target.FreeMemory = source.FreeMemory; target.IsAllowedToCalculate = source.IsAllowedToCalculate; target.Memory = source.Memory; target.Name = source.Name; target.SlaveConfigId = source.SlaveConfigId; target.SlaveState = source.SlaveState;155 target.ResourceId = source.Id; target.ParentResourceId = source.ParentResourceId; target.Cores = source.Cores; target.CpuSpeed = source.CpuSpeed; target.FreeCores = source.FreeCores; target.FreeMemory = source.FreeMemory; target.IsAllowedToCalculate = source.IsAllowedToCalculate; target.Memory = source.Memory; target.Name = source.Name; target.SlaveState = source.SlaveState; 158 156 } 159 157 } … … 163 161 public static DT.SlaveGroup ToDto(SlaveGroup source) { 164 162 if (source == null) return null; 165 return new DT.SlaveGroup { Id = source.ResourceId, Name = source.Name, ChildResourcesIds = source.SlaveGroup_Resources_Children.Select(x => x.ResourceId).ToList(), ParentResourcesIds = source.SlaveGroup_Resources_Parents.Select(x => x.ResourceId).ToList()};163 return new DT.SlaveGroup { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId }; 166 164 } 167 165 public static SlaveGroup ToEntity(DT.SlaveGroup source) { … … 172 170 public static void ToEntity(DT.SlaveGroup source, SlaveGroup target) { 173 171 if ((source != null) && (target != null)) { 174 target.ResourceId = source.Id; 175 target.Name = source.Name; 176 //target.SlaveGroup_Resources_Children = // TODO: see how working with groups will work, then decide how to handle enumerations in here 177 //target.SlaveGroup_Resources_Parents = 172 target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; 178 173 } 179 174 } … … 183 178 public static DT.Resource ToDto(Resource source) { 184 179 if (source == null) return null; 185 return new DT.Resource { Id = source.ResourceId, Name = source.Name };180 return new DT.Resource { Id = source.ResourceId, Name = source.Name, ParentResourceId = source.ParentResourceId }; 186 181 } 187 182 public static Resource ToEntity(DT.Resource source) { … … 192 187 public static void ToEntity(DT.Resource source, Resource target) { 193 188 if ((source != null) && (target != null)) { 194 target.ResourceId = source.Id; target.Name = source.Name; 189 target.ResourceId = source.Id; target.Name = source.Name; target.ParentResourceId = source.ParentResourceId; 195 190 } 196 191 }
Note: See TracChangeset
for help on using the changeset viewer.