Code Monkey home page Code Monkey logo

compas-scl-data-service's People

Contributors

apupier avatar dependabot[bot] avatar dlabordus avatar flurb avatar github-actions[bot] avatar juancho0202 avatar pascalwilbrink avatar stef3st avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

compas-scl-data-service's Issues

Add more information (who/when/what) to Versions call

For the OpenSCD Front-end Application the call to retrieve info about all versions need to be extended with the fields 'who', 'when' and 'what'. This information can then be shown by OpenSCD to the user.

This information needs to be retrieved from the XML in the Database using a XPath Query.
Find the first HItem with a specific version (version that's stored by the record of the SCL), with empty revision.
From that record retrieve the attributes 'who', 'when' and 'what' and add these to the response (extend the Response with these fields).

Return Labels when listing the SCL Files for existing list function

User Story
When listing all SCL File for a specific SCL File Type we also want to return the labels that are attached to that SCL File. This way the Engineer using OpenSCD can use these labels to filter the List of SCL File and find a specific SCL File faster.

Acceptance criteria
When the list of SCL Files are retrieved the labels attached to a SCL File are also returned by a Entry. OpenSCD can use these labels to be shown to the user and filter on them.

Additional information
The Labels are stored in the private section (type='compas_scl') of CoMPAS in the SCL Element. These labels need to be retrieved from the SCL XML File and converted to a list of strings in the class Item (Element 'Label' as List).

Remark 1: Item Class is also used to return the list of versions, so maybe do something similar as with HistoryItem, so that only the call 'list' will return labels.
Remark 2: Retrieving information van the SCL XML File is already done in the call 'listVersionsByUUID'. In the same way we can first retrieve the labels from the SCL XML File. But for the PostgreSQL version we need to figure out how to extract a Array of values, that's new.
Remark 3: Try to implement both BaseX and PostgreSQL implementation.

Example of Private Section in SCL XML File

<SCL xmlns="http://www.iec.ch/61850/2003/SCL" xmlns:compas="https://www.lfenergy.org/compas/extension/v1" 
          release="4" revision="B" version="2007">
  <Private type="compas_scl">
    <compas:SclName>MiniGrid</compas:SclName>
    <compas:SclFileType>CID</compas:SclFileType>
    <compas:Labels>
     <compas:Label>Label1</compas:Label>
     <compas:Label>Label2</compas:Label>
    </compas:Labels>
  </Private>
  ...
</SCL>

Example of List Response

<ListResponse xmlns="https://www.lfenergy.org/compas/SclDataService/v1">
  <Item>
    <Id>123e4567-e89b-12d3-a456-426614174000</Id>
    <Name>STATION-0012312</Name>
    <Version>1.0.0</Version>
    <Label>Label1</Label>
    <Label>Label2</Label>
  </Item>
</ListResponse>

Make Docker image of PostgreSQL version of SCL Data Service

As a deployer
I want a Docker Image of the PostgreSQL version of the SCL Data Service.
So that I can deploy this image in a Docker/Kubernetes environment.

Background:
Currently we create a BaseX version of the Docker image. It would be nice to create both a BaseX and PostgreSQL of the SCL Data Service image and publish both to Docker Hub.
Also check if the docker image works as native image.

Make it possible to add some comment to a create or update call of a SCL

As a user
I want to add some comment when adding or updating a SCL
So that in the future we have more information to know why a add or update was done

To the CreateRequest and UpdateRequest and a required field "what" this field will be added to the SCL XML.
This can be done as THitem in the History of the Header.

Accepetance criteria:
Minimun amount of charaters: 10
Comment can be added in THitem: what
Save/date time can be added to THitem: when ->XSD date-time format

Create a THItem Record in the header
version -> from Header
revision -> from Header
when -> current date/time (YYYY-MM-DDThh:mm:ss)
who -> Username of the logged in user
what -> "SCL created, {comment}" or "SCL updated, {comment}"

Validate Labels when adding/update a SCL File

User Story
When updating or adding a SCL File the service should check the Labels in the CoMPAS Private section to make sure these don't validate the rules. This way we prevent that strange labels are showing up in the open/save dialogs of OpenSCD.

Acceptance criteria
Invalid Labels are not allowed by the Data Service when upodating or adding a SCL File.

[BUG] "Release project" action failing

Subject of the issue

The github action "Release project" failed for the release v0.14.0 at the "Deploy with maven to Github packages and Docker hub" step. The following error was logged:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:08 min
[INFO] Finished at: 2023-10-05T13:03:34Z
[INFO] ------------------------------------------------------------------------
Error:  Failed to execute goal io.quarkus:quarkus-maven-plugin:3.0.4.Final:build (build-basex) on project app: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
Error: [ERROR] 	[error]: Build step io.quarkus.deployment.pkg.steps.JarResultBuildStep#buildNativeImageJar threw an exception: java.lang.IllegalStateException: java.nio.file.NoSuchFileException: /home/runner/work/compas-scl-data-service/compas-scl-data-service/app/target/basex-quarkus-app/app-0.14.0-native-image-source-jar/lib/com.fasterxml.jackson.core.jackson-databind-2.14.2.jar
Error:  	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:918)
Error:  	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
Error:  	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
Error:  	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
Error:  	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
Error:  	at java.base/java.lang.Thread.run(Thread.java:833)
Error:  	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Error:  Caused by: java.nio.file.NoSuchFileException: /home/runner/work/compas-scl-data-service/compas-scl-data-service/app/target/basex-quarkus-app/app-0.14.0-native-image-source-jar/lib/com.fasterxml.jackson.core.jackson-databind-2.14.2.jar
Error:  	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
Error:  	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
Error:  	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
Error:  	at java.base/sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:246)
Error:  	at java.base/sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:603)
Error:  	at java.base/sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:257)
Error:  	at java.base/java.nio.file.Files.copy(Files.java:1305)
Error:  	at io.quarkus.deployment.pkg.steps.JarResultBuildStep.copyLibraryJars(JarResultBuildStep.java:1101)
Error:  	at io.quarkus.deployment.pkg.steps.JarResultBuildStep.doLegacyThinJarGeneration(JarResultBuildStep.java:1069)
Error:  	at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildNativeImageThinJar(JarResultBuildStep.java:1011)
Error:  	at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildNativeImageJar(JarResultBuildStep.java:975)
Error:  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error:  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
Error:  	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error:  	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
Error:  	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
Error:  	... 6 more
Error:  	Suppressed: java.nio.file.NoSuchFileException: /home/runner/work/compas-scl-data-service/compas-scl-data-service/app/target/basex-quarkus-app/app-0.14.0-native-image-source-jar/app-0.14.0-runner.jar
Error:  		at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
Error:  		at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
Error:  		at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
Error:  		at java.base/sun.nio.fs.UnixPath.toRealPath(UnixPath.java:825)
Error:  		at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.lambda$removeFileSystem$0(ZipFileSystemProvider.java:305)
Error:  		at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
Error:  		at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.removeFileSystem(ZipFileSystemProvider.java:307)
Error:  		at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.close(ZipFileSystem.java:526)
Error:  		at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildNativeImageThinJar(JarResultBuildStep.java:999)
Error:  		... 12 more
Error:  -> [Help 1]
Error:  
Error:  To see the full stack trace of the errors, re-run Maven with the -e switch.
Error:  Re-run Maven using the -X switch to enable full debug logging.
Error:  
Error:  For more information about the errors and possible solutions, please read the following articles:
Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Error:  
Error:  After correcting the problems, you can resume the build with the command
Error:    mvn <args> -rf :app
Error: Process completed with exit code 1.

