Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/rdmp-1 Update Ticketing System #1870

Merged
merged 22 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [8.2.1] - Unreleased

- Add Release status optiosn to the ticketing system

## [8.2.0] - Unreleased

## Changed
Expand Down
2 changes: 1 addition & 1 deletion Rdmp.Core/Curation/Data/EncryptedString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public string Value
}
catch (Exception e)
{
if (e.Message.Contains("Bad Length") || e.Message.Contains("data too large for key size"))
if (e.Message.Contains("Bad Length") || e.Message.Contains("data too large for key size"))
throw new InvalidOperationException(
$"The free text Value supplied to this class was too long to be encrypted (Length of string was {value.Length})",
e);
Expand Down
11 changes: 10 additions & 1 deletion Rdmp.Core/Curation/Data/TicketingSystemConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) The University of Dundee 2018-2019
// Copyright (c) The University of Dundee 2018-2024
// This file is part of the Research Data Management Platform (RDMP).
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Expand Down Expand Up @@ -118,6 +118,14 @@ public TicketingSystemConfiguration(ICatalogueRepository repository, string name
});
}

/// <summary>
/// Fetches a list of acceptable release statuses set for the ticketing system
/// </summary>
public List<TicketingSystemReleaseStatus> GetReleaseStatuses()
{
return [.. Repository.GetAllObjectsWhere<TicketingSystemReleaseStatus>("TicketingSystemConfigurationID", this.ID)];
}

/// <inheritdoc/>
internal TicketingSystemConfiguration(ICatalogueRepository repository, DbDataReader r) : base(repository, r)
{
Expand All @@ -127,4 +135,5 @@ internal TicketingSystemConfiguration(ICatalogueRepository repository, DbDataRea
Name = r["Name"] as string;
DataAccessCredentials_ID = ObjectToNullableInt(r["DataAccessCredentials_ID"]);
}

}
48 changes: 48 additions & 0 deletions Rdmp.Core/Curation/TicketingSystemReleaseStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) The University of Dundee 2024-2024
// This file is part of the Research Data Management Platform (RDMP).
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.

using Rdmp.Core.Curation.Data;
using Rdmp.Core.MapsDirectlyToDatabaseTable;
using Rdmp.Core.Repositories;
using Rdmp.Core.ReusableLibraryCode.Annotations;
using System;
using System.Collections.Generic;
using System.Data.Common;
namespace Rdmp.Core.Curation
{
/// <summary>
/// Stored a status name and which ticketing system it coresponds to
/// </summary>
public class TicketingSystemReleaseStatus : DatabaseEntity
{

private string _status;
private int _ticketingSystemConfiguratonID;

[NotNull]
public string Status { get => _status; set => SetField(ref _status, value); }

[NotNull]
public int TicketingSystemConfigurationID { get => _ticketingSystemConfiguratonID; set => SetField(ref _ticketingSystemConfiguratonID, value); }

public TicketingSystemReleaseStatus() { }

public TicketingSystemReleaseStatus(ICatalogueRepository repository, string status, int? statusID, TicketingSystemConfiguration config) : base()
{
repository.InsertAndHydrate(this, new Dictionary<string, object>
{
{"Status", status},
{"TicketingSystemConfigurationID", config.ID }
});
}

public TicketingSystemReleaseStatus(ICatalogueRepository repository, DbDataReader r) : base(repository, r)
{
Status = r["Status"] as string;
TicketingSystemConfigurationID = int.Parse(r["TicketingSystemConfigurationID"].ToString());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) The University of Dundee 2018-2019
// Copyright (c) The University of Dundee 2018-2024
// This file is part of the Research Data Management Platform (RDMP).
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Expand All @@ -7,6 +7,7 @@
using System;
using System.Linq;
using System.Threading;
using Rdmp.Core.Curation;
using Rdmp.Core.Curation.Data;
using Rdmp.Core.DataExport.Data;
using Rdmp.Core.Repositories;
Expand Down Expand Up @@ -44,7 +45,6 @@ private void MakeAssessment()
var configuration = _repository.CatalogueRepository
.GetAllObjectsWhere<TicketingSystemConfiguration>("IsActive", 1).SingleOrDefault();
if (configuration == null) return;

var factory = new TicketingSystemFactory(_repository.CatalogueRepository);


Expand All @@ -66,7 +66,7 @@ private void MakeAssessment()
try
{
Assesment = ticketingSystem.GetDataReleaseabilityOfTicket(Project.MasterTicket,
Configuration.RequestTicket, Configuration.ReleaseTicket, out var reason, out var e);
Configuration.RequestTicket, Configuration.ReleaseTicket, configuration.GetReleaseStatuses(), out var reason, out var e);
Exception = e;
Reason = reason;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--Version: 8.2.1
--Description: Add lookup table of release status names for a ticketing configuration


if not exists (select 1 from sys.tables where name = 'TicketingSystemReleaseStatus')
BEGIN
CREATE TABLE [dbo].[TicketingSystemReleaseStatus](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Status] [nvarchar](250) NOT NULL,
[TicketingSystemConfigurationID] [int] NOT NULL,
FOREIGN KEY (TicketingSystemConfigurationID) REFERENCES TicketingSystemConfiguration(ID) ON DELETE CASCADE,

CONSTRAINT [PK_TicketingSystemReleaseStatus] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
END
GO
11 changes: 7 additions & 4 deletions Rdmp.Core/Icons/IconProvision/CatalogueIcons.resx
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,10 @@
<data name="LoadMetadataCatalogueLinkage" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\LoadMetadataCatalogueLinkage.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Setting" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\famfamfam\cog.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
<data name="Setting" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\famfamfam\cog.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="TicketingSystemReleaseStatus" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\TicketingSystemReleaseStatus.png;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
3 changes: 2 additions & 1 deletion Rdmp.Core/Icons/IconProvision/RDMPConcept.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,6 @@ public enum RDMPConcept
TableInfoDatabaseNode,
Dataset,
LoadMetadataCatalogueLinkage,
Setting
Setting,
TicketingSystemReleaseStatus
}
Binary file added Rdmp.Core/Icons/TicketingSystemReleaseStatus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Rdmp.Core/Rdmp.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
<None Remove="Databases\CatalogueDatabase\up\082_AddCohortVersioning.sql" />
<None Remove="Databases\CatalogueDatabase\up\083_AddGroupBy.sql" />
<None Remove="Databases\CatalogueDatabase\up\084_AddLoadDirectorySplit.sql" />
<None Remove="Databases\CatalogueDatabase\up\085_AddTicketingReleaseStatuses.sql" />
<None Remove="Databases\DataExportDatabase\runAfterCreateDatabase\CreateDataExportManager.sql" />
<None Remove="Databases\DataExportDatabase\up\001_AddUsernamePasswordFieldsToExternalCohortTable.sql" />
<None Remove="Databases\DataExportDatabase\up\002_FixServerAndDatabaseNameOnExternalCohort.sql" />
Expand Down Expand Up @@ -251,6 +252,7 @@
<EmbeddedResource Include="Databases\CatalogueDatabase\up\077_AddDataSetMapping.sql" />
<EmbeddedResource Include="Databases\CatalogueDatabase\up\078_AddLastLoadTimeToLoadMetadata.sql" />
<EmbeddedResource Include="Databases\CatalogueDatabase\up\084_AddLoadDirectorySplit.sql" />
<EmbeddedResource Include="Databases\CatalogueDatabase\up\085_AddTicketingReleaseStatuses.sql" />
<EmbeddedResource Include="Databases\CatalogueDatabase\up\079_AddProcessTaskConfiguration.sql" />
<EmbeddedResource Include="Databases\CatalogueDatabase\up\082_AddCohortVersioning.sql" />
<EmbeddedResource Include="Databases\CatalogueDatabase\up\083_AddGroupBy.sql" />
Expand Down
7 changes: 6 additions & 1 deletion Rdmp.Core/Ticketing/ITicketingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using Rdmp.Core.Curation;
using Rdmp.Core.ReusableLibraryCode.Checks;

namespace Rdmp.Core.Ticketing;
Expand Down Expand Up @@ -41,13 +43,16 @@ public interface ITicketingSystem : ICheckable
/// <param name="masterTicket"></param>
/// <param name="requestTicket"></param>
/// <param name="releaseTicket"></param>
/// <param name="acceptedStatuses"></param>
/// <param name="reason"></param>
/// <param name="exception"></param>
/// <returns></returns>
TicketingReleaseabilityEvaluation GetDataReleaseabilityOfTicket(string masterTicket, string requestTicket,
string releaseTicket, out string reason, out Exception exception);
string releaseTicket, List<TicketingSystemReleaseStatus> acceptedStatuses,out string reason, out Exception exception);

string GetProjectFolderName(string masterTicket);

List<string> GetAvailableStatuses();
}

public enum TicketingReleaseabilityEvaluation
Expand Down
7 changes: 6 additions & 1 deletion Rdmp.Core/Ticketing/PluginTicketingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using Rdmp.Core.Curation;
using Rdmp.Core.ReusableLibraryCode.Checks;
using Rdmp.Core.ReusableLibraryCode.DataAccess;

Expand All @@ -26,7 +28,10 @@ protected PluginTicketingSystem(TicketingSystemConstructorParameters parameters)
public abstract void NavigateToTicket(string ticketName);

public abstract TicketingReleaseabilityEvaluation GetDataReleaseabilityOfTicket(string masterTicket,
string requestTicket, string releaseTicket, out string reason, out Exception exception);
string requestTicket, string releaseTicket, List<TicketingSystemReleaseStatus> acceptedStatuses,out string reason, out Exception exception);

public abstract string GetProjectFolderName(string masterTicket);

public abstract List<string> GetAvailableStatuses();

}
9 changes: 8 additions & 1 deletion Rdmp.Core/Ticketing/SimpleTicketingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using Rdmp.Core.Curation;
using Rdmp.Core.ReusableLibraryCode;
using Rdmp.Core.ReusableLibraryCode.Checks;
using Rdmp.Core.ReusableLibraryCode.DataAccess;
Expand Down Expand Up @@ -45,7 +47,7 @@ public void NavigateToTicket(string ticketName)
}

public TicketingReleaseabilityEvaluation GetDataReleaseabilityOfTicket(string masterTicket, string requestTicket,
string releaseTicket, out string reason, out Exception exception)
string releaseTicket, List<TicketingSystemReleaseStatus> acceptedStatuses, out string reason, out Exception exception)
{
reason = null;
exception = null;
Expand All @@ -55,4 +57,9 @@ public TicketingReleaseabilityEvaluation GetDataReleaseabilityOfTicket(string ma

public string GetProjectFolderName(string masterTicket) =>
UsefulStuff.RegexThingsThatAreNotNumbersOrLettersOrUnderscores.Replace(masterTicket, "");

public List<string> GetAvailableStatuses()
{
return new List<string>();
}
}
3 changes: 1 addition & 2 deletions Rdmp.Core/Ticketing/TicketingSystemConstructorParameters.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// Copyright (c) The University of Dundee 2018-2019
// Copyright (c) The University of Dundee 2018-2024
// This file is part of the Research Data Management Platform (RDMP).
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.

using Rdmp.Core.ReusableLibraryCode.DataAccess;

namespace Rdmp.Core.Ticketing;

/// <summary>
Expand Down
Loading