Skip to content

Commit

Permalink
updated deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
agg3fe committed Feb 14, 2024
1 parent 9ea1dc0 commit d1a0c4d
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -149,25 +150,25 @@ 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 );
default:
return Try.failure( new Exception( String.format( "Wrong AAS output format %s", aasFormat.toString() ) ) );

}
} catch ( IOException e ) {
} catch ( Exception e ) {
return Try.failure( e );
}
}
Expand Down

0 comments on commit d1a0c4d

Please sign in to comment.