Skip to content

Commit 6cdbfd4

Browse files
committed
Merge branch 'rc' of https://github.com/bexis2/core into rc
2 parents 618c83b + 051a7cf commit 6cdbfd4

File tree

8 files changed

+79
-12
lines changed

8 files changed

+79
-12
lines changed

.github/workflows/codeql.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ name: "CodeQL Advanced"
1313

1414
on:
1515
push:
16-
branches:
16+
branches:
17+
- master
1718
- rc
1819
pull_request:
1920
branches:
21+
- master
2022
- rc
2123
schedule:
2224
- cron: '38 14 * * 4'

Components/IO/BExIS.IO.Tests/Transform/Input/AsciiReaderTest.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,29 @@ public void rowToList_RowAsQuotesAndSeperatorInQuotes_ReturnExpectedListOfString
121121
Assert.That(values, Is.EquivalentTo(expectedOutcome));
122122
}
123123

124+
[Test]
125+
public void rowToList_RowAsOneVariablewithQuotesAndSeperatorInQuotes_ReturnExpectedListOfStrings()
126+
{
127+
//Arrange
128+
string row = "V1,V2,'V3,V4'";
129+
List<string> expectedOutcome = new List<string> { "V1", "V2", "V3,V4" };
130+
131+
AsciiFileReaderInfo info = new AsciiFileReaderInfo();
132+
info.Seperator = TextSeperator.comma;
133+
134+
AsciiReader reader = new AsciiReader(new StructuredDataStructure(), info);
135+
136+
//Act
137+
138+
List<string> values = reader.rowToList(row,
139+
AsciiFileReaderInfo.GetSeperator(TextSeperator.comma));
140+
141+
//Assert
142+
Assert.That(values.Count, Is.EqualTo(expectedOutcome.Count));
143+
Assert.That(values, Is.EquivalentTo(expectedOutcome));
144+
}
145+
146+
124147
[Test]
125148
public void ValidateRow_runNotValid_LimitErrors()
126149
{

Components/IO/BExIS.IO.Tests/Transform/Input/StructureAnalyzerTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public void SuggestSystemTypes_Valid_ResultWithCorrectTypes(int n)
249249
StructureAnalyser structureAnalyser = new StructureAnalyser();
250250

251251
//Act
252-
var result = structureAnalyser.SuggestSystemTypes(rows.GetRange(0, n), TextSeperator.semicolon, DecimalCharacter.comma, new List<string>());
252+
var result = structureAnalyser.SuggestSystemTypes(rows.GetRange(0, n),TextMarker.doubleQuotes, TextSeperator.semicolon, DecimalCharacter.comma, new List<string>());
253253

254254
//Assert
255255
Assert.NotNull(result);
@@ -294,7 +294,7 @@ public void SuggestSystemTypes_WithTestData_ResultWithCorrectTypes()
294294
StructureAnalyser structureAnalyser = new StructureAnalyser();
295295

296296
//Act
297-
var result = structureAnalyser.SuggestSystemTypes(rows, TextSeperator.semicolon, DecimalCharacter.comma, new List<string>());
297+
var result = structureAnalyser.SuggestSystemTypes(rows, TextMarker.doubleQuotes, TextSeperator.semicolon, DecimalCharacter.comma, new List<string>());
298298

299299
//Assert
300300
Assert.NotNull(result);
@@ -321,7 +321,7 @@ public void SuggestSystemTypes_ValidDateTypes_ResultWithCorrectTypes(int n)
321321
dateValues.Add("2022-12-24"); // yyyy-MM-dd
322322

323323
//Act
324-
var result = structureAnalyser.SuggestSystemTypes(rows.GetRange(0, n), TextSeperator.semicolon, DecimalCharacter.comma, new List<string>());
324+
var result = structureAnalyser.SuggestSystemTypes(rows.GetRange(0, n), TextMarker.doubleQuotes, TextSeperator.semicolon, DecimalCharacter.comma, new List<string>());
325325

326326
//Assert
327327
Assert.NotNull(result);
@@ -334,7 +334,7 @@ public void SuggestSystemTypes_ValidWithMissingValues_ResultWithCorrectTypes()
334334
StructureAnalyser structureAnalyser = new StructureAnalyser();
335335

336336
//Act
337-
var result = structureAnalyser.SuggestSystemTypes(rowWithMissingValues, TextSeperator.semicolon, DecimalCharacter.comma, missingValueList);
337+
var result = structureAnalyser.SuggestSystemTypes(rowWithMissingValues, TextMarker.doubleQuotes, TextSeperator.semicolon, DecimalCharacter.comma, missingValueList);
338338

339339
//Assert
340340
Assert.NotNull(result);

Components/IO/BExIS.IO.Transform.Input/AsciiReader.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,28 @@ public List<string> rowToList(string line, char seperator)
988988
return line.Split(seperator).ToList();
989989
}
990990