Expected behavior
All the steps in the "Release project" action run successfully.

Actual behavior
As described in the subject.

Slow retrieval of SCL File list for a specific type

Subject of the issue

Retrieve the list of SCL Files when opening a SCL File from CoMPAS take too long.
This is caused because the query needs to retrieve the labels from the SCL XML File.

Expected behaviour

Retrieve the list faster.

Actual behaviour

Slow retrieval from the list

Proposed solution

This is only needed for the SQL Database implementation. BaseX has less problems here.
When add/updating a SCL File extract the Labels from the SCL XML File and stored these is a separate table linked to the SCL File (meaning ID + version). This way when retrieving the Labels for the list, querying the table is enough and fast.

Userrights

As a data steward
I want to able to limit access to SCL file types by create, read-only and edit acces, delete rights based on the user rights
So I prevent any unwanted changes to SCL files

Background
It is important to prevent unwanted SCL changes and consequences

Acceptance criteria:

  • SCD/SSD/ICD/IID/CID/SED/ISD file
  • ICD's are read-only by default
  • Document the solution

Remove BaseX database support

Since BaseX has completely rewritten their API and it is not used a-lot , support will be dropped.

Todo:
Send out a slack message to inform that BaseX support will be dropped
Remove support in this repository (this is the most work)
Remove relevant tests
Remove form deployment + documentation
Check on internal deployments on the use of BaseX

