Skip to content

Commit

Permalink
Merge pull request #1296 from BEXIS2/rc
Browse files Browse the repository at this point in the history
Rc
  • Loading branch information
DavidBlaa authored Sep 6, 2023
2 parents 2505271 + 4d9eadf commit dba2039
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 74 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
);
}

}

Expand Down Expand Up @@ -205,6 +236,7 @@ public void uploadFiles(IEnumerable<HttpPostedFileBase> 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;
Expand All @@ -213,8 +245,6 @@ public void uploadFiles(IEnumerable<HttpPostedFileBase> attachments, long datase
{
DatasetVersion datasetVersion = dm.GetDatasetWorkingCopy(datasetId);



//set StateInfo of the previus version
if (datasetVersion.StateInfo == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Console/BExIS.Web.Shell/General.Settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
<!-- landing page for users , when they logged in successfuly -->
<entry key="faq" value="https://github.com/BEXIS2/Core/wiki/FAQ" type="string" />

<entry key="version" value="2.18" type="string" />
<entry key="version" value="2.18.1" type="string" />
</settings>
2 changes: 1 addition & 1 deletion Console/BExIS.Web.Shell/Web.config.sample
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<add key="UseSchemaInDatabaseGeneration" value="False" />
<add key="ThrowErrorWhenParialContentNotFound" value="False" />
<add key="ApplicationName" value="{APPLICATIONNAME}" />
<add key="ApplicationVersion" value="2.18" />
<add key="ApplicationVersion" value="2.18.1" />
<add key="SessionWarningDelaySecond" value="30" />
<!-- Keep it as false, there are some test data in the database-->
<add key="CreateDatabase" value="false" />
Expand Down
2 changes: 1 addition & 1 deletion Console/Workspace
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -103,7 +104,12 @@ public Dictionary<string, string> 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:
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
37 changes: 9 additions & 28 deletions Release Notes/Release_Notes.md
Original file line number Diff line number Diff line change
@@ -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 <br>
>*api/{name}/{id}/{version}* <br>
>*api/{name}/{id}/version_number/{version_number}*<br>
>*api/{name}/{id}/version_name/{version_name}*<br>
**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)



Expand Down
12 changes: 10 additions & 2 deletions database update scripts/Update_Script_217to218.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions database update scripts/Update_Script_218to2.18.1.sql
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit dba2039

Please sign in to comment.