991+
/// <summary>
992+
/// Convert a row as a string to a list of strings based on offset,seperator and textmarker
993+
/// </summary>
994+
/// <remarks></remarks>
995+
/// <seealso cref=""/>
996+
/// <param name="line">Row as a string</param>
997+
/// <param name="seperator">Character used as TextSeparator</param>
998+
/// <param name="textMarker">Character used as TextMarker</param>
999+
/// <param name="offset">offset to skip values from begin</param>
1000+
/// <returns>List of values</returns>
1001+
public List<string> RowToList(string line, char seperator, char textMarker, int offset = 0)
1002+
{
1003+
List<string> tempRow = new List<string>();
1004+
1005+
tempRow = new List<string>();
1006+
tempRow = TextMarkerHandling(line, seperator,textMarker);
1007+
1008+
//if a offset is marked in the file reader information the offset needs to skip from the complete string array
1009+
return tempRow.Skip(offset).ToList();
1010+
//return line.Split(seperator).ToList();
1011+
}
1012+
9911013
private List<string> values;
9921014
private List<string> temp;
9931015

Components/IO/BExIS.IO.Transform.Input/StructureAnalyser.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,20 @@ public List<string> GetRandowRows(List<string> rows, int numberOfRows)
457457
throw new NotImplementedException();
458458
}
459459

