From d1a0c4daab08f682f9a7eeb9425d08f51dbd9849 Mon Sep 17 00:00:00 2001 From: Sahil Aggarwal Date: Wed, 14 Feb 2024 11:16:20 +0100 Subject: [PATCH] updated deprecated code --- .../tractusx/semantics/hub/samm/SDKAccessHelperSAMM.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/org/eclipse/tractusx/semantics/hub/samm/SDKAccessHelperSAMM.java b/backend/src/main/java/org/eclipse/tractusx/semantics/hub/samm/SDKAccessHelperSAMM.java index 21e46bc5..b8faa21c 100644 --- a/backend/src/main/java/org/eclipse/tractusx/semantics/hub/samm/SDKAccessHelperSAMM.java +++ b/backend/src/main/java/org/eclipse/tractusx/semantics/hub/samm/SDKAccessHelperSAMM.java @@ -31,6 +31,7 @@ import java.util.Optional; import org.apache.jena.rdf.model.Model; +import org.eclipse.esmf.aspectmodel.aas.AasFileFormat; import org.eclipse.esmf.aspectmodel.aas.AspectModelAASGenerator; import org.eclipse.esmf.aspectmodel.generator.diagram.AspectModelDiagramGenerator; import org.eclipse.esmf.aspectmodel.generator.diagram.AspectModelDiagramGenerator.Format; @@ -149,17 +150,17 @@ public Try getAasSubmodelTemplate( String urn, AasFormat aasFormat ) { try { switch ( aasFormat ) { case FILE: - aasGenerator.generateAASXFile( aspect, ( String s ) -> { + aasGenerator.generate( AasFileFormat.AASX, aspect, ( String s ) -> { return stream; } ); return Try.of( stream::toByteArray ); case XML: - aasGenerator.generateAasXmlFile( aspect, ( String s ) -> { + aasGenerator.generate( AasFileFormat.XML, aspect, ( String s ) -> { return stream; } ); return Try.of( stream::toString ); case JSON: - aasGenerator.generateAasJsonFile( aspect, ( String s ) -> { + aasGenerator.generate( AasFileFormat.JSON, aspect, ( String s ) -> { return stream; } ); return Try.of( stream::toString ); @@ -167,7 +168,7 @@ public Try getAasSubmodelTemplate( String urn, AasFormat aasFormat ) { return Try.failure( new Exception( String.format( "Wrong AAS output format %s", aasFormat.toString() ) ) ); } - } catch ( IOException e ) { + } catch ( Exception e ) { return Try.failure( e ); } }