Changeset 1597
- Timestamp:
- 04/17/09 14:03:06 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.DataAccess/3.2/HeuristicLab.DataAccess-3.2.csproj
r1534 r1597 95 95 </ItemGroup> 96 96 <ItemGroup> 97 <Compile Include="Interfaces\IPolymorphicDataAdapter.cs" /> 97 98 <Compile Include="Properties\AssemblyInfo.cs" /> 98 99 <Compile Include="DataAccessPlugin.cs" /> -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ClientGroupAdapter.cs
r1580 r1597 71 71 } 72 72 } 73 74 private IClientAdapter clientAdapter = null;75 76 private IClientAdapter ClientAdapter {77 get {78 if (clientAdapter == null)79 clientAdapter =80 this.Session.GetDataAdapter<ClientInfo, IClientAdapter>();81 82 return clientAdapter;83 }84 }85 73 #endregion 86 74 … … 102 90 clientGroup.Resources.Clear(); 103 91 foreach(Guid resource in resources) { 104 ClientInfo client =105 ClientAdapter.GetById(resource);92 Resource res = 93 ResAdapter.GetByIdPolymorphic(resource); 106 94 107 if (client == null) { 108 //client group 109 ClientGroup group = 110 GetById(resource); 111 112 clientGroup.Resources.Add(group); 113 } else { 114 clientGroup.Resources.Add(client); 115 } 95 clientGroup.Resources.Add(res); 116 96 } 117 97 … … 141 121 new List<Guid>(); 142 122 foreach(Resource res in group.Resources) { 143 if (res is ClientInfo) { 144 ClientAdapter.Update(res as ClientInfo); 145 } else if (res is ClientGroup) { 146 Update(res as ClientGroup); 147 } else { 148 ResAdapter.Update(res); 149 } 123 ResAdapter.UpdatePolymorphic(res); 150 124 151 125 relationships.Add(res.Id); -
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/ResourceAdapter.cs
r1580 r1597 49 49 50 50 return clientAdapter; 51 } 52 } 53 54 private IClientGroupAdapter clientGroupAdapter = null; 55 56 private IClientGroupAdapter ClientGroupAdapter { 57 get { 58 if (clientGroupAdapter == null) 59 clientGroupAdapter = 60 this.Session.GetDataAdapter<ClientGroup, IClientGroupAdapter>(); 61 62 return clientGroupAdapter; 51 63 } 52 64 } … … 108 120 109 121 #endregion 122 123 #region IPolymorphicDataAdapter<Resource> Members 124 125 public void UpdatePolymorphic(Resource res) { 126 if (res is ClientInfo) { 127 ClientAdapter.Update(res as ClientInfo); 128 } else if (res is ClientGroup) { 129 ClientGroupAdapter.Update(res as ClientGroup); 130 } else { 131 this.Update(res); 132 } 133 } 134 135 public Resource GetByIdPolymorphic(Guid id) { 136 ClientGroup group = 137 ClientGroupAdapter.GetById(id); 138 139 if (group != null) 140 return group; 141 else { 142 ClientInfo client = 143 ClientAdapter.GetById(id); 144 145 if (client != null) 146 return client; 147 else { 148 return this.GetById(id); 149 } 150 } 151 } 152 153 public bool DeletePolymorphic(Resource res) { 154 if (res is ClientInfo) { 155 return ClientAdapter.Delete(res as ClientInfo); 156 } else if (res is ClientGroup) { 157 return ClientGroupAdapter.Delete(res as ClientGroup); 158 } else { 159 return this.Delete(res); 160 } 161 } 162 163 #endregion 110 164 } 111 165 } -
trunk/sources/HeuristicLab.Hive.Server.DataAccess/3.2/IResourceAdapter.cs
r1530 r1597 30 30 /// The resource database adapter 31 31 /// </summary> 32 public interface IResourceAdapter: I DataAdapter<Resource> {32 public interface IResourceAdapter: IPolymorphicDataAdapter<Resource> { 33 33 /// <summary> 34 34 /// Gets the resource and updates the values of the object
Note: See TracChangeset
for help on using the changeset viewer.