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

Eclipse Licence adjustments #330

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Use a multi-stage build to build and publish the .NET application
# Specify the initial base architecture (amd64 in this case)
FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /repo/src

# Copy everything else and build
COPY ./src/ /repo/src/
COPY ./LICENSE.TXT /repo/LICENSE.txt

RUN dotnet clean
RUN dotnet restore
RUN dotnet build -o /out/AasxServerBlazor AasxServerBlazor -v diag
RUN dotnet publish -c Release -v diag --no-restore

# Use a runtime image to run the application
# Specify the initial base architecture (amd64 in this case)
FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/aspnet:8.0 as base
RUN apt update && apt upgrade --yes
RUN apt install -y curl nano libgdiplus
EXPOSE 5001
COPY --from=build-env /out/AasxServerBlazor/ /AasxServerBlazor/
COPY ./content-for-demo/ /AasxServerBlazor/
WORKDIR /AasxServerBlazor
ENTRYPOINT ["/bin/bash", "-c", "./startForDemo.sh"]
8 changes: 6 additions & 2 deletions src/AasSecurity/AasSecurity.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="2.1.2" />
</ItemGroup>

<ItemGroup>
<Using Include="AasCore.Aas3_0"/>
<Using Include="AasCore.Aas3_0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AasxServerStandardBib\AasxServerStandardBib.csproj"/>
<ProjectReference Include="..\AasxServerStandardBib\AasxServerStandardBib.csproj" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions src/AasxServerAspNetCore/AasxServerAspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HotChocolate.AspNetCore" Version="13.9.6" />
<PackageReference Include="HotChocolate.AspNetCore" Version="13.9.7" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\IO.Swagger.Lib.V3\IO.Swagger.Lib.V3.csproj"/>
<ProjectReference Include="..\IO.Swagger.Registry.Lib.V3\IO.Swagger.Registry.Lib.V3.csproj"/>
<ProjectReference Include="..\IO.Swagger.Lib.V3\IO.Swagger.Lib.V3.csproj" />
<ProjectReference Include="..\IO.Swagger.Registry.Lib.V3\IO.Swagger.Registry.Lib.V3.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
42 changes: 21 additions & 21 deletions src/AasxServerBlazor/AasxServerBlazor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
</PropertyGroup>

<ItemGroup>
<Using Include="AasCore.Aas3_0"/>
<Using Include="AasCore.Aas3_0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="HotChocolate.AspNetCore" Version="13.9.6" />
<PackageReference Include="HotChocolate.AspNetCore" Version="13.9.7" />
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0"/>
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -35,17 +35,17 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AasSecurity\AasSecurity.csproj"/>
<ProjectReference Include="..\AasxServerStandardBib\AasxServerStandardBib.csproj"/>
<ProjectReference Include="..\es6numberserializer\es6numberserializer.csproj"/>
<ProjectReference Include="..\IO.Swagger.Lib.V3\IO.Swagger.Lib.V3.csproj"/>
<ProjectReference Include="..\IO.Swagger.Registry.Lib.V3\IO.Swagger.Registry.Lib.V3.csproj"/>
<ProjectReference Include="..\jsoncanonicalizer\jsoncanonicalizer.csproj"/>
<ProjectReference Include="..\AasSecurity\AasSecurity.csproj" />
<ProjectReference Include="..\AasxServerStandardBib\AasxServerStandardBib.csproj" />
<ProjectReference Include="..\es6numberserializer\es6numberserializer.csproj" />
<ProjectReference Include="..\IO.Swagger.Lib.V3\IO.Swagger.Lib.V3.csproj" />
<ProjectReference Include="..\IO.Swagger.Registry.Lib.V3\IO.Swagger.Registry.Lib.V3.csproj" />
<ProjectReference Include="..\jsoncanonicalizer\jsoncanonicalizer.csproj" />
</ItemGroup>

<ProjectExtensions>
<VisualStudio>
<UserProperties appsettings_1json__JsonSchema="Url&quot;"/>
<UserProperties appsettings_1json__JsonSchema="Url&quot;" />
</VisualStudio>
</ProjectExtensions>

