diff --git a/Console/BExIS.Web.Shell/Areas/DCM/Controllers/AttachmentsController.cs b/Console/BExIS.Web.Shell/Areas/DCM/Controllers/AttachmentsController.cs index 5811905c0b..19c2e85cd7 100644 --- a/Console/BExIS.Web.Shell/Areas/DCM/Controllers/AttachmentsController.cs +++ b/Console/BExIS.Web.Shell/Areas/DCM/Controllers/AttachmentsController.cs @@ -67,29 +67,60 @@ public ActionResult Delete(long datasetId, String fileName) var filePath = Path.Combine(AppConfiguration.DataPath, "Datasets", datasetId.ToString(), "Attachments", fileName); FileHelper.Delete(filePath); var dataset = dm.GetDataset(datasetId); - var datasetVersion = dm.GetDatasetLatestVersion(dataset); - var contentDescriptor = datasetVersion.ContentDescriptors.FirstOrDefault(item => item.Name == fileName); - if (contentDescriptor == null) - throw new Exception("There is not any content descriptor having file name '" + fileName + "'. "); - datasetVersion.ContentDescriptors.Remove(contentDescriptor); + // get status of the latest version + DatasetVersion latestVersion = dm.GetDatasetLatestVersion(datasetId); + string status = DatasetStateInfo.NotValid.ToString(); + if (latestVersion.StateInfo != null) status = latestVersion.StateInfo.State; - datasetVersion.ModificationInfo = new EntityAuditInfo() + if (dm.IsDatasetCheckedOutFor(datasetId, GetUsernameOrDefault()) || dm.CheckOutDataset(datasetId, GetUsernameOrDefault())) { - Performer = GetUsernameOrDefault(), - Comment = "Attachment", - ActionType = AuditActionType.Delete - }; + DatasetVersion datasetVersion = dm.GetDatasetWorkingCopy(datasetId); + + //set StateInfo of the previus version + if (datasetVersion.StateInfo == null) + { + datasetVersion.StateInfo = new Vaiona.Entities.Common.EntityStateInfo() + { + State = status + }; + } + else + { + datasetVersion.StateInfo.State = status; + } + + var contentDescriptor = datasetVersion.ContentDescriptors.FirstOrDefault(item => item.Name == fileName); + if (contentDescriptor == null) + throw new Exception("There is not any content descriptor having file name '" + fileName + "'. "); + + datasetVersion.ContentDescriptors.Remove(contentDescriptor); - dm.EditDatasetVersion(datasetVersion, null, null, null); - dm.CheckInDataset(dataset.Id, fileName, GetUsernameOrDefault(), ViewCreationBehavior.None); + datasetVersion.ModificationInfo = new EntityAuditInfo() + { + Performer = GetUsernameOrDefault(), + Comment = "Attachment", + ActionType = AuditActionType.Delete + }; - var es = new EmailService(); + // update metadata + int v = 1; + if (datasetVersion.Dataset.Versions != null && datasetVersion.Dataset.Versions.Count > 1) v = datasetVersion.Dataset.Versions.Count(); + datasetVersion.Metadata = setSystemValuesToMetadata(datasetId, v, datasetVersion.Dataset.MetadataStructure.Id, datasetVersion.Metadata, false); - es.Send(MessageHelper.GetAttachmentDeleteHeader(datasetId, typeof(Dataset).Name), - MessageHelper.GetAttachmentDeleteMessage(datasetId, fileName, GetUsernameOrDefault()), - ConfigurationManager.AppSettings["SystemEmail"] - ); + + + dm.EditDatasetVersion(datasetVersion, null, null, null); + dm.CheckInDataset(dataset.Id, fileName, GetUsernameOrDefault(), ViewCreationBehavior.None); + + + var es = new EmailService(); + + es.Send(MessageHelper.GetAttachmentDeleteHeader(datasetId, typeof(Dataset).Name), + MessageHelper.GetAttachmentDeleteMessage(datasetId, fileName, GetUsernameOrDefault()), + ConfigurationManager.AppSettings["SystemEmail"] + ); + } } @@ -205,6 +236,7 @@ public void uploadFiles(IEnumerable attachments, long datase var dataset = dm.GetDataset(datasetId); // var datasetVersion = dm.GetDatasetLatestVersion(dataset); + // get status of the latest version DatasetVersion latestVersion = dm.GetDatasetLatestVersion(datasetId); string status = DatasetStateInfo.NotValid.ToString(); if (latestVersion.StateInfo != null) status = latestVersion.StateInfo.State; @@ -213,8 +245,6 @@ public void uploadFiles(IEnumerable attachments, long datase { DatasetVersion datasetVersion = dm.GetDatasetWorkingCopy(datasetId); - - //set StateInfo of the previus version if (datasetVersion.StateInfo == null) { diff --git a/Console/BExIS.Web.Shell/Areas/DDM/Controllers/DataController.cs b/Console/BExIS.Web.Shell/Areas/DDM/Controllers/DataController.cs index fee287681f..a99c029fff 100644 --- a/Console/BExIS.Web.Shell/Areas/DDM/Controllers/DataController.cs +++ b/Console/BExIS.Web.Shell/Areas/DDM/Controllers/DataController.cs @@ -1739,11 +1739,11 @@ private string getVersionInfo(DatasetVersion d) // attachment else if (d.ModificationInfo.Comment.Equals("Attachment") && d.ModificationInfo.ActionType == Vaiona.Entities.Common.AuditActionType.Create) { - sb.Append(String.Format("Attachtment uploaded: {0} ({1}{2})", Truncate(d.ChangeDescription, 30), createEditedBy(d.ModificationInfo.Performer), d.Timestamp.ToString("dd.MM.yyyy"))); + sb.Append(String.Format("Attachment uploaded: {0} ({1}{2})", Truncate(d.ChangeDescription, 30), createEditedBy(d.ModificationInfo.Performer), d.Timestamp.ToString("dd.MM.yyyy"))); } else if (d.ModificationInfo.Comment.Equals("Attachment") && d.ModificationInfo.ActionType == Vaiona.Entities.Common.AuditActionType.Delete) { - sb.Append(String.Format("Attachtment deleted: {0} ({1}{2})", Truncate(d.ChangeDescription, 30), createEditedBy(d.ModificationInfo.Performer), d.Timestamp.ToString("dd.MM.yyyy"))); + sb.Append(String.Format("Attachment deleted: {0} ({1}{2})", Truncate(d.ChangeDescription, 30), createEditedBy(d.ModificationInfo.Performer), d.Timestamp.ToString("dd.MM.yyyy"))); } else { diff --git a/Console/BExIS.Web.Shell/Areas/DIM/Helpers/DimSeedDataGenerator.cs b/Console/BExIS.Web.Shell/Areas/DIM/Helpers/DimSeedDataGenerator.cs index e8865364a9..e980a5eace 100644 --- a/Console/BExIS.Web.Shell/Areas/DIM/Helpers/DimSeedDataGenerator.cs +++ b/Console/BExIS.Web.Shell/Areas/DIM/Helpers/DimSeedDataGenerator.cs @@ -219,7 +219,7 @@ private void createDOIMappingConcept() creators = conceptManager.CreateMappingKey("Creators", "", "www.google.de",false,true, "data/attributes/creators", concept); if (!keys.Any(k => k.XPath.Equals("data/attributes/creators/name"))) - conceptManager.CreateMappingKey("FullName", "", "", false, false, "data/attributes/creators/name", concept, creators); + conceptManager.CreateMappingKey("Name", "", "", false, false, "data/attributes/creators/name", concept, creators); if (!keys.Any(k => k.XPath.Equals("data/attributes/creators/givenName"))) conceptManager.CreateMappingKey("GivenName", "", "", false, false, "data/attributes/creators/givenName", concept,creators); diff --git a/Console/BExIS.Web.Shell/Areas/RPM/Models/DataStructureEditModel.cs b/Console/BExIS.Web.Shell/Areas/RPM/Models/DataStructureEditModel.cs index fbf9defbfe..4f54d26fb6 100644 --- a/Console/BExIS.Web.Shell/Areas/RPM/Models/DataStructureEditModel.cs +++ b/Console/BExIS.Web.Shell/Areas/RPM/Models/DataStructureEditModel.cs @@ -581,22 +581,12 @@ public DataStructurePreviewModel fill(long dataStructureId) datasetManager = new DatasetManager(); foreach (Dataset d in dataStructure.Datasets) { + if (datasetManager.RowAny(d.Id)) { this.inUse = true; break; } - else - { - foreach (DatasetVersion dv in d.Versions) - { - if (datasetManager.GetDatasetVersionEffectiveTuples(dv).Any()) - { - this.inUse = true; - break; - } - } - } } } finally diff --git a/Console/BExIS.Web.Shell/General.Settings.xml b/Console/BExIS.Web.Shell/General.Settings.xml index 962e9c6313..29fa230ebf 100644 --- a/Console/BExIS.Web.Shell/General.Settings.xml +++ b/Console/BExIS.Web.Shell/General.Settings.xml @@ -14,5 +14,5 @@ - + \ No newline at end of file diff --git a/Console/BExIS.Web.Shell/Web.config.sample b/Console/BExIS.Web.Shell/Web.config.sample index c2965b132b..97473e618a 100644 --- a/Console/BExIS.Web.Shell/Web.config.sample +++ b/Console/BExIS.Web.Shell/Web.config.sample @@ -22,7 +22,7 @@ - + diff --git a/Console/Workspace b/Console/Workspace index c77ef02975..c3f52beafe 160000 --- a/Console/Workspace +++ b/Console/Workspace @@ -1 +1 @@ -Subproject commit c77ef02975f78d5857b00dae6a1f0044bd66c08c +Subproject commit c3f52beafe72de78986db41462d0f23420fd1fb4 diff --git a/Modules/DIM/BExIS.Dim.Helper/DataCiteDOI/DataCiteDoiHelper.cs b/Modules/DIM/BExIS.Dim.Helper/DataCiteDOI/DataCiteDoiHelper.cs index 5b305dc677..414c6a6a5e 100644 --- a/Modules/DIM/BExIS.Dim.Helper/DataCiteDOI/DataCiteDoiHelper.cs +++ b/Modules/DIM/BExIS.Dim.Helper/DataCiteDOI/DataCiteDoiHelper.cs @@ -23,6 +23,7 @@ using System.Security.Policy; using Vaelastrasz.Library.Models; using System.Runtime.CompilerServices; +using BExIS.Dlm.Services.Data; namespace BExIS.Dim.Helpers { @@ -103,7 +104,12 @@ public Dictionary CreatePlaceholders(DatasetVersion datasetVersi case "VersionNumber": - _placeholders.Add("{VersionNumber}", Convert.ToString(datasetVersion.VersionNo)); + using (var datasetManager = new DatasetManager()) + { + var versionNumber = datasetManager.GetDatasetVersionNr(datasetVersion); + _placeholders.Add("{VersionNumber}", Convert.ToString(versionNumber)); + + } break; default: diff --git a/README.md b/README.md index ad0112dbf1..fb0b5ab524 100644 --- a/README.md +++ b/README.md @@ -8,23 +8,23 @@ BEXIS 2 is published under a GNU LESSER GENERAL PUBLIC LICENSE Version 3 > In the release notes you can find a list of all the current versions. -[RELEASE NOTES](https://github.com/BEXIS2/Core/blob/2.18/Release%20Notes/Release_Notes.md) +[RELEASE NOTES](https://github.com/BEXIS2/Core/blob/2.18.1/Release%20Notes/Release_Notes.md) > A more detailed list of the changes is available for the co-developers. It mentions the changed libraries and important feature changes. -[CHANGES](https://github.com/BEXIS2/Core/blob/2.18/Release%20Notes/changes.md) +[CHANGES](https://github.com/BEXIS2/Core/blob/2.18.1/Release%20Notes/changes.md) >if a running instance is updated, an update to the database is required. - STEP BY STEP -[UPDATE SCRIPTS](https://github.com/BEXIS2/Core/blob/2.18/database%20update%20scripts) +[UPDATE SCRIPTS](https://github.com/BEXIS2/Core/blob/2.18.1/database%20update%20scripts) # Installation For the preparation of Bexis 2 on a server a guide is available here. -[Installation Manual](https://github.com/BEXIS2/Documents/blob/2.18/Guides/Installation/installation.md) +[Installation Manual](https://github.com/BEXIS2/Documents/blob/2.18.1/Guides/Installation/installation.md) # Help for Users/Admins/Developers @@ -46,9 +46,9 @@ The page is divided into: The initial version of the workspace can be found here: -- [Workspace 2.18 Repo](https://github.com/BEXIS2/Workspace/tree/2.18) -- [Workspace 2.18 Release](https://github.com/BEXIS2/Workspace/releases/tag/2.18) +- [Workspace 2.18.1 Repo](https://github.com/BEXIS2/Workspace/tree/2.18.1) +- [Workspace 2.18.1 Release](https://github.com/BEXIS2/Workspace/releases/tag/2.18.1) # List of new Modules -- [Modules Overview](https://github.com/BEXIS2/Core/blob/2.18/MODULES.md) +- [Modules Overview](https://github.com/BEXIS2/Core/blob/2.18.1/MODULES.md) diff --git a/Release Notes/Release_Notes.md b/Release Notes/Release_Notes.md index cca6cc98c8..74a1dec221 100644 --- a/Release Notes/Release_Notes.md +++ b/Release Notes/Release_Notes.md @@ -1,33 +1,14 @@ # BEXIS 2.18 Release Notes ->**Database update**: [Update_Script_217to218.sql](https://github.com/BEXIS2/Core/blob/rc/database%20update%20scripts/Update_Script_217to218.sql) - ->**API changes**: Attention the api calls for **metadata**, **data** and **dataset** have been extended and changed with regard to versions. ->in general, the calls work according to the following pattern
->*api/{name}/{id}/{version}*
->*api/{name}/{id}/version_number/{version_number}*
->*api/{name}/{id}/version_name/{version_name}*
- -**Workspace changes:** [2.17.1...2.18](https://github.com/BEXIS2/Workspace/compare/2.17.1...2.18) - -### Features -- Deleted Datasets: Adjust info text, add reason and allow metadata view (https://github.com/BEXIS2/Core/issues/1099) -- Version API: Add (https://github.com/BEXIS2/Core/issues/1028) -- Export a single dataset to darwin core archive format (v1) (https://github.com/BEXIS2/Core/issues/917) - [how to setup?](https://github.com/BEXIS2/Documents/blob/master/Manuals/DIM/Manual.md#3-gbif) - -### Enhancements -- Metadata API: Unify API calls and add version number and name (https://github.com/BEXIS2/Core/issues/1101) -- Metadata API: Update to get values in the structure of the concept (https://github.com/BEXIS2/Core/issues/1093) -- Search: Order items column-wise instead of row-wise when clicking on "more" in the facets (https://github.com/BEXIS2/Core/issues/1089) -- Darwin Core: Create Concept for DWC Metadata needed Attributes (https://github.com/BEXIS2/Core/issues/1092) - +>**Database update**: [Update_Script_218to2181.sql](https://github.com/BEXIS2/Core/blob/rc/database%20update%20scripts/Update_Script_218to2.18.1.sql) + + + +**Workspace changes:** [2.18...2.18.1](https://github.com/BEXIS2/Workspace/compare/2.18...2.18.1) + ### Bugs -- Fix Requests are sent to old owner after change (https://github.com/BEXIS2/Core/issues/1108) -- Fix Metadata Edit: xsd element type "xs:boolean" always disabled (https://github.com/BEXIS2/Core/issues/1106) -- Fix Download data: Fails with filter if special characters in dataset title (https://github.com/BEXIS2/Core/issues/1105) -- Fix Tabular primary data display problem "Displaying items 0 - 0 of 0" (https://github.com/BEXIS2/Core/issues/1116) -- Fix Leading empty line inside each metadata input field (https://github.com/BEXIS2/Core/issues/1117) -- Darwin Core archive: Add documentation to dim manual enhancement (https://github.com/BEXIS2/Core/issues/1104) -- Code cleanup: Remove duplicate folder & consolidation of hamdi1992/core:master and bexis2/core:rc (https://github.com/BEXIS2/Core/issues/1107) (https://github.com/BEXIS2/Core/issues/1066) +- Fix hangs when loading data structures linked to datasets that have been deleted (https://github.com/BEXIS2/Core/issues/1222) +- Fix Attachment Typos (https://github.com/BEXIS2/Core/issues/1194) +- Fix Delete Attachment: system key not triggered & dataset version overwritten (https://github.com/BEXIS2/Core/issues/1179) diff --git a/database update scripts/Update_Script_217to218.sql b/database update scripts/Update_Script_217to218.sql index 71d8f7d208..7d986ad22d 100644 --- a/database update scripts/Update_Script_217to218.sql +++ b/database update scripts/Update_Script_217to218.sql @@ -688,12 +688,20 @@ WHERE NOT EXISTS (SELECT * FROM public.mappingkeys WHERE name='surName' and pare -- END GBIF - +-- add gbif broker and datarepo +INSERT INTO public.dim_brokers( + versionno, name, primarydataformat, link) + Select 1, 'GBIF', 'text/csv','https://www.gbif.org/' + WHERE NOT EXISTS (Select id from public.dim_brokers where name='GBIF' ) + +INSERT INTO public.dim_repositories( + versionno,name, url, brokerref) + Select 1,'GBIF','https://www.gbif.org/', (Select id from public.dim_brokers where name='GBIF' ) + WHERE NOT EXISTS (Select id from public.dim_repositories where name='GBIF' AND brokerref = (Select id from public.dim_brokers where name='GBIF' ) ) -- END insert DATA - -- Insert version INSERT INTO public.versions( versionno, extra, module, value, date) diff --git a/database update scripts/Update_Script_218to2.18.1.sql b/database update scripts/Update_Script_218to2.18.1.sql new file mode 100644 index 0000000000..b294c36f1e --- /dev/null +++ b/database update scripts/Update_Script_218to2.18.1.sql @@ -0,0 +1,9 @@ +BEGIN TRANSACTION; + +-- ROLLBACK TRANSACTION; +-- Insert version +INSERT INTO public.versions( + versionno, extra, module, value, date) + VALUES (1, null, 'Shell', '2.18.1',NOW()); + +COMMIT;