[1580] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using HeuristicLab.Hive.Server.DataAccess;
|
---|
| 6 | using HeuristicLab.DataAccess.ADOHelper;
|
---|
| 7 | using HeuristicLab.Hive.Contracts.BusinessObjects;
|
---|
| 8 | using HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper;
|
---|
| 9 | using System.Xml.Serialization;
|
---|
| 10 | using HeuristicLab.PluginInfrastructure;
|
---|
| 11 | using System.IO;
|
---|
| 12 |
|
---|
| 13 | namespace HeuristicLab.Hive.Server.ADODataAccess {
|
---|
| 14 | class PluginInfoAdapter:
|
---|
| 15 | DataAdapterBase<dsHiveServerTableAdapters.PluginInfoTableAdapter,
|
---|
| 16 | HivePluginInfo,
|
---|
| 17 | dsHiveServer.PluginInfoRow>,
|
---|
| 18 | IPluginInfoAdapter {
|
---|
| 19 |
|
---|
| 20 | public PluginInfoAdapter() :
|
---|
| 21 | base(new PluginInfoAdapterWrapper()) {
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | protected override dsHiveServer.PluginInfoRow ConvertObj(HivePluginInfo pluginInfo,
|
---|
| 25 | dsHiveServer.PluginInfoRow row) {
|
---|
| 26 | if (row != null && pluginInfo != null) {
|
---|
| 27 | row.PluginId = pluginInfo.Id;
|
---|
| 28 | row.Name = pluginInfo.Name;
|
---|
| 29 | row.Version = pluginInfo.Version;
|
---|
| 30 | row.BuildDate = pluginInfo.BuildDate;
|
---|
| 31 |
|
---|
| 32 | return row;
|
---|
| 33 | } else {
|
---|
| 34 | return null;
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | protected override HivePluginInfo ConvertRow(dsHiveServer.PluginInfoRow row,
|
---|
| 39 | HivePluginInfo pluginInfo) {
|
---|
| 40 | if (row != null && pluginInfo != null) {
|
---|
| 41 | pluginInfo.Id = row.PluginId;
|
---|
| 42 |
|
---|
| 43 | if (!row.IsNameNull()) {
|
---|
| 44 | pluginInfo.Name = row.Name;
|
---|
| 45 | } else {
|
---|
| 46 | pluginInfo.Name = null;
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | if (!row.IsVersionNull()) {
|
---|
| 50 | pluginInfo.Version = row.Version;
|
---|
| 51 | } else {
|
---|
| 52 | pluginInfo.Version = null;
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | if (!row.IsBuildDateNull()) {
|
---|
| 56 | pluginInfo.BuildDate = row.BuildDate;
|
---|
| 57 | } else {
|
---|
[1592] | 58 | pluginInfo.BuildDate = DateTime.Now;
|
---|
[1580] | 59 | }
|
---|
| 60 |
|
---|
| 61 | return pluginInfo;
|
---|
| 62 | } else {
|
---|
| 63 | return null;
|
---|
| 64 | }
|
---|
| 65 | }
|
---|
[1592] | 66 |
|
---|
| 67 | public HivePluginInfo GetByNameVersionBuilddate(String name, String version, DateTime buildDate) {
|
---|
| 68 | return
|
---|
| 69 | base.FindSingle(
|
---|
| 70 | delegate() {
|
---|
| 71 | return Adapter.GetDataByNameVersionBuilddate(name, version, buildDate);
|
---|
| 72 | });
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | public ICollection<HivePluginInfo> GetOrphanedPluginInfos() {
|
---|
| 76 | return
|
---|
| 77 | base.FindMultiple(
|
---|
| 78 | delegate() {
|
---|
| 79 | return Adapter.GetDataByOrphaned();
|
---|
| 80 | });
|
---|
| 81 | }
|
---|
[1580] | 82 | }
|
---|
| 83 | }
|
---|