Skip to content

Commit

Permalink
Merge pull request #59 from cesmii/cesmii/mhdev
Browse files Browse the repository at this point in the history
NodeSet Model 2.0: methods, symbolicname, event notifier, allow subtypes
  • Loading branch information
MarkusHorstmann authored Nov 28, 2023
2 parents 6ba95c2 + 0e69662 commit b22ec84
Show file tree
Hide file tree
Showing 21 changed files with 10,550 additions and 38 deletions.
2 changes: 1 addition & 1 deletion CloudLibSync/CloudLibSync.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<ProjectReference Include="..\Opc.Ua.CloudLib.Client\Opc.Ua.Cloud.Library.Client.csproj" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core" Version="1.4.371.96" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core" Version="1.4.372.76" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta3.22114.1" />
<PackageReference Include="System.CommandLine.NamingConventionBinder" Version="2.0.0-beta3.22114.1" />
</ItemGroup>
Expand Down
20 changes: 5 additions & 15 deletions UACloudLibraryServer/Authentication/ApiKeyTokenProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,10 @@ public async Task<bool> ValidateAsync(string purpose, string token, UserManager<
}
}
throw new ArgumentException($"Key not found");

}

/// <summary>
///
///
/// </summary>
/// <param name="userManager">UserManager to use to generate and set the key.</param>
/// <param name="user">User for who to generate the key for.</param>
Expand Down Expand Up @@ -165,26 +164,17 @@ internal class ApiKeyGenerationException : Exception
{
public IEnumerable<string> Errors { get; private set; }

public ApiKeyGenerationException()
{
}
public ApiKeyGenerationException() { }

public ApiKeyGenerationException(string message, IEnumerable<string> enumerable) : base(message)
{
Errors = enumerable;
}

public ApiKeyGenerationException(string message) : base(message)
{
}
public ApiKeyGenerationException(string message) : base(message) { }

public ApiKeyGenerationException(string message, Exception innerException) : base(message, innerException)
{
}
public ApiKeyGenerationException(string message, Exception innerException) : base(message, innerException) { }

protected ApiKeyGenerationException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
protected ApiKeyGenerationException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}

}
15 changes: 14 additions & 1 deletion UACloudLibraryServer/CloudLibDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using CESMII.OpcUa.NodeSetModel;
using CESMII.OpcUa.NodeSetModel.Opc.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -107,6 +108,10 @@ public IQueryable<ObjectModel> GetObjects(string modelUri = null, DateTime? publ
{
return GetNodeModels<ObjectModel>(nsm => nsm.Objects, modelUri, publicationDate, nodeId);
}
public IQueryable<MethodModel> GetMethods(string modelUri = null, DateTime? publicationDate = null, string nodeId = null)
{
return GetNodeModels<MethodModel>(nsm => nsm.Methods, modelUri, publicationDate, nodeId);
}


public IQueryable<NodeModel> GetAllNodes(string modelUri = null, DateTime? publicationDate = null, string nodeId = null)
Expand Down Expand Up @@ -526,7 +531,15 @@ private void MapToEntity(ref NamespaceMetaDataModel entity, UANameSpace uaNamesp
{
var identifier = nodeSetModel != null ? nodeSetModel.Identifier : uaNamespace.Nodeset.Identifier.ToString(CultureInfo.InvariantCulture);
entity.NodesetId = identifier;
entity.CreationTime = uaNamespace.CreationTime ?? DateTime.Now;
if (uaNamespace.CreationTime != null)
{
entity.CreationTime = uaNamespace.CreationTime.GetNormalizedPublicationDate();
}
else
{
entity.CreationTime = DateTime.Now;
}

entity.NodeSet = nodeSetModel;
entity.Title = uaNamespace.Title;
entity.ContributorId = contributor?.Id ?? 0;
Expand Down
1 change: 1 addition & 0 deletions UACloudLibraryServer/GraphQL/AppDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ protected override void OnModelCreating(ModelBuilder builder)
.Property(nsm => nsm.ValidationStatus)
.HasConversion<string>();
builder.Entity<NodeSetModel>()
.Ignore(nsm => nsm.HeaderComments)
.HasAlternateKey(nm => nm.Identifier)
;

Expand Down
6 changes: 6 additions & 0 deletions UACloudLibraryServer/GraphQL/QueryModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ public IQueryable<ObjectModel> GetObjects([Service(ServiceKind.Synchronized)] ID
{
return dp.GetObjects(modelUri ?? nodeSetUrl, publicationDate, nodeId);
}
[UsePaging, UseFiltering, UseSorting]
public IQueryable<MethodModel> GetMethods([Service(ServiceKind.Synchronized)] IDatabase dp, string modelUri = null, string nodeSetUrl = null, DateTime? publicationDate = null, string nodeId = null)
{
return dp.GetMethods(modelUri ?? nodeSetUrl, publicationDate, nodeId);
}

[UsePaging, UseFiltering, UseSorting]
public IQueryable<NodeModel> GetAllNodes([Service(ServiceKind.Synchronized)] IDatabase dp, string modelUri = null, string nodeSetUrl = null, DateTime? publicationDate = null, string nodeId = null)
Expand Down Expand Up @@ -221,6 +226,7 @@ protected override void Configure(IObjectTypeDescriptor<CloudLibNodeSetModel> de
ConfigureField(descriptor.Field(f => f.DataTypes));
ConfigureField(descriptor.Field(f => f.Interfaces));
ConfigureField(descriptor.Field(f => f.Objects));
ConfigureField(descriptor.Field(f => f.Methods));
ConfigureField(descriptor.Field(f => f.Properties));
ConfigureField(descriptor.Field(f => f.DataVariables));
ConfigureField(descriptor.Field(f => f.ReferenceTypes));
Expand Down
1 change: 1 addition & 0 deletions UACloudLibraryServer/Interfaces/IDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public interface IDatabase
IQueryable<ReferenceTypeModel> GetReferenceTypes(string modelUri = null, DateTime? publicationDate = null, string nodeId = null);
IQueryable<InterfaceModel> GetInterfaces(string modelUri = null, DateTime? publicationDate = null, string nodeId = null);
IQueryable<ObjectModel> GetObjects(string modelUri = null, DateTime? publicationDate = null, string nodeId = null);
IQueryable<MethodModel> GetMethods(string modelUri = null, DateTime? publicationDate = null, string nodeId = null);
IQueryable<NodeModel> GetAllNodes(string modelUri = null, DateTime? publicationDate = null, string nodeId = null);

IQueryable<CategoryModel> GetCategories();
Expand Down
Loading

0 comments on commit b22ec84

Please sign in to comment.