Expand All @@ -66,20 +66,20 @@
</ItemGroup>

<ItemGroup>
<Content Remove="wwwroot\2022-02-15_IDTA_AAS-Logo_Final_RGB.png"/>
<Content Remove="wwwroot\Cable2.jpg"/>
<Content Remove="wwwroot\db-schema.jpg"/>
<Content Remove="wwwroot\ex.png"/>
<Content Remove="wwwroot\Ex_IECEx.jpg"/>
<Content Remove="wwwroot\Logo_IDTA.jpg"/>
<Content Remove="wwwroot\NOA.jpg"/>
<Content Remove="wwwroot\sm_icons\bom.svg"/>
<Content Remove="wwwroot\sm_icons\pcf v1.0.svg"/>
<Content Remove="wwwroot\2022-02-15_IDTA_AAS-Logo_Final_RGB.png" />
<Content Remove="wwwroot\Cable2.jpg" />
<Content Remove="wwwroot\db-schema.jpg" />
<Content Remove="wwwroot\ex.png" />
<Content Remove="wwwroot\Ex_IECEx.jpg" />
<Content Remove="wwwroot\Logo_IDTA.jpg" />
<Content Remove="wwwroot\NOA.jpg" />
<Content Remove="wwwroot\sm_icons\bom.svg" />
<Content Remove="wwwroot\sm_icons\pcf v1.0.svg" />
</ItemGroup>

<ItemGroup>
<Folder Include="temp\"/>
<Folder Include="wwwroot\images\scottplot\"/>
<Folder Include="temp\" />
<Folder Include="wwwroot\images\scottplot\" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/AasxServerBlazor/Configuration/ServerConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using AasSecurity;
Expand Down Expand Up @@ -233,7 +233,8 @@ private static void AddSwaggerGen(IServiceCollection services) =>
});

swaggerGenOptions.EnableAnnotations();
swaggerGenOptions.CustomSchemaIds(type => type.FullName);
//Based on issue https://github.com/swagger-api/swagger-ui/issues/7911
swaggerGenOptions.CustomSchemaIds(type => type.FullName?.Replace("+", "."));

