Skip to content

Commit

Permalink
PMN-2022.2 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
PopMedNet-Team committed Jun 3, 2022
1 parent 18eb7b9 commit 5ac3710
Show file tree
Hide file tree
Showing 325 changed files with 8,626 additions and 10,513 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ semver.ps1
/Lpp.Dns.Api.Tests/ConnectionStrings.config
Lpp.Dns.Portal/Scripts/PmnGrid/PmnGrid.js
/DMCS/PopMedNet.DMCS/appsettings.Development.json
/Lpp.Dns.Portal/js/_rootlayout.js.map
/PopMedNet.Hangfire.ServerManagement/ConnectionStrings.config
/Tests/PopMedNet.UITests/App.config
/DMCS/PopMedNet.DMCS.Tests/appsettings.json
6 changes: 3 additions & 3 deletions Build/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
[assembly: AssemblyCopyright("Copyright © PopMedNet 2011-2022")]
[assembly: ComVisible(false)]
//Please Also update The Click Once version under Lpp.Dns.DataMartClient Properties > publish > Version Number
[assembly: AssemblyVersion( /*<VERSION>*/ "7.5.0.0" /*</VERSION>*/ )]
[assembly: AssemblyFileVersion( /*<VERSION>*/ "7.5.0.0" /*</VERSION>*/ )]
[assembly: AssemblyInformationalVersion("2022.1")]
[assembly: AssemblyVersion( /*<VERSION>*/ "7.6.0.0" /*</VERSION>*/ )]
[assembly: AssemblyFileVersion( /*<VERSION>*/ "7.6.0.0" /*</VERSION>*/ )]
[assembly: AssemblyInformationalVersion("2022.2")]
6 changes: 3 additions & 3 deletions Build/DataMartClientCommonAssemlbyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
[assembly: AssemblyCopyright("Copyright © PopMedNet 2011-2022")]
[assembly: ComVisible(false)]
//Please Also update The Click Once version under Lpp.Dns.DataMartClient Properties > publish > Version Number
[assembly: AssemblyVersion( /*<VERSION>*/ "7.5.0.0" /*</VERSION>*/ )]
[assembly: AssemblyFileVersion( /*<VERSION>*/ "7.5.0.0" /*</VERSION>*/ )]
[assembly: AssemblyInformationalVersion("2022.1")]
[assembly: AssemblyVersion( /*<VERSION>*/ "7.6.0.0" /*</VERSION>*/ )]
[assembly: AssemblyFileVersion( /*<VERSION>*/ "7.6.0.0" /*</VERSION>*/ )]
[assembly: AssemblyInformationalVersion("2022.2")]
2 changes: 1 addition & 1 deletion Build/Dependencies.targets
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<BootstrapCSS Include="./node_modules/bootstrap/dist/css/*.*" />
<BootstrapFonts Include="./node_modules/bootstrap/fonts/*.*" />
</ItemGroup>
<Target Name="NodeBuild" DependsOnTargets="CompileTypeScript">
<Target Name="NodeBuild">
<Message Text="Executing npm install"></Message>
<Exec Command="npm install" />
<Copy SourceFiles="./node_modules/bootstrap/dist/js/bootstrap.js;./node_modules/bootstrap/dist/js/bootstrap.min.js;" DestinationFolder="./Scripts/bootstrap" />
Expand Down
6 changes: 3 additions & 3 deletions Build/DomainManagerCommonAssemlbyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
[assembly: AssemblyCopyright("Copyright © PopMedNet 2011-2022")]
[assembly: ComVisible(false)]

[assembly: AssemblyVersion( /*<VERSION>*/ "7.5.0.*" /*</VERSION>*/ )]
[assembly: AssemblyVersion( /*<VERSION>*/ "7.6.0.*" /*</VERSION>*/ )]

