Skip to content

Commit e53df9c

Browse files
committed
interim
1 parent 9c30c96 commit e53df9c

File tree

6 files changed

+111
-87
lines changed

6 files changed

+111
-87
lines changed

Application/ResearchDataManagementPlatform/WindowManagement/ActivateItems.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ public override void RequestItemEmphasis(object sender, EmphasiseRequest request
226226
? descendancy.Parents.FirstOrDefault()
227227
: request.ObjectToEmphasise; //assume maybe o is a root object itself?
228228

229-
if (root is CohortIdentificationConfiguration cic)
230-
Activate<CohortIdentificationConfigurationUI, CohortIdentificationConfiguration>(cic);
229+
if (root is Rdmp.Core.EntityFramework.Models.CohortIdentificationConfiguration cic)
230+
Activate<CohortIdentificationConfigurationUI, Rdmp.Core.EntityFramework.Models.CohortIdentificationConfiguration>(cic);
231231
else if (root != null)
232232
_windowManager.ShowCollectionWhichSupportsRootObjectType(root);
233233

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,41 @@
1-
using Rdmp.Core.EntityFramework.Helpers;
1+
using Rdmp.Core.Curation.Data;
2+
using Rdmp.Core.EntityFramework.Helpers;
23
using System;
34
using System.Collections.Generic;
45
using System.ComponentModel.DataAnnotations;
6+
using System.ComponentModel.DataAnnotations.Schema;
57
using System.Linq;
68
using System.Text;
79
using System.Threading.Tasks;
810

911
namespace Rdmp.Core.EntityFramework.Models
1012
{
11-
public class CohortIdentificationConfiguration: DatabaseObject
13+
[Table("CohortIdentificationConfiguration")]
14+
15+
public class CohortIdentificationConfiguration: DatabaseObject, IHasFolder
1216
{
1317

1418
[Key]
1519
public override int ID { get; set; }
20+
21+
public int? Version { get; set; }
22+
23+
public string Name { get; set => SetField(ref field, value); }
24+
public string Description { get; set => SetField(ref field, value); }
25+
public string Folder { get; set => SetField(ref field, value); }
26+
public bool Frozen { get; set => SetField(ref field, value); }
27+
public string FrozenBy { get; set => SetField(ref field, value); }
28+
public DateTime? FrozenDate { get; set => SetField(ref field, value); }
29+
public bool IsTemplate { get; set => SetField(ref field, value); }
30+
31+
public override string ToString()
32+
{
33+
return Name;
34+
}
35+
36+
public List<CohortIdentificationConfiguration> GetVersions()
37+
{
38+
return new List<CohortIdentificationConfiguration>();//TODO
39+
}
1640
}
1741
}

Rdmp.Core/EntityFramework/RDMPDbContext.cs

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
using Rdmp.Core.Curation.Data.Aggregation;
55
using Rdmp.Core.Curation.Data.Cohort;
66
using Rdmp.Core.Curation.Data.Defaults;
7-
using Rdmp.Core.MapsDirectlyToDatabaseTable;
87
using Rdmp.Core.EntityFramework.Models;
8+
using Rdmp.Core.MapsDirectlyToDatabaseTable;
99
using Rdmp.Core.Providers;
1010
using Rdmp.Core.Providers.Nodes;
11+
using Rdmp.Core.Providers.Nodes.CohortNodes;
1112
using System;
1213
using System.Collections;
1314
using System.Collections.Generic;
@@ -35,7 +36,8 @@ public RDMPDbContext(DbContextOptions<RDMPDbContext> options)
3536
public DbSet<Models.TableInfo> TableInfos { get; set; }
3637
public DbSet<Models.Lookup> Lookups{ get; set; }
3738
public DbSet<Models.LookupCompositeJoinInfo> LookupCompositeJoinInfos { get; set; }
38-
public DbSet<ANOTable> ANOTables{ get; set; }
39+
public DbSet<ANOTable> ANOTables { get; set; }
40+
public DbSet<Models.CohortIdentificationConfiguration> CohortIdentificationConfigurations { get; set; }
3941

4042
public T[] GetAllObjects<T>()
4143
{
@@ -90,7 +92,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
9092
entity.Property(e => e.Name).IsRequired();
9193
//entity.HasIndex(e => e.CatalogueItem);
9294
});
93-
95+
modelBuilder.Entity<Models.CohortIdentificationConfiguration>(entity =>
96+
{
97+
entity.HasKey(e => e.ID);
98+
entity.Property(e => e.Name).IsRequired().HasMaxLength(500);
99+
});
94100
modelBuilder.Entity<Models.Catalogue>(entity =>
95101
{
96102
entity.HasKey(e => e.ID);
@@ -99,24 +105,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
99105
entity.HasIndex(e => e.Name);
100106
entity.HasIndex(e => e.Acronym);
101107
entity.HasIndex(e => e.IsDeprecated);
102-
// entity.Property(e => e.Type).HasConversion(v => v.ToString(),
103-
// v => (CatalogueType)Enum.Parse(typeof(CatalogueType), v));
104-
105-
// entity.Property(e => e.Purpose).HasConversion(v => v.ToString(),
106-
// v => (DatasetPurpose)Enum.Parse(typeof(DatasetPurpose), v));
107-
108-
// entity.Property(e => e.Periodicity).HasConversion(v => v.ToString(),
109-
// v => (CataloguePeriodicity)Enum.Parse(typeof(CataloguePeriodicity), v));
110-
111-
// entity.Property(e => e.Granularity).HasConversion(v => v.ToString(),
112-
// v => (CatalogueGranularity)Enum.Parse(typeof(CatalogueGranularity), v));
113-
114-
// entity.Property(e => e.Update_freq).HasConversion(v => v.ToString(),
115-
// v => (UpdateFrequencies)Enum.Parse(typeof(UpdateFrequencies), v));
116-
117-
// entity.Property(e => e.UpdateLag).HasConversion(v => v.ToString(),
118-
//v => (UpdateLagTimes)Enum.Parse(typeof(UpdateLagTimes), v));
119-
120108
});
121109
}
122110