Background: It is hard to split;

Approach for this repository:
remove a basex-repository and fix the pointers in the code

Validate Request Body

As a Developer
I want the Request Body to be validated
So that I know a SCL element is there with the correct namespace

Because we need to support all three versions of a SCL the element isn't type bounded anymore, but a Any Element.
To make it more robust we should check the content of that Any Element.

  • Make it a List of Elements again.
  • Check that it has only 1 entry
  • Check that that entry has a Name "SCL" and the SCL Namespace (same for all three versions.)
  • Check voor CreateRequest the field Name is filled and correct characters
  • Check voor UpdateRequest the field ChangeSet is filled

Create/Add OpenAPI Descriptions and examples

As a Developer I want to understand how to use the REST API
So that I know how to send request and read responses

The SCL Data Service has a Rest Interface that is described using OpenAPI.
With annotations the different fields and classes can be described.
Also a Example value can be displayed. For the SCL Field we need to decide how fare we go in the example.

Simplify caching Maven artifact configuration in GitHub Workflows example

Since 2.3.0, the setup-java GitHub actions have a built-in cache mechanism which simplifies configuration of the workflow.

It will simplify this: https://github.com/com-pas/contributing/blob/e0e6ccbc2160d9ad05cf0dadea5faa33a977d8c1/docs/GITHUB_ACTIONS.md?plain=1#L147

see also com-pas/contributing#62

User Story

As a com-pas maintainer

I want to have the simpler code to maintain

So that I can develop faster

Acceptance criteria

Please describe the initial acceptance critera.

Same feature level with less and simpler code

UserInfo call returns session timeout values

As a developer
I want the session timeout values
So that I can use these values in OpenSCD to inform the engineer

Background:
Return a sessionTimeout and sessionWarning value with the UserInfo call.
These values can be set through Environment Variables when the Docker container is deployed.

Add SCL name uniqueness check (PostgreSQL)

As an Engineer
I want to be informed if my project name in CoMPAS already exists in the SCL file type
So I prevent confusion (projects with the same name)

When the users enter a name in this window:
image

and clicks on the "save" button, CoMPAS should check if the name already exists for the selected SCL type.
If the name matches an existing one an error should show.

Background:
When a new SCL File is added/updated to the PostgreSQL database we need to check if the name registered in the Private Element "SclName" (under SCL, type "compas_scl") isn't already used.

  • Extended the existing Repositories (PostgreSQL/BaseX) with a method to check if a name isn't already used.
  • In the Service layer first check if the value from the private has changed (update only).
    If not changed no check is needed.
    If changed use the new method to check if the (new) name isn't already used. If already used throw a Exception and stop processing the SCL File.
  • For the BaseX version implementation of the method for now just always return that the name is unique, other issue #203 will implement this version.
  • For the PostgreSQL version execute a query to retrieve the names of all the latest versions and check if the (new) name isn't already used by a other SCL File.

Error Handling in Rest Service

As a user of the Rest Service
I would like to have nicer Error Responses
So that we can handle the different kind of situations better.

Add Error Handling to the project, so the standard HTML Page isn't displayed, but nicer responses, maybe some kind of XML Error Response.

Use standard http status codes:
Find: 404 if not found
Input error: 400 + body
Other errors: 500 + body

Background:
This might be possible using Quarkus

Publish Docker images with version / latest version

As a developer
I want to publish the latest version of the SCL dataservice
So I can test them using Docker hub

Acceptance criteria:

  • Publish a release version when a release is created. Also mark that release as "latest"

Remark:

  • Development versions aren't pushed to Docker Hub. These can be build and run locally.