var swaggerCommentedAssembly =
typeof(AssetAdministrationShellRepositoryAPIApiController).Assembly.GetName().Name;
Expand Down
2 changes: 1 addition & 1 deletion src/AasxServerBlazor/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"AasxServerBlazor": {
"commandName": "Project",
"commandLineArgs": "--with-db --start-index 1000 --save-temp 30 --no-security --secret-string-api 1234 --aasx-in-memory 1000 --data-path \"C:\\Development\\aasxs-repository\" --edit --external-blazor http://localhost:5001",
"commandLineArgs": "--with-db --start-index 100000 --save-temp 30 --no-security --secret-string-api 1234 --aasx-in-memory 1000 --data-path \"C:\\Development\\DB\" --edit --external-blazor http://localhost:5001",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
Expand Down
86 changes: 63 additions & 23 deletions src/AasxServerDB/Query.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Collections.Generic;
using System.Runtime.Intrinsics.X86;
using AasxServerDB.Entities;
using AasxServerDB.Result;
using Extensions;
Expand Down Expand Up @@ -68,14 +70,35 @@ public int CountSMEs(
string smSemanticId = "", string smIdentifier = "", string semanticId = "", string diff = "",
string contains = "", string equal = "", string lower = "", string upper = "")
{
var withSemanticID = !semanticId.IsNullOrEmpty();
var withDiff = diff != "";
var diffDT = TimeStamp.TimeStamp.StringToDateTime(diff);

var watch = System.Diagnostics.Stopwatch.StartNew();
Console.WriteLine();
Console.WriteLine("CountSMEs");
Console.WriteLine("Total number of SMEs " + new AasContext().SMESets.Count() + " in " + watch.ElapsedMilliseconds + "ms");

watch.Restart();
var smeWithValue = GetSMEWithValue(smSemanticId, smIdentifier, semanticId, diff, contains, equal, lower, upper);
var count = smeWithValue.Count;

var count = 0;
if ((withSemanticID || withDiff)
&& contains.IsNullOrEmpty() && equal.IsNullOrEmpty() && lower.IsNullOrEmpty() && upper.IsNullOrEmpty())
{
using AasContext db = new();
count = db.SMESets
.Where(sme =>
(!withSemanticID || (sme.SemanticId != null && sme.SemanticId == semanticId)) &&
(!withDiff || (sme.TimeStamp > diffDT))
)
.Count();
}
else
{
var smeWithValue = GetSMEWithValue(smSemanticId, smIdentifier, semanticId, diff, contains, equal, lower, upper);
count = smeWithValue.Count;
}

Console.WriteLine("Found " + count + " SMEs in " + watch.ElapsedMilliseconds + "ms");

return count;
Expand Down Expand Up @@ -345,7 +368,8 @@ private List<SMEWithValue> GetSMEWithValue(string smSemanticId = "", string smId
var result = new List<SMEWithValue>();

var dateTime = TimeStamp.TimeStamp.StringToDateTime(diff);
var withDiff = !diff.Equals(DateTime.MinValue);
var withDiff = diff != "";
var withSemanticID = !semanticId.IsNullOrEmpty();

var parameter = 0;
if (!contains.IsNullOrEmpty())
Expand All @@ -357,40 +381,56 @@ private List<SMEWithValue> GetSMEWithValue(string smSemanticId = "", string smId
if (parameter > 1 || (semanticId.IsNullOrEmpty() && !withDiff && parameter != 1))
return result;

GetXValue(ref result, semanticId, dateTime, contains, equal, lower, upper);
GetSValue(ref result, semanticId, dateTime, contains, equal);
GetIValue(ref result, semanticId, dateTime, equal, lower, upper);
GetDValue(ref result, semanticId, dateTime, equal, lower, upper);
GetOValue(ref result, semanticId, dateTime, contains, equal);
if ((withSemanticID || withDiff)
&& contains.IsNullOrEmpty() && equal.IsNullOrEmpty() && lower.IsNullOrEmpty() && upper.IsNullOrEmpty())
{
using AasContext db = new();
result.AddRange(db.SMESets
.Where(sme =>
(!withSemanticID || (sme.SemanticId != null && sme.SemanticId == semanticId)) &&
(!withDiff || (sme.TimeStamp > dateTime))
)
.Select(sme => new SMEWithValue { sme = sme })
.ToList());
}
else
{
GetXValue(ref result, semanticId, dateTime, contains, equal, lower, upper);
GetSValue(ref result, semanticId, dateTime, contains, equal);
GetIValue(ref result, semanticId, dateTime, equal, lower, upper);
GetDValue(ref result, semanticId, dateTime, equal, lower, upper);
GetOValue(ref result, semanticId, dateTime, contains, equal);
}

SelectSM(ref result, smSemanticId, smIdentifier);
return result;
}

private static void GetXValue(ref List<SMEWithValue> smeValue, string semanticId = "", DateTime diff = new(), string contains = "", string equal = "", string lower = "", string upper = "")
{
var withValue = !contains.IsNullOrEmpty() || !equal.IsNullOrEmpty() || !lower.IsNullOrEmpty() || !upper.IsNullOrEmpty();
var withSME = !semanticId.IsNullOrEmpty();
var withSemanticID = !semanticId.IsNullOrEmpty();
var withDiff = !diff.Equals(DateTime.MinValue);
if (!withDiff || withValue)
if ((!withSemanticID && !withDiff) || withValue)
return;

using AasContext db = new();
smeValue.AddRange(db.SMESets
.Where(sme =>
(sme.TValue == string.Empty || sme.TValue == null) &&
(!withSME || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withSemanticID || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withDiff || sme.TimeStamp.CompareTo(diff) > 0))
.Select(sme => new SMEWithValue { sme = sme })
.ToList());
}

private static void GetSValue(ref List<SMEWithValue> smeValue, string semanticId = "", DateTime diff = new(), string contains = "", string equal = "")
{
var withSME = !semanticId.IsNullOrEmpty();
var withSemanticID = !semanticId.IsNullOrEmpty();
var withDiff = !diff.Equals(DateTime.MinValue);
var withContains = !contains.IsNullOrEmpty();
var withEqual = !equal.IsNullOrEmpty();
if (!withDiff && !withContains && !withEqual)
if (!withSemanticID && !withDiff && !withContains && !withEqual)
return;

using AasContext db = new();
Expand All @@ -401,19 +441,19 @@ private List<SMEWithValue> GetSMEWithValue(string smSemanticId = "", string smId
.Join(
db.SMESets
.Where(sme =>
(!withSME || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withSemanticID || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withDiff || sme.TimeStamp.CompareTo(diff) > 0)),
v => v.SMEId, sme => sme.Id, (v, sme) => new SMEWithValue { sme = sme, value = v.Value })
.ToList());
}

private static void GetIValue(ref List<SMEWithValue> smeValue, string semanticId = "", DateTime diff = new(), string equal = "", string lower = "", string upper = "")
{
var withSME = !semanticId.IsNullOrEmpty();
var withSemanticID = !semanticId.IsNullOrEmpty();
var withDiff = !diff.Equals(DateTime.MinValue);
var withEqual = !equal.IsNullOrEmpty();
var withCompare = !(lower.IsNullOrEmpty() && upper.IsNullOrEmpty());
if (!withDiff && !withEqual && !withCompare)
if (!withSemanticID && !withDiff && !withEqual && !withCompare)
return;

var iEqual = (long) 0;
Expand Down Expand Up @@ -442,19 +482,19 @@ private List<SMEWithValue> GetSMEWithValue(string smSemanticId = "", string smId
.Join(
(db.SMESets
.Where(sme =>
(!withSME || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withSemanticID || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withDiff || sme.TimeStamp.CompareTo(diff) > 0))),
v => v.SMEId, sme => sme.Id, (v, sme) => new SMEWithValue { sme = sme, value = v.Value.ToString() })
.ToList());
}

private static void GetDValue(ref List<SMEWithValue> smeValue, string semanticId = "", DateTime diff = new(), string equal = "", string lower = "", string upper = "")
{
var withSME = !semanticId.IsNullOrEmpty();
var withSemanticID = !semanticId.IsNullOrEmpty();
var withDiff = !diff.Equals(DateTime.MinValue);
var withEqual = !equal.IsNullOrEmpty();
var withCompare = !(lower.IsNullOrEmpty() && upper.IsNullOrEmpty());
if (!withDiff && !withEqual && !withCompare)
if (!withSemanticID && !withDiff && !withEqual && !withCompare)
return;

var dEqual = (long) 0;
Expand Down Expand Up @@ -483,19 +523,19 @@ private List<SMEWithValue> GetSMEWithValue(string smSemanticId = "", string smId
.Join(
(db.SMESets
.Where(sme =>
(!withSME || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withSemanticID || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withDiff || sme.TimeStamp.CompareTo(diff) > 0))),
v => v.SMEId, sme => sme.Id, (v, sme) => new SMEWithValue { sme = sme, value = v.Value.ToString() })
.ToList());
}

private static void GetOValue(ref List<SMEWithValue> smeValue, string semanticId = "", DateTime diff = new(), string contains = "", string equal = "")
{
var withSME = !semanticId.IsNullOrEmpty();
var withSemanticID = !semanticId.IsNullOrEmpty();
var withDiff = !diff.Equals(DateTime.MinValue);
var withContains = !contains.IsNullOrEmpty();
var withEqual = !equal.IsNullOrEmpty();
if (!withDiff && !withContains && !withEqual)
if (!withSemanticID && !withDiff && !withContains && !withEqual)
return;

using AasContext db = new();
Expand All @@ -506,7 +546,7 @@ private List<SMEWithValue> GetSMEWithValue(string smSemanticId = "", string smId
.Join(
db.SMESets
.Where(sme =>
(!withSME || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withSemanticID || (sme.SemanticId != null && sme.SemanticId.Equals(semanticId))) &&
(!withDiff || sme.TimeStamp.CompareTo(diff) > 0)),
v => v.SMEId, sme => sme.Id, (v, sme) => new SMEWithValue { sme = sme, value = (string) v.Value })
.ToList());
Expand Down
Loading