@@ -222,7 +210,22 @@ public IEnumerable<object> GetChildren(object obj)
222210
var extractionInformations = ExtractionInformation.Where(ei => ei.CatalogueItem_ID == catalogueItem.ID).ToList();
223211
return [..ColumnInfos.Where(ci => ci.CatalogueItems.Select(ci => ci.ID).Contains(catalogueItem.ID)),..extractionInformations];
224212
}
225-
213+
if (obj is FolderNode<Core.EntityFramework.Models.CohortIdentificationConfiguration> fcic)
214+
{
215+
return fcic.ChildFolders.Cast<object>().Union(fcic.ChildObjects);//Catalogues.Where(c => c.Folder == fnc.FullName);
216+
}
217+
if(obj is AllTemplateCohortIdentificationConfigurationsNode atcicn)
218+
{
219+
return CohortIdentificationConfigurations.Where(cic => cic.IsTemplate).ToList();
220+
}
221+
if (obj is AllOrphanAggregateConfigurationsNode aocicn)
222+
{
223+
return new List<string>() { }; ;// CohortIdentificationConfigurations.Where(cic => cic.IsTemplate).ToList();
224+
}
225+
if (obj is AllTemplateAggregateConfigurationsNode atacicn)
226+
{
227+
return new List<string>() { }; ;// CohortIdentificationConfigurations.Where(cic => cic.IsTemplate).ToList();
228+
}
226229
return new List<string>() { };
227230
}
228231
}

Rdmp.UI/Collections/CohortIdentificationCollectionUI.cs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,45 +56,42 @@ public override void SetItemActivator(IActivateItems activator)
5656
);
5757
CommonTreeFunctionality.AxeChildren = new[]
5858
{
59-
typeof(CohortIdentificationConfiguration), typeof(Core.Curation.Data.Aggregation.AggregateConfiguration)
59+
typeof(Core.EntityFramework.Models.CohortIdentificationConfiguration), typeof(Core.Curation.Data.Aggregation.AggregateConfiguration)
6060
};
6161

6262
CommonTreeFunctionality.MaintainRootObjects = new[]
6363
{
64-
typeof(FolderNode<CohortIdentificationConfiguration>),
64+
typeof(FolderNode<Core.EntityFramework.Models.CohortIdentificationConfiguration>),
6565
typeof(AllTemplateCohortIdentificationConfigurationsNode),
6666
typeof(AllOrphanAggregateConfigurationsNode),
6767
typeof(AllTemplateAggregateConfigurationsNode)
6868
};
69-
var rootFolder = new FolderNode<CohortIdentificationConfiguration>("yall");// Activator.CoreChildProvider.CohortIdentificationConfigurationRootFolderWithoutVersionedConfigurations;
70-
rootFolder.ChildFolders = new List<FolderNode<CohortIdentificationConfiguration>>();
71-
rootFolder.ChildObjects = new List<CohortIdentificationConfiguration>();
69+
var rootFolder = FolderHelper.BuildFolderTree<Core.EntityFramework.Models.CohortIdentificationConfiguration>(Activator.RepositoryLocator.CatalogueDbContext.CohortIdentificationConfigurations.Where(cic => !cic.IsTemplate && cic.Version == null).ToArray());
7270

