Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/AasxServerDB/EntityFrameworkPersistenceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ public async Task<DbRequestResult> DoDbOperation(DbRequest dbRequest)
var submodelElement = CrudOperator.ReadSubmodelElementByPath(db, aasIdentifier, submodelIdentifier, idShort, out SMESet smE, securitySqlConditions);
if (submodelElement == null)
{
throw new NotFoundException($"Submodel with id {submodelIdentifier} NOT found in AAS with id {aasIdentifier}");
throw new NotFoundException($"Submodel element in Submodel with id {submodelIdentifier} NOT found in AAS with id {aasIdentifier}");
}

result.ResultData = new List<IClass>
Expand Down
34 changes: 19 additions & 15 deletions src/AasxServerStandardBib/EventService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,21 @@
using AasxServer;
using AasxServerDB;
using AasxServerDB.Entities;
using AasxServerStandardBib.Logging;
using AdminShellNS;
using Contracts;
using Contracts.Events;
using Extensions;
using IdentityModel.Client;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Tokens;

public class EventService : IEventService
{
{
private static readonly ILogger _logger = ApplicationLogging.CreateLogger("EventService");

public EventService(MqttClientService mqttClientService)
{
_mqttClientService = mqttClientService;
Expand Down Expand Up @@ -419,7 +423,7 @@
if (result != null && result.IsSuccess)
{
isSucceeded = true;
Console.WriteLine($"MQTT message sent on message topic {eventData.MessageTopicType.Value}.");
_logger.LogDebug($"MQTT message sent on message topic {eventData.MessageTopicType.Value}.");
}

if (isSucceeded)
Expand Down Expand Up @@ -492,7 +496,7 @@
var now = DateTime.UtcNow;
eventData.Status.SetTimeStamp(now);

Console.WriteLine($"FAILED: Send MQTT message on message topic {eventData.MessageTopicType.Value}.");
_logger.LogDebug($"FAILED: Send MQTT message on message topic {eventData.MessageTopicType.Value}.");

// d = eventData.LastUpdate.Value = "reconnect";
}
Expand Down Expand Up @@ -965,8 +969,8 @@
entry.data = ConvertSmJsonToRestApiSpecSmJson(j);
}
}
}

}
_logger.LogDebug($"Event id: {entry.id}, Type: {entry.type}");
eventPayloadList.Add(entry);
}
}
Expand Down Expand Up @@ -1335,7 +1339,7 @@
eventPayloadList.Add(entry);

diffEntry.Add(entry.eventPayloadEntryType.ToString() + " " + entry.GetIdShortPath());
Console.WriteLine($"Event {entry.eventPayloadEntryType.ToString()} Schema: {entry.dataSchema} idShortPath: {entry.GetIdShortPath()}");
_logger.LogDebug($"Event {entry.eventPayloadEntryType.ToString()} Schema: {entry.dataSchema} idShortPath: {entry.GetIdShortPath()}");

Check notice

Code scanning / CodeQL

Redundant ToString() call Note

Redundant call to 'ToString'.
countSME++;
}
}
Expand Down Expand Up @@ -1391,7 +1395,7 @@
}

diffEntry.Add(entry.eventPayloadEntryType.ToString() + " " + entry.GetIdShortPath());
Console.WriteLine($"Event {entry.eventPayloadEntryType.ToString()} Type: {entry.dataSchema} idShortPath: {entry.GetIdShortPath()}");
_logger.LogDebug($"Event {entry.eventPayloadEntryType.ToString()} Type: {entry.dataSchema} idShortPath: {entry.GetIdShortPath()}");

Check notice

Code scanning / CodeQL

Redundant ToString() call Note

Redundant call to 'ToString'.

eventPayloadList.Add(entry);
countSM++;
Expand Down Expand Up @@ -1475,7 +1479,7 @@
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
_logger.LogDebug(ex.ToString());
}
transmit = eventPayload[0].transmitted;
var dt = TimeStamp.TimeStamp.StringToDateTime(eventPayload[0].time);
Expand Down Expand Up @@ -1516,7 +1520,7 @@
var entriesSubmodel = new List<EventPayload>();
foreach (var entry in eventPayload)
{
Console.WriteLine($"Event {entry.eventPayloadEntryType.ToString()} Type: {entry.dataSchema} idShortPath: {entry.GetIdShortPath()}");
_logger.LogDebug($"Event {entry.eventPayloadEntryType.ToString()} Type: {entry.dataSchema} idShortPath: {entry.GetIdShortPath()}");

Check notice

Code scanning / CodeQL

Redundant ToString() call Note

Redundant call to 'ToString'.
Submodel receiveSM = null;
if (entry.dataSchema.Split("/")?.Last().ToLower() == "submodel")
{
Expand Down Expand Up @@ -1751,7 +1755,7 @@
}
if (!path.Contains("."))
{
Console.WriteLine("Event CREATE SME: " + entry.GetIdShortPath());
_logger.LogDebug("Event CREATE SME: " + entry.GetIdShortPath());
receiveSme.TimeStampCreate = dt;
receiveSme.TimeStampDelete = new DateTime();
int i = 0;
Expand Down Expand Up @@ -1805,7 +1809,7 @@
var sme = submodelElements[i];
if (entry.GetIdShortPath() == idShortPath + sme.IdShort)
{
Console.WriteLine("Event UPDATE SME: " + entry.GetIdShortPath());
_logger.LogDebug("Event UPDATE SME: " + entry.GetIdShortPath());
receiveSme.TimeStampCreate = submodelElements[i].TimeStampCreate;
receiveSme.TimeStampDelete = submodelElements[i].TimeStampDelete;
submodelElements[i] = receiveSme;
Expand Down Expand Up @@ -1849,7 +1853,7 @@
}
if (entry.GetIdShortPath() == idShortPath + sme.IdShort)
{
Console.WriteLine("Event DELETE SME: " + entry.GetIdShortPath());
_logger.LogDebug("Event DELETE SME: " + entry.GetIdShortPath());
if (children.Count != 0)
{
int c = 0;
Expand Down Expand Up @@ -2031,12 +2035,12 @@
var url = System.Environment.GetEnvironmentVariable(envVarName);
if (url != null)
{
Console.WriteLine($"{p.Value} = {url}");
_logger.LogDebug($"{p.Value} = {url}");
p.Value = url;
}
else
{
Console.WriteLine($"Environment variable {envVarName} not found.");
_logger.LogWarning($"Environment variable {envVarName} not found.");
}
}
eventDto.EndPoint = p;
Expand Down Expand Up @@ -2447,7 +2451,7 @@
if (result != null && result.IsSuccess)
{
isSucceeded = true;
Console.WriteLine("MQTT message sent.");
_logger.LogDebug("MQTT message sent.");
}

if (isSucceeded)
Expand Down
Loading