Skip to content

Commit

Permalink
Jtikekar/reverting nullables (#353)
Browse files Browse the repository at this point in the history
* Revert nullables,
Revert DTO-nullables,
Add Metadata-serializer

* Upgrading to API version 3.0.2

* Remove child elements from MetadataDTOs (3.0.2)

* Support for Metadata as per 3.0.2

* Support for /submodel-elements and Get + $path

* Fix for ExceptionHandling

* Support for $Path

* Support for Level in case of Operation Element

* Rebasing and resoling conflicts
Revert nullables,
Revert DTO-nullables,
Add Metadata-serializer

* rebase and resolve conflicts
epgrading to API version 3.0.2

* Remove child elements from MetadataDTOs (3.0.2)

* Resolve conflicts
Support for Metadata as per 3.0.2

* Resolve conflicts
Support for /submodel-elements and Get + $path

* Fix for ExceptionHandling

* Resolve conflicts
Support for $Path

* Support for Level in case of Operation Element

* Resolve issues after rebase

* Headers added

* Remove null check on DataSpecRef

* Support for encoded AssetId in GetAllShells

* Upgrade to 3.0.3,
Change in incorrect level and extent handling

* Upgrade to BugFix version 3.0.3

* Update to BugFix Version 3.0.3

* Fix bugs w.r.t., Path and submodel service

* Upgrade CD APIs to 3.0.3

* Fix tests

* Removing support of Path on AnnotatedRelationshipElement

* Support for API Versioning

* Resolove conflicts with main
Revert nullables,
Revert DTO-nullables,
Add Metadata-serializer

* Resolve conflicts with main
Upgrading to API version 3.0.2

* resolve conflicts with main
Remove child elements from MetadataDTOs (3.0.2)

* Resolve conflicts with main
Support for Metadata as per 3.0.2

* Resolve conflicts with main
Support for /submodel-elements and Get + $path

* Resolve conflicts with main
Support for $Path

* Support for Level in case of Operation Element

* Remove null check on DataSpecRef

* Headers added

* Support for encoded AssetId in GetAllShells

* Upgrade to 3.0.3,
Change in incorrect level and extent handling

* Upgrade to BugFix version 3.0.3

* Update to BugFix Version 3.0.3

* Fix bugs w.r.t., Path and submodel service

* Upgrade CD APIs to 3.0.3

* Fix tests

* Removing support of Path on AnnotatedRelationshipElement

* Support for API Versioning

* Correct errors after rebase

---------

Co-authored-by: martaf <[email protected]>
  • Loading branch information
juileetikekar and martafullen authored Nov 6, 2024
1 parent bfe41ae commit d1cffea
Show file tree
Hide file tree
Showing 103 changed files with 10,912 additions and 8,397 deletions.
8 changes: 4 additions & 4 deletions src/AasCore.Aas3_0/AasCore.Aas3_0.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;DebugSlow</Configurations>
<Platforms>AnyCPU</Platforms>
<LangVersion>8</LangVersion>

<PackageId>AasCore.Aas3_0</PackageId>
<Version>0.3.0.1-aasV3-alpha-latest</Version>
<Version>1.0.0-rc1</Version>
<Authors>Marko Ristin</Authors>
<Description>
An SDK for manipulating, verifying and de/serializing Asset Administration Shells.
Expand All @@ -18,8 +18,8 @@
<PackageLicenseUrl>https://raw.githubusercontent.com/aas-core-works/aas-core3.0-csharp/main/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/aas-core-works/aas-core3.0-csharp</PackageProjectUrl>
<PackageTags>aas;asset administration shell;iiot;industry internet of things;industrie 4.0;i4.0</PackageTags>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions src/AasCore.Aas3_0/Attributes/CountForHash.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/********************************************************************************
* Copyright (c) {2019 - 2024} Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

using System;

Check warning on line 14 in src/AasCore.Aas3_0/Attributes/CountForHash.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Remove the underscores from assembly name AasCore.Aas3_0 (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1707)

Check warning on line 14 in src/AasCore.Aas3_0/Attributes/CountForHash.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Remove the underscores from assembly name AasCore.Aas3_0 (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1707)

Check warning on line 14 in src/AasCore.Aas3_0/Attributes/CountForHash.cs

View workflow job for this annotation

GitHub Actions / Check that the whole project is buildable and attach packages to process

Remove the underscores from assembly name AasCore.Aas3_0 (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1707)

Check warning on line 14 in src/AasCore.Aas3_0/Attributes/CountForHash.cs

View workflow job for this annotation

GitHub Actions / Create a new prerelease build and attach built packages to release

Remove the underscores from assembly name AasCore.Aas3_0 (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1707)

namespace AasCore.Aas3_0.Attributes

Check warning on line 16 in src/AasCore.Aas3_0/Attributes/CountForHash.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Remove the underscores from namespace name 'AasCore.Aas3_0' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1707)

Check warning on line 16 in src/AasCore.Aas3_0/Attributes/CountForHash.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Remove the underscores from namespace name 'AasCore.Aas3_0' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1707)

Check warning on line 16 in src/AasCore.Aas3_0/Attributes/CountForHash.cs

View workflow job for this annotation

GitHub Actions / Check that the whole project is buildable and attach packages to process

Remove the underscores from namespace name 'AasCore.Aas3_0' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1707)

Check warning on line 16 in src/AasCore.Aas3_0/Attributes/CountForHash.cs

View workflow job for this annotation

GitHub Actions / Create a new prerelease build and attach built packages to release

Remove the underscores from namespace name 'AasCore.Aas3_0' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1707)
{
/// <summary>
/// This attribute indicates, that it should e.g. serialized in JSON.
/// </summary>
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true)]
public class CountForHash : Attribute

Check warning on line 22 in src/AasCore.Aas3_0/Attributes/CountForHash.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Rename AasCore.Aas3_0.Attributes.CountForHash to end in 'Attribute' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1710)

Check warning on line 22 in src/AasCore.Aas3_0/Attributes/CountForHash.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Rename AasCore.Aas3_0.Attributes.CountForHash to end in 'Attribute' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1710)

Check warning on line 22 in src/AasCore.Aas3_0/Attributes/CountForHash.cs

View workflow job for this annotation

GitHub Actions / Check that the whole project is buildable and attach packages to process

Rename AasCore.Aas3_0.Attributes.CountForHash to end in 'Attribute' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1710)
{
}
}
28 changes: 28 additions & 0 deletions src/AasCore.Aas3_0/Attributes/MetaModelName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/********************************************************************************
* Copyright (c) {2019 - 2024} Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

namespace AasCore.Aas3_0.Attributes
{
/// <summary>
/// This attribute indicates, that the field / property is searchable
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple = true)]
public class MetaModelName : System.Attribute

Check warning on line 20 in src/AasCore.Aas3_0/Attributes/MetaModelName.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Rename AasCore.Aas3_0.Attributes.MetaModelName to end in 'Attribute' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1710)

Check warning on line 20 in src/AasCore.Aas3_0/Attributes/MetaModelName.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Rename AasCore.Aas3_0.Attributes.MetaModelName to end in 'Attribute' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1710)

Check warning on line 20 in src/AasCore.Aas3_0/Attributes/MetaModelName.cs

View workflow job for this annotation

GitHub Actions / Check that the whole project is buildable and attach packages to process

Rename AasCore.Aas3_0.Attributes.MetaModelName to end in 'Attribute' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1710)
{
public string name;

Check warning on line 22 in src/AasCore.Aas3_0/Attributes/MetaModelName.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Do not declare visible instance fields (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1051)

Check warning on line 22 in src/AasCore.Aas3_0/Attributes/MetaModelName.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Do not declare visible instance fields (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1051)

Check warning on line 22 in src/AasCore.Aas3_0/Attributes/MetaModelName.cs

View workflow job for this annotation

GitHub Actions / Check that the whole project is buildable and attach packages to process

Do not declare visible instance fields (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1051)
public MetaModelName(string name)
{
this.name = name;
}
}
}
24 changes: 24 additions & 0 deletions src/AasCore.Aas3_0/Attributes/SkipForReflection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/********************************************************************************
* Copyright (c) {2019 - 2024} Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

namespace AasCore.Aas3_0.Attributes
{
/// <summary>
/// This attribute indicates, that the field / property shall be skipped for reflection
/// in order to avoid cycles
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple = true)]
public class SkipForReflection : System.Attribute

Check warning on line 21 in src/AasCore.Aas3_0/Attributes/SkipForReflection.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Rename AasCore.Aas3_0.Attributes.SkipForReflection to end in 'Attribute' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1710)

Check warning on line 21 in src/AasCore.Aas3_0/Attributes/SkipForReflection.cs

View workflow job for this annotation

GitHub Actions / Check that the whole project is buildable and attach packages to process

Rename AasCore.Aas3_0.Attributes.SkipForReflection to end in 'Attribute' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1710)
{
}
}
24 changes: 24 additions & 0 deletions src/AasCore.Aas3_0/Attributes/SkipForSearch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/********************************************************************************
* Copyright (c) {2019 - 2024} Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

namespace AasCore.Aas3_0.Attributes
{
/// <summary>
/// This attribute indicates, that the field / property shall be skipped for searching, because it is not
/// directly displayed in Package Explorer
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple = true)]
public class SkipForSearch : System.Attribute

Check warning on line 21 in src/AasCore.Aas3_0/Attributes/SkipForSearch.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Rename AasCore.Aas3_0.Attributes.SkipForSearch to end in 'Attribute' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1710)
{
}
}
23 changes: 23 additions & 0 deletions src/AasCore.Aas3_0/Attributes/TextSearchable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/********************************************************************************
* Copyright (c) {2019 - 2024} Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

namespace AasCore.Aas3_0.Attributes
{
/// <summary>
/// This attribute indicates, that the field / property is searchable
/// </summary>
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property, AllowMultiple = true)]
public class TextSearchable : System.Attribute
{
}
}
71 changes: 71 additions & 0 deletions src/AasCore.Aas3_0/DiaryData/DiaryDataDef.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/********************************************************************************
* Copyright (c) {2019 - 2024} Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

using AasCore.Aas3_0;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.Xml.Serialization;

namespace AdminShellNS.DiaryData
{
public class DiaryDataDef
{
public enum TimeStampKind { Create, Update }

[XmlIgnore]
[JsonIgnore]
private DateTime[] _timeStamp = new DateTime[2];

[XmlIgnore]
[JsonIgnore]
public DateTime[] TimeStamp { get { return _timeStamp; } }

/// <summary>
/// List of entries, timewise one after each other (entries are timestamped).
/// Note: Default is <c>Entries = null</c>, as handling of many many AAS elements does not
/// create additional overhead of creating empty lists. An empty list shall be avoided.
/// </summary>
public List<IAasDiaryEntry> Entries = null;

Check warning on line 39 in src/AasCore.Aas3_0/DiaryData/DiaryDataDef.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Cannot convert null literal to non-nullable reference type.

Check warning on line 39 in src/AasCore.Aas3_0/DiaryData/DiaryDataDef.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Cannot convert null literal to non-nullable reference type.

Check warning on line 39 in src/AasCore.Aas3_0/DiaryData/DiaryDataDef.cs

View workflow job for this annotation

GitHub Actions / Check that the whole project is buildable and attach packages to process

Cannot convert null literal to non-nullable reference type.

Check warning on line 39 in src/AasCore.Aas3_0/DiaryData/DiaryDataDef.cs

View workflow job for this annotation

GitHub Actions / Create a new prerelease build and attach built packages to release

Cannot convert null literal to non-nullable reference type.

Check warning on line 39 in src/AasCore.Aas3_0/DiaryData/DiaryDataDef.cs

View workflow job for this annotation

GitHub Actions / Create a new prerelease build and attach built packages to release

Do not declare visible instance fields (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1051)

Check warning on line 39 in src/AasCore.Aas3_0/DiaryData/DiaryDataDef.cs

View workflow job for this annotation

GitHub Actions / Create a new prerelease build and attach built packages to release

Member 'Entries' is explicitly initialized to its default value (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1805)

public static void AddAndSetTimestamps(IReferable element, IAasDiaryEntry de, bool isCreate = false)
{
// trivial
if (element == null || de == null || element.DiaryData == null)
return;

// add entry
if (element.DiaryData.Entries == null)
element.DiaryData.Entries = new List<IAasDiaryEntry>();
element.DiaryData.Entries.Add(de);

// figure out which timestamp
var tsk = TimeStampKind.Update;
if (isCreate)
{
tsk = TimeStampKind.Create;
}

// set this timestamp (and for the parents, as well)
IDiaryData el = element;
while (el?.DiaryData != null)
{
// itself
el.DiaryData.TimeStamp[(int)tsk] = DateTime.UtcNow;

// go up
el = (el as IReferable)?.Parent as IDiaryData;

Check warning on line 67 in src/AasCore.Aas3_0/DiaryData/DiaryDataDef.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Converting null literal or possible null value to non-nullable type.

Check warning on line 67 in src/AasCore.Aas3_0/DiaryData/DiaryDataDef.cs

View workflow job for this annotation

GitHub Actions / Run all project unit tests

Converting null literal or possible null value to non-nullable type.

Check warning on line 67 in src/AasCore.Aas3_0/DiaryData/DiaryDataDef.cs

View workflow job for this annotation

GitHub Actions / Check that the whole project is buildable and attach packages to process

Converting null literal or possible null value to non-nullable type.

Check warning on line 67 in src/AasCore.Aas3_0/DiaryData/DiaryDataDef.cs

View workflow job for this annotation

GitHub Actions / Create a new prerelease build and attach built packages to release

Converting null literal or possible null value to non-nullable type.
}
}
}
}
19 changes: 19 additions & 0 deletions src/AasCore.Aas3_0/DiaryData/IAasDiaryEntry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/********************************************************************************
* Copyright (c) {2019 - 2024} Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

namespace AdminShellNS.DiaryData
{
public interface IAasDiaryEntry
{
}
}
26 changes: 26 additions & 0 deletions src/AasCore.Aas3_0/DiaryData/IDiaryData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/********************************************************************************
* Copyright (c) {2019 - 2024} Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AdminShellNS.DiaryData
{
public interface IDiaryData
{
DiaryDataDef DiaryData { get; }
}
}
Loading

0 comments on commit d1cffea

Please sign in to comment.