Background:
Similar to the Docker Hub publishment of our OpenSCD repository.

Getting non-existing latest version of BaseX document gives convert errors

For getting the latest version of a document in BaseX, we use the document-node() function:

declare function local:latest-version($db as xs:string, $id as xs:string) as document-node() { ...

If the function returns nothing, you'll get a empty-sequence() which cannot be converted to a document-node().
This gives errors in the logging (without breaking the build):

CompasSclDataBaseXRepositoryTest > createAndDelete_WhenSclAddedAndDelete_ThenScLStoredAndRemoved() STANDARD_ERROR [Test worker] ERROR org.lfenergy.compas.scl.data.repository.CompasSclDataBaseXRepository - executeCommand: Stopped at ., 2/18: [XPTY0004] Cannot convert empty-sequence() to document-node(): ().

How to handle update by multiple users at the same time

As a engineer
I don't want to lose information if a colleague edits at the same time
So that the correct data is in de store

Background:
If 2 engineers are editing the same configuration the last one saving the configuration will now win.
The changes of the other engineer will be lost in the latest version. But in the history it's will be there.

Show filename and substation name instead of ID

As a user-interface user
I want to see the filename (private element) and optional (if the name is theire) substationname (SCL) for SCD and SCD
So I can easly find the correct SCL file without knowing the UUID

Background
To make the CoMPAS/OpenSCD easy to use;
A private element needs to be added first.
Find the SCL substation field in IEC61850

Acceptance
Works with SCD/SSD/ICD/IID/CID/SED/ISD

Investigate the use of the BaseX Client

As a Developer I would like to have a nice interface to communicate with BaseX
So that it would be easier and more reliable to use BaseX

Currently we copied a BaseX Java Client van the BaseX Project, using this client is quit low-level.

Setup PostgreSQL Database, creating table(s) automatically

As a developer
I want the maintenance of the database structure to be automated
So that changes are automatically applied with new versions.

Background:
We would like to use a tool like FlyWay or LiquiBase to maintain the structure of the database automatically.
So we need to decided to use FlyWay or LiquiBase and configure this tool to create the structure defined in #124.
The implementation can be done in the module already available in the SCL Data Service repository.

SCL Data Service should implement native Entities

If we want to migrate to Native Repositories, we need to support native Entities.
This means that the repository package will contain interfaces of the Entities.
The [DB]-repository package should contain a mapper that maps/transforms DTO's into implemented Entities.

For example:

App > Service > Repository

The App layer has a dependency on the Service layer.
The Service layer has a dependency on an implemented Data layer (Repository).

The app communicates in DTO's ( towards the UI and Service ). The service Maps a DTO from the App into an Entity via the injected Mapper (from the repository). This entity will be passed down to the repository.

Once an Entity comes back from the repository, it should be mapped in the service to a DTO.
The service returns the DTO to the App

Move from Gradle to Maven

As a developer
I want to replace Gradle with Maven
So that maintaining the build is easier

During discussions it seems that Maven is still in favor of Gradle and most companies support this build tool.
And because of that there is more knowledge about Maven and more example can be found.

Acceptence criteria:

  • Build is rewritten to Maven.
  • (Build and publish action are converted to Maven) (Will be done when release topic is done)
  • SonarCloud action is converted to Maven
  • Documentation is updated, how to use Maven, also how to use GitHub Packages in Maven

Implement PostgreSQL database version of Repository

As an operations engineer
I want support for PostgreSQL databases
So I can use a managed service for back-up and restore

Background:
The baseX database is not available as hosted version. Therefore, backups and restores need to be organized manually. Especially the restore part could be challenging.
PostgreSQL supports XML query's: https://www.postgresql.org/docs/current/functions-xml.html

Major steps:

  • Data model for database (#124)
  • Setup Flyway/LiquiBase to configure postgreSQL to setup tables (#125)
  • Implement repository

After the other 2 issues are done we can implement the repository in the module already exists in the SCL Data Service.
Last step is to make it work in Docker. (#126)

Create initial setup

As developer I would like to have a separate BaseX Service (Github) Project
So that we could make a new Docker image based on the BaseX Image to make use of RestXQ Functions for working with BaseX

Background
Create the initial setup with Gradle and Quarkus to store the SCL in BaseX Database and prepare to support PostgreSQL

Acceptance criteria

  • Load and store XML SCL files
  • REST Api
  • Add design to documentation

Add SCL name uniqueness check (BaseX)

As an Engineer
I want to be informed if my project name in CoMPAS already exists in the SCL file type
So I prevent confusion (projects with the same name)

When the users enter a name in this window:
image

and clicks on the "save" button, CoMPAS should check if the name already exists for the selected SCL type.
If the name matches an existing one an error should show.

Background:
In issue #197 the base is created to check the uniqueness for the PostgreSQL implementation.
For BaseX this new method in the repository needs to be implemented to also check for uniqueness.

  • Implement the method to retrieve all the latest versions and retrieve the SclName private from the SCL XML. (Private Element "SclName" under the private section (type: "compas_scl") under the SCL Tag.)
  • Use these names to see if the (new) name is already used.

Test database versioning

As end-user

I would to able to retrieve multiple versions of a specific SCL file

So I can test if the versioning system works

Background:

Test it: import version 1, make some modifications and save it as version 2. Now, you should be able down retrieve both versions and the connection.

Acceptance criteria:

Separate file per version

Feature to load the latest version

Add history to XML file add storage time (select MAJOR/MINOR/PATCH)

Add type and (file)name as private element to SCL

As enduser
I want the type and (file)name to be stored
So that later the SCL can be exported to a file system with that name

We decided to store the (file)name and type (extension) as private element in the SCL.
This way this information can be used to search for and also save the SCL again to the file system.

Acceptance criteria:

  • Name and Type are added as private element when POST call is made (Create new SCL)
  • Type is set/added when PUT call is made (Update SCL) and name is copied from previous version if not already in new SCL.
  • For the ListResponse and VersionsResponse the Item class is extended with the name, this will be filled with the name from the private extension in CompasSclDataBaseXRepository (list and listVersionsByUUID methods).

Support use of Websockets to Save/Update/Retrieve SCL Files

As a engineer
I want to be able to save/update/retrieve large SCL Files
So that I can edit these files

Currently it takes some time to save or update large (50 MB) SCL files and this can cause time-outs when executing the call.
Just like the SCL Validator Service, Websockets support needs to be added to see if it's possible to work with these files with a time-out occurring.

There are 4 call that should support Websockets to work with large files (CompasSclDataResource.java):

  • POST
  • PUT
  • GET (/{id})
  • GET (/{id}/{version})

These calls all retrieve or/and return the SCL File.
See the PR com-pas/compas-scl-validator#49 for ideas how it was done in the Validator Service.
Remarks:

  • Use different event names to make a disquisition between the 4 calls, but handling can be done in a single Event Handler Class;
  • With the validator both REST API and Websockets are handled by the EventBus, for the Data Service this can also be done for these 4 calls;
  • Check the native image also if working. Validator Service is not (yet) a native image, so this needs some attention;

Make the Native Quarkus VM work

As a Developer
It would be nice to have the Quarkus Native Test working
So that this part of the application is also covered

Acceptance criteria
The services can be tested by calling the API calls.
The Quarkus Native test works

Background:
Currently the Native is isn't working anymore and marked out.

Naming convention of SSD and SCD files

This works for
Filename export a concatenation
Substationname_header.id_header.version_header.revision

Substationname is inside the SCD/SSD file (this is an open field, for other
header.id is a UUID

Bug: Determine the latest SCL file version in BaseX

As a user
I want the retrieve the latest version
So I can continue working on that

The semantic versioning is not very nice to use in sorting. It's not a number, but seen as string, so 2.0.9 is later then 2.0.10.
We need to figure a nice solution to sort the version in such way that the correct ordering is shown.

Basic security

As a user
I want to have basic security controls for service calls
So my data is protected

Acceptance criteria:
CRUD rights (on all file types)

SCL Data Service should support DTO's

In order to make the implementation better to maintain; The idea is to replace existing custom code by standard implementation. In order to do so; the DTO is concept is needed to prevent errors.

If we want to migrate to native Repositories (like has been done in Sitipe), we need to support DTO's (Data Transfer Objects).

App > Service > Repository
DTO > DTO/Entity translation > Entity

The Input and Output of the Service package should be DTO's.
The translation from/to a DTO should be in the Service.

Add support for multiple SCL/XSD versions in the data service

As an engineer
I would I like to store or use multiple 61850 versions
So I can store multiple versions of 61850 that are supported by the IED devices in the field

Background
IED's sometimes stay in a specific version. Therefore old 61850 versions needs to be supported.
OpenSCD supports 3 major SCD versions. New versions are backwards compatible.
This most importent in the SCL-data service.

Acceptance criteria:
Document the approach
Implement it;

MVP database versioning (BaseX)

As end-user
I would to able to store multiple versions of a specific SCL file
So I can test if the versioning system works

Background:
Test it: import version 1, make some modifications and save it as version 2. Now, you should be able down retrieve both versions and the connection.

Acceptance criteria:

  • Separate file per version
  • Feature to load the latest version
  • Add history to XML file add storage time (select MAJOR/MINOR/PATCH)

Define Data Model for the PostgreSQL implementation

As a developer
I want to define a table structure
So that we can store the SCL information in the PostgreSQL Database.

Background:
For the PostgreSQL version we need to define a table structure.
This can initially be very simple like the ID, Version, Name, SCL Content (Text)
Add database schema to the readme.md of the SCL dataservice.
The result of this issue should be a table definition.

Add Rest API to check if a SCL Name isn't already used

As a engineer
I want to have faster feedback when changing/using a SCL Name
So that I can change the name before the add/save returned a error

Background:
Issues #197 and #203 implement check the SCL Name isn't already used during adding/saving of the SCL File.
It would be nice that the front-end can make a call to check this before executing the add/save action.

  • Add a new Rest API Call (Post) to check if a name isn't already used ("/scl/v1/{type}/checkname")
  • It will retrieve the filename are parameter in the Request Body
  • Use this name to make the call the service layer, which make the call to the repository.
  • In the response return true/false to indicate if the name is unique.

Fixed native build after adding Jakarta Validator

Subject of the issue

After adding validation of the message retrieved by the Websocket the native image isn't working anymore.
The problem is that the logging is not displayed (see com-pas/compas-architecture#173) so it's very hard to determine what is missing. It may be something simple.

The validation is done in the decode method from the websocket-commons module in CoMPAS Core.
The suspicion is that the validator implementation is being removed by GraalVM.

Steps to reproduce

  • Build the container image using maven and "-Pnative-image".
  • Use this image for instance in the Docker Compose file of CoMPAS Deployment.
  • Open a file from the local file system.
  • Make sure Websocket is used in the CoMPAS Settings
  • Try saving the file to CoMPAS using the name invalid/*name.
  • There should be a error message showing the name is invalid.

Expected behaviour

There is a error shown that marshalling is went wrong (in Log Dialog).

Actual behaviour

There should be a message shown that the name is invalid and can't be used (in Log Dialog).

Add SCL Type STD to List

As a Engineer
I want to be able to select the SCL Type during opening and saving a SCL File
So that I can store and retrieve this type of SCL.

There is a enum SCLType containing all types of SCLs. We need to add the type STD ("System Template Definition") to this Enum.
Maybe also think about moving this Enum Class to the CoMPAS Core repository (Module "commons").

Update HItem, if exists, when adding/updating a SCL File

Subject of the issue

When add or saving a SCL File to the database a HItem is always created, but this can cause strange behavior if there is already a HItem with the same version/revision in the Header. Because the new one is added at the end of the list, the already existing one is shown in the frontend.

The idea is to cleanup HItem Elements that are created by CoMPAS, but keep the HItem Elements from other tools.
The ones from CoMPAS are there probably because the SCL File was already in CoMPAS, but is now saved as new SCL File.
The old HItem Elements are still there and can cause problems, because of uniqueness (version/revision) of the HItem Elements.

Steps to reproduce

Save a SCL File to the CoMPAS Database, next use the Save As to save that file with a other name.
In the new file there are now 2 HItem for version 1.0.0.

Expected behaviour

During creating and updating of a SCL File determine the new version and first remove all HItem Elements with the same of newer version (and revision is empty), before creating a new HItem Element for the new version.

Example 1 when adding the SCL File to CoMPAS (Version 1.0.0). Before:

<History>
  <Hitem version="1" revision="1" what="Device Relay_FIELDA is imported" when="..." who="...."/>
  <Hitem revision="" version="0.0.1" what="SCL created from CIM File(s)" when="..." who="..."/>
  <Hitem revision="" version="1.0.0" what="SCL created" when="..." who="..."/>
  <Hitem revision="" version="2.1.0" what="SCL updated" when="..." who="..."/>
</History>

After:

<History>
  <Hitem version="1" revision="1" what="Device Relay_FIELDA is imported" when="..." who="...."/>
  <Hitem revision="" version="0.0.1" what="SCL created from CIM File(s)" when="..." who="..."/>
  <Hitem revision="" version="1.0.0" what="<updated>" when="<updated>" who="<updated>"/>
</History>

Example 2 when upodating the SCL File in CoMPAS (2.0.0). Before

<History>
  <Hitem version="1" revision="1" what="Device Relay_FIELDA is imported" when="..." who="...."/>
  <Hitem revision="" version="0.0.1" what="SCL created from CIM File(s)" when="..." who="..."/>
  <Hitem revision="" version="1.0.0" what="SCL created" when="..." who="..."/>
  <Hitem revision="" version="2.1.0" what="SCL updated" when="..." who="..."/>
</History>

After:

<History>
  <Hitem version="1" revision="1" what="Device Relay_FIELDA is imported" when="..." who="...."/>
  <Hitem revision="" version="0.0.1" what="SCL created from CIM File(s)" when="..." who="..."/>
  <Hitem revision="" version="1.0.0" what="SCL created" when="..." who="..."/>
  <Hitem revision="" version="2.0.0" what="<new>" when="<new>" who="<new>"/>
</History>

Actual behaviour

Extra HItem Elements are created with the same version and revision, which also cause validation errors.

Additional information
Keep in mind to not check the string, but split the version into major/minor/patch version.
If the version doesn't meet this pattern it can be ignore and keep the HItem Element.

Move to Java 17

User Story

As a developer
I want to upgrade to Java 17
So that I can use the latest features and we keep up with Java releases (for security updated)

Acceptance criteria
The project is build with Java 17 and the containers are using Java 17 to run.
Convert some Model Classes to Records and check if it works.

Security Policy violation SECURITY.md

This issue was automatically created by Allstar.

Security Policy Violation
Security policy not enabled.
A SECURITY.md file can give users information about what constitutes a vulnerability and how to report one securely so that information about a bug is not publicly visible. Examples of secure reporting methods include using an issue tracker with private issue support, or encrypted email with a published key.

To fix this, add a SECURITY.md file that explains how to handle vulnerabilities found in your repository. Go to https://github.com/com-pas/compas-scl-data-service/security/policy to enable.

For more information, see https://docs.github.com/en/code-security/getting-started/adding-a-security-policy-to-your-repository.


This issue will auto resolve when the policy is in compliance.

Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

Saving SCD to database fails with 0102

Subject of the issue
When I want to save an SCD file to the database, I get an error with error code (0102) and the file is not saved to the database.

Steps to reproduce
Open any SCL. Go to save as and try to save as an SCD file.

We think that the issue is caused by large SCL files in the SCD section of the database. When opening those to check for name uniqueness is potentially causing a timeout.

Add new Call to retrieve userinfo from JWT

As a Developer
I need a Web Service call to retrieve user information
So that this info can be used in the web application

Background:
The web application needs in information about the user, like the username.
This information can be extracted from the JWT.
The solution is to create a new service call under /common/vi/userinfo to return this information.
For now the only information returned will be the element "name".
This will be a claim from the JWT that can be configured using the application.properties (+ override using a environment variable.)

Acceptance:
Make a call to the service and the XML Body is returned with the name.

Future:
For the future we can extend this call with info like canCreate/canUpdate/canDelete indicators to customize the webapplication even more.

Replace deprecated `set-output` in GitHub Actions before 31st May 2023

https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

used in 2 places:

run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"

echo "##[set-output name=sonar_opts;]$(echo -Dsonar.host.url=https://sonarcloud.io \

see also warning annotation:
image

relates to com-pas/contributing#65

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.