460-
public Dictionary<int, Type> SuggestSystemTypes(List<string> rows, TextSeperator delimeter, DecimalCharacter decimalCharacter, List<string> missingValues)
460+
public Dictionary<int, Type> SuggestSystemTypes(List<string> rows,TextMarker textMarker, TextSeperator delimeter, DecimalCharacter decimalCharacter, List<string> missingValues)
461461
{
462462
Dictionary<int, List<Type>> source = new Dictionary<int, List<Type>>();
463463
Dictionary<int, Type> result = new Dictionary<int, Type>();
464464

465465
// get type checks
466466
checks = getDataTypeChecks(decimalCharacter);
467467

468+
// validate input
469+
AsciiFileReaderInfo info = new AsciiFileReaderInfo();
470+
info.Seperator = delimeter;
471+
info.TextMarker = textMarker;
472+
AsciiReader reader = new AsciiReader(new StructuredDataStructure(), info);
473+
468474
// create dictionary with types per column
469475
char seperator = AsciiFileReaderInfo.GetSeperator(delimeter);
470476
int numberOfRow = rows.First().Split(seperator).Count();
@@ -477,8 +483,11 @@ public Dictionary<int, Type> SuggestSystemTypes(List<string> rows, TextSeperator
477483
// go throw each row
478484
foreach (var row in rows)
479485
{
486+
//
487+
var cells = reader.rowToList(row, seperator);
488+
480489
//split row based on sepeartor
481-
foreach (var cell in row.Split(seperator).Select((x, i) => new { Value = x, Index = i }))
490+
foreach (var cell in cells.Select((x, i) => new { Value = x, Index = i }))
482491
{
483492
//update possible list of types by check the value against the existing list
484493
source[cell.Index] = checkValue(cell.Value, source[cell.Index], missingValues);

Console/BExIS.Web.Shell/Areas/DDM/BExIS.Modules.Ddm.UI/Controllers/DataController.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,10 @@ public async Task<ActionResult> GetCitationOrTitle(long Id, long datasetVersionI
469469
var citationSettings = settingsHelper.GetCitationSettings();
470470

471471
var errors = new List<string>();
472-
if (citationSettings == null || !citationSettings.ShowCitation || !MappingUtils.IsMapped(datasetVersion.Dataset.MetadataStructure.Id, LinkElementType.MetadataStructure, conceptManager.FindByName("citation").Id, LinkElementType.MappingConcept, out errors))
472+
string conceptName = "Citation_" + citationSettings.ReadCitationFormat;
473+
var concept = conceptManager.FindByName(conceptName);
474+
475+
if (citationSettings == null || !citationSettings.ShowCitation || concept == null || !MappingUtils.IsMapped(datasetVersion.Dataset.MetadataStructure.Id, LinkElementType.MetadataStructure, concept.Id, LinkElementType.MappingConcept, out errors))
473476
{
474477
return PartialView("_Title", datasetVersion.Title);
475478
}

Console/BExIS.Web.Shell/Areas/RPM/BExIS.Modules.Rpm.UI/Controllers/DataStructureController.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ public JsonResult Generate(DataStructureCreationModel model)
441441
path,
442442
AsciiFileReaderInfo.GetSeperator((char)model.Delimeter),
443443
AsciiFileReaderInfo.GetDecimalCharacter((char)model.Decimal),
444+
AsciiFileReaderInfo.GetTextMarker((char)model.TextMarker),
444445
missingValues,
445446
startdataIndex + 1
446447
);
@@ -844,7 +845,7 @@ public JsonResult GetDWCRequirements()
844845
/// <param name="missingValues"></param>
845846
/// <param name="datastart">row not index!</param>
846847
/// <returns></returns>
847-
private Dictionary<int, Type> suggestSystemTypes(string file, TextSeperator delimeter, DecimalCharacter decimalCharacter, List<string> missingValues, int datastart)
848+
private Dictionary<int, Type> suggestSystemTypes(string file, TextSeperator delimeter, DecimalCharacter decimalCharacter, TextMarker textMarker, List<string> missingValues, int datastart)
848849
{
849850
var settings = ModuleManager.GetModuleSettings("Rpm");
850851
int min = Convert.ToInt32(settings.GetValueByKey("minToAnalyse"));
@@ -863,7 +864,7 @@ private Dictionary<int, Type> suggestSystemTypes(string file, TextSeperator deli
863864

864865
List<string> rows = AsciiReader.GetRandowRows(file, total, selection, datastart);
865866

866-
return structureAnalyser.SuggestSystemTypes(rows, delimeter, decimalCharacter, missingValues);
867+
return structureAnalyser.SuggestSystemTypes(rows, textMarker, delimeter, decimalCharacter, missingValues);
867868
}
868869

869870
private string getValueFromMarkedRow(List<string> rows, List<Marker> markers, string type, char delimeter, int position, char textMarker)

Release Notes/Release_Notes.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ Set up if user need to agree the data agreements before download and where the a
2121

2222

2323

24-
25-
2624
# Bugfixes and enhancements
2725
### New features
2826

@@ -38,6 +36,7 @@ Set up if user need to agree the data agreements before download and where the a
3836
- **Entity Template:** Fix Wrong (trash) icon for cancel button in edit mode ([#2228](https://github.com/BEXIS2/Core/issues/2228))
3937
- **Core UI**: UX improvements across the core UI. ([#2223](https://github.com/BEXIS2/Core/issues/2223))
4038
- **Accessibility**: Accessibility improvements for Dataset Creation / Edit / Data Structure flows. ([#2271](https://github.com/BEXIS2/Core/issues/2271))
39+
- **JWT Token**: Add a copy to clipboard button ([#2259](https://github.com/BEXIS2/Core/issues/2259))
4140

4241

4342
### Search
@@ -68,6 +67,11 @@ Set up if user need to agree the data agreements before download and where the a
6867
- **Complex types**: Random reuse of metadata elements with the same name in complex types. ([#2189](https://github.com/BEXIS2/Core/issues/2189))
6968
- **Concept Output**: Multi complex → one complex conversion does not work. ([#2224](https://github.com/BEXIS2/Core/issues/2224))
7069
- **Structure Mapping**: Allow mapping multiple default sources to one target. ([#2227](https://github.com/BEXIS2/Core/issues/2227))
70+
- **Concept mapping**: False outcome when one field is mapped to multiple target fields with default values. ([#2202](https://github.com/BEXIS2/Core/issues/2202))
71+
- **Dataset Details**: Creating links fails with HTTP 500 error. ([#2269](https://github.com/BEXIS2/Core/issues/2269))
72+
- **Set links**: Set links cannot be deleted — fix deletion handling. ([#2272](https://github.com/BEXIS2/Core/issues/2272))
73+
- **Metadata API**: Formats missing in JSON schemas — add missing format entries. ([#2275](https://github.com/BEXIS2/Core/issues/2275))
74+
7175

7276

7377
### Upload & parsing
@@ -81,6 +85,9 @@ Set up if user need to agree the data agreements before download and where the a
8185
- **Data Structure Edit**: Fix Selecting a meaning opens the select template overlay ([#2222](https://github.com/BEXIS2/Core/issues/2222))
8286
- **External Link**: Fix Missing validation and required fields indicator ([#2218](https://github.com/BEXIS2/Core/issues/2218))
8387
- **Manage Meaning**: Fix Crashes when saving empty relation([#2215](https://github.com/BEXIS2/Core/issues/2215))
88+
- **Data Structure From File**: Fix Escaped delimiter not ignored during data structure creation ([#283](https://github.com/BEXIS2/Core/issues/222832835))
8489

8590
### DOI & Citation
8691
- **DOI Overview**: Fix links not working. ([#2261](https://github.com/BEXIS2/Core/issues/2261))
92+
- **Citation API**: Add and add generic creation of citation formats
93+
([#2258](https://github.com/BEXIS2/Core/issues/2258)) ([#2104](https://github.com/BEXIS2/Core/issues/2104))

0 commit comments

Comments
 (0)