7371
tlvCohortIdentificationConfigurations.AddObject(rootFolder);
74-
tlvCohortIdentificationConfigurations.AddObject(Activator.CoreChildProvider.AllTemplateCohortIdentificationConfigurationsNode);
75-
tlvCohortIdentificationConfigurations.AddObject(Activator.CoreChildProvider.OrphanAggregateConfigurationsNode);
76-
tlvCohortIdentificationConfigurations.AddObject(Activator.CoreChildProvider
77-
.TemplateAggregateConfigurationsNode);
72+
tlvCohortIdentificationConfigurations.AddObject(new AllTemplateCohortIdentificationConfigurationsNode());
73+
tlvCohortIdentificationConfigurations.AddObject(new AllOrphanAggregateConfigurationsNode());
74+
tlvCohortIdentificationConfigurations.AddObject(new AllTemplateAggregateConfigurationsNode());
7875

7976

8077
tlvCohortIdentificationConfigurations.CanExpandGetter = delegate (object x)
8178
{
82-
if (x is CohortIdentificationConfiguration)
79+
if (x is Core.EntityFramework.Models.CohortIdentificationConfiguration)
8380
{
84-
return ((CohortIdentificationConfiguration)x).GetVersions().Count > 0;
81+
return ((Core.EntityFramework.Models.CohortIdentificationConfiguration)x).GetVersions().Count > 0;
8582
}
8683

87-
return Activator.CoreChildProvider.GetChildren(x).Length > 0;
84+
return Activator.RepositoryLocator.CatalogueDbContext.GetChildren(x).Count() > 0;
8885
};
8986

9087
tlvCohortIdentificationConfigurations.ChildrenGetter = delegate (object x)
9188
{
92-
if (x is CohortIdentificationConfiguration)
89+
if (x is Core.EntityFramework.Models.CohortIdentificationConfiguration)
9390
{
94-
CohortIdentificationConfiguration cic = (CohortIdentificationConfiguration)x;
91+
Core.EntityFramework.Models.CohortIdentificationConfiguration cic = (Core.EntityFramework.Models.CohortIdentificationConfiguration)x;
9592
return cic.GetVersions();
9693
}
97-
return Activator.CoreChildProvider.GetChildren(x);
94+
return Activator.RepositoryLocator.CatalogueDbContext.GetChildren(x);
9895
};
9996

10097
CommonTreeFunctionality.WhitespaceRightClickMenuCommandsGetter = a => new IAtomicCommand[]

Rdmp.UI/CommandExecution/Proposals/ProposeExecutionWhenTargetIsCohortIdentificationConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.
66

77
using Rdmp.Core.CommandExecution;
8-
using Rdmp.Core.Curation.Data.Cohort;
8+
using Rdmp.Core.EntityFramework.Models;
99
using Rdmp.UI.ItemActivation;
1010
using Rdmp.UI.SubComponents;
1111

Rdmp.UI/SubComponents/CohortIdentificationConfigurationUI.cs

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -164,22 +164,22 @@ private void refreshColumnValues(object sender, EventArgs e)
164164
tlvCic.RefreshObjects(tlvCic.Objects.Cast<object>().ToArray());
165165
}
166166

167-
public override void SetDatabaseObject(IActivateItems activator, CohortIdentificationConfiguration databaseObject)
167+
public override void SetDatabaseObject(IActivateItems activator, Core.EntityFramework.Models.CohortIdentificationConfiguration databaseObject)
168168
{
169-
base.SetDatabaseObject(activator, databaseObject);
170-
version.Setup(databaseObject, activator);
171-
Common.Configuration = databaseObject;
172-
Common.Compiler.CohortIdentificationConfiguration = databaseObject;
173-
174-
RebuildClearCacheCommand();
175-
176-
gbCicInfo.Text = $"Name: {databaseObject.Name}";
177-
tbDescription.Text = $"Description: {databaseObject.Description}";
178-
ticket.TicketText = databaseObject.Ticket;
179-
if (databaseObject.IsTemplate)
180-
{
181-
version.Visible = false;
182-
}
169+
//base.SetDatabaseObject(activator, databaseObject);
170+
//version.Setup(databaseObject, activator);
171+
//Common.Configuration = databaseObject;
172+
//Common.Compiler.CohortIdentificationConfiguration = databaseObject;
173+
174+
//RebuildClearCacheCommand();
175+
176+
//gbCicInfo.Text = $"Name: {databaseObject.Name}";
177+
//tbDescription.Text = $"Description: {databaseObject.Description}";
178+
//ticket.TicketText = databaseObject.Ticket;
179+
//if (databaseObject.IsTemplate)
180+
//{
181+
// version.Visible = false;
182+
//}
183183
if (_commonFunctionality == null)
184184
{
185185
activator.RefreshBus.Subscribe(this);
@@ -203,35 +203,35 @@ public override void SetDatabaseObject(IActivateItems activator, CohortIdentific
203203
tlvCic.SelectedIndex = 0;
204204
}
205205

206-
CommonFunctionality.AddToMenu(cbIncludeCumulative);
207-
CommonFunctionality.AddToMenu(new ToolStripSeparator());
208-
CommonFunctionality.AddToMenu(new ExecuteCommandSetQueryCachingDatabase(Activator, databaseObject));
209-
CommonFunctionality.AddToMenu(new ExecuteCommandClearQueryCache(Activator, databaseObject));
210-
CommonFunctionality.AddToMenu(new ExecuteCommandCreateNewQueryCacheDatabase(activator, databaseObject));
211-
CommonFunctionality.AddToMenu(
212-
new ExecuteCommandSet(activator, databaseObject, databaseObject.GetType().GetProperty("Description"))
213-
{
214-
OverrideIcon =
215-
Activator.CoreIconProvider.GetImage(RDMPConcept.CohortIdentificationConfiguration, OverlayKind.Edit)
216-
});
217-
CommonFunctionality.AddToMenu(new ToolStripSeparator());
218-
CommonFunctionality.AddToMenu(
219-
new ExecuteCommandShowXmlDoc(activator, "CohortIdentificationConfiguration.QueryCachingServer_ID",
220-
"Query Caching"), "Help (What is Query Caching)");
221-
if (!databaseObject.IsTemplate)
222-
{
223-
CommonFunctionality.Add(
224-
new ExecuteCommandCreateNewCohortByExecutingACohortIdentificationConfiguration(activator, null).SetTarget(
225-
databaseObject),
226-
"Commit Cohort",
227-
activator.CoreIconProvider.GetImage(RDMPConcept.ExtractableCohort, OverlayKind.Add));
228-
}
229-
foreach (var c in _timeoutControls.GetControls())
230-
CommonFunctionality.Add(c);
231-
232-
Common.QueryCachingServer = databaseObject.QueryCachingServer;
233-
Common.Compiler.CoreChildProvider = activator.CoreChildProvider;
234-
Common.RecreateAllTasks();
206+
//CommonFunctionality.AddToMenu(cbIncludeCumulative);
207+
//CommonFunctionality.AddToMenu(new ToolStripSeparator());
208+
//CommonFunctionality.AddToMenu(new ExecuteCommandSetQueryCachingDatabase(Activator, databaseObject));
209+
//CommonFunctionality.AddToMenu(new ExecuteCommandClearQueryCache(Activator, databaseObject));
210+
//CommonFunctionality.AddToMenu(new ExecuteCommandCreateNewQueryCacheDatabase(activator, databaseObject));
211+
//CommonFunctionality.AddToMenu(
212+
// new ExecuteCommandSet(activator, databaseObject, databaseObject.GetType().GetProperty("Description"))
213+
// {
214+
// OverrideIcon =
215+
// Activator.CoreIconProvider.GetImage(RDMPConcept.CohortIdentificationConfiguration, OverlayKind.Edit)
216+
// });
217+
//CommonFunctionality.AddToMenu(new ToolStripSeparator());
218+
//CommonFunctionality.AddToMenu(
219+
// new ExecuteCommandShowXmlDoc(activator, "CohortIdentificationConfiguration.QueryCachingServer_ID",
220+
// "Query Caching"), "Help (What is Query Caching)");
221+
//if (!databaseObject.IsTemplate)
222+
//{
223+
// CommonFunctionality.Add(
224+
// new ExecuteCommandCreateNewCohortByExecutingACohortIdentificationConfiguration(activator, null).SetTarget(
225+
// databaseObject),
226+
// "Commit Cohort",
227+
// activator.CoreIconProvider.GetImage(RDMPConcept.ExtractableCohort, OverlayKind.Add));
228+
//}
229+
//foreach (var c in _timeoutControls.GetControls())
230+
// CommonFunctionality.Add(c);
231+
232+
//Common.QueryCachingServer = databaseObject.QueryCachingServer;
233+
//Common.Compiler.CoreChildProvider = activator.CoreChildProvider;
234+
//Common.RecreateAllTasks();
235235
}
236236

237237
/// <summary>
@@ -423,6 +423,6 @@ private void cbKnownVersions_SelectedIndexChanged(object sender, EventArgs e)
423423
[TypeDescriptionProvider(
424424
typeof(AbstractControlDescriptionProvider<CohortIdentificationConfigurationUI_Design, UserControl>))]
425425
public abstract class
426-
CohortIdentificationConfigurationUI_Design : RDMPSingleDatabaseObjectControl<CohortIdentificationConfiguration>
426+
CohortIdentificationConfigurationUI_Design : RDMPSingleDatabaseObjectControl<Core.EntityFramework.Models.CohortIdentificationConfiguration>
427427
{
428428
}

0 commit comments

Comments
 (0)