//Need to keep the file private part equal to 3000 or above for RavenDB as Embedded usage in adapter packages.
[assembly: AssemblyFileVersion( /*<VERSION>*/ "7.5.0.3000" /*</VERSION>*/ )]
[assembly: AssemblyInformationalVersion("2022.1")]
[assembly: AssemblyFileVersion( /*<VERSION>*/ "7.6.0.3000" /*</VERSION>*/ )]
[assembly: AssemblyInformationalVersion("2022.2")]
2 changes: 0 additions & 2 deletions Build/Lpp.Dns.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
<WarningLevel>4</WarningLevel>
<RuntimeCCCheck>False</RuntimeCCCheck>
<RestorePackages>true</RestorePackages>
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void SetAttachments(IEnumerable<Document> attachments)
public void InitializeResponseDocumentsFromCache(Lib.Caching.DocumentCacheManager cache)
{
_cache = cache;
this.documents = (cache.GetResponseDocuments() ?? Array.Empty<Document>()).ToArray();
this.documents = (cache.GetResponseDocuments().Cast<Document>() ?? Array.Empty<Document>()).ToArray();

FileListDataSource = documents;

Expand Down
20 changes: 16 additions & 4 deletions Lpp.Adapters/Lpp.Dns.DataMart.Client/Forms/RequestDetailForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,12 @@ private void btnUploadResults_Click(object sender, EventArgs e)
new ParallelOptions { MaxDegreeOfParallelism = 4 },
(doc) =>
{
string uploadIdentifier = ("[" + Utilities.Crypto.Hash(Guid.NewGuid()) + "]").PadRight(16);
var cacheDocument = doc as Lib.Caching.CacheDocument;
if(cacheDocument != null && !string.IsNullOrEmpty(cacheDocument.UploadedOn))
{
//document has already been uploaded, do not upload again
return;
}
Stream stream;
Expand All @@ -418,7 +423,7 @@ private void btnUploadResults_Click(object sender, EventArgs e)
var beforeMath = 25 / responseDocuments.Length;
progressPercentage = Math.Ceiling(progressPercentage + beforeMath);
//TODO: use the calculated percentage
uploadWorker.ReportProgress(0);
var dto = new DTO.DataMartClient.Criteria.DocumentMetadata
Expand All @@ -434,13 +439,20 @@ private void btnUploadResults_Click(object sender, EventArgs e)
CurrentChunkIndex = 0
};
string uploadIdentifier = ("[" + Utilities.Crypto.Hash(Guid.NewGuid()) + "]").PadRight(16);
DnsServiceManager.PostDocumentChunk(uploadIdentifier, dto, stream, netWorkSetting);
double afterMath = 75 / responseDocuments.Length;
progressPercentage = Math.Ceiling(progressPercentage + afterMath);
//TODO: use the calculated percentage
uploadWorker.ReportProgress(0);
if(cacheDocument != null)
{
Cache.MarkUploaded(cacheDocument);
}
});
Expand Down
48 changes: 48 additions & 0 deletions Lpp.Adapters/Lpp.Dns.DataMart.Client/Lib/Caching/CacheDocument.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace Lpp.Dns.DataMart.Client.Lib.Caching
{
[DataContract, Serializable]
public class CacheDocument : Model.Document
{
internal CacheDocument() : base(string.Empty, string.Empty, string.Empty)
{

}

public CacheDocument(string documentID, string mimeType, string filename) : base(documentID, mimeType, filename)
{

}

public CacheDocument(Guid documentID, string mimeType, string filename, bool isViewable, int size, string kind) : base(documentID, mimeType, filename, isViewable, size, kind)
{

}

public Guid ID
{
get
{
return Guid.Parse(DocumentID);
}
}

[DataMember]
public string UploadedOn
{
get;set;
}

internal static CacheDocument FromDocument(Model.Document document)
{
return new CacheDocument(Guid.Parse(document.DocumentID), document.MimeType, document.Filename, document.IsViewable, document.Size, document.Kind);
}

}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Security.Cryptography;
using Lpp.Dns.DataMart.Model;
Expand Down Expand Up @@ -89,15 +87,15 @@ public bool CanClearRequestSpecificCache
}
}

public IEnumerable<Document> GetResponseDocuments()
public IEnumerable<CacheDocument> GetResponseDocuments()
{
if (Enabled == false)
{
return Array.Empty<Document>();
return Array.Empty<CacheDocument>();
}

var files = Directory.GetFiles(BaseCachePath, "*.meta");
List<Document> documents = new List<Document>(files.Length * 2);
List<CacheDocument> documents = new List<CacheDocument>(files.Length * 2);

foreach (var path in files)
{
Expand All @@ -109,9 +107,9 @@ public IEnumerable<Document> GetResponseDocuments()
using (var json = new Newtonsoft.Json.JsonTextReader(reader))
{
var serializer = new Newtonsoft.Json.JsonSerializer();
serializer.Converters.Add(new DocumentCreationConverter());
serializer.Converters.Add(new CacheDocumentCreationConverter());

var doc = serializer.Deserialize<Document>(json);
var doc = serializer.Deserialize<CacheDocument>(json);
documents.Add(doc);
}
}
Expand Down Expand Up @@ -155,7 +153,7 @@ public void Add(IEnumerable<DocumentWithStream> documents)
using (var json = new Newtonsoft.Json.JsonTextWriter(writer))
{
var serializer = new Newtonsoft.Json.JsonSerializer();
serializer.Serialize(json, document.Document);
serializer.Serialize(json, CacheDocument.FromDocument(document.Document));
json.Flush();
}

Expand All @@ -169,6 +167,27 @@ public void Add(IEnumerable<DocumentWithStream> documents)
}
}

/// <summary>
/// Updates the serialized document metadata to include an uploaded on timestamp.
/// The timestamp is set as Utc now.
/// </summary>
/// <param name="document"></param>
public void MarkUploaded(CacheDocument document)
{
document.UploadedOn = DateTime.UtcNow.ToString("s");

string metaDataPath = Path.Combine(BaseCachePath, document.ID.ToString("D") + (Configuration.EncryptCacheItems ? ".e" : "") + ".meta");

using (var fileStream = File.OpenWrite(metaDataPath))
using (StreamWriter writer = Configuration.EncryptCacheItems ? new StreamWriter(CreateEncryptionStream(fileStream)) : new StreamWriter(fileStream))
using (var json = new Newtonsoft.Json.JsonTextWriter(writer))
{
var serializer = new Newtonsoft.Json.JsonSerializer();
serializer.Serialize(json, document);
json.Flush();
}
}

public void ClearCache()
{
foreach(var file in Directory.GetFiles(BaseCachePath))
Expand Down Expand Up @@ -243,16 +262,16 @@ static byte[] ReadByteArray(Stream s)

}

public class DocumentCreationConverter : Newtonsoft.Json.Converters.CustomCreationConverter<Document>
internal class CacheDocumentCreationConverter : Newtonsoft.Json.Converters.CustomCreationConverter<CacheDocument>
{
public override Document Create(Type objectType)
public override CacheDocument Create(Type objectType)
{
return new Document("", "", "");
return new CacheDocument();
}

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
var document = new Document("", "", "");
var document = new CacheDocument();
while (reader.Read())
{
if(reader.TokenType == JsonToken.PropertyName && (reader.Value.ToStringEx() == "DocumentID"))
Expand Down Expand Up @@ -285,6 +304,11 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
reader.Read();
document.Kind = reader.Value.ToStringEx();
}
else if (reader.TokenType == JsonToken.PropertyName && (reader.Value.ToStringEx() == "UploadedOn"))
{
reader.Read();
document.UploadedOn = reader.Value.ToStringEx();
}
}

return document;
Expand Down
4 changes: 2 additions & 2 deletions Lpp.Adapters/Lpp.Dns.DataMart.Client/Lib/DnsApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public async Task PostResponseDocumentChunk(Guid documentID, IEnumerable<byte> d
public async Task PostDocumentChunk(Lpp.Dns.DTO.DataMartClient.Criteria.DocumentMetadata doc, byte[] data)
{
string identifier;
_log.Debug(ExecutingMessage("PostResponseDocumentChunk?documentID=" + doc.ID.ToString("D"), out identifier));
_log.Debug(ExecutingMessage("PostDocumentChunk", out identifier));
using (var content = new MultipartFormDataContent())
{
var docContent = JsonConvert.SerializeObject(doc, HttpClientHelpers.SerializerSettings());
Expand All @@ -210,7 +210,7 @@ public async Task PostDocumentChunk(Lpp.Dns.DTO.DataMartClient.Criteria.Document
if (!result.IsSuccessStatusCode)
{
var errorMsg = await result.GetMessage();
_log.Error(CompletionMessage(identifier, "PostResponseDocumentChunk?documentID=" + doc.ID.ToString("D"), false) + ".\r\n" + errorMsg);
_log.Error(CompletionMessage(identifier, "PostDocumentChunk", false) + ".\r\n" + errorMsg);

throw new Exception("An error occured during upload of document data: " + errorMsg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
<Compile Include="Forms\ViewSQL.Designer.cs">
<DependentUpon>ViewSQL.cs</DependentUpon>
</Compile>
<Compile Include="Lib\Caching\CacheDocument.cs" />
<Compile Include="Lib\Caching\CacheRetentionService.cs" />
<Compile Include="Lib\Configuration\DataMartDescription.cs" />
<Compile Include="Lib\Configuration\ModelDescription.cs" />
Expand Down Expand Up @@ -544,22 +545,22 @@
<ItemGroup>
<PublishFile Include="System.Net.Http">
<Visible>False</Visible>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
<PublishFile Include="System.Net.Http.Primitives">
<Visible>False</Visible>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Include</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
</ItemGroup>
Expand Down

0 comments on commit 5ac3710

Please sign in to comment.