diff --git a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/serialization/EnumSerializer.java b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/serialization/EnumSerializer.java index 425e9cfdc..56b88f1af 100644 --- a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/serialization/EnumSerializer.java +++ b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/serialization/EnumSerializer.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. - * Copyright (c) 2023 SAP SE + * Copyright (C) 2023 SAP SE or an SAP affiliate company. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeDefXsd; import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeIec61360; import org.eclipse.digitaltwin.aas4j.v3.model.Direction; +import org.eclipse.digitaltwin.aas4j.v3.model.SecurityTypeEnum; import org.eclipse.digitaltwin.aas4j.v3.model.StateOfEvent; import java.io.IOException; @@ -52,6 +53,8 @@ public void serialize(Enum value, JsonGenerator gen, SerializerProvider provider } } else if (value instanceof DataTypeIec61360) { gen.writeString(value.name().toUpperCase()); + } else if (value instanceof SecurityTypeEnum) { + gen.writeString(value.name().toUpperCase()); } else if (value instanceof Direction || value instanceof StateOfEvent) { gen.writeString(value.name().toLowerCase()); } else if (ReflectionHelper.ENUMS.contains(value.getClass())) { diff --git a/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/Examples.java b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/Examples.java index 941d292d6..437fa5065 100644 --- a/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/Examples.java +++ b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/Examples.java @@ -42,6 +42,7 @@ public class Examples { .id("something_142922d6") .extensions(new DefaultExtension.Builder() .name("something_aae6caf4") + .valueType(DataTypeDefXsd.STRING) .build()) .assetInformation(new DefaultAssetInformation.Builder() .assetKind(AssetKind.NOT_APPLICABLE) @@ -86,7 +87,6 @@ public class Examples { .build()) .build(); - public static final Environment ENVIRONMENT_WITH_DUMMYDATASPEC = new DefaultEnvironment.Builder() .submodels( new DefaultSubmodel.Builder() diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonDeserializer.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonDeserializer.java index ab6275d9e..785769cd9 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonDeserializer.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonDeserializer.java @@ -16,128 +16,34 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; +import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.List; -import java.util.stream.Collectors; import org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException; -import org.eclipse.digitaltwin.aas4j.v3.model.Environment; -import org.eclipse.digitaltwin.aas4j.v3.model.Referable; import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver; - /** * Class for deserializing/parsing AAS JSON documents. */ public class JsonDeserializer { - protected JsonMapper mapper; protected SimpleAbstractTypeResolver typeResolver; private JsonMapperFactory jsonMapperFactory; - private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; - public JsonDeserializer() { typeResolver = new SimpleAbstractTypeResolverFactory().create(); jsonMapperFactory = new JsonMapperFactory(); mapper = jsonMapperFactory.create(typeResolver); } - /** - * Deserializes a given string into an instance of AssetAdministrationShellEnvironment - * - * @param value a string representation of the AssetAdministrationShellEnvironment - * @return an instance of AssetAdministrationShellEnvironment - * @throws DeserializationException if deserialization fails - */ - public Environment read(String value) throws DeserializationException { - try { - return mapper.readValue(value, Environment.class); - } catch (JsonProcessingException ex) { - throw new DeserializationException("error deserializing AssetAdministrationShellEnvironment", ex); - } - } - - /** - * Deserializes a given JSON node into an instance of AssetAdministrationShellEnvironment - * - * @param root root node of the document to parse - * @return an instance of AssetAdministrationShellEnvironment - * @throws DeserializationException if deserialization fails - */ - public Environment read(JsonNode root) throws DeserializationException { - try { - return mapper.treeToValue(root, Environment.class); - } catch (JsonProcessingException ex) { - throw new DeserializationException("error deserializing AssetAdministrationShellEnvironment", ex); - } - } - - /** - * Deserializes a given InputStream into an instance of AssetAdministrationShellEnvironment using DEFAULT_CHARSET - * - * @param src an InputStream containing the string representation of the AssetAdministrationShellEnvironment - * @return an instance of AssetAdministrationShellEnvironment - * @throws DeserializationException if deserialization fails - */ - public Environment read(InputStream src) throws DeserializationException { - return read(src, DEFAULT_CHARSET); - } - - /** - * Deserializes a given InputStream into an instance of AssetAdministrationShellEnvironment using a given charset - * - * @param src An InputStream containing the string representation of the AssetAdministrationShellEnvironment - * @param charset the charset to use for deserialization - * @return an instance of AssetAdministrationShellEnvironment - * @throws DeserializationException if deserialization fails - */ - public Environment read(InputStream src, Charset charset) throws DeserializationException { - return read(new BufferedReader( - new InputStreamReader(src, charset)) - .lines() - .collect(Collectors.joining(System.lineSeparator()))); - } - - /** - * Deserializes a given File into an instance of AssetAdministrationShellEnvironment using DEFAULT_CHARSET - * - * @param file A java.io.File containing the string representation of the AssetAdministrationShellEnvironment - * @param charset the charset to use for deserialization - * @return an instance of AssetAdministrationShellEnvironment - * @throws FileNotFoundException if file is not present - * @throws DeserializationException if deserialization fails - */ - public Environment read(java.io.File file, Charset charset) - throws FileNotFoundException, DeserializationException { - return read(new FileInputStream(file), charset); - } - - /** - * Deserializes a given File into an instance of AssetAdministrationShellEnvironment using a given charset - * - * @param file a java.io.File containing the string representation of the AssetAdministrationShellEnvironment - * @return an instance of AssetAdministrationShellEnvironment - * @throws FileNotFoundException if the file is not present - * @throws DeserializationException if deserialization fails - */ - public Environment read(java.io.File file) throws FileNotFoundException, DeserializationException { - return read(file, DEFAULT_CHARSET); - } - - /** * Enables usage of custom implementation to be used for deserialization instead of default implementation, e.g. * defining a custom implementation of the Submodel interface {@code class @@ -156,192 +62,134 @@ public void useImplementation(Class aasInterface, Class impl } /** - * Deserializes a given string into an instance of the given Referable + * Generic method to deserialize a given string into instance of an AAS type * - * @param src a string representation of the Referable - * @param outputClass most specific class of the given Referable - * @param type of the returned element - * @return an instance of the referable + * @param value a string representation of the AAS instance + * @param valueType the class type of the AAS instance. Not null. + * @param the AAS type + * @return the instance * @throws DeserializationException if deserialization fails */ - public T readReferable(String src, Class outputClass) throws DeserializationException { + public T read(String value, Class valueType) throws DeserializationException { try { - return mapper.readValue(src, outputClass); + return mapper.readValue(value, valueType); } catch (JsonProcessingException ex) { - throw new DeserializationException("error deserializing Referable", ex); + throw new DeserializationException("error deserializing " + valueType.getSimpleName(), ex); } } /** - * Deserializes a given input stream into an instance of the given Referable using DEFAULT_CHARSET + * Generic method to deserialize a given string into a list of AAS instances * - * @param src a input stream representing a Referable - * @param outputClass most specific class of the given Referable - * @param type of the returned element - * @return an instance of the referable + * @param value a string representation of the AAS instances list + * @param valueType the class type of the instance. Not null. + * @param the AAS type + * @return a list of AAS instances * @throws DeserializationException if deserialization fails */ - public T readReferable(InputStream src, Class outputClass) throws DeserializationException { - return readReferable(src, DEFAULT_CHARSET, outputClass); - } - - /** - * Deserializes a given input stream into an instance of the given Referable using DEFAULT_CHARSET - * - * @param root JSON node representing a Referable - * @param outputClass most specific class of the given Referable - * @param type of the returned element - * @return an instance of the referable - * @throws DeserializationException if deserialization fails - */ - public T readReferable(JsonNode root, Class outputClass) throws DeserializationException { + public List readList(String value, Class valueType) throws DeserializationException { try { - return mapper.treeToValue(root, outputClass); + return mapper.readValue(value, mapper.getTypeFactory().constructCollectionLikeType(List.class, valueType)); } catch (JsonProcessingException ex) { - throw new DeserializationException("error deserializing Referable", ex); + throw new DeserializationException("error deserializing list of " + valueType.getSimpleName(), ex); } } /** - * Deserializes a given input stream into an instance of the given Referable + * Generic method to deserialize a given InputStream into instance of an AAS type, using the default UTF-8 charset * - * @param src a input stream representing a Referable - * @param charset the charset to use - * @param outputClass most specific class of the given Referable - * @param type of the returned element - * @return an instance of the referable + * @param stream An InputStream containing the string representation of the AAS instance + * @param valueType the class type of the AAS instance. Not null. + * @param the AAS type + * @return an AAS instance * @throws DeserializationException if deserialization fails */ - public T readReferable(InputStream src, Charset charset, Class outputClass) throws DeserializationException { - return readReferable(new BufferedReader( - new InputStreamReader(src, charset)) - .lines() - .collect(Collectors.joining(System.lineSeparator())), - outputClass); + public T read(InputStream stream, Class valueType) throws DeserializationException { + return read(stream, StandardCharsets.UTF_8, valueType); } /** - * Deserializes a given file into an instance of the given Referable using DEFAULT_CHARSET + * Generic method to deserialize a given InputStream into instance of an AAS type, using a given charset * - * @param src a file containing string representation of a Referable - * @param outputClass most specific class of the given Referable - * @param type of the returned element - * @return an instance of the referable + * @param stream An InputStream containing the string representation of the AAS instance + * @param charset the charset to use for deserialization + * @param valueType the class type of the AAS instance. Not null. + * @param the AAS type + * @return an AAS instance * @throws DeserializationException if deserialization fails - * @throws java.io.FileNotFoundException if file is not found */ - public T readReferable(File src, Class outputClass) throws DeserializationException, FileNotFoundException { - return readReferable(src, DEFAULT_CHARSET, outputClass); + public T read(InputStream stream, Charset charset, Class valueType) throws DeserializationException { + try { + return mapper.readValue(new InputStreamReader(stream, charset), valueType); + } catch (IOException ex) { + throw new DeserializationException("error deserializing " + valueType.getSimpleName(), ex); + } } /** - * Deserializes a given file into an instance of the given Referable + * Deserializes a given input stream into a list of AAS instances using the default UTF-8 charset * - * @param src a file containing string representation of a Referable - * @param charset the charset to use - * @param outputClass most specific class of the given Referable - * @param type of the returned element - * @return an instance of the referable + * @param stream An InputStream containing the string representation of the AAS instances list + * @param valueType the class type of the AAS instance. Not null. + * @param the AAS type + * @return a list of AAS instances * @throws DeserializationException if deserialization fails - * @throws java.io.FileNotFoundException if file is not found */ - public T readReferable(File src, Charset charset, Class outputClass) throws DeserializationException, FileNotFoundException { - return readReferable(new FileInputStream(src), charset, outputClass); + public List readList(InputStream stream, Class valueType) throws DeserializationException { + return readList(stream, StandardCharsets.UTF_8, valueType); } /** - * Deserializes a given string into an instance of a list of the given Referables + * Deserializes a given input stream into a list of AAS instances * - * @param referables a string representation of an array of Referables - * @param outputClass most specific class of the given Referable - * @param type of the returned element - * @return an instance of a list of the referables - * @throws DeserializationException if deserialization of referable fails + * @param stream An InputStream containing the string representation of the AAS instances list + * @param charset the charset to use for deserialization + * @param valueType the class type of the AAS instance. Not null. + * @param the AAS type + * @return a list of AAS instances + * @throws DeserializationException if deserialization fails */ - public List readReferables(String referables, Class outputClass) throws DeserializationException { + public List readList(InputStream stream, Charset charset, Class valueType) throws DeserializationException { try { - return mapper.readValue(referables, new TypeReference>() { - }); - } catch (JsonProcessingException ex) { - throw new DeserializationException("error deserializing list of Referable", ex); + return mapper.readValue(new InputStreamReader(stream, charset), + mapper.getTypeFactory().constructCollectionLikeType(List.class, valueType)); + } catch (Exception ex) { + throw new DeserializationException("error deserializing list of " + valueType.getSimpleName(), ex); } } /** - * Deserializes a given string into an instance of a list of the given Referables + * Generic method to deserialize a given JSON node into instance of an AAS type + * + * @param node the node to parse + * @param valueType the class type of the AAS instance. Not null. + * @param the AAS type + * @return an AAS instance * - * @param root JSON node representation of an array of Referables - * @param outputClass most specific class of the given Referable - * @param type of the returned element - * @return an instance of a list of the referables - * @throws DeserializationException if deserialization of referable fails + * @throws DeserializationException if deserialization fails */ - public List readReferables(JsonNode root, Class outputClass) throws DeserializationException { + public T read(JsonNode node, Class valueType) throws DeserializationException { try { - return mapper.treeToValue(root, mapper.getTypeFactory().constructCollectionLikeType(List.class, outputClass)); + return mapper.treeToValue(node, valueType); } catch (JsonProcessingException ex) { - throw new DeserializationException("error deserializing list of Referable", ex); + throw new DeserializationException("error deserializing " + valueType.getSimpleName(), ex); } } /** - * Deserializes a given input stream into an instance of a list of the given Referable using DEFAULT_CHARSET - * - * @param src a input stream representing a Referable - * @param outputClass most specific class of the given Referable - * @param type of the returned element - * @return an instance of the referable - * @throws DeserializationException if deserialization fails - */ - public List readReferables(InputStream src, Class outputClass) throws DeserializationException { - return readReferables(src, DEFAULT_CHARSET, outputClass); - } - - /** - * Deserializes a given input stream into an instance of a list of the given Referable - * - * @param src a input stream representing a Referable - * @param charset the charset to use - * @param outputClass most specific class of the given Referable - * @param type of the returned element - * @return an instance of the referable - * @throws DeserializationException if deserialization fails - */ - public List readReferables(InputStream src, Charset charset, Class outputClass) throws DeserializationException { - return readReferables(new BufferedReader( - new InputStreamReader(src, charset)) - .lines() - .collect(Collectors.joining(System.lineSeparator())), - outputClass); - } - - /** - * Deserializes a given file into an instance of a list of the given Referable using DEFAULT_CHARSET + * Deserializes a given JsonArray into a list of AAS instances * - * @param src a file containing string representation of a Referable - * @param outputClass most specific class of the given Referable - * @param type of the returned element - * @return an instance of the referable + * @param node a JsonArray representing the AAS instances list + * @param valueType the class type of the instance. Not null. + * @param the AAS type + * @return a list of AAS instances * @throws DeserializationException if deserialization fails - * @throws java.io.FileNotFoundException if file is not found */ - public List readReferables(File src, Class outputClass) throws DeserializationException, FileNotFoundException { - return readReferables(src, DEFAULT_CHARSET, outputClass); - } - - /** - * Deserializes a given file into an instance of a list of the given Referable - * - * @param src a file containing string representation of a Referable - * @param charset the charset to use - * @param outputClass most specific class of the given Referable - * @param type of the returned element - * @return an instance of the referable - * @throws DeserializationException if deserialization fails - * @throws java.io.FileNotFoundException if file is not found - */ - public List readReferables(File src, Charset charset, Class outputClass) throws DeserializationException, FileNotFoundException { - return readReferables(new FileInputStream(src), charset, outputClass); + public List readList(JsonNode node, Class valueType) throws DeserializationException { + try { + return mapper.treeToValue(node, mapper.getTypeFactory().constructCollectionLikeType(List.class, valueType)); + } catch (JsonProcessingException ex) { + throw new DeserializationException("error deserializing list of " + valueType.getSimpleName(), ex); + } } - } \ No newline at end of file diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonSerializer.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonSerializer.java index 993ee925d..527468176 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonSerializer.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonSerializer.java @@ -16,8 +16,6 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; @@ -27,194 +25,145 @@ import java.util.List; import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; -import org.eclipse.digitaltwin.aas4j.v3.model.Environment; -import org.eclipse.digitaltwin.aas4j.v3.model.Referable; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectWriter; import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeFactory; /** - * Class for serializing an instance of AssetAdministrationShellEnvironment or Referables to - * JSON. + * Class for serializing of AAS instances. */ public class JsonSerializer { - protected JsonMapper mapper; - private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; - public JsonSerializer() { mapper = new JsonMapperFactory().create(new SimpleAbstractTypeResolverFactory().create()); } /** - * Serializes a given instance of AssetAdministrationShellEnvironment to string + * Generic method to serialize a given AAS instance to a string * - * @param aasEnvironment the AssetAdministrationShellEnvironment to serialize - * @return the string representation of the environment + * @param aasInstance the AAS instance to serialize + * @return the string representation * @throws SerializationException if serialization fails */ - public String write(Environment aasEnvironment) throws SerializationException { + public String write(Object aasInstance) throws SerializationException { try { - return mapper.writeValueAsString(aasEnvironment); + return mapper.writeValueAsString(aasInstance); } catch (JsonProcessingException ex) { - throw new SerializationException("error serializing AssetAdministrationShellEnvironment", ex); + throw new SerializationException( + String.format("error serializing %s", aasInstance.getClass().getSimpleName()), ex); } } /** - * Converts a given instance of AssetAdministrationShellEnvironment as JSON node. - * - * @param aasEnvironment the AssetAdministrationShellEnvironment to serialize - * @return the JSON node representation of the environment - */ - public JsonNode toNode(Environment aasEnvironment) { - return mapper.valueToTree(aasEnvironment); - } - - /** - * Serializes a given instance of Environment to an OutputStream using DEFAULT_CHARSET - * - * @param out the Outputstream to serialize to - * @param aasEnvironment the Environment to serialize - * @throws IOException if writing to the stream fails + * Generic method to serialize a collection. + * @param collection the collection to serialize. Not null. + * @return the string representation of the collection. * @throws SerializationException if serialization fails */ - void write(OutputStream out, Environment aasEnvironment) throws IOException, SerializationException { - write(out, DEFAULT_CHARSET, aasEnvironment); - } + public String writeList(Collection collection) throws SerializationException { + if (collection == null || collection.isEmpty()) { + return write(collection); + } - /** - * Serializes a given instance of Environment to an OutputStream using given charset - * - * @param out the Outputstream to serialize to - * @param charset the Charset to use for serialization - * @param aasEnvironment the Environment to serialize - * @throws IOException if writing to the stream fails - * @throws SerializationException if serialization fails - */ - void write(OutputStream out, Charset charset, Environment aasEnvironment) - throws IOException, SerializationException { - try (OutputStreamWriter writer = new OutputStreamWriter(out, charset)) { - writer.write(write(aasEnvironment)); + Class clazz = collection.iterator().next().getClass(); + try { + return mapper.writerFor(mapper.getTypeFactory().constructCollectionType(List.class, clazz)) + .writeValueAsString(collection); + } catch (JsonProcessingException ex) { + throw new SerializationException("error serializing list of " + clazz.getSimpleName(), ex); } } - // Note that the AAS also defines a file class /** - * Serializes a given instance of Environment to a java.io.File using DEFAULT_CHARSET + * Generic method to convert a given AAS instance to a JSON node * - * @param file the java.io.File to serialize to - * @param charset the Charset to use for serialization - * @param aasEnvironment the Environment to serialize - * @throws FileNotFoundException if the fail does not exist - * @throws IOException if writing to the file fails - * @throws SerializationException if serialization fails + * @param aasInstance the AAS instance to serialize + * @return the JSON node representation + * @throws IllegalArgumentException */ - void write(java.io.File file, Charset charset, Environment aasEnvironment) - throws FileNotFoundException, IOException, SerializationException { - try (OutputStream out = new FileOutputStream(file)) { - write(out, charset, aasEnvironment); - } + public JsonNode toNode(Object aasInstance) { + return mapper.valueToTree(aasInstance); } /** - * Serializes a given instance of Environment to a java.io.File using given charset + * Generic method to convert a collection of AAS instances to a JSON array * - * @param file the java.io.File to serialize to - * @param aasEnvironment the Environment to serialize - * @throws FileNotFoundException if the fail does not exist - * @throws IOException if writing to the file fails - * @throws SerializationException if serialization fails + * @param aasInstances the list of AAS instances to convert + * @return the JSON array representation + * @throws IllegalArgumentException */ - void write(java.io.File file, Environment aasEnvironment) - throws FileNotFoundException, IOException, SerializationException { - write(file, DEFAULT_CHARSET, aasEnvironment); + public JsonNode toArrayNode(Collection aasInstances) { + if(aasInstances == null) { + return JsonNodeFactory.instance.nullNode(); + } + ArrayNode result = JsonNodeFactory.instance.arrayNode(); + for (Object obj : aasInstances) { + result.add(toNode(obj)); + } + return result; } /** - * Serializes a given instance of a Referable to string + * Generic method to serialize a given AAS instance to an output stream using given charset * - * @param referable the referable to serialize - * @return the string representation of the referable + * @param out the output stream to serialize to + * @param charset the charset to use for serialization + * @param aasInstance the AAS instance to serialize * @throws SerializationException if serialization fails */ - public String write(Referable referable) throws SerializationException { + public void write(OutputStream out, Charset charset, Object aasInstance) throws SerializationException { try { - return mapper.writeValueAsString(referable); - } catch (JsonProcessingException ex) { - throw new SerializationException("error serializing Referable", ex); + mapper.writeValue(new OutputStreamWriter(out, charset), aasInstance); + } catch (IOException ex) { + throw new SerializationException("error serializing " + aasInstance.getClass().getSimpleName() , ex); } } /** - * Converts a given instance of a Referable to a JSON node. + * Generic method to serialize a given AAS instance to an output stream using UTF-8 charset * - * @param referable the referable to serialize - * @return the JSON node representation of the referable + * @param out the output stream to serialize to + * @param aasInstance the AAS instance to serialize + * @throws SerializationException if serialization fails */ - public JsonNode toNode(Referable referable) { - return mapper.valueToTree(referable); + public void write(OutputStream out, Object aasInstance) throws SerializationException { + write(out, StandardCharsets.UTF_8, aasInstance); } /** + * Generic method to serialize a collection of AAS instances to an output stream using given charset * - * @param referables the referables to serialize - * @return the string representation of the list of referables + * @param out the output stream to serialize to + * @param charset the charset to use for serialization + * @param collection the collection of AAS instances to serialize * @throws SerializationException if serialization fails */ - public String write(Collection referables) throws SerializationException { - if (referables == null) { - return null; - } else if (referables.isEmpty()) { - return mapper.createArrayNode().toString(); - } - - try { - return mapper.writerFor(mapper.getTypeFactory().constructCollectionType(List.class, referables.iterator().next().getClass())) - .writeValueAsString(referables); - } catch (JsonProcessingException ex) { - throw new SerializationException("error serializing list of Referables", ex); + public void writeList(OutputStream out, Charset charset, Collection collection) throws SerializationException { + if (collection == null || collection.isEmpty()) { + write(out, charset, collection); + } else { + Class clazz = collection.iterator().next().getClass(); + try { + mapper.writerFor(mapper.getTypeFactory().constructCollectionType(List.class, clazz)) + .writeValue(new OutputStreamWriter(out, charset), collection); + } catch (IOException ex) { + throw new SerializationException("error serializing list of " + clazz.getSimpleName(), ex); + } } } /** + * Generic method to serialize a collection of AAS instances to an output stream using UTF-8 charset * - * @param referables the referables to serialize - * @return the string representation of the list of referables + * @param out the output stream to serialize to + * @param collection the collection of AAS instances to serialize + * @throws SerializationException if serialization fails */ - public JsonNode toNode(Collection referables) { - if (referables == null) { - return null; - } else if (referables.isEmpty()) { - return mapper.createArrayNode(); - } - return mapper.valueToTree(referables); - } - - public String writeReferable(Referable referable) throws SerializationException { - try { - return mapper.writeValueAsString(mapper.valueToTree(referable)); - } catch (JsonProcessingException ex) { - throw new SerializationException("error serializing Referable", ex); - } - } - - public String writeReferables(List referables) throws SerializationException { - if(referables.isEmpty()){ - return "[]"; - } - - try { - ObjectWriter objectWriter = mapper.writerFor(mapper.getTypeFactory().constructCollectionType(List.class, referables.get(0).getClass())); - String json = objectWriter.writeValueAsString(referables); - - return mapper.writeValueAsString(this.mapper.readTree(json)); - - } catch (JsonProcessingException ex) { - throw new SerializationException("error serializing list of Referables", ex); - } + public void writeList(OutputStream out, Collection collection) throws SerializationException { + writeList(out, StandardCharsets.UTF_8, collection); } -} +} \ No newline at end of file diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AnnotatedRelationshipElementMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AnnotatedRelationshipElementMixin.java deleted file mode 100644 index 434115819..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AnnotatedRelationshipElementMixin.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.DataElement; - -import java.util.List; - -public interface AnnotatedRelationshipElementMixin { - - @JsonProperty("annotations") - public List getAnnotations(); - - @JsonProperty("annotations") - public void setAnnotations(List annotations); -} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AssetAdministrationShellMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AssetAdministrationShellMixin.java index 01f4f53a1..b71c21b9e 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AssetAdministrationShellMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AssetAdministrationShellMixin.java @@ -15,11 +15,11 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; -import com.fasterxml.jackson.annotation.JsonInclude; import org.eclipse.digitaltwin.aas4j.v3.model.AssetInformation; -public interface AssetAdministrationShellMixin { +import com.fasterxml.jackson.annotation.JsonInclude; +public interface AssetAdministrationShellMixin { @JsonInclude(JsonInclude.Include.ALWAYS) - public AssetInformation getAssetInformation(); -} + AssetInformation getAssetInformation(); +} \ No newline at end of file diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AssetInformationMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AssetInformationMixin.java index 810b7232c..d5fc45b33 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AssetInformationMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AssetInformationMixin.java @@ -15,18 +15,11 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; import org.eclipse.digitaltwin.aas4j.v3.model.AssetKind; -public interface AssetInformationMixin { +import com.fasterxml.jackson.annotation.JsonInclude; +public interface AssetInformationMixin { @JsonInclude(JsonInclude.Include.ALWAYS) - public AssetKind getAssetKind(); - - @JsonProperty("globalAssetId") - public String getGlobalAssetId(); - - @JsonProperty("globalAssetId") - public void setGlobalAssetId(String globalAssetId); + AssetKind getAssetKind(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/BlobMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/BlobMixin.java index 7dec06cbe..23ed61c3f 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/BlobMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/BlobMixin.java @@ -18,7 +18,6 @@ import com.fasterxml.jackson.annotation.JsonInclude; public interface BlobMixin { - @JsonInclude(JsonInclude.Include.ALWAYS) - public String getMimeType(); + String getMimeType(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ConceptDescriptionMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ConceptDescriptionMixin.java deleted file mode 100644 index 3b31ea790..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ConceptDescriptionMixin.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.Reference; - -import java.util.List; - -public interface ConceptDescriptionMixin { - - @JsonProperty("isCaseOf") - public List getIsCaseOf(); - - @JsonProperty("isCaseOf") - public void setIsCaseOf(List isCaseOf); -} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/DataSpecificationIec61360Mixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/DataSpecificationIec61360Mixin.java index 2d3281b2c..9653720d3 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/DataSpecificationIec61360Mixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/DataSpecificationIec61360Mixin.java @@ -15,32 +15,13 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.LangStringPreferredNameTypeIec61360; -import org.eclipse.digitaltwin.aas4j.v3.model.LevelType; -import org.eclipse.digitaltwin.aas4j.v3.model.Reference; - import java.util.List; -public interface DataSpecificationIec61360Mixin { - - @JsonProperty("levelType") - public List getLevelTypes(); +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringPreferredNameTypeIec61360; - @JsonProperty("levelType") - public void setLevelTypes(List levelTypes); +import com.fasterxml.jackson.annotation.JsonInclude; +public interface DataSpecificationIec61360Mixin { @JsonInclude(JsonInclude.Include.ALWAYS) - @JsonProperty("preferredName") - public List getPreferredName(); - - @JsonProperty("preferredName") - public void setPreferredName(List preferredName); - - @JsonProperty("unitId") - public Reference getUnitId(); - - @JsonProperty("unitId") - public void setUnitId(Reference unitId); + List getPreferredName(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/PropertyMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EndpointMixin.java similarity index 68% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/PropertyMixin.java rename to dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EndpointMixin.java index 328276991..da1f46232 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/PropertyMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EndpointMixin.java @@ -1,5 +1,6 @@ /* - * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * + * Copyright (C) 2023 SAP SE or an SAP affiliate company. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,13 +17,11 @@ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.Reference; - -public interface PropertyMixin { - @JsonProperty("valueId") - public Reference getValueId(); +public interface EndpointMixin { + @JsonProperty("interface") + String get_interface(); - @JsonProperty("valueId") - public void setValueId(Reference valueId); + @JsonProperty("interface") + void set_interface(String _interface); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EntityMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EntityMixin.java index edc862bf9..189a273ce 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EntityMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EntityMixin.java @@ -15,18 +15,12 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; import org.eclipse.digitaltwin.aas4j.v3.model.EntityType; +import com.fasterxml.jackson.annotation.JsonInclude; + public interface EntityMixin { @JsonInclude(JsonInclude.Include.ALWAYS) - public EntityType getEntityType(); - - @JsonProperty("globalAssetId") - public String getGlobalAssetId(); - - @JsonProperty("globalAssetId") - public void setGlobalAssetId(String globalAssetId); + EntityType getEntityType(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EnvironmentMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EnvironmentMixin.java index c4aacb2c8..11261f1b3 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EnvironmentMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EnvironmentMixin.java @@ -15,22 +15,22 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; -import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.List; +import java.util.Set; + import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell; import org.eclipse.digitaltwin.aas4j.v3.model.ConceptDescription; import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; -import java.util.List; -import java.util.Set; +import com.fasterxml.jackson.annotation.JsonInclude; public interface EnvironmentMixin { - @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Set getAssetAdministrationShells(); + Set getAssetAdministrationShells(); @JsonInclude(JsonInclude.Include.NON_EMPTY) - public List getSubmodels(); + List getSubmodels(); @JsonInclude(JsonInclude.Include.NON_EMPTY) - public List getConceptDescriptions(); + List getConceptDescriptions(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ExtensionMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ExtensionMixin.java index f169a29ed..06240b00a 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ExtensionMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ExtensionMixin.java @@ -18,7 +18,6 @@ import com.fasterxml.jackson.annotation.JsonInclude; public interface ExtensionMixin { - @JsonInclude(JsonInclude.Include.ALWAYS) - public String getName(); + String getName(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/FileMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/FileMixin.java index 91b903b08..e32942542 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/FileMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/FileMixin.java @@ -18,7 +18,6 @@ import com.fasterxml.jackson.annotation.JsonInclude; public interface FileMixin { - @JsonInclude(JsonInclude.Include.ALWAYS) - public String getContentType(); + String getContentType(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/HasDataSpecificationMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/HasDataSpecificationMixin.java deleted file mode 100644 index ddf50345a..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/HasDataSpecificationMixin.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.EmbeddedDataSpecification; -import org.eclipse.digitaltwin.aas4j.v3.model.Reference; - -import java.util.List; - -public interface HasDataSpecificationMixin { - - @JsonProperty("embeddedDataSpecifications") - public List getEmbeddedDataSpecifications(); - - @JsonProperty("embeddedDataSpecifications") - public void setEmbeddedDataSpecifications(List embeddedDataSpecifications); - - @JsonProperty("dataSpecifications") - public List getDataSpecifications(); - - @JsonProperty("dataSpecifications") - public void setDataSpecifications(List dataSpecifications); -} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/HasSemanticsMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/HasSemanticsMixin.java deleted file mode 100644 index 574e3e035..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/HasSemanticsMixin.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2023 jab. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.Reference; - -public interface HasSemanticsMixin { - @JsonProperty("semanticId") - public Reference getSemanticId(); - - @JsonProperty("semanticId") - public void setSemanticId(Reference semanticId); -} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/IdentifiableMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/IdentifiableMixin.java index 301a31bc6..96d0dfd8d 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/IdentifiableMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/IdentifiableMixin.java @@ -18,7 +18,6 @@ import com.fasterxml.jackson.annotation.JsonInclude; public interface IdentifiableMixin { - @JsonInclude(JsonInclude.Include.ALWAYS) - public String getId(); + String getId(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/KeyMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/KeyMixin.java index fbbe1f0e2..26de3024d 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/KeyMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/KeyMixin.java @@ -15,14 +15,14 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; -import com.fasterxml.jackson.annotation.JsonInclude; import org.eclipse.digitaltwin.aas4j.v3.model.KeyTypes; -public interface KeyMixin { +import com.fasterxml.jackson.annotation.JsonInclude; +public interface KeyMixin { @JsonInclude(JsonInclude.Include.ALWAYS) - public KeyTypes getType(); + KeyTypes getType(); @JsonInclude(JsonInclude.Include.ALWAYS) - public String getValue(); + String getValue(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/MultiLanguagePropertyMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/MultiLanguagePropertyMixin.java deleted file mode 100644 index 50f7c3383..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/MultiLanguagePropertyMixin.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; -import org.eclipse.digitaltwin.aas4j.v3.model.Reference; - -import java.util.List; - -public interface MultiLanguagePropertyMixin { - - @JsonProperty("value") - public List getValue(); - - @JsonProperty("value") - public void setValue(LangStringTextType value); - - @JsonProperty("valueId") - public Reference getValueId(); - - @JsonProperty("valueId") - public void setValueId(Reference valueId); -} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/OperationMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/OperationMixin.java deleted file mode 100644 index ffb0316f7..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/OperationMixin.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; - -import java.util.List; - -public interface OperationMixin { - - @JsonProperty("inputVariables") - public List getInputVariables(); - - @JsonProperty("inputVariables") - public void setInputVariables(List inputVariables); - - @JsonProperty("inoutputVariables") - public List getInoutputVariables(); - - @JsonProperty("inoutputVariables") - public void setInoutputVariables(List inoutputVariables); - - @JsonProperty("outputVariables") - public List getOutputVariables(); - - @JsonProperty("outputVariables") - public void setOutputVariables(List outputVariables); -} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/OperationVariableMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/OperationVariableMixin.java index 33ca567e1..aec20388d 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/OperationVariableMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/OperationVariableMixin.java @@ -15,11 +15,11 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; -import com.fasterxml.jackson.annotation.JsonInclude; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; -public interface OperationVariableMixin { +import com.fasterxml.jackson.annotation.JsonInclude; +public interface OperationVariableMixin { @JsonInclude(JsonInclude.Include.ALWAYS) - public SubmodelElement getValue(); + SubmodelElement getValue(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/QualifierMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/QualifierMixin.java index 3e1efbdef..53f937f59 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/QualifierMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/QualifierMixin.java @@ -16,17 +16,8 @@ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.Reference; public interface QualifierMixin { - @JsonInclude(JsonInclude.Include.ALWAYS) - public String getType(); - - @JsonProperty("valueId") - public Reference getValueId(); - - @JsonProperty("valueId") - public void setValueId(Reference valueId); + String getType(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/RangeMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/RangeMixin.java index 49fdef609..d7b609ac4 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/RangeMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/RangeMixin.java @@ -18,7 +18,6 @@ import com.fasterxml.jackson.annotation.JsonInclude; public interface RangeMixin { - @JsonInclude(JsonInclude.Include.ALWAYS) - public String getValueType(); + String getValueType(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ReferableMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ReferableMixin.java deleted file mode 100644 index d93eb2c17..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ReferableMixin.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.LangStringNameType; -import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; - -import java.util.List; - -public interface ReferableMixin { - - @JsonProperty("description") - public List getDescription(); - - @JsonProperty("description") - public void setDescription(List description); - - @JsonProperty("displayName") - public List getDisplayName(); - - @JsonProperty("displayName") - public void setDisplayName(List displayNames); -} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ReferenceMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ReferenceMixin.java index 9105bc8bf..222de6026 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ReferenceMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ReferenceMixin.java @@ -15,23 +15,17 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + import org.eclipse.digitaltwin.aas4j.v3.model.Key; import org.eclipse.digitaltwin.aas4j.v3.model.ReferenceTypes; -import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; public interface ReferenceMixin { - @JsonInclude(JsonInclude.Include.ALWAYS) - @JsonProperty("keys") - public List getKeys(); + List getKeys(); @JsonInclude(JsonInclude.Include.ALWAYS) - @JsonProperty("type") - public ReferenceTypes getType(); - - @JsonProperty("type") - public void setType(ReferenceTypes type); -} + ReferenceTypes getType(); +} \ No newline at end of file diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/RelationshipElementMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/RelationshipElementMixin.java index 04abbe3a3..cc3adb685 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/RelationshipElementMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/RelationshipElementMixin.java @@ -15,14 +15,14 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; -import com.fasterxml.jackson.annotation.JsonInclude; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; -public interface RelationshipElementMixin { +import com.fasterxml.jackson.annotation.JsonInclude; +public interface RelationshipElementMixin { @JsonInclude(JsonInclude.Include.ALWAYS) - public Reference getFirst(); + Reference getFirst(); @JsonInclude(JsonInclude.Include.ALWAYS) - public Reference getSecond(); + Reference getSecond(); } diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SpecificAssetIdMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SpecificAssetIdMixin.java deleted file mode 100644 index ae379d373..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SpecificAssetIdMixin.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2023 jab. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.Reference; - -public interface SpecificAssetIdMixin { - - @JsonProperty("externalSubjectId") - public Reference getExternalSubjectId(); - - @JsonProperty("externalSubjectId") - public void setExternalSubjectId(Reference reference); -} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelElementCollectionMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelElementCollectionMixin.java deleted file mode 100644 index f56304f81..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelElementCollectionMixin.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; - -import java.util.Collection; - -public interface SubmodelElementCollectionMixin { - - @JsonProperty("value") - public Collection getValue(); - - @JsonProperty("value") - public void setValue(Collection values); -} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelElementListMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelElementListMixin.java index 7f3492674..3ea2fa1b1 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelElementListMixin.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelElementListMixin.java @@ -17,45 +17,8 @@ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.AasSubmodelElements; -import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeDefXsd; -import org.eclipse.digitaltwin.aas4j.v3.model.Reference; -import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; - -import java.util.Collection; public interface SubmodelElementListMixin { - - @JsonInclude(JsonInclude.Include.NON_DEFAULT) - @JsonProperty("orderRelevant") - public boolean getOrdered(); - - @JsonInclude(JsonInclude.Include.NON_DEFAULT) - @JsonProperty("orderRelevant") - public void setOrdered(boolean orderRelevant); - - @JsonProperty("semanticIdListElement") - public Reference getSemanticIdListElement(); - - @JsonProperty("semanticIdListElement") - public void setSemanticIdListElement(Reference semanticIdListElement); - - @JsonProperty("typeValueListElement") - public AasSubmodelElements getTypeValueListElement(); - - @JsonProperty("typeValueListElement") - public void setTypeValueListElement(AasSubmodelElements typeValueListElement); - - @JsonProperty("valueTypeListElement") - public DataTypeDefXsd getValueTypeListElement(); - - @JsonProperty("valueTypeListElement") - public void setValueTypeListElement(DataTypeDefXsd valueTypeListElement); - - @JsonProperty("value") - public Collection getValue(); - - @JsonProperty("value") - public void setValue(Collection value); + @JsonInclude(JsonInclude.Include.ALWAYS) + boolean getOrderRelevant(); } \ No newline at end of file diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelMixin.java deleted file mode 100644 index 1d8f7a03c..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelMixin.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. - * Copyright (C) 2023 SAP SE or an SAP affiliate company. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.LangStringNameType; -import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; - -import java.util.List; - -public interface SubmodelMixin { - @JsonProperty("idShort") - public String getIdShort(); - - @JsonProperty("idShort") - public void setIdShort(String idShort); - - @JsonProperty("description") - public List getDescription(); - - @JsonProperty("description") - public void setDescription(List description); - - @JsonProperty("displayName") - public List getDisplayName(); - - @JsonProperty("displayName") - public void setDisplayName(List displayName); -} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ValueReferencePairMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ValueReferencePairMixin.java deleted file mode 100644 index 8a8b08338..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ValueReferencePairMixin.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2023 jab. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; - -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.Reference; - -public interface ValueReferencePairMixin { - - @JsonProperty("valueId") - public Reference getValueId(); - - @JsonProperty("valueId") - public void setValueId(Reference valueId); -} diff --git a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonDeserializerTest.java b/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonDeserializerTest.java index b4f819499..45761420b 100644 --- a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonDeserializerTest.java +++ b/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonDeserializerTest.java @@ -15,67 +15,242 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASSimple; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.CustomProperty; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.CustomSubmodel; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.CustomSubmodel2; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.util.ExampleData; import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.util.Examples; +import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShellDescriptor; +import org.eclipse.digitaltwin.aas4j.v3.model.ConceptDescription; +import org.eclipse.digitaltwin.aas4j.v3.model.DataSpecificationContent; +import org.eclipse.digitaltwin.aas4j.v3.model.DefaultDummyDataSpecification; import org.eclipse.digitaltwin.aas4j.v3.model.Environment; import org.eclipse.digitaltwin.aas4j.v3.model.Property; +import org.eclipse.digitaltwin.aas4j.v3.model.Referable; import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; +import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelDescriptor; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultProperty; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSubmodel; -import org.junit.Assert; + +import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; public class JsonDeserializerTest { + private static JsonDeserializer deserializerToTest; - @Test - public void testReadFromFile() throws Exception { - new JsonDeserializer().read(Examples.EXAMPLE_FULL.fileContentStream()); - } - - @Test - public void testSimpleExample() throws Exception { - Environment expected = Examples.EXAMPLE_SIMPLE.getModel(); - Environment actual = new JsonDeserializer().read(Examples.EXAMPLE_SIMPLE.fileContentStream()); - Assert.assertEquals(expected, actual); + @BeforeClass + public static void initialize() { + deserializerToTest = new JsonDeserializer(); } @Test - public void testFullExample() throws Exception { - Environment expected = Examples.EXAMPLE_FULL.getModel(); - Environment actual = new JsonDeserializer().read(Examples.EXAMPLE_FULL.fileContentStream()); - Assert.assertEquals(expected, actual); - } - - @Test - public void testFullExampleFromNode() throws Exception { - Environment expected = Examples.EXAMPLE_FULL.getModel(); - JsonNode node = new ObjectMapper().readTree(Examples.EXAMPLE_FULL.fileContentStream()); - Environment actual = new JsonDeserializer().read(node); - Assert.assertEquals(expected, actual); + public void testReadCustomDataSpecification() throws DeserializationException { + JsonDeserializer deserializer = new JsonDeserializer(); + deserializer.useImplementation(DataSpecificationContent.class, DefaultDummyDataSpecification.class); + Environment env = deserializer.read(Examples.ENVIRONMENT_CUSTOM_DATA.fileContentStream(), Environment.class); + assertEquals(Examples.ENVIRONMENT_CUSTOM_DATA.getModel(), env); } @Test - public void testCustomImplementationClass() throws Exception { - String json = new JsonSerializer().write(AASSimple.createEnvironment()); + public void testReadCustomImplementationClass() throws Exception { + String json = Examples.EXAMPLE_SIMPLE.fileContent(); + // As we test useImplementation(), we need to create a new deserializer here. JsonDeserializer deserializer = new JsonDeserializer(); - Environment environment = deserializer.read(json); + Environment environment = deserializer.read(json, Environment.class); checkImplementationClasses(environment, DefaultSubmodel.class, DefaultProperty.class); deserializer.useImplementation(Submodel.class, CustomSubmodel.class); deserializer.useImplementation(Property.class, CustomProperty.class); - environment = deserializer.read(json); + environment = deserializer.read(json, Environment.class); checkImplementationClasses(environment, CustomSubmodel.class, CustomProperty.class); deserializer.useImplementation(Submodel.class, CustomSubmodel2.class); - environment = deserializer.read(json); + environment = deserializer.read(json, Environment.class); checkImplementationClasses(environment, CustomSubmodel2.class, CustomProperty.class); } + @Test + @Ignore("Physical Unit has been removed from the V3.0 metamodel. Might be added later again.") + public void testReadConceptDescriptionWithPhysicalUnit() throws IOException, DeserializationException { + ConceptDescription expected = Examples.CONCEPT_DESCRIPTION_DATA_SPECIFICATION_PHYSICAL_UNIT.getModel(); + ConceptDescription actual = deserializerToTest.read( + Examples.CONCEPT_DESCRIPTION_DATA_SPECIFICATION_PHYSICAL_UNIT.fileContentStream(), + ConceptDescription.class); + assertEquals(expected, actual); + } + + @Test + public void testReadNull() throws DeserializationException { + assertNull(deserializerToTest.read("null", Submodel.class)); + assertNull(deserializerToTest.readList("null", Submodel.class)); + + + assertNull(deserializerToTest.read(JsonNodeFactory.instance.nullNode(), Submodel.class)); + assertNull(deserializerToTest.readList(JsonNodeFactory.instance.nullNode(), Submodel.class)); + + ByteArrayInputStream bais = new ByteArrayInputStream("null".getBytes()); + assertNull(deserializerToTest.read(bais, Submodel.class)); + + bais = new ByteArrayInputStream("null".getBytes()); + assertNull(deserializerToTest.readList(bais, Submodel.class)); + } + + @Test + public void testReadEmptyReferableList() throws DeserializationException { + List emptyList = Collections.emptyList(); + + List deserialized = deserializerToTest.readList("[]", Referable.class); + assertEquals(emptyList, deserialized); + + deserialized = deserializerToTest.readList(JsonNodeFactory.instance.arrayNode(), Referable.class); + assertEquals(emptyList, deserialized); + + ByteArrayInputStream bais = new ByteArrayInputStream("[]".getBytes()); + assertEquals(emptyList, deserializerToTest.readList(bais, Submodel.class)); + } + + @Test + public void testReadFullExampleEnv() { + readAndCompare(Examples.EXAMPLE_FULL); + } + + @Test + public void testReadSimpleExampleEnv() { + readAndCompare(Examples.EXAMPLE_SIMPLE); + } + + @Test + public void testReadShell() { + readAndCompare(Examples.ASSET_ADMINISTRATION_SHELL); + } + + @Test + public void testReadShells() { + readAndCompare(Examples.ASSET_ADMINISTRATION_SHELL_LIST_OF); + } + + @Test + public void testReadSubmodel() { + readAndCompare(Examples.SUBMODEL); + } + + @Test + public void testReadSubmodels() { + readAndCompare(Examples.SUBMODEL_LIST_OF); + } + + @Test + public void testReadSubmodelElement() { + readAndCompare(Examples.SUBMODEL_ELEMENT); + } + + @Test + public void testReadSubmodelElements() { + readAndCompare(Examples.SUBMODEL_ELEMENT_LIST_OF); + } + + @Test + public void testReadSubmodelElementList() { + readAndCompare(Examples.SUBMODEL_ELEMENT_LIST); + } + + @Test + public void testReadSubmodelElementCollection() { + readAndCompare(Examples.SUBMODEL_ELEMENT_COLLECTION); + } + + @Test + public void testReadExtensionMinimalEnv() { + readAndCompare(Examples.EXTENSION_MINIMAL); + } + + @Test + public void testReadExtensionMaximalEnv() { + readAndCompare(Examples.EXTENSION_MAXIMAL); + } + + @Test + public void testReadShellDescriptor() { + readAndCompare(Examples.SHELL_DESCRIPTOR); + } + + @Test + public void testReadOperationRequest() { + readAndCompare(Examples.OPERATION_REQUEST); + } + + @Test + public void testReadShellDescriptors() throws IOException, DeserializationException { + String jsonString = "[" + Examples.SHELL_DESCRIPTOR.fileContent() + "]"; + List shellDescriptors = + deserializerToTest.readList(jsonString, AssetAdministrationShellDescriptor.class); + assertEquals(Examples.SHELL_DESCRIPTOR.getModel(), shellDescriptors.get(0)); + } + + @Test + public void testReadSubmodelDescriptor() { + readAndCompare(Examples.SUBMODEL_DESCRIPTOR); + } + + @Test + public void testReadSubmodelDescriptors() throws IOException, DeserializationException { + String jsonString = "[" + Examples.SUBMODEL_DESCRIPTOR.fileContent() + "]"; + List submodelDescriptors = + deserializerToTest.readList(jsonString, SubmodelDescriptor.class); + assertEquals(Examples.SUBMODEL_DESCRIPTOR.getModel(), submodelDescriptors.get(0)); + } + + private void readAndCompare(ExampleData exampleData) { + try { + Object expected = exampleData.getModel(); + assertEquals(expected, readFromString(exampleData)); + assertEquals(expected, readFromNode(exampleData)); + assertEquals(expected, readFromStream(exampleData)); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + private Object readFromString(ExampleData exampleData) throws IOException, DeserializationException { + Object model = exampleData.getModel(); + if(model instanceof Collection) { + Collection coll = (Collection) model; + return deserializerToTest.readList(exampleData.fileContent(), coll.iterator().next().getClass()); + } + return deserializerToTest.read(exampleData.fileContent(), model.getClass()); + } + + private Object readFromStream(ExampleData exampleData) throws DeserializationException { + Object model = exampleData.getModel(); + if(model instanceof Collection) { + Collection coll = (Collection) model; + return deserializerToTest.readList(exampleData.fileContentStream(), coll.iterator().next().getClass()); + } + return deserializerToTest.read(exampleData.fileContentStream(), model.getClass()); + } + + private Object readFromNode(ExampleData exampleData) throws IOException, DeserializationException { + Object model = exampleData.getModel(); + if(model instanceof Collection) { + Collection coll = (Collection) model; + return deserializerToTest.readList(exampleData.getJsonNode(), coll.iterator().next().getClass()); + } + return deserializerToTest.read(exampleData.getJsonNode(), model.getClass()); + } + private void checkImplementationClasses(Environment environment, Class submodelImpl, Class propertyImpl) { environment.getSubmodels().forEach(submodel -> { @@ -85,4 +260,4 @@ private void checkImplementationClasses(Environment environment, .forEach(element -> assertEquals(element.getClass(), propertyImpl)); }); } -} +} \ No newline at end of file diff --git a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonReferableDeserializerTest.java b/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonReferableDeserializerTest.java deleted file mode 100644 index bb21cfec8..000000000 --- a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonReferableDeserializerTest.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. - * Copyright (C) 2023 SAP SE or an SAP affiliate company. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json; - -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.util.ExampleData; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.util.Examples; -import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell; -import org.eclipse.digitaltwin.aas4j.v3.model.ConceptDescription; -import org.eclipse.digitaltwin.aas4j.v3.model.Environment; -import org.eclipse.digitaltwin.aas4j.v3.model.Property; -import org.eclipse.digitaltwin.aas4j.v3.model.Referable; -import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; -import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; -import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElementCollection; -import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElementList; -import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultProperty; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Collections; -import java.util.List; - -import static org.junit.Assert.assertEquals; - - -public class JsonReferableDeserializerTest { - - @Test - public void testReadAAS() throws IOException, DeserializationException { - AssetAdministrationShell expected = Examples.ASSET_ADMINISTRATION_SHELL.getModel(); - AssetAdministrationShell actual = new JsonDeserializer().readReferable(Examples.ASSET_ADMINISTRATION_SHELL.fileContentStream(), AssetAdministrationShell.class); - assertEquals(expected, actual); - } - - @Test - public void testReadAASs() throws IOException, DeserializationException { - List expected = Examples.ASSET_ADMINISTRATION_SHELL_LIST_OF.getModel(); - List actual = new JsonDeserializer().readReferables(Examples.ASSET_ADMINISTRATION_SHELL_LIST_OF.fileContentStream(), AssetAdministrationShell.class); - assertEquals(expected, actual); - } - - @Test - public void testReadSubmodel() throws IOException, DeserializationException { - Submodel expected = Examples.SUBMODEL.getModel(); - Submodel actual = new JsonDeserializer().readReferable(Examples.SUBMODEL.fileContentStream(), Submodel.class); - assertEquals(expected, actual); - } - - @Test - public void testReadSubmodels() throws IOException, DeserializationException { - List expected = Examples.SUBMODEL_LIST_OF.getModel(); - List actual = new JsonDeserializer().readReferables(Examples.SUBMODEL_LIST_OF.fileContentStream(), Submodel.class); - assertEquals(expected, actual); - } - - @Test - public void testReadSubmodelElement() throws IOException, DeserializationException { - SubmodelElement expected = Examples.SUBMODEL_ELEMENT.getModel(); - SubmodelElement actual = new JsonDeserializer().readReferable(Examples.SUBMODEL_ELEMENT.fileContentStream(), SubmodelElement.class); - assertEquals(expected, actual); - } - - @Test - public void testReadSubmodelElements() throws IOException, DeserializationException { - List expected = Examples.SUBMODEL_ELEMENT_LIST_OF.getModel(); - List actual = new JsonDeserializer().readReferables( - Examples.SUBMODEL_ELEMENT_LIST_OF.fileContentStream(), SubmodelElement.class); - assertEquals(expected, actual); - } - - @Test - public void testReadSubmodelElementList() throws IOException, DeserializationException { - SubmodelElement expected = Examples.SUBMODEL_ELEMENT_LIST.getModel(); - SubmodelElementList actual = new JsonDeserializer().readReferable(Examples.SUBMODEL_ELEMENT_LIST.fileContentStream(), SubmodelElementList.class); - assertEquals(expected, actual); - } - - @Test - public void testReadSubmodelElementCollection() throws IOException, DeserializationException { - SubmodelElement expected = Examples.SUBMODEL_ELEMENT_COLLECTION.getModel(); - SubmodelElementCollection actual = new JsonDeserializer().readReferable(Examples.SUBMODEL_ELEMENT_COLLECTION.fileContentStream(), SubmodelElementCollection.class); - assertEquals(expected, actual); - } - - @Test - public void testReadEmptyReferableList() throws DeserializationException { - List emptyList = Collections.emptyList(); - List deserialized = new JsonDeserializer().readReferables("[]", Referable.class); - assertEquals(emptyList, deserialized); - } - - @Test - @Ignore("Physical Unit has been removed from the V3.0 metamodel. Might be added later again.") - public void testDeserializeConceptDescriptionWithPhysicalUnit() throws IOException, DeserializationException { - ExampleData exampleData = Examples.CONCEPT_DESCRIPTION_DATA_SPECIFICATION_PHYSICAL_UNIT; - Object expected = exampleData.getModel(); - try (InputStream fileContent = exampleData.fileContentStream()) { - Object actual = new JsonDeserializer().readReferable(fileContent, (Class) exampleData.getModel().getClass()); - Assert.assertEquals(expected, actual); - } - } - - - @Test - public void testPropertyFromNode() throws Exception { - Property expected = new DefaultProperty.Builder() - .idShort("exampleId") - .build(); - ObjectNode input = JsonNodeFactory.instance.objectNode(); - input.put("idShort", "exampleId"); - input.put("modelType", "Property"); - Property actual = new JsonDeserializer().readReferable(input, Property.class); - assertEquals(expected, actual); - } - - @Test - public void testExtensionMinimal() throws Exception { - Environment expected = Examples.EXTENSION_MINIMAL.getModel(); - Environment actual = new JsonDeserializer().read(Examples.EXTENSION_MINIMAL.fileContentStream()); - assertEquals(expected, actual); - } - - @Test - public void testExtensionMaximal() throws Exception { - Environment expected = Examples.EXTENSION_MAXIMAL.getModel(); - Environment actual = new JsonDeserializer().read(Examples.EXTENSION_MAXIMAL.fileContentStream()); - assertEquals(expected, actual); - } -} diff --git a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonReferableSerializerTest.java b/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonReferableSerializerTest.java deleted file mode 100644 index 1ff5d1114..000000000 --- a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonReferableSerializerTest.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. - * Copyright (C) 2023 SAP SE or an SAP affiliate company. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.util.ExampleData; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.util.Examples; -import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeDefXsd; -import org.eclipse.digitaltwin.aas4j.v3.model.Environment; -import org.eclipse.digitaltwin.aas4j.v3.model.Property; -import org.eclipse.digitaltwin.aas4j.v3.model.Referable; -import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; -import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultExtension; -import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultProperty; -import org.json.JSONException; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.skyscreamer.jsonassert.JSONAssert; -import org.skyscreamer.jsonassert.JSONCompareMode; - -import java.io.IOException; -import java.util.Collection; - -public class JsonReferableSerializerTest { - - @Test - public void testSerializeAAS() throws IOException, SerializationException, JSONException { - compare(Examples.ASSET_ADMINISTRATION_SHELL); - } - - @Test - public void testSerializeAASWithAssetInformation() throws SerializationException, JSONException, IOException { - compare(Examples.ASSET_ADMINISTRATION_SHELL_WITH_ASSET_INFORMATION); - } - - @Test - public void testSerializeAASs() throws IOException, SerializationException, JSONException { - compare(Examples.ASSET_ADMINISTRATION_SHELL_LIST_OF); - } - - @Test - @Ignore("Add test after DataSpecficationPhysicalUnit is supported again") - public void testSerializeConceptDescriptionWithPhysicalUnit() throws IOException, SerializationException, JSONException { - compare(Examples.CONCEPT_DESCRIPTION_DATA_SPECIFICATION_PHYSICAL_UNIT); - } - - @Test - public void testSerializeSubmodel() throws IOException, SerializationException, JSONException { - compare(Examples.SUBMODEL); - } - - @Test - public void testSerializeSubmodelWithExtensions() throws DeserializationException, SerializationException, JsonProcessingException { - Submodel submodel = new JsonDeserializer().readReferable(Examples.SUBMODEL.fileContentStream(), Submodel.class); - submodel.getExtensions().add(new DefaultExtension.Builder() - .name("myExtension").value("my extension value").valueType(DataTypeDefXsd.STRING) - .build()); - JsonNode jsonNode = new ObjectMapper().readTree(new JsonSerializer().writeReferable(submodel)); - Assert.assertTrue(jsonNode.has("extensions")); - } - - - @Test - public void testSerializeSubmodelList() throws IOException, SerializationException, JSONException { - compare(Examples.SUBMODEL_ELEMENT_LIST_OF); - } - - @Test - public void testSerializeSubmodelElement() throws IOException, SerializationException, JSONException { - compare(Examples.SUBMODEL_ELEMENT); - } - - @Test - public void testSerializeSubmodelElements() throws IOException, SerializationException, JSONException { - compare(Examples.SUBMODEL_ELEMENT_LIST_OF); - } - - @Test - public void testSerializeSubmodelElementCollection() throws IOException, SerializationException, JSONException { - compare(Examples.SUBMODEL_ELEMENT_COLLECTION); - } - - @Test - public void testSerializeSubmodelElementList() throws IOException, SerializationException, JSONException { - compare(Examples.SUBMODEL_ELEMENT_LIST); - } - - @Test - public void testSerializeSubmodelElementListEmpty() throws SerializationException, JSONException, IOException { - compare(Examples.SUBMODEL_ELEMENT_LIST_EMPTY); - } - - @Test - public void testSerializePropertyToNode() throws IOException, SerializationException, JSONException { - Property property = new DefaultProperty.Builder() - .idShort("exampleId") - .build(); - ObjectNode expected = JsonNodeFactory.instance.objectNode(); - expected.put("idShort", "exampleId"); - expected.put("modelType", "Property"); - JsonNode actual = new JsonSerializer().toNode(property); - Assert.assertEquals(expected, actual); - } - - @Test - public void testSerializeExtensionMinimal() throws SerializationException, JSONException, IOException { - compare(Examples.EXTENSION_MINIMAL); - } - - @Test - public void testSerializeExtensionMaximal() throws SerializationException, JSONException, IOException { - compare(Examples.EXTENSION_MAXIMAL); - } - - @SuppressWarnings("unchecked") - private void compare(ExampleData exampleData) throws IOException, SerializationException, JSONException { - String expected = exampleData.fileContent(); - String actual = null; - if (Environment.class.isAssignableFrom(exampleData.getModel().getClass())) { - actual = new JsonSerializer().write((Environment) exampleData.getModel()); - } else if (Referable.class.isAssignableFrom(exampleData.getModel().getClass())) { - actual = new JsonSerializer().write((Referable) exampleData.getModel()); - } else if (Collection.class.isAssignableFrom(exampleData.getModel().getClass()) - && ((Collection) exampleData.getModel()).stream().allMatch(x -> x != null && Referable.class.isAssignableFrom(x.getClass()))) { - actual = new JsonSerializer().write((Collection) exampleData.getModel()); - } - JSONAssert.assertEquals(expected, actual, JSONCompareMode.NON_EXTENSIBLE); - JSONAssert.assertEquals(actual, expected, JSONCompareMode.NON_EXTENSIBLE); - } - -} diff --git a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonSerializerTest.java b/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonSerializerTest.java index dfd22388a..43ed8361b 100644 --- a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonSerializerTest.java +++ b/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonSerializerTest.java @@ -16,126 +16,263 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json; -import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASSimple; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.util.ExampleData; import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.util.Examples; -import org.eclipse.digitaltwin.aas4j.v3.model.DataSpecificationContent; -import org.eclipse.digitaltwin.aas4j.v3.model.DefaultDummyDataSpecification; import org.eclipse.digitaltwin.aas4j.v3.model.Environment; import org.eclipse.digitaltwin.aas4j.v3.model.Referable; + import org.json.JSONException; +import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; + import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; -import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertEquals;; import static org.junit.Assert.assertTrue; public class JsonSerializerTest { - private static final Logger logger = LoggerFactory.getLogger(JsonSerializerTest.class); + private static JsonSerializer serializerToTest; + + @BeforeClass + public static void initialize() { + serializerToTest = new JsonSerializer(); + } @Rule public TemporaryFolder tempFolder = new TemporaryFolder(); @Test - public void testSerializeNull() throws JsonProcessingException, IOException, SerializationException { - assertEquals("null", new JsonSerializer().write((Environment) null)); + public void testWriteNull() throws SerializationException { + assertEquals("null", serializerToTest.write(null)); + assertEquals("null", serializerToTest.writeList(null)); + + assertEquals(JsonNodeFactory.instance.nullNode(), serializerToTest.toNode(null)); + assertEquals(JsonNodeFactory.instance.nullNode(), serializerToTest.toArrayNode(null)); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + serializerToTest.write(baos, StandardCharsets.UTF_8, null); + assertEquals("null", baos.toString()); + + baos = new ByteArrayOutputStream(); + serializerToTest.writeList(baos,null); + assertEquals("null", baos.toString()); + } + + @Test + public void testWriteEmptyReferableList() throws SerializationException, JSONException { + List emptyList = Collections.emptyList(); + String actual = serializerToTest.writeList(emptyList); + JSONAssert.assertEquals("[]", actual, JSONCompareMode.NON_EXTENSIBLE); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + serializerToTest.writeList(baos, emptyList); + JSONAssert.assertEquals("[]", baos.toString(), JSONCompareMode.NON_EXTENSIBLE); + + JSONAssert.assertEquals("[]", serializerToTest.toArrayNode(emptyList).toString(), JSONCompareMode.NON_EXTENSIBLE); } @Test - public void testWriteToFile() throws JsonProcessingException, IOException, SerializationException { + public void testWriteToFile() throws IOException, SerializationException { File file = tempFolder.newFile("output.json"); - new JsonSerializer().write(file, AASSimple.createEnvironment()); + serializerToTest.write(new FileOutputStream(file), Examples.EXAMPLE_SIMPLE.getModel()); assertTrue(file.exists()); } @Test - public void testSerializeEmpty() throws JsonProcessingException, IOException, SerializationException, JSONException { - validateAndCompare(Examples.ENVIRONMENT_EMPTY); + public void testWriteEmptyEnv() { + writeValidateAndCompare(Examples.ENVIRONMENT_EMPTY); } @Test - public void testSerializeSimpleExample() throws SerializationException, JSONException, IOException { - validateAndCompare(Examples.EXAMPLE_SIMPLE); + public void testWriteSimpleExampleEnv() { + writeValidateAndCompare(Examples.EXAMPLE_SIMPLE); } @Test - public void testSerializeFullExample() throws SerializationException, JSONException, IOException { - validateAndCompare(Examples.EXAMPLE_FULL); + public void testWriteFullExampleEnv() { + writeValidateAndCompare(Examples.EXAMPLE_FULL); } @Test - public void testSerializeFullExampleToNode() throws SerializationException, JSONException, IOException { + public void testFullExampleEnvToNode() throws IOException { String expected = Examples.EXAMPLE_FULL.fileContent(); - JsonNode node = new JsonSerializer().toNode(Examples.EXAMPLE_FULL.getModel()); - String actual = new ObjectMapper().writeValueAsString(node); - validateAndCompare(expected, actual); + JsonNode node = serializerToTest.toNode(Examples.EXAMPLE_FULL.getModel()); + validateAndCompare(expected, node.toPrettyString()); } @Test - public void testSerializeEmptyReferableList() throws SerializationException { - List emptyList = Collections.emptyList(); - String serialized = new JsonSerializer().write(emptyList); - assertEquals("[]", serialized); + public void testWriteCustomDataSpecification() { + writeAndCompare(Examples.ENVIRONMENT_CUSTOM_DATA); } - /** - * This test ensures that future DataSpecificationContents can be added without adjustments in the code. - * - * @throws SerializationException - * @throws DeserializationException - */ @Test - public void testSerializeCustomDataSpecification() throws SerializationException, DeserializationException { - JsonSerializer serializer = new JsonSerializer(); - JsonDeserializer deserializer = new JsonDeserializer(); + public void testWriteShellDescriptor() { + writeAndCompare(Examples.SHELL_DESCRIPTOR); + } - // This is the only way to make the serialization to work. - Set> subtypes = ReflectionHelper.SUBTYPES.get(DataSpecificationContent.class); - subtypes.add(DefaultDummyDataSpecification.class); + @Test + public void testWriteShell() { + writeAndCompare(Examples.ASSET_ADMINISTRATION_SHELL); + } - Environment origin = org.eclipse.digitaltwin.aas4j.v3.dataformat.core.Examples.ENVIRONMENT_WITH_DUMMYDATASPEC ; + @Test + public void testWriteShellWithAssetInformation() { + writeAndCompare(Examples.ASSET_ADMINISTRATION_SHELL_WITH_ASSET_INFORMATION); + } - String jsonString = serializer.write(origin); - assertNotNull(jsonString); + @Test + public void testWriteShells() { + writeAndCompare(Examples.ASSET_ADMINISTRATION_SHELL_LIST_OF); + } - Environment copy = deserializer.read(jsonString); - assertNotNull(copy); + @Test + @Ignore("Add test after DataSpecficationPhysicalUnit is supported again") + public void testWriteConceptDescriptionWithPhysicalUnit() { + writeAndCompare(Examples.CONCEPT_DESCRIPTION_DATA_SPECIFICATION_PHYSICAL_UNIT); + } - assertTrue(origin.equals(copy)); + @Test + public void testWriteSubmodel() { + writeAndCompare(Examples.SUBMODEL); } + @Test + public void testWriteSubmodels() { + writeAndCompare(Examples.SUBMODEL_LIST_OF); + } - private void validateAndCompare(ExampleData exampleData) throws IOException, SerializationException, JSONException { - String expected = exampleData.fileContent(); - String actual = new JsonSerializer().write(exampleData.getModel()); - validateAndCompare(expected, actual); + @Test + public void testWriteSubmodelElement() { + writeAndCompare(Examples.SUBMODEL_ELEMENT); } - private void validateAndCompare(String expected, String actual) throws IOException, SerializationException, JSONException { - logger.info(actual); - Set errors = new JsonSchemaValidator().validateSchema(actual); - assertTrue(errors.isEmpty()); + @Test + public void testWriteSubmodelElements() { + writeAndCompare(Examples.SUBMODEL_ELEMENT_LIST_OF); + } + + @Test + public void testWriteSubmodelElementCollection() { + writeAndCompare(Examples.SUBMODEL_ELEMENT_COLLECTION); + } + + @Test + public void testWriteSubmodelElementList() { + writeAndCompare(Examples.SUBMODEL_ELEMENT_LIST); + } + + @Test + public void testWriteSubmodelElementListEmpty() { + writeAndCompare(Examples.SUBMODEL_ELEMENT_LIST_EMPTY); + } + + @Test + public void testWriteExtensionMinimal() { + writeAndCompare(Examples.EXTENSION_MINIMAL); + } + + @Test + public void testWriteExtensionMaximal() { + writeAndCompare(Examples.EXTENSION_MAXIMAL); + } + + @Test + public void testWriteSubmodelDescriptor() { + writeAndCompare(Examples.SUBMODEL_DESCRIPTOR); + } + + @Test + public void testWriteOperationRequest() { + writeAndCompare(Examples.OPERATION_REQUEST); + } + + private String writeToString(ExampleData exampleData) throws SerializationException { + String actual; + if (Collection.class.isAssignableFrom(exampleData.getModel().getClass())) { + actual = serializerToTest.writeList((Collection) exampleData.getModel()); + } else { + actual = serializerToTest.write(exampleData.getModel()); + } + return actual; + } + + private String writeToStream(ExampleData exampleData) throws SerializationException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + if (Collection.class.isAssignableFrom(exampleData.getModel().getClass())) { + serializerToTest.writeList(baos, (Collection) exampleData.getModel()); + } else { + serializerToTest.write(baos, exampleData.getModel()); + } + return baos.toString(StandardCharsets.UTF_8); + } + + private JsonNode writeToNode(ExampleData exampleData) { + JsonNode actual; + if (Collection.class.isAssignableFrom(exampleData.getModel().getClass())) { + actual = serializerToTest.toArrayNode((Collection) exampleData.getModel()); + } else { + actual = serializerToTest.toNode(exampleData.getModel()); + } + return actual; + } + + private void compare(String expected, String actual) throws JSONException { JSONAssert.assertEquals(expected, actual, JSONCompareMode.NON_EXTENSIBLE); JSONAssert.assertEquals(actual, expected, JSONCompareMode.NON_EXTENSIBLE); } + @SuppressWarnings("unchecked") + private void writeAndCompare(ExampleData exampleData) { + try { + String expected = exampleData.fileContent(); + compare(expected, writeToString(exampleData)); + assertEquals(exampleData.getJsonNode(), writeToNode(exampleData)); + compare(expected, writeToStream(exampleData)); + } catch(Exception ex) { + throw new RuntimeException(ex); + } + } + + private void writeValidateAndCompare(ExampleData exampleData) { + try { + String actual = writeToString(exampleData); + String expected = exampleData.fileContent(); + validateAndCompare(expected, actual); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + + private void validateAndCompare(String expected, String actual) { + Set errors = new JsonSchemaValidator().validateSchema(actual); + if(errors.size() > 0) { + logger.error(String.join("\n", errors)); + } + assertTrue(errors.isEmpty()); + try { + compare(expected, actual); + } catch(JSONException ex) { + throw new RuntimeException(ex); + } + } } diff --git a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/ReflectionAnnotationIntrospectorTest.java b/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/ReflectionAnnotationIntrospectorTest.java index 7b659c9f8..e632dd607 100644 --- a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/ReflectionAnnotationIntrospectorTest.java +++ b/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/ReflectionAnnotationIntrospectorTest.java @@ -28,7 +28,6 @@ import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.CustomSubmodel; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.CustomSubmodel2; import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.ReflectionAnnotationIntrospector; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins.ReferenceMixin; import org.eclipse.digitaltwin.aas4j.v3.model.ClassA; import org.eclipse.digitaltwin.aas4j.v3.model.ClassB; import org.eclipse.digitaltwin.aas4j.v3.model.DataElement; @@ -59,7 +58,7 @@ public class ReflectionAnnotationIntrospectorTest { private static ObjectMapper mapper; @Before - public void setUp() throws Exception { + public void setUp() { introspector = new ReflectionAnnotationIntrospector(); mapper = new ObjectMapper(); } @@ -79,18 +78,17 @@ private TypeResolverBuilder getTypeResolver(Class clazz) { } @Test - public void testFindTypeNameForClassesWithoutTypeInfo() throws Exception { + public void testFindTypeNameForClassesWithoutTypeInfo() { List.of(String.class, Object.class, Integer.class, ReflectionAnnotationIntrospectorTest.class, - ReferenceMixin.class, DummyInterface.class) .forEach(x -> assertNull(introspector.findTypeName(getAnnotatedClass(x)))); } @Test - public void testFindTypeNameForClassesWithTypeInfo() throws Exception { + public void testFindTypeNameForClassesWithTypeInfo() { Map.of(CustomProperty.class, Property.class, CustomSubProperty.class, Property.class, TypedProperty.class, TypedProperty.class, @@ -104,12 +102,11 @@ public void testFindTypeNameForClassesWithTypeInfo() throws Exception { } @Test - public void testFindTypeResolverForClassesWithoutTypeInfo() throws Exception { + public void testFindTypeResolverForClassesWithoutTypeInfo() { List.of(String.class, Object.class, Integer.class, ReflectionAnnotationIntrospectorTest.class, - ReferenceMixin.class, DummyInterface.class) .forEach(x -> { TypeResolverBuilder typeResolver = getTypeResolver(x); @@ -118,7 +115,7 @@ public void testFindTypeResolverForClassesWithoutTypeInfo() throws Exception { } @Test - public void testFindTypeResolverForClassesWithTypeInfo() throws Exception { + public void testFindTypeResolverForClassesWithTypeInfo() { List.of(CustomProperty.class, CustomSubProperty.class, TypedProperty.class, @@ -141,7 +138,6 @@ public void testFindSubtypesForExternalClasses() throws Exception { Object.class, Integer.class, ReflectionAnnotationIntrospectorTest.class, - ReferenceMixin.class, DummyInterface.class) .forEach(x -> { List subtypes = introspector.findSubtypes(getAnnotatedClass(x)); @@ -181,5 +177,4 @@ public void testFindSubtypesForInterfacesWithSubtypes() throws Exception { assertTrue(!subtypes.isEmpty()); }); } - -} +} \ No newline at end of file diff --git a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/util/ExampleData.java b/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/util/ExampleData.java index 82cd21dc5..3acd6508b 100644 --- a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/util/ExampleData.java +++ b/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/util/ExampleData.java @@ -15,12 +15,17 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.util; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; public class ExampleData { + private static final ObjectMapper mapper = new ObjectMapper(); + private final T model; private final String file; @@ -49,4 +54,11 @@ public InputStream fileContentStream() { return getClass().getClassLoader().getResourceAsStream(file); } + public JsonNode getJsonNode() { + try { + return mapper.readTree(fileContent()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } } diff --git a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/util/Examples.java b/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/util/Examples.java index 0f6a667c0..1462331a9 100644 --- a/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/util/Examples.java +++ b/dataformat-json/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/util/Examples.java @@ -18,38 +18,199 @@ import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASFull; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASSimple; +import org.eclipse.digitaltwin.aas4j.v3.model.AdministrativeInformation; import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell; +import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShellDescriptor; import org.eclipse.digitaltwin.aas4j.v3.model.AssetKind; import org.eclipse.digitaltwin.aas4j.v3.model.ConceptDescription; +import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeDefXsd; +import org.eclipse.digitaltwin.aas4j.v3.model.EmbeddedDataSpecification; import org.eclipse.digitaltwin.aas4j.v3.model.Environment; +import org.eclipse.digitaltwin.aas4j.v3.model.Key; import org.eclipse.digitaltwin.aas4j.v3.model.KeyTypes; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringNameType; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; +import org.eclipse.digitaltwin.aas4j.v3.model.OperationRequest; +import org.eclipse.digitaltwin.aas4j.v3.model.Reference; import org.eclipse.digitaltwin.aas4j.v3.model.ReferenceTypes; +import org.eclipse.digitaltwin.aas4j.v3.model.SecurityTypeEnum; +import org.eclipse.digitaltwin.aas4j.v3.model.SpecificAssetId; import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; +import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelDescriptor; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElementCollection; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElementList; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAdministrativeInformation; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAssetAdministrationShell; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAssetAdministrationShellDescriptor; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAssetInformation; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultConceptDescription; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultDataSpecificationIec61360; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultEmbeddedDataSpecification; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultEndpoint; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultEnvironment; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultKey; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultLangStringNameType; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultLangStringPreferredNameTypeIec61360; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultLangStringTextType; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultOperationRequest; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultOperationVariable; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultProperty; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultProtocolInformation; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultReference; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultResource; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSecurityAttributeObject; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSpecificAssetId; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSubmodelDescriptor; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSubmodelElementList; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; import java.util.List; - public class Examples { + private static final String DEFAULT_IDENTIFICATION = "identification"; + + private static final Reference DEFAULT_SEMANTIC_ID = + new DefaultReference.Builder().type(ReferenceTypes.EXTERNAL_REFERENCE) + .keys(new DefaultKey.Builder().type(KeyTypes.GLOBAL_REFERENCE).value("eClassDefaultSemanticId").build()) + .build(); + + private static final EmbeddedDataSpecification DEFAULT_EMBEDDED_DATA_SPECIFICATION = new DefaultEmbeddedDataSpecification.Builder() + .dataSpecificationContent(new DefaultDataSpecificationIec61360.Builder() + .preferredName( + new DefaultLangStringPreferredNameTypeIec61360.Builder().language("en").text("defaultPreferredName").build()) + .build()) + .dataSpecification(createGlobalReference("defaultEmbeddedDataSpecificationDataSpecificationValue")).build(); + + private static final AdministrativeInformation DEFAULT_ADMINISTRATIVE_INFORMATION = + new DefaultAdministrativeInformation.Builder() + .embeddedDataSpecifications(DEFAULT_EMBEDDED_DATA_SPECIFICATION) + .revision("1") + .version("1").build(); + + private static final List DEFAULT_DESCRIPTION = List.of(createLangStringTextType("en", "defaultDescription")); + + private static final List DEFAULT_DISPLAY_NAME = List.of(createLangStringNameType("en", "defaultDisplayName")); + + private static final String DEFAULT_ID_SHORT = "defaultIdShort"; + + private static LangStringTextType createLangStringTextType(String langCode, String text) { + return new DefaultLangStringTextType.Builder().language(langCode).text(text).build(); + } + + private static LangStringNameType createLangStringNameType(String langCode, String text) { + return new DefaultLangStringNameType.Builder().language(langCode).text(text).build(); + } + + private static Reference createReference(ReferenceTypes type, KeyTypes keyType, String value) { + return new DefaultReference.Builder().type(type).keys(createKey(keyType, value)).build(); + } + + private static Reference createGlobalReference(String value) { + return createReference(ReferenceTypes.EXTERNAL_REFERENCE, KeyTypes.GLOBAL_REFERENCE, value); + } + + private static DefaultEndpoint.Builder createEndpointBuilder() { + + String DEFAULT_INTERFACE_VALUE = "defaultInterface"; + + return new DefaultEndpoint.Builder() + .protocolInformation(createProtocolInformationBuilder().build()) + ._interface(DEFAULT_INTERFACE_VALUE); + } + + private static Key createKey(KeyTypes type, String value) { + return new DefaultKey.Builder().type(type).value(value).build(); + } + + private static DefaultProtocolInformation.Builder createProtocolInformationBuilder() { + return new DefaultProtocolInformation.Builder() + .href("defaultEndpointAddress") + .endpointProtocol("defaultEndpointProtocol") + .endpointProtocolVersion(List.of("defaultEndpointProtocolVersion")) + .subprotocol("defaultSubprotocol") + .subprotocolBody("defaultSubprotocolBody") + .subprotocolBodyEncoding("defaultSubprotocolBodyEncoding") + .securityAttributes(new DefaultSecurityAttributeObject.Builder() + .key("NONE") + .type(SecurityTypeEnum.NONE) + .value("NONE") + .build()); + } + + private static SpecificAssetId createSpecificAssetId() { + return new DefaultSpecificAssetId.Builder() + .name("testSpecificAssetId") + .value("testValue") + .build(); + } + + private static AssetAdministrationShellDescriptor createAasDescriptor() { + + SpecificAssetId specificAssetId = new DefaultSpecificAssetId.Builder() + .semanticId(DEFAULT_SEMANTIC_ID) + .externalSubjectId(createReference( + ReferenceTypes.MODEL_REFERENCE, KeyTypes.ASSET_ADMINISTRATION_SHELL, "defaultSpecificAssetId")) + .name("defaultSpecificAssetIdName") + .value("http://example.company/myAsset").build(); + + return new DefaultAssetAdministrationShellDescriptor.Builder() + .administration(DEFAULT_ADMINISTRATIVE_INFORMATION) + .description(DEFAULT_DESCRIPTION) + .displayName(DEFAULT_DISPLAY_NAME) + .id(DEFAULT_IDENTIFICATION) + .idShort(DEFAULT_ID_SHORT) + .specificAssetIds(List.of(specificAssetId)) + .endpoints(List.of(createEndpointBuilder().build())) + .globalAssetId("defaultGlobalAssetId") + .submodelDescriptors(List.of(createDefaultSubmodelDescriptor())).build(); + } + + private static SubmodelDescriptor createDefaultSubmodelDescriptor () { + return new DefaultSubmodelDescriptor.Builder() + .administration(DEFAULT_ADMINISTRATIVE_INFORMATION) + .description(DEFAULT_DESCRIPTION) + .displayName(DEFAULT_DISPLAY_NAME) + .id(DEFAULT_IDENTIFICATION) + .idShort(DEFAULT_ID_SHORT) + .endpoints(List.of(createEndpointBuilder().build())) + .semanticId(DEFAULT_SEMANTIC_ID) + .build(); + } + + private static OperationRequest createOperationRequest() { + try { + return new DefaultOperationRequest.Builder() + .inoutputArguments(new DefaultOperationVariable.Builder() + .value(new DefaultProperty.Builder() + .valueType(DataTypeDefXsd.INT).value("42") + .idShort("TheAnswerOfAllQuestions") + .build()) + .build()) + .clientTimeoutDuration(DatatypeFactory.newInstance().newDurationDayTime("PT3M")) // three minutes + .build(); + } catch (DatatypeConfigurationException e) { + throw new RuntimeException(e); + } + } public static final ExampleData EXAMPLE_FULL = ExampleData.of(AASFull.createEnvironment(), "Example-Full.json"); public static final ExampleData EXAMPLE_SIMPLE = ExampleData.of(AASSimple.createEnvironment(), "Example-Simple.json"); public static final ExampleData ENVIRONMENT_EMPTY = ExampleData.of(new DefaultEnvironment.Builder().build(), "Environment-Empty.json"); + public static final ExampleData ENVIRONMENT_CUSTOM_DATA = ExampleData.of( + org.eclipse.digitaltwin.aas4j.v3.dataformat.core.Examples.ENVIRONMENT_WITH_DUMMYDATASPEC, + "Environment-CustomDataSpec.json"); + + public static final ExampleData SHELL_DESCRIPTOR = ExampleData.of( + createAasDescriptor(), "AssetAdministrationShellDescriptor.json"); + + public static final ExampleData SUBMODEL_DESCRIPTOR = ExampleData.of( + createDefaultSubmodelDescriptor(), "SubmodelDescriptor.json"); + public static final ExampleData> ASSET_ADMINISTRATION_SHELL_LIST_OF = ExampleData.of( List.of(AASFull.createEnvironment().getAssetAdministrationShells().get(0), AASFull.createEnvironment().getAssetAdministrationShells().get(1)), @@ -82,6 +243,7 @@ public class Examples { public static final ExampleData ASSET_ADMINISTRATION_SHELL = ExampleData.of(AASFull.createEnvironment().getAssetAdministrationShells().get(0), "AssetAdministrationShell.json"); + public static final ExampleData CONCEPT_DESCRIPTION_DATA_SPECIFICATION_PHYSICAL_UNIT = ExampleData.of( new DefaultConceptDescription.Builder() .id("https://example.org/ConceptDescription") @@ -94,28 +256,6 @@ public class Examples { .value("https://admin-shell.io/DataSpecificationTemplates/DataSpecificationPhysicalUnit/3/0/RC02") .build()) .build()) - // .dataSpecificationContent(new DefaultDataSpecificationPhysicalUnit.Builder() - // .conversionFactor("1.0") - // .eceCode("ece-code") - // .eceName("ece-name") - // .definition(new DefaultLangString.Builder() - // .language("en") - // .text("definition-en") - // .build()) - // .definition(new DefaultLangString.Builder() - // .language("de") - // .text("definition-de") - // .build()) - // .nistName("nist-name") - // .dinNotation("din-notation") - // .siName("si-name") - // .registrationAuthorityId("registration-authority-id") - // .siNotation("si-notation") - // .sourceOfDefinition("source-of-definition") - // .supplier("supplier") - // .unitName("unit-name") - // .unitSymbol("unit-symbol") - // .build()) .build()) .build(), "ConceptDescription-DataSpecificationPhysicalUnit.json"); @@ -148,4 +288,7 @@ public class Examples { public static final ExampleData EXTENSION_MINIMAL = ExampleData.of(org.eclipse.digitaltwin.aas4j.v3.dataformat.core.Examples.EXTENSION_MINIMAL, "admin-shell-io/Extension/Minimal.json"); public static final ExampleData EXTENSION_MAXIMAL = ExampleData.of(org.eclipse.digitaltwin.aas4j.v3.dataformat.core.Examples.EXTENSION_MAXIMAL, "admin-shell-io/Extension/Maximal.json"); + + public static final ExampleData OPERATION_REQUEST = ExampleData.of( + createOperationRequest(), "OperationRequest.json"); } diff --git a/dataformat-json/src/test/resources/AssetAdministrationShellDescriptor.json b/dataformat-json/src/test/resources/AssetAdministrationShellDescriptor.json new file mode 100644 index 000000000..ab5c8fed5 --- /dev/null +++ b/dataformat-json/src/test/resources/AssetAdministrationShellDescriptor.json @@ -0,0 +1,122 @@ +{ + "endpoints" : [ { + "protocolInformation" : { + "href" : "defaultEndpointAddress", + "endpointProtocol" : "defaultEndpointProtocol", + "endpointProtocolVersion" : ["defaultEndpointProtocolVersion"], + "subprotocol" : "defaultSubprotocol", + "subprotocolBody" : "defaultSubprotocolBody", + "subprotocolBodyEncoding" : "defaultSubprotocolBodyEncoding", + "securityAttributes": [ { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } ] + }, + "interface" : "defaultInterface" + } ], + "administration" : { + "revision" : "1", + "version" : "1", + "embeddedDataSpecifications" : [ { + "dataSpecification" : { + "keys" : [ { + "type" : "GlobalReference", + "value" : "defaultEmbeddedDataSpecificationDataSpecificationValue" + } ], + "type" : "ExternalReference" + }, + "dataSpecificationContent" : { + "modelType" : "DataSpecificationIec61360", + "preferredName" : [ { + "language": "en", + "text": "defaultPreferredName" + } ] + } + } ] + }, + "description" : [ { + "language" : "en", + "text" : "defaultDescription" + } ], + "displayName" : [ { + "language" : "en", + "text" : "defaultDisplayName" + } ], + "idShort" : "defaultIdShort", + "id" : "identification", + "globalAssetId" : "defaultGlobalAssetId", + "specificAssetIds" : [{ + "semanticId" : { + "keys" : [ { + "type" : "GlobalReference", + "value" : "eClassDefaultSemanticId" + } ], + "type" : "ExternalReference" + }, + "externalSubjectId" : { + "keys" : [ { + "type" : "AssetAdministrationShell", + "value" : "defaultSpecificAssetId" + } ], + "type" : "ModelReference" + }, + "name" : "defaultSpecificAssetIdName", + "value" : "http://example.company/myAsset" + }], + "submodelDescriptors" : [ { + "endpoints" : [ { + "protocolInformation" : { + "href" : "defaultEndpointAddress", + "endpointProtocol" : "defaultEndpointProtocol", + "endpointProtocolVersion" : ["defaultEndpointProtocolVersion"], + "subprotocol" : "defaultSubprotocol", + "subprotocolBody" : "defaultSubprotocolBody", + "subprotocolBodyEncoding" : "defaultSubprotocolBodyEncoding", + "securityAttributes": [ { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } ] + }, + "interface" : "defaultInterface" + } ], + "administration" : { + "revision" : "1", + "version" : "1", + "embeddedDataSpecifications" : [ { + "dataSpecification" : { + "keys" : [ { + "type" : "GlobalReference", + "value" : "defaultEmbeddedDataSpecificationDataSpecificationValue" + } ], + "type" : "ExternalReference" + }, + "dataSpecificationContent" : { + "modelType" : "DataSpecificationIec61360", + "preferredName" : [ { + "language": "en", + "text": "defaultPreferredName" + } ] + } + } ] + }, + "description" : [ { + "language" : "en", + "text" : "defaultDescription" + } ], + "displayName" : [ { + "language" : "en", + "text" : "defaultDisplayName" + } ], + "idShort" : "defaultIdShort", + "id" : "identification", + "semanticId" : { + "keys" : [ { + "type" : "GlobalReference", + "value" : "eClassDefaultSemanticId" + } ], + "type" : "ExternalReference" + } + } ] +} \ No newline at end of file diff --git a/dataformat-json/src/test/resources/Environment-CustomDataSpec.json b/dataformat-json/src/test/resources/Environment-CustomDataSpec.json new file mode 100644 index 000000000..976b90bcf --- /dev/null +++ b/dataformat-json/src/test/resources/Environment-CustomDataSpec.json @@ -0,0 +1,48 @@ +{ + "submodels" : [ { + "modelType" : "Submodel", + "embeddedDataSpecifications" : [ { + "dataSpecification" : { + "keys" : [ { + "type" : "GlobalReference", + "value" : "https://admin-shell.io/aas/3/0/CustomDataSpecification" + } ], + "type" : "ExternalReference" + }, + "dataSpecificationContent" : { + "modelType" : "DefaultDummyDataSpecification", + "name" : { + "language" : "en", + "text" : "myName" + }, + "text" : "myText", + "pages" : 42 + } + }, { + "dataSpecification" : { + "keys" : [ { + "type" : "GlobalReference", + "value" : "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIec61360" + } ], + "type" : "ExternalReference" + }, + "dataSpecificationContent" : { + "modelType" : "DataSpecificationIec61360", + "dataType" : "BLOB", + "definition" : [ { + "language" : "en", + "text" : "myDefinition" + } ], + "preferredName" : [ ] + } + } ], + "kind" : "Instance", + "id" : "urn:test", + "submodelElements" : [ { + "modelType" : "File", + "contentType" : null, + "value" : "FileValue", + "idShort" : "myIdShort" + } ] + } ] +} \ No newline at end of file diff --git a/dataformat-json/src/test/resources/OperationRequest.json b/dataformat-json/src/test/resources/OperationRequest.json new file mode 100644 index 000000000..9313e08ae --- /dev/null +++ b/dataformat-json/src/test/resources/OperationRequest.json @@ -0,0 +1,11 @@ +{ + "clientTimeoutDuration" : "PT3M", + "inoutputArguments" : [ { + "value" : { + "modelType" : "Property", + "value" : "42", + "valueType" : "xs:int", + "idShort" : "TheAnswerOfAllQuestions" + } + } ] +} \ No newline at end of file diff --git a/dataformat-json/src/test/resources/Submodel-List.json b/dataformat-json/src/test/resources/Submodel-List.json index a1708a819..1d9ea5cc6 100644 --- a/dataformat-json/src/test/resources/Submodel-List.json +++ b/dataformat-json/src/test/resources/Submodel-List.json @@ -46,11 +46,13 @@ "valueType": "xs:string", "qualifiers": [ { + "kind" : "ConceptQualifier", "type": "http://acplt.org/Qualifier/ExampleQualifier", "value": "100", "valueType": "xs:int" }, { + "kind" : "ConceptQualifier", "type": "http://acplt.org/Qualifier/ExampleQualifier2", "value": "50", "valueType": "xs:int" diff --git a/dataformat-json/src/test/resources/SubmodelDescriptor.json b/dataformat-json/src/test/resources/SubmodelDescriptor.json new file mode 100644 index 000000000..3e7c79652 --- /dev/null +++ b/dataformat-json/src/test/resources/SubmodelDescriptor.json @@ -0,0 +1,55 @@ +{ + "endpoints" : [ { + "protocolInformation" : { + "href" : "defaultEndpointAddress", + "endpointProtocol" : "defaultEndpointProtocol", + "endpointProtocolVersion" : ["defaultEndpointProtocolVersion"], + "subprotocol" : "defaultSubprotocol", + "subprotocolBody" : "defaultSubprotocolBody", + "subprotocolBodyEncoding" : "defaultSubprotocolBodyEncoding", + "securityAttributes": [ { + "type": "NONE", + "key": "NONE", + "value": "NONE" + } ] + }, + "interface" : "defaultInterface" + } ], + "administration" : { + "revision" : "1", + "version" : "1", + "embeddedDataSpecifications" : [ { + "dataSpecification" : { + "keys" : [ { + "type" : "GlobalReference", + "value" : "defaultEmbeddedDataSpecificationDataSpecificationValue" + } ], + "type" : "ExternalReference" + }, + "dataSpecificationContent" : { + "modelType" : "DataSpecificationIec61360", + "preferredName" : [ { + "language": "en", + "text": "defaultPreferredName" + } ] + } + } ] + }, + "description" : [ { + "language" : "en", + "text" : "defaultDescription" + } ], + "displayName" : [ { + "language" : "en", + "text" : "defaultDisplayName" + } ], + "idShort" : "defaultIdShort", + "id" : "identification", + "semanticId" : { + "keys" : [ { + "type" : "GlobalReference", + "value" : "eClassDefaultSemanticId" + } ], + "type" : "ExternalReference" + } +} \ No newline at end of file diff --git a/dataformat-xml/src/main/resources/AAS_ABAC.xsd b/dataformat-xml/src/main/resources/AAS_ABAC.xsd new file mode 100644 index 000000000..472c60d37 --- /dev/null +++ b/dataformat-xml/src/main/resources/AAS_ABAC.xsd @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dataformat-xml/src/main/resources/IEC61360.xsd b/dataformat-xml/src/main/resources/IEC61360.xsd new file mode 100644 index 000000000..b929a4304 --- /dev/null +++ b/dataformat-xml/src/main/resources/IEC61360.xsd @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/AbstractLangString.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/AbstractLangString.java index 80d41621f..52fd7fd57 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/AbstractLangString.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/AbstractLangString.java @@ -24,11 +24,11 @@ * Strings with language tags */ @KnownSubtypes({ + @KnownSubtypes.Type(value = LangStringTextType.class), + @KnownSubtypes.Type(value = LangStringNameType.class), @KnownSubtypes.Type(value = LangStringPreferredNameTypeIec61360.class), @KnownSubtypes.Type(value = LangStringShortNameTypeIec61360.class), - @KnownSubtypes.Type(value = LangStringDefinitionTypeIec61360.class), - @KnownSubtypes.Type(value = LangStringNameType.class), - @KnownSubtypes.Type(value = LangStringTextType.class) + @KnownSubtypes.Type(value = LangStringDefinitionTypeIec61360.class) }) public interface AbstractLangString { diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/AssetAdministrationShell.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/AssetAdministrationShell.java index 2b51a7a67..f284b05e7 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/AssetAdministrationShell.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/AssetAdministrationShell.java @@ -28,7 +28,7 @@ @KnownSubtypes({ @KnownSubtypes.Type(value = DefaultAssetAdministrationShell.class) }) -public interface AssetAdministrationShell extends HasDataSpecification, Identifiable { +public interface AssetAdministrationShell extends Identifiable, HasDataSpecification { /** * The reference to the AAS the AAS was derived from. diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/AssetAdministrationShellDescriptor.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/AssetAdministrationShellDescriptor.java new file mode 100644 index 000000000..67aedfbf9 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/AssetAdministrationShellDescriptor.java @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAssetAdministrationShellDescriptor; + +import java.util.List; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultAssetAdministrationShellDescriptor.class) +}) +public interface AssetAdministrationShellDescriptor extends Descriptor { + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/administration + * + * @return Returns the AdministrativeInformation for the property administration. + */ + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/administration") + AdministrativeInformation getAdministration(); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/administration + * + * @param administration desired value for the property administration. + */ + void setAdministration(AdministrativeInformation administration); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/assetKind + * + * @return Returns the AssetKind for the property assetKind. + */ + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/assetKind") + AssetKind getAssetKind(); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/assetKind + * + * @param assetKind desired value for the property assetKind. + */ + void setAssetKind(AssetKind assetKind); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/assetType + * + * @return Returns the String for the property assetType. + */ + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/assetType") + String getAssetType(); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/assetType + * + * @param assetType desired value for the property assetType. + */ + void setAssetType(String assetType); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/endpoints + * + * @return Returns the List of Endpoints for the property endpoints. + */ + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/endpoints") + List getEndpoints(); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/endpoints + * + * @param endpoints desired value for the property endpoints. + */ + void setEndpoints(List endpoints); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/globalAssetId + * + * @return Returns the String for the property globalAssetId. + */ + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/globalAssetId") + String getGlobalAssetId(); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/globalAssetId + * + * @param globalAssetId desired value for the property globalAssetId. + */ + void setGlobalAssetId(String globalAssetId); + + /** + * + * More information under https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/idShort + * + * @return Returns the String for the property idShort. + */ + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/idShort") + String getIdShort(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/idShort + * + * @param idShort desired value for the property idShort. + */ + void setIdShort(String idShort); + + /** + * + * More information under https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/id + * + * @return Returns the String for the property id. + */ + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/id") + String getId(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/id + * + * @param id desired value for the property id. + */ + void setId(String id); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/specificAssetIds + * + * @return Returns the List of SpecificAssetIds for the property specificAssetIds. + */ + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/specificAssetIds") + List getSpecificAssetIds(); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/specificAssetIds + * + * @param specificAssetIds desired value for the property specificAssetIds. + */ + void setSpecificAssetIds(List specificAssetIds); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/submodelDescriptors + * + * @return Returns the List of SubmodelDescriptors for the property submodelDescriptors. + */ + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/submodelDescriptors") + List getSubmodelDescriptors(); + + /** + * + * More information under + * https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/submodelDescriptors + * + * @param submodelDescriptors desired value for the property submodelDescriptors. + */ + void setSubmodelDescriptors(List submodelDescriptors); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/BaseOperationResult.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/BaseOperationResult.java new file mode 100644 index 000000000..0da07e1a0 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/BaseOperationResult.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultBaseOperationResult; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultBaseOperationResult.class) +}) +public interface BaseOperationResult extends Result { + + /** + * + * More information under https://admin-shell.io/aas/3/0/BaseOperationResult/executionState + * + * @return Returns the ExecutionState for the property executionState. + */ + @IRI("https://admin-shell.io/aas/3/0/BaseOperationResult/executionState") + ExecutionState getExecutionState(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/BaseOperationResult/executionState + * + * @param executionState desired value for the property executionState. + */ + void setExecutionState(ExecutionState executionState); + + /** + * + * More information under https://admin-shell.io/aas/3/0/BaseOperationResult/success + * + * @return Returns the boolean for the property success. + */ + @IRI("https://admin-shell.io/aas/3/0/BaseOperationResult/success") + boolean getSuccess(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/BaseOperationResult/success + * + * @param success desired value for the property success. + */ + void setSuccess(boolean success); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/ConceptDescription.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/ConceptDescription.java index 724d31fed..942452b8c 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/ConceptDescription.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/ConceptDescription.java @@ -29,7 +29,7 @@ @KnownSubtypes({ @KnownSubtypes.Type(value = DefaultConceptDescription.class) }) -public interface ConceptDescription extends HasDataSpecification, Identifiable { +public interface ConceptDescription extends Identifiable, HasDataSpecification { /** * Reference to an external definition the concept is compatible to or was derived from. diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/DataElement.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/DataElement.java index d2cfd8bf7..fe56cb02e 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/DataElement.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/DataElement.java @@ -15,8 +15,10 @@ package org.eclipse.digitaltwin.aas4j.v3.model; + import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; + /** * A data element is a submodel element that is not further composed out of other submodel elements. */ diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Descriptor.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Descriptor.java new file mode 100644 index 000000000..5611270ec --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Descriptor.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultDescriptor; + +import java.util.List; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultDescriptor.class), + @KnownSubtypes.Type(value = AssetAdministrationShellDescriptor.class), + @KnownSubtypes.Type(value = SubmodelDescriptor.class) +}) +public interface Descriptor { + + /** + * + * More information under https://admin-shell.io/aas/3/0/Descriptor/description + * + * @return Returns the List of LangStringTextTypes for the property description. + */ + @IRI("https://admin-shell.io/aas/3/0/Descriptor/description") + List getDescription(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Descriptor/description + * + * @param descriptions desired value for the property description. + */ + void setDescription(List descriptions); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Descriptor/displayName + * + * @return Returns the List of LangStringNameTypes for the property displayName. + */ + @IRI("https://admin-shell.io/aas/3/0/Descriptor/displayName") + List getDisplayName(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Descriptor/displayName + * + * @param displayNames desired value for the property displayName. + */ + void setDisplayName(List displayNames); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Descriptor/extensions + * + * @return Returns the List of Extensions for the property extensions. + */ + @IRI("https://admin-shell.io/aas/3/0/Descriptor/extensions") + List getExtensions(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Descriptor/extensions + * + * @param extensions desired value for the property extensions. + */ + void setExtensions(List extensions); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Endpoint.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Endpoint.java new file mode 100644 index 000000000..8d5db6a4f --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Endpoint.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultEndpoint; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultEndpoint.class) +}) +public interface Endpoint { + + /** + * + * More information under https://admin-shell.io/aas/3/0/Endpoint/_interface + * + * @return Returns the String for the property _interface. + */ + @IRI("https://admin-shell.io/aas/3/0/Endpoint/_interface") + String get_interface(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Endpoint/_interface + * + * @param _interface desired value for the property _interface. + */ + void set_interface(String _interface); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Endpoint/protocolInformation + * + * @return Returns the ProtocolInformation for the property protocolInformation. + */ + @IRI("https://admin-shell.io/aas/3/0/Endpoint/protocolInformation") + ProtocolInformation getProtocolInformation(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Endpoint/protocolInformation + * + * @param protocolInformation desired value for the property protocolInformation. + */ + void setProtocolInformation(ProtocolInformation protocolInformation); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/ExecutionState.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/ExecutionState.java new file mode 100644 index 000000000..d184636fc --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/ExecutionState.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; + + +/** +*/ +@IRI("aas:ExecutionState") +public enum ExecutionState { + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/ExecutionState/Canceled") + CANCELED, + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/ExecutionState/Completed") + COMPLETED, + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/ExecutionState/Failed") + FAILED, + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/ExecutionState/Initiated") + INITIATED, + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/ExecutionState/Running") + RUNNING, + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/ExecutionState/Timeout") + TIMEOUT; + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/HasSemantics.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/HasSemantics.java index 41f9b9978..a7f73523c 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/HasSemantics.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/HasSemantics.java @@ -26,9 +26,9 @@ */ @KnownSubtypes({ @KnownSubtypes.Type(value = SpecificAssetId.class), + @KnownSubtypes.Type(value = Extension.class), @KnownSubtypes.Type(value = SubmodelElement.class), @KnownSubtypes.Type(value = Submodel.class), - @KnownSubtypes.Type(value = Extension.class), @KnownSubtypes.Type(value = Qualifier.class) }) public interface HasSemantics { diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Message.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Message.java new file mode 100644 index 000000000..6d0a29988 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Message.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultMessage; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultMessage.class) +}) +public interface Message { + + /** + * + * More information under https://admin-shell.io/aas/3/0/Message/code + * + * @return Returns the String for the property code. + */ + @IRI("https://admin-shell.io/aas/3/0/Message/code") + String getCode(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Message/code + * + * @param code desired value for the property code. + */ + void setCode(String code); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Message/correlationId + * + * @return Returns the String for the property correlationId. + */ + @IRI("https://admin-shell.io/aas/3/0/Message/correlationId") + String getCorrelationId(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Message/correlationId + * + * @param correlationId desired value for the property correlationId. + */ + void setCorrelationId(String correlationId); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Message/messageType + * + * @return Returns the MessageTypeEnum for the property messageType. + */ + @IRI("https://admin-shell.io/aas/3/0/Message/messageType") + MessageTypeEnum getMessageType(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Message/messageType + * + * @param messageType desired value for the property messageType. + */ + void setMessageType(MessageTypeEnum messageType); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Message/text + * + * @return Returns the String for the property text. + */ + @IRI("https://admin-shell.io/aas/3/0/Message/text") + String getText(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Message/text + * + * @param text desired value for the property text. + */ + void setText(String text); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Message/timestamp + * + * @return Returns the String for the property timestamp. + */ + @IRI("https://admin-shell.io/aas/3/0/Message/timestamp") + String getTimestamp(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Message/timestamp + * + * @param timestamp desired value for the property timestamp. + */ + void setTimestamp(String timestamp); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/MessageTypeEnum.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/MessageTypeEnum.java new file mode 100644 index 000000000..6542c8111 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/MessageTypeEnum.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; + + +/** +*/ +@IRI("aas:MessageTypeEnum") +public enum MessageTypeEnum { + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/MessageType/Error") + ERROR, + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/MessageType/Exception") + EXCEPTION, + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/MessageType/Info") + INFO, + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/MessageType/Warning") + WARNING; + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/OperationHandle.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/OperationHandle.java new file mode 100644 index 000000000..60987eed4 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/OperationHandle.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultOperationHandle; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultOperationHandle.class) +}) +public interface OperationHandle { + + /** + * + * More information under https://admin-shell.io/aas/3/0/OperationHandle/handleId + * + * @return Returns the String for the property handleId. + */ + @IRI("https://admin-shell.io/aas/3/0/OperationHandle/handleId") + String getHandleId(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/OperationHandle/handleId + * + * @param handleId desired value for the property handleId. + */ + void setHandleId(String handleId); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/OperationRequest.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/OperationRequest.java new file mode 100644 index 000000000..c9a1e6404 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/OperationRequest.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultOperationRequest; + +import javax.xml.datatype.Duration; +import java.util.List; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultOperationRequest.class) +}) +public interface OperationRequest { + + /** + * + * More information under https://admin-shell.io/aas/3/0/OperationRequest/inoutputArguments + * + * @return Returns the List of OperationVariables for the property inoutputArguments. + */ + @IRI("https://admin-shell.io/aas/3/0/OperationRequest/inoutputArguments") + List getInoutputArguments(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/OperationRequest/inoutputArguments + * + * @param inoutputArguments desired value for the property inoutputArguments. + */ + void setInoutputArguments(List inoutputArguments); + + /** + * + * More information under https://admin-shell.io/aas/3/0/OperationRequest/inputArguments + * + * @return Returns the List of OperationVariables for the property inputArguments. + */ + @IRI("https://admin-shell.io/aas/3/0/OperationRequest/inputArguments") + List getInputArguments(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/OperationRequest/inputArguments + * + * @param inputArguments desired value for the property inputArguments. + */ + void setInputArguments(List inputArguments); + + /** + * + * More information under https://admin-shell.io/aas/3/0/OperationRequest/clientTimeoutDuration + * + * @return Returns the String for the property clientTimeoutDuration. + */ + @IRI("https://admin-shell.io/aas/3/0/OperationRequest/clientTimeoutDuration") + Duration getClientTimeoutDuration(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/OperationRequest/clientTimeoutDuration + * + * @param clientTimeoutDuration desired value for the property clientTimeoutDuration. + */ + void setClientTimeoutDuration(Duration clientTimeoutDuration); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/OperationResult.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/OperationResult.java new file mode 100644 index 000000000..7ba79ee45 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/OperationResult.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultOperationResult; + +import java.util.List; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultOperationResult.class) +}) +public interface OperationResult { + + /** + * + * More information under https://admin-shell.io/aas/3/0/OperationResult/inoutputArguments + * + * @return Returns the List of OperationVariables for the property inoutputArguments. + */ + @IRI("https://admin-shell.io/aas/3/0/OperationResult/inoutputArguments") + List getInoutputArguments(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/OperationResult/inoutputArguments + * + * @param inoutputArguments desired value for the property inoutputArguments. + */ + void setInoutputArguments(List inoutputArguments); + + /** + * + * More information under https://admin-shell.io/aas/3/0/OperationResult/outputArguments + * + * @return Returns the List of OperationVariables for the property outputArguments. + */ + @IRI("https://admin-shell.io/aas/3/0/OperationResult/outputArguments") + List getOutputArguments(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/OperationResult/outputArguments + * + * @param outputArguments desired value for the property outputArguments. + */ + void setOutputArguments(List outputArguments); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/PackageDescription.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/PackageDescription.java new file mode 100644 index 000000000..8360f4e62 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/PackageDescription.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultPackageDescription; + +import java.util.List; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultPackageDescription.class) +}) +public interface PackageDescription { + + /** + * + * More information under https://admin-shell.io/aas/3/0/PackageDescription/items + * + * @return Returns the List of Strings for the property items. + */ + @IRI("https://admin-shell.io/aas/3/0/PackageDescription/items") + List getItems(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/PackageDescription/items + * + * @param items desired value for the property items. + */ + void setItems(List items); + + /** + * + * More information under https://admin-shell.io/aas/3/0/PackageDescription/packageId + * + * @return Returns the String for the property packageId. + */ + @IRI("https://admin-shell.io/aas/3/0/PackageDescription/packageId") + String getPackageId(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/PackageDescription/packageId + * + * @param packageId desired value for the property packageId. + */ + void setPackageId(String packageId); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/ProtocolInformation.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/ProtocolInformation.java new file mode 100644 index 000000000..172ed35aa --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/ProtocolInformation.java @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultProtocolInformation; + +import java.util.List; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultProtocolInformation.class) +}) +public interface ProtocolInformation { + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/href + * + * @return Returns the String for the property href. + */ + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/href") + String getHref(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/href + * + * @param href desired value for the property href. + */ + void setHref(String href); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/endpointProtocol + * + * @return Returns the String for the property endpointProtocol. + */ + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/endpointProtocol") + String getEndpointProtocol(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/endpointProtocol + * + * @param endpointProtocol desired value for the property endpointProtocol. + */ + void setEndpointProtocol(String endpointProtocol); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/endpointProtocolVersion + * + * @return Returns the List of Strings for the property endpointProtocolVersion. + */ + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/endpointProtocolVersion") + List getEndpointProtocolVersion(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/endpointProtocolVersion + * + * @param endpointProtocolVersions desired value for the property endpointProtocolVersion. + */ + void setEndpointProtocolVersion(List endpointProtocolVersions); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/subprotocol + * + * @return Returns the String for the property subprotocol. + */ + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/subprotocol") + String getSubprotocol(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/subprotocol + * + * @param subprotocol desired value for the property subprotocol. + */ + void setSubprotocol(String subprotocol); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/subprotocolBody + * + * @return Returns the String for the property subprotocolBody. + */ + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/subprotocolBody") + String getSubprotocolBody(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/subprotocolBody + * + * @param subprotocolBody desired value for the property subprotocolBody. + */ + void setSubprotocolBody(String subprotocolBody); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/subprotocolBodyEncoding + * + * @return Returns the String for the property subprotocolBodyEncoding. + */ + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/subprotocolBodyEncoding") + String getSubprotocolBodyEncoding(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/subprotocolBodyEncoding + * + * @param subprotocolBodyEncoding desired value for the property subprotocolBodyEncoding. + */ + void setSubprotocolBodyEncoding(String subprotocolBodyEncoding); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/securityAttributes + * + * @return Returns the List of SecurityAttributeObjects for the property securityAttributes. + */ + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/securityAttributes") + List getSecurityAttributes(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/ProtocolInformation/securityAttributes + * + * @param securityAttributes desired value for the property securityAttributes. + */ + void setSecurityAttributes(List securityAttributes); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Referable.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Referable.java index 71c5e6ad8..e899e7a0b 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Referable.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Referable.java @@ -25,8 +25,8 @@ * An element that is referable by its 'idShort'. */ @KnownSubtypes({ - @KnownSubtypes.Type(value = SubmodelElement.class), - @KnownSubtypes.Type(value = Identifiable.class) + @KnownSubtypes.Type(value = Identifiable.class), + @KnownSubtypes.Type(value = SubmodelElement.class) }) public interface Referable extends HasExtensions { diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Result.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Result.java new file mode 100644 index 000000000..ff1f97932 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Result.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultResult; + +import java.util.List; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultResult.class), + @KnownSubtypes.Type(value = BaseOperationResult.class) +}) +public interface Result { + + /** + * + * More information under https://admin-shell.io/aas/3/0/Result/messages + * + * @return Returns the List of Messages for the property messages. + */ + @IRI("https://admin-shell.io/aas/3/0/Result/messages") + List getMessages(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/Result/messages + * + * @param messages desired value for the property messages. + */ + void setMessages(List messages); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SecurityAttributeObject.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SecurityAttributeObject.java new file mode 100644 index 000000000..eada6211a --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SecurityAttributeObject.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSecurityAttributeObject; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultSecurityAttributeObject.class) +}) +public interface SecurityAttributeObject { + + /** + * + * More information under https://admin-shell.io/aas/3/0/SecurityAttributeObject/type + * + * @return Returns the SecurityTypeEnum for the property type. + */ + @IRI("https://admin-shell.io/aas/3/0/SecurityAttributeObject/type") + SecurityTypeEnum getType(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SecurityAttributeObject/type + * + * @param type desired value for the property type. + */ + void setType(SecurityTypeEnum type); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SecurityAttributeObject/key + * + * @return Returns the String for the property key. + */ + @IRI("https://admin-shell.io/aas/3/0/SecurityAttributeObject/key") + String getKey(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SecurityAttributeObject/key + * + * @param key desired value for the property key. + */ + void setKey(String key); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SecurityAttributeObject/value + * + * @return Returns the String for the property value. + */ + @IRI("https://admin-shell.io/aas/3/0/SecurityAttributeObject/value") + String getValue(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SecurityAttributeObject/value + * + * @param value desired value for the property value. + */ + void setValue(String value); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SecurityTypeEnum.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SecurityTypeEnum.java new file mode 100644 index 000000000..81dc1f0fd --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SecurityTypeEnum.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; + + +/** +*/ +@IRI("aas:SecurityTypeEnum") +public enum SecurityTypeEnum { + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/SecurityTypeEnum/None") + NONE, + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/SecurityTypeEnum/Rfc_Tlsa") + RFC_TLSA, + + /** + */ + @IRI("https://admin-shell.io/aas/3/0/SecurityTypeEnum/W3c_Did") + W3C_DID; + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Submodel.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Submodel.java index 4e8fd3266..1c5e731a5 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Submodel.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/Submodel.java @@ -28,7 +28,7 @@ @KnownSubtypes({ @KnownSubtypes.Type(value = DefaultSubmodel.class) }) -public interface Submodel extends HasDataSpecification, HasKind, HasSemantics, Identifiable, Qualifiable { +public interface Submodel extends Identifiable, HasDataSpecification, HasSemantics, Qualifiable, HasKind { /** * A submodel consists of zero or more submodel elements. diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SubmodelDescriptor.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SubmodelDescriptor.java new file mode 100644 index 000000000..703609a1b --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SubmodelDescriptor.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model; + +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.KnownSubtypes; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSubmodelDescriptor; + +import java.util.List; + + +/** +*/ +@KnownSubtypes({ + @KnownSubtypes.Type(value = DefaultSubmodelDescriptor.class) +}) +public interface SubmodelDescriptor extends Descriptor { + + /** + * + * More information under https://admin-shell.io/aas/3/0/SubmodelDescriptor/administration + * + * @return Returns the AdministrativeInformation for the property administration. + */ + @IRI("https://admin-shell.io/aas/3/0/SubmodelDescriptor/administration") + AdministrativeInformation getAdministration(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SubmodelDescriptor/administration + * + * @param administration desired value for the property administration. + */ + void setAdministration(AdministrativeInformation administration); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SubmodelDescriptor/endpoints + * + * @return Returns the List of Endpoints for the property endpoints. + */ + @IRI("https://admin-shell.io/aas/3/0/SubmodelDescriptor/endpoints") + List getEndpoints(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SubmodelDescriptor/endpoints + * + * @param endpoints desired value for the property endpoints. + */ + void setEndpoints(List endpoints); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SubmodelDescriptor/idShort + * + * @return Returns the String for the property idShort. + */ + @IRI("https://admin-shell.io/aas/3/0/SubmodelDescriptor/idShort") + String getIdShort(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SubmodelDescriptor/idShort + * + * @param idShort desired value for the property idShort. + */ + void setIdShort(String idShort); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SubmodelDescriptor/id + * + * @return Returns the String for the property id. + */ + @IRI("https://admin-shell.io/aas/3/0/SubmodelDescriptor/id") + String getId(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SubmodelDescriptor/id + * + * @param id desired value for the property id. + */ + void setId(String id); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SubmodelDescriptor/semanticId + * + * @return Returns the Reference for the property semanticId. + */ + @IRI("https://admin-shell.io/aas/3/0/SubmodelDescriptor/semanticId") + Reference getSemanticId(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SubmodelDescriptor/semanticId + * + * @param semanticId desired value for the property semanticId. + */ + void setSemanticId(Reference semanticId); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SubmodelDescriptor/supplementalSemanticId + * + * @return Returns the List of References for the property supplementalSemanticId. + */ + @IRI("https://admin-shell.io/aas/3/0/SubmodelDescriptor/supplementalSemanticId") + List getSupplementalSemanticId(); + + /** + * + * More information under https://admin-shell.io/aas/3/0/SubmodelDescriptor/supplementalSemanticId + * + * @param supplementalSemanticIds desired value for the property supplementalSemanticId. + */ + void setSupplementalSemanticId(List supplementalSemanticIds); + +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SubmodelElement.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SubmodelElement.java index afb2299d6..a10fffd2c 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SubmodelElement.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/SubmodelElement.java @@ -32,6 +32,6 @@ @KnownSubtypes.Type(value = SubmodelElementCollection.class), @KnownSubtypes.Type(value = SubmodelElementList.class) }) -public interface SubmodelElement extends HasDataSpecification, HasSemantics, Qualifiable, Referable { +public interface SubmodelElement extends HasDataSpecification, Referable, HasSemantics, Qualifiable { } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/AnnotatedRelationshipElementBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/AnnotatedRelationshipElementBuilder.java index 0a3067f18..053a5469d 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/AnnotatedRelationshipElementBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/AnnotatedRelationshipElementBuilder.java @@ -96,61 +96,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -238,4 +183,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/AssetAdministrationShellBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/AssetAdministrationShellBuilder.java index e2820dc4c..846e59c61 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/AssetAdministrationShellBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/AssetAdministrationShellBuilder.java @@ -74,28 +74,6 @@ public B submodels(Reference submodels) { return getSelf(); } - /** - * This function allows setting a value for embeddedDataSpecifications - * - * @param embeddedDataSpecifications desired value to be set - * @return Builder object with new value for embeddedDataSpecifications - */ - public B embeddedDataSpecifications(List embeddedDataSpecifications) { - getBuildingInstance().setEmbeddedDataSpecifications(embeddedDataSpecifications); - return getSelf(); - } - - /** - * This function allows adding a value to the List embeddedDataSpecifications - * - * @param embeddedDataSpecifications desired value to be added - * @return Builder object with new value for embeddedDataSpecifications - */ - public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecifications) { - getBuildingInstance().getEmbeddedDataSpecifications().add(embeddedDataSpecifications); - return getSelf(); - } - /** * This function allows setting a value for administration * @@ -205,4 +183,26 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for embeddedDataSpecifications + * + * @param embeddedDataSpecifications desired value to be set + * @return Builder object with new value for embeddedDataSpecifications + */ + public B embeddedDataSpecifications(List embeddedDataSpecifications) { + getBuildingInstance().setEmbeddedDataSpecifications(embeddedDataSpecifications); + return getSelf(); + } + + /** + * This function allows adding a value to the List embeddedDataSpecifications + * + * @param embeddedDataSpecifications desired value to be added + * @return Builder object with new value for embeddedDataSpecifications + */ + public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecifications) { + getBuildingInstance().getEmbeddedDataSpecifications().add(embeddedDataSpecifications); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/AssetAdministrationShellDescriptorBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/AssetAdministrationShellDescriptorBuilder.java new file mode 100644 index 000000000..10faa0151 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/AssetAdministrationShellDescriptorBuilder.java @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + +import org.eclipse.digitaltwin.aas4j.v3.model.AdministrativeInformation; +import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShellDescriptor; +import org.eclipse.digitaltwin.aas4j.v3.model.AssetKind; +import org.eclipse.digitaltwin.aas4j.v3.model.Endpoint; +import org.eclipse.digitaltwin.aas4j.v3.model.Extension; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringNameType; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; +import org.eclipse.digitaltwin.aas4j.v3.model.SpecificAssetId; +import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelDescriptor; + +import java.util.List; + + +public abstract class AssetAdministrationShellDescriptorBuilder> + extends ExtendableBuilder { + + /** + * This function allows setting a value for administration + * + * @param administration desired value to be set + * @return Builder object with new value for administration + */ + public B administration(AdministrativeInformation administration) { + getBuildingInstance().setAdministration(administration); + return getSelf(); + } + + /** + * This function allows setting a value for assetKind + * + * @param assetKind desired value to be set + * @return Builder object with new value for assetKind + */ + public B assetKind(AssetKind assetKind) { + getBuildingInstance().setAssetKind(assetKind); + return getSelf(); + } + + /** + * This function allows setting a value for assetType + * + * @param assetType desired value to be set + * @return Builder object with new value for assetType + */ + public B assetType(String assetType) { + getBuildingInstance().setAssetType(assetType); + return getSelf(); + } + + /** + * This function allows setting a value for endpoints + * + * @param endpoints desired value to be set + * @return Builder object with new value for endpoints + */ + public B endpoints(List endpoints) { + getBuildingInstance().setEndpoints(endpoints); + return getSelf(); + } + + /** + * This function allows adding a value to the List endpoints + * + * @param endpoints desired value to be added + * @return Builder object with new value for endpoints + */ + public B endpoints(Endpoint endpoints) { + getBuildingInstance().getEndpoints().add(endpoints); + return getSelf(); + } + + /** + * This function allows setting a value for globalAssetId + * + * @param globalAssetId desired value to be set + * @return Builder object with new value for globalAssetId + */ + public B globalAssetId(String globalAssetId) { + getBuildingInstance().setGlobalAssetId(globalAssetId); + return getSelf(); + } + + /** + * This function allows setting a value for idShort + * + * @param idShort desired value to be set + * @return Builder object with new value for idShort + */ + public B idShort(String idShort) { + getBuildingInstance().setIdShort(idShort); + return getSelf(); + } + + /** + * This function allows setting a value for id + * + * @param id desired value to be set + * @return Builder object with new value for id + */ + public B id(String id) { + getBuildingInstance().setId(id); + return getSelf(); + } + + /** + * This function allows setting a value for specificAssetIds + * + * @param specificAssetIds desired value to be set + * @return Builder object with new value for specificAssetIds + */ + public B specificAssetIds(List specificAssetIds) { + getBuildingInstance().setSpecificAssetIds(specificAssetIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List specificAssetIds + * + * @param specificAssetIds desired value to be added + * @return Builder object with new value for specificAssetIds + */ + public B specificAssetIds(SpecificAssetId specificAssetIds) { + getBuildingInstance().getSpecificAssetIds().add(specificAssetIds); + return getSelf(); + } + + /** + * This function allows setting a value for submodelDescriptors + * + * @param submodelDescriptors desired value to be set + * @return Builder object with new value for submodelDescriptors + */ + public B submodelDescriptors(List submodelDescriptors) { + getBuildingInstance().setSubmodelDescriptors(submodelDescriptors); + return getSelf(); + } + + /** + * This function allows adding a value to the List submodelDescriptors + * + * @param submodelDescriptors desired value to be added + * @return Builder object with new value for submodelDescriptors + */ + public B submodelDescriptors(SubmodelDescriptor submodelDescriptors) { + getBuildingInstance().getSubmodelDescriptors().add(submodelDescriptors); + return getSelf(); + } + + /** + * This function allows setting a value for description + * + * @param descriptions desired value to be set + * @return Builder object with new value for description + */ + public B description(List descriptions) { + getBuildingInstance().setDescription(descriptions); + return getSelf(); + } + + /** + * This function allows adding a value to the List description + * + * @param description desired value to be added + * @return Builder object with new value for description + */ + public B description(LangStringTextType description) { + getBuildingInstance().getDescription().add(description); + return getSelf(); + } + + /** + * This function allows setting a value for displayName + * + * @param displayNames desired value to be set + * @return Builder object with new value for displayName + */ + public B displayName(List displayNames) { + getBuildingInstance().setDisplayName(displayNames); + return getSelf(); + } + + /** + * This function allows adding a value to the List displayName + * + * @param displayName desired value to be added + * @return Builder object with new value for displayName + */ + public B displayName(LangStringNameType displayName) { + getBuildingInstance().getDisplayName().add(displayName); + return getSelf(); + } + + /** + * This function allows setting a value for extensions + * + * @param extensions desired value to be set + * @return Builder object with new value for extensions + */ + public B extensions(List extensions) { + getBuildingInstance().setExtensions(extensions); + return getSelf(); + } + + /** + * This function allows adding a value to the List extensions + * + * @param extensions desired value to be added + * @return Builder object with new value for extensions + */ + public B extensions(Extension extensions) { + getBuildingInstance().getExtensions().add(extensions); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/BaseOperationResultBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/BaseOperationResultBuilder.java new file mode 100644 index 000000000..eea07026f --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/BaseOperationResultBuilder.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + +import org.eclipse.digitaltwin.aas4j.v3.model.BaseOperationResult; +import org.eclipse.digitaltwin.aas4j.v3.model.ExecutionState; +import org.eclipse.digitaltwin.aas4j.v3.model.Message; + +import java.util.List; + + +public abstract class BaseOperationResultBuilder> + extends ExtendableBuilder { + + /** + * This function allows setting a value for executionState + * + * @param executionState desired value to be set + * @return Builder object with new value for executionState + */ + public B executionState(ExecutionState executionState) { + getBuildingInstance().setExecutionState(executionState); + return getSelf(); + } + + /** + * This function allows setting a value for success + * + * @param success desired value to be set + * @return Builder object with new value for success + */ + public B success(boolean success) { + getBuildingInstance().setSuccess(success); + return getSelf(); + } + + /** + * This function allows setting a value for messages + * + * @param messages desired value to be set + * @return Builder object with new value for messages + */ + public B messages(List messages) { + getBuildingInstance().setMessages(messages); + return getSelf(); + } + + /** + * This function allows adding a value to the List messages + * + * @param messages desired value to be added + * @return Builder object with new value for messages + */ + public B messages(Message messages) { + getBuildingInstance().getMessages().add(messages); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/BasicEventElementBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/BasicEventElementBuilder.java index 181f1199a..23d2f52c3 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/BasicEventElementBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/BasicEventElementBuilder.java @@ -141,61 +141,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -283,4 +228,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/BlobBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/BlobBuilder.java index 7859c310e..aaf6f193a 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/BlobBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/BlobBuilder.java @@ -72,61 +72,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -214,4 +159,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/CapabilityBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/CapabilityBuilder.java index 548d57037..2cea916a0 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/CapabilityBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/CapabilityBuilder.java @@ -50,61 +50,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -192,4 +137,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ConceptDescriptionBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ConceptDescriptionBuilder.java index 57919df59..68793dda9 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ConceptDescriptionBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ConceptDescriptionBuilder.java @@ -51,28 +51,6 @@ public B isCaseOf(Reference isCaseOf) { return getSelf(); } - /** - * This function allows setting a value for embeddedDataSpecifications - * - * @param embeddedDataSpecifications desired value to be set - * @return Builder object with new value for embeddedDataSpecifications - */ - public B embeddedDataSpecifications(List embeddedDataSpecifications) { - getBuildingInstance().setEmbeddedDataSpecifications(embeddedDataSpecifications); - return getSelf(); - } - - /** - * This function allows adding a value to the List embeddedDataSpecifications - * - * @param embeddedDataSpecifications desired value to be added - * @return Builder object with new value for embeddedDataSpecifications - */ - public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecifications) { - getBuildingInstance().getEmbeddedDataSpecifications().add(embeddedDataSpecifications); - return getSelf(); - } - /** * This function allows setting a value for administration * @@ -182,4 +160,26 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for embeddedDataSpecifications + * + * @param embeddedDataSpecifications desired value to be set + * @return Builder object with new value for embeddedDataSpecifications + */ + public B embeddedDataSpecifications(List embeddedDataSpecifications) { + getBuildingInstance().setEmbeddedDataSpecifications(embeddedDataSpecifications); + return getSelf(); + } + + /** + * This function allows adding a value to the List embeddedDataSpecifications + * + * @param embeddedDataSpecifications desired value to be added + * @return Builder object with new value for embeddedDataSpecifications + */ + public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecifications) { + getBuildingInstance().getEmbeddedDataSpecifications().add(embeddedDataSpecifications); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/DescriptorBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/DescriptorBuilder.java new file mode 100644 index 000000000..1e7b4c9c0 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/DescriptorBuilder.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + +import org.eclipse.digitaltwin.aas4j.v3.model.Descriptor; +import org.eclipse.digitaltwin.aas4j.v3.model.Extension; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringNameType; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; + +import java.util.List; + + +public abstract class DescriptorBuilder> extends ExtendableBuilder { + + /** + * This function allows setting a value for description + * + * @param descriptions desired value to be set + * @return Builder object with new value for description + */ + public B description(List descriptions) { + getBuildingInstance().setDescription(descriptions); + return getSelf(); + } + + /** + * This function allows adding a value to the List description + * + * @param description desired value to be added + * @return Builder object with new value for description + */ + public B description(LangStringTextType description) { + getBuildingInstance().getDescription().add(description); + return getSelf(); + } + + /** + * This function allows setting a value for displayName + * + * @param displayNames desired value to be set + * @return Builder object with new value for displayName + */ + public B displayName(List displayNames) { + getBuildingInstance().setDisplayName(displayNames); + return getSelf(); + } + + /** + * This function allows adding a value to the List displayName + * + * @param displayName desired value to be added + * @return Builder object with new value for displayName + */ + public B displayName(LangStringNameType displayName) { + getBuildingInstance().getDisplayName().add(displayName); + return getSelf(); + } + + /** + * This function allows setting a value for extensions + * + * @param extensions desired value to be set + * @return Builder object with new value for extensions + */ + public B extensions(List extensions) { + getBuildingInstance().setExtensions(extensions); + return getSelf(); + } + + /** + * This function allows adding a value to the List extensions + * + * @param extensions desired value to be added + * @return Builder object with new value for extensions + */ + public B extensions(Extension extensions) { + getBuildingInstance().getExtensions().add(extensions); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/EndpointBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/EndpointBuilder.java new file mode 100644 index 000000000..a1040c6b4 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/EndpointBuilder.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + + +import org.eclipse.digitaltwin.aas4j.v3.model.Endpoint; +import org.eclipse.digitaltwin.aas4j.v3.model.ProtocolInformation; + + +public abstract class EndpointBuilder> extends ExtendableBuilder { + + /** + * This function allows setting a value for _interface + * + * @param _interface desired value to be set + * @return Builder object with new value for _interface + */ + public B _interface(String _interface) { + getBuildingInstance().set_interface(_interface); + return getSelf(); + } + + /** + * This function allows setting a value for protocolInformation + * + * @param protocolInformation desired value to be set + * @return Builder object with new value for protocolInformation + */ + public B protocolInformation(ProtocolInformation protocolInformation) { + getBuildingInstance().setProtocolInformation(protocolInformation); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/EntityBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/EntityBuilder.java index 98511ba99..0571300fa 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/EntityBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/EntityBuilder.java @@ -119,61 +119,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -261,4 +206,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/FileBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/FileBuilder.java index ff1eacc8b..675181358 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/FileBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/FileBuilder.java @@ -72,61 +72,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -214,4 +159,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/MessageBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/MessageBuilder.java new file mode 100644 index 000000000..2450de674 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/MessageBuilder.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + + +import org.eclipse.digitaltwin.aas4j.v3.model.Message; +import org.eclipse.digitaltwin.aas4j.v3.model.MessageTypeEnum; + + +public abstract class MessageBuilder> extends ExtendableBuilder { + + /** + * This function allows setting a value for code + * + * @param code desired value to be set + * @return Builder object with new value for code + */ + public B code(String code) { + getBuildingInstance().setCode(code); + return getSelf(); + } + + /** + * This function allows setting a value for correlationId + * + * @param correlationId desired value to be set + * @return Builder object with new value for correlationId + */ + public B correlationId(String correlationId) { + getBuildingInstance().setCorrelationId(correlationId); + return getSelf(); + } + + /** + * This function allows setting a value for messageType + * + * @param messageType desired value to be set + * @return Builder object with new value for messageType + */ + public B messageType(MessageTypeEnum messageType) { + getBuildingInstance().setMessageType(messageType); + return getSelf(); + } + + /** + * This function allows setting a value for text + * + * @param text desired value to be set + * @return Builder object with new value for text + */ + public B text(String text) { + getBuildingInstance().setText(text); + return getSelf(); + } + + /** + * This function allows setting a value for timestamp + * + * @param timestamp desired value to be set + * @return Builder object with new value for timestamp + */ + public B timestamp(String timestamp) { + getBuildingInstance().setTimestamp(timestamp); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/MultiLanguagePropertyBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/MultiLanguagePropertyBuilder.java index 85f30d76a..88263ea0f 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/MultiLanguagePropertyBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/MultiLanguagePropertyBuilder.java @@ -84,61 +84,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -226,4 +171,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationBuilder.java index f7d0a63a9..c8270827f 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationBuilder.java @@ -96,167 +96,167 @@ public B inoutputVariables(OperationVariable inoutputVariables) { } /** - * This function allows setting a value for embeddedDataSpecifications + * This function allows setting a value for category * - * @param embeddedDataSpecifications desired value to be set - * @return Builder object with new value for embeddedDataSpecifications + * @param category desired value to be set + * @return Builder object with new value for category */ - public B embeddedDataSpecifications(List embeddedDataSpecifications) { - getBuildingInstance().setEmbeddedDataSpecifications(embeddedDataSpecifications); + public B category(String category) { + getBuildingInstance().setCategory(category); return getSelf(); } /** - * This function allows adding a value to the List embeddedDataSpecifications + * This function allows setting a value for idShort * - * @param embeddedDataSpecifications desired value to be added - * @return Builder object with new value for embeddedDataSpecifications + * @param idShort desired value to be set + * @return Builder object with new value for idShort */ - public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecifications) { - getBuildingInstance().getEmbeddedDataSpecifications().add(embeddedDataSpecifications); + public B idShort(String idShort) { + getBuildingInstance().setIdShort(idShort); return getSelf(); } /** - * This function allows setting a value for semanticId + * This function allows setting a value for displayName * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId + * @param displayNames desired value to be set + * @return Builder object with new value for displayName */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); + public B displayName(List displayNames) { + getBuildingInstance().setDisplayName(displayNames); return getSelf(); } /** - * This function allows setting a value for supplementalSemanticIds + * This function allows adding a value to the List displayName * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds + * @param displayName desired value to be added + * @return Builder object with new value for displayName */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + public B displayName(LangStringNameType displayName) { + getBuildingInstance().getDisplayName().add(displayName); return getSelf(); } /** - * This function allows adding a value to the List supplementalSemanticIds + * This function allows setting a value for description * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds + * @param descriptions desired value to be set + * @return Builder object with new value for description */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + public B description(List descriptions) { + getBuildingInstance().setDescription(descriptions); return getSelf(); } /** - * This function allows setting a value for qualifiers + * This function allows adding a value to the List description * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers + * @param description desired value to be added + * @return Builder object with new value for description */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); + public B description(LangStringTextType description) { + getBuildingInstance().getDescription().add(description); return getSelf(); } /** - * This function allows adding a value to the List qualifiers + * This function allows setting a value for extensions * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers + * @param extensions desired value to be set + * @return Builder object with new value for extensions */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); + public B extensions(List extensions) { + getBuildingInstance().setExtensions(extensions); return getSelf(); } /** - * This function allows setting a value for category + * This function allows adding a value to the List extensions * - * @param category desired value to be set - * @return Builder object with new value for category + * @param extensions desired value to be added + * @return Builder object with new value for extensions */ - public B category(String category) { - getBuildingInstance().setCategory(category); + public B extensions(Extension extensions) { + getBuildingInstance().getExtensions().add(extensions); return getSelf(); } /** - * This function allows setting a value for idShort + * This function allows setting a value for embeddedDataSpecifications * - * @param idShort desired value to be set - * @return Builder object with new value for idShort + * @param embeddedDataSpecifications desired value to be set + * @return Builder object with new value for embeddedDataSpecifications */ - public B idShort(String idShort) { - getBuildingInstance().setIdShort(idShort); + public B embeddedDataSpecifications(List embeddedDataSpecifications) { + getBuildingInstance().setEmbeddedDataSpecifications(embeddedDataSpecifications); return getSelf(); } /** - * This function allows setting a value for displayName + * This function allows adding a value to the List embeddedDataSpecifications * - * @param displayNames desired value to be set - * @return Builder object with new value for displayName + * @param embeddedDataSpecifications desired value to be added + * @return Builder object with new value for embeddedDataSpecifications */ - public B displayName(List displayNames) { - getBuildingInstance().setDisplayName(displayNames); + public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecifications) { + getBuildingInstance().getEmbeddedDataSpecifications().add(embeddedDataSpecifications); return getSelf(); } /** - * This function allows adding a value to the List displayName + * This function allows setting a value for semanticId * - * @param displayName desired value to be added - * @return Builder object with new value for displayName + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId */ - public B displayName(LangStringNameType displayName) { - getBuildingInstance().getDisplayName().add(displayName); + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); return getSelf(); } /** - * This function allows setting a value for description + * This function allows setting a value for supplementalSemanticIds * - * @param descriptions desired value to be set - * @return Builder object with new value for description + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds */ - public B description(List descriptions) { - getBuildingInstance().setDescription(descriptions); + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); return getSelf(); } /** - * This function allows adding a value to the List description + * This function allows adding a value to the List supplementalSemanticIds * - * @param description desired value to be added - * @return Builder object with new value for description + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds */ - public B description(LangStringTextType description) { - getBuildingInstance().getDescription().add(description); + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); return getSelf(); } /** - * This function allows setting a value for extensions + * This function allows setting a value for qualifiers * - * @param extensions desired value to be set - * @return Builder object with new value for extensions + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers */ - public B extensions(List extensions) { - getBuildingInstance().setExtensions(extensions); + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); return getSelf(); } /** - * This function allows adding a value to the List extensions + * This function allows adding a value to the List qualifiers * - * @param extensions desired value to be added - * @return Builder object with new value for extensions + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers */ - public B extensions(Extension extensions) { - getBuildingInstance().getExtensions().add(extensions); + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); return getSelf(); } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationHandleBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationHandleBuilder.java new file mode 100644 index 000000000..1307ed2b5 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationHandleBuilder.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + + +import org.eclipse.digitaltwin.aas4j.v3.model.OperationHandle; + + +public abstract class OperationHandleBuilder> + extends ExtendableBuilder { + + /** + * This function allows setting a value for handleId + * + * @param handleId desired value to be set + * @return Builder object with new value for handleId + */ + public B handleId(String handleId) { + getBuildingInstance().setHandleId(handleId); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationRequestBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationRequestBuilder.java new file mode 100644 index 000000000..fe598803f --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationRequestBuilder.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + +import org.eclipse.digitaltwin.aas4j.v3.model.OperationRequest; +import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; + +import javax.xml.datatype.Duration; +import java.util.List; + + +public abstract class OperationRequestBuilder> + extends ExtendableBuilder { + + /** + * This function allows setting a value for inoutputArguments + * + * @param inoutputArguments desired value to be set + * @return Builder object with new value for inoutputArguments + */ + public B inoutputArguments(List inoutputArguments) { + getBuildingInstance().setInoutputArguments(inoutputArguments); + return getSelf(); + } + + /** + * This function allows adding a value to the List inoutputArguments + * + * @param inoutputArguments desired value to be added + * @return Builder object with new value for inoutputArguments + */ + public B inoutputArguments(OperationVariable inoutputArguments) { + getBuildingInstance().getInoutputArguments().add(inoutputArguments); + return getSelf(); + } + + /** + * This function allows setting a value for inputArguments + * + * @param inputArguments desired value to be set + * @return Builder object with new value for inputArguments + */ + public B inputArguments(List inputArguments) { + getBuildingInstance().setInputArguments(inputArguments); + return getSelf(); + } + + /** + * This function allows adding a value to the List inputArguments + * + * @param inputArguments desired value to be added + * @return Builder object with new value for inputArguments + */ + public B inputArguments(OperationVariable inputArguments) { + getBuildingInstance().getInputArguments().add(inputArguments); + return getSelf(); + } + + /** + * This function allows setting a value for clientTimeoutDuration + * + * @param clientTimeoutDuration desired value to be set + * @return Builder object with new value for clientTimeoutDuration + */ + public B clientTimeoutDuration(Duration clientTimeoutDuration) { + getBuildingInstance().setClientTimeoutDuration(clientTimeoutDuration); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationResultBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationResultBuilder.java new file mode 100644 index 000000000..edf5b944f --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/OperationResultBuilder.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + +import org.eclipse.digitaltwin.aas4j.v3.model.OperationResult; +import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; + +import java.util.List; + + +public abstract class OperationResultBuilder> + extends ExtendableBuilder { + + /** + * This function allows setting a value for inoutputArguments + * + * @param inoutputArguments desired value to be set + * @return Builder object with new value for inoutputArguments + */ + public B inoutputArguments(List inoutputArguments) { + getBuildingInstance().setInoutputArguments(inoutputArguments); + return getSelf(); + } + + /** + * This function allows adding a value to the List inoutputArguments + * + * @param inoutputArguments desired value to be added + * @return Builder object with new value for inoutputArguments + */ + public B inoutputArguments(OperationVariable inoutputArguments) { + getBuildingInstance().getInoutputArguments().add(inoutputArguments); + return getSelf(); + } + + /** + * This function allows setting a value for outputArguments + * + * @param outputArguments desired value to be set + * @return Builder object with new value for outputArguments + */ + public B outputArguments(List outputArguments) { + getBuildingInstance().setOutputArguments(outputArguments); + return getSelf(); + } + + /** + * This function allows adding a value to the List outputArguments + * + * @param outputArguments desired value to be added + * @return Builder object with new value for outputArguments + */ + public B outputArguments(OperationVariable outputArguments) { + getBuildingInstance().getOutputArguments().add(outputArguments); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/PackageDescriptionBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/PackageDescriptionBuilder.java new file mode 100644 index 000000000..6fd672705 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/PackageDescriptionBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + +import org.eclipse.digitaltwin.aas4j.v3.model.PackageDescription; + +import java.util.List; + + +public abstract class PackageDescriptionBuilder> + extends ExtendableBuilder { + + /** + * This function allows setting a value for items + * + * @param items desired value to be set + * @return Builder object with new value for items + */ + public B items(List items) { + getBuildingInstance().setItems(items); + return getSelf(); + } + + /** + * This function allows adding a value to the List items + * + * @param items desired value to be added + * @return Builder object with new value for items + */ + public B items(String items) { + getBuildingInstance().getItems().add(items); + return getSelf(); + } + + /** + * This function allows setting a value for packageId + * + * @param packageId desired value to be set + * @return Builder object with new value for packageId + */ + public B packageId(String packageId) { + getBuildingInstance().setPackageId(packageId); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/PropertyBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/PropertyBuilder.java index dc6fd05b1..341655cd5 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/PropertyBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/PropertyBuilder.java @@ -84,61 +84,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -226,4 +171,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ProtocolInformationBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ProtocolInformationBuilder.java new file mode 100644 index 000000000..c94565ef6 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ProtocolInformationBuilder.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + +import org.eclipse.digitaltwin.aas4j.v3.model.ProtocolInformation; +import org.eclipse.digitaltwin.aas4j.v3.model.SecurityAttributeObject; + +import java.util.List; + + +public abstract class ProtocolInformationBuilder> + extends ExtendableBuilder { + + /** + * This function allows setting a value for href + * + * @param href desired value to be set + * @return Builder object with new value for href + */ + public B href(String href) { + getBuildingInstance().setHref(href); + return getSelf(); + } + + /** + * This function allows setting a value for endpointProtocol + * + * @param endpointProtocol desired value to be set + * @return Builder object with new value for endpointProtocol + */ + public B endpointProtocol(String endpointProtocol) { + getBuildingInstance().setEndpointProtocol(endpointProtocol); + return getSelf(); + } + + /** + * This function allows setting a value for endpointProtocolVersion + * + * @param endpointProtocolVersions desired value to be set + * @return Builder object with new value for endpointProtocolVersion + */ + public B endpointProtocolVersion(List endpointProtocolVersions) { + getBuildingInstance().setEndpointProtocolVersion(endpointProtocolVersions); + return getSelf(); + } + + /** + * This function allows adding a value to the List endpointProtocolVersion + * + * @param endpointProtocolVersion desired value to be added + * @return Builder object with new value for endpointProtocolVersion + */ + public B endpointProtocolVersion(String endpointProtocolVersion) { + getBuildingInstance().getEndpointProtocolVersion().add(endpointProtocolVersion); + return getSelf(); + } + + /** + * This function allows setting a value for subprotocol + * + * @param subprotocol desired value to be set + * @return Builder object with new value for subprotocol + */ + public B subprotocol(String subprotocol) { + getBuildingInstance().setSubprotocol(subprotocol); + return getSelf(); + } + + /** + * This function allows setting a value for subprotocolBody + * + * @param subprotocolBody desired value to be set + * @return Builder object with new value for subprotocolBody + */ + public B subprotocolBody(String subprotocolBody) { + getBuildingInstance().setSubprotocolBody(subprotocolBody); + return getSelf(); + } + + /** + * This function allows setting a value for subprotocolBodyEncoding + * + * @param subprotocolBodyEncoding desired value to be set + * @return Builder object with new value for subprotocolBodyEncoding + */ + public B subprotocolBodyEncoding(String subprotocolBodyEncoding) { + getBuildingInstance().setSubprotocolBodyEncoding(subprotocolBodyEncoding); + return getSelf(); + } + + /** + * This function allows setting a value for securityAttributes + * + * @param securityAttributes desired value to be set + * @return Builder object with new value for securityAttributes + */ + public B securityAttributes(List securityAttributes) { + getBuildingInstance().setSecurityAttributes(securityAttributes); + return getSelf(); + } + + /** + * This function allows adding a value to the List securityAttributes + * + * @param securityAttributes desired value to be added + * @return Builder object with new value for securityAttributes + */ + public B securityAttributes(SecurityAttributeObject securityAttributes) { + getBuildingInstance().getSecurityAttributes().add(securityAttributes); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/RangeBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/RangeBuilder.java index e6bf48fc8..154ab006a 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/RangeBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/RangeBuilder.java @@ -84,61 +84,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -226,4 +171,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ReferenceElementBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ReferenceElementBuilder.java index 6aa98e110..6cdf40435 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ReferenceElementBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ReferenceElementBuilder.java @@ -62,61 +62,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -204,4 +149,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/RelationshipElementBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/RelationshipElementBuilder.java index 081547980..01c1d2815 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/RelationshipElementBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/RelationshipElementBuilder.java @@ -73,61 +73,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -215,4 +160,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ResultBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ResultBuilder.java new file mode 100644 index 000000000..db842fc77 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/ResultBuilder.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + +import org.eclipse.digitaltwin.aas4j.v3.model.Message; +import org.eclipse.digitaltwin.aas4j.v3.model.Result; + +import java.util.List; + + +public abstract class ResultBuilder> extends ExtendableBuilder { + + /** + * This function allows setting a value for messages + * + * @param messages desired value to be set + * @return Builder object with new value for messages + */ + public B messages(List messages) { + getBuildingInstance().setMessages(messages); + return getSelf(); + } + + /** + * This function allows adding a value to the List messages + * + * @param messages desired value to be added + * @return Builder object with new value for messages + */ + public B messages(Message messages) { + getBuildingInstance().getMessages().add(messages); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SecurityAttributeObjectBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SecurityAttributeObjectBuilder.java new file mode 100644 index 000000000..5277d7b60 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SecurityAttributeObjectBuilder.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + + +import org.eclipse.digitaltwin.aas4j.v3.model.SecurityAttributeObject; +import org.eclipse.digitaltwin.aas4j.v3.model.SecurityTypeEnum; + + +public abstract class SecurityAttributeObjectBuilder> + extends ExtendableBuilder { + + /** + * This function allows setting a value for type + * + * @param type desired value to be set + * @return Builder object with new value for type + */ + public B type(SecurityTypeEnum type) { + getBuildingInstance().setType(type); + return getSelf(); + } + + /** + * This function allows setting a value for key + * + * @param key desired value to be set + * @return Builder object with new value for key + */ + public B key(String key) { + getBuildingInstance().setKey(key); + return getSelf(); + } + + /** + * This function allows setting a value for value + * + * @param value desired value to be set + * @return Builder object with new value for value + */ + public B value(String value) { + getBuildingInstance().setValue(value); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelBuilder.java index c3c970250..0546305c9 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelBuilder.java @@ -53,72 +53,6 @@ public B submodelElements(SubmodelElement submodelElements) { return getSelf(); } - /** - * This function allows setting a value for embeddedDataSpecifications - * - * @param embeddedDataSpecifications desired value to be set - * @return Builder object with new value for embeddedDataSpecifications - */ - public B embeddedDataSpecifications(List embeddedDataSpecifications) { - getBuildingInstance().setEmbeddedDataSpecifications(embeddedDataSpecifications); - return getSelf(); - } - - /** - * This function allows adding a value to the List embeddedDataSpecifications - * - * @param embeddedDataSpecifications desired value to be added - * @return Builder object with new value for embeddedDataSpecifications - */ - public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecifications) { - getBuildingInstance().getEmbeddedDataSpecifications().add(embeddedDataSpecifications); - return getSelf(); - } - - /** - * This function allows setting a value for kind - * - * @param kind desired value to be set - * @return Builder object with new value for kind - */ - public B kind(ModellingKind kind) { - getBuildingInstance().setKind(kind); - return getSelf(); - } - - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - /** * This function allows setting a value for administration * @@ -229,6 +163,61 @@ public B extensions(Extension extensions) { return getSelf(); } + /** + * This function allows setting a value for embeddedDataSpecifications + * + * @param embeddedDataSpecifications desired value to be set + * @return Builder object with new value for embeddedDataSpecifications + */ + public B embeddedDataSpecifications(List embeddedDataSpecifications) { + getBuildingInstance().setEmbeddedDataSpecifications(embeddedDataSpecifications); + return getSelf(); + } + + /** + * This function allows adding a value to the List embeddedDataSpecifications + * + * @param embeddedDataSpecifications desired value to be added + * @return Builder object with new value for embeddedDataSpecifications + */ + public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecifications) { + getBuildingInstance().getEmbeddedDataSpecifications().add(embeddedDataSpecifications); + return getSelf(); + } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + /** * This function allows setting a value for qualifiers * @@ -250,4 +239,15 @@ public B qualifiers(Qualifier qualifiers) { getBuildingInstance().getQualifiers().add(qualifiers); return getSelf(); } + + /** + * This function allows setting a value for kind + * + * @param kind desired value to be set + * @return Builder object with new value for kind + */ + public B kind(ModellingKind kind) { + getBuildingInstance().setKind(kind); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelDescriptorBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelDescriptorBuilder.java new file mode 100644 index 000000000..0897fbd3e --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelDescriptorBuilder.java @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.builder; + +import org.eclipse.digitaltwin.aas4j.v3.model.AdministrativeInformation; +import org.eclipse.digitaltwin.aas4j.v3.model.Endpoint; +import org.eclipse.digitaltwin.aas4j.v3.model.Extension; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringNameType; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; +import org.eclipse.digitaltwin.aas4j.v3.model.Reference; +import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelDescriptor; + +import java.util.List; + + +public abstract class SubmodelDescriptorBuilder> + extends ExtendableBuilder { + + /** + * This function allows setting a value for administration + * + * @param administration desired value to be set + * @return Builder object with new value for administration + */ + public B administration(AdministrativeInformation administration) { + getBuildingInstance().setAdministration(administration); + return getSelf(); + } + + /** + * This function allows setting a value for endpoints + * + * @param endpoints desired value to be set + * @return Builder object with new value for endpoints + */ + public B endpoints(List endpoints) { + getBuildingInstance().setEndpoints(endpoints); + return getSelf(); + } + + /** + * This function allows adding a value to the List endpoints + * + * @param endpoints desired value to be added + * @return Builder object with new value for endpoints + */ + public B endpoints(Endpoint endpoints) { + getBuildingInstance().getEndpoints().add(endpoints); + return getSelf(); + } + + /** + * This function allows setting a value for idShort + * + * @param idShort desired value to be set + * @return Builder object with new value for idShort + */ + public B idShort(String idShort) { + getBuildingInstance().setIdShort(idShort); + return getSelf(); + } + + /** + * This function allows setting a value for id + * + * @param id desired value to be set + * @return Builder object with new value for id + */ + public B id(String id) { + getBuildingInstance().setId(id); + return getSelf(); + } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticId + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticId + */ + public B supplementalSemanticId(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticId(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticId + * + * @param supplementalSemanticId desired value to be added + * @return Builder object with new value for supplementalSemanticId + */ + public B supplementalSemanticId(Reference supplementalSemanticId) { + getBuildingInstance().getSupplementalSemanticId().add(supplementalSemanticId); + return getSelf(); + } + + /** + * This function allows setting a value for description + * + * @param descriptions desired value to be set + * @return Builder object with new value for description + */ + public B description(List descriptions) { + getBuildingInstance().setDescription(descriptions); + return getSelf(); + } + + /** + * This function allows adding a value to the List description + * + * @param description desired value to be added + * @return Builder object with new value for description + */ + public B description(LangStringTextType description) { + getBuildingInstance().getDescription().add(description); + return getSelf(); + } + + /** + * This function allows setting a value for displayName + * + * @param displayNames desired value to be set + * @return Builder object with new value for displayName + */ + public B displayName(List displayNames) { + getBuildingInstance().setDisplayName(displayNames); + return getSelf(); + } + + /** + * This function allows adding a value to the List displayName + * + * @param displayName desired value to be added + * @return Builder object with new value for displayName + */ + public B displayName(LangStringNameType displayName) { + getBuildingInstance().getDisplayName().add(displayName); + return getSelf(); + } + + /** + * This function allows setting a value for extensions + * + * @param extensions desired value to be set + * @return Builder object with new value for extensions + */ + public B extensions(List extensions) { + getBuildingInstance().setExtensions(extensions); + return getSelf(); + } + + /** + * This function allows adding a value to the List extensions + * + * @param extensions desired value to be added + * @return Builder object with new value for extensions + */ + public B extensions(Extension extensions) { + getBuildingInstance().getExtensions().add(extensions); + return getSelf(); + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelElementCollectionBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelElementCollectionBuilder.java index e1c8e980c..afa1350bd 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelElementCollectionBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelElementCollectionBuilder.java @@ -74,61 +74,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -216,4 +161,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelElementListBuilder.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelElementListBuilder.java index f50442fee..734351772 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelElementListBuilder.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/builder/SubmodelElementListBuilder.java @@ -120,61 +120,6 @@ public B embeddedDataSpecifications(EmbeddedDataSpecification embeddedDataSpecif return getSelf(); } - /** - * This function allows setting a value for semanticId - * - * @param semanticId desired value to be set - * @return Builder object with new value for semanticId - */ - public B semanticId(Reference semanticId) { - getBuildingInstance().setSemanticId(semanticId); - return getSelf(); - } - - /** - * This function allows setting a value for supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be set - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(List supplementalSemanticIds) { - getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows adding a value to the List supplementalSemanticIds - * - * @param supplementalSemanticIds desired value to be added - * @return Builder object with new value for supplementalSemanticIds - */ - public B supplementalSemanticIds(Reference supplementalSemanticIds) { - getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); - return getSelf(); - } - - /** - * This function allows setting a value for qualifiers - * - * @param qualifiers desired value to be set - * @return Builder object with new value for qualifiers - */ - public B qualifiers(List qualifiers) { - getBuildingInstance().setQualifiers(qualifiers); - return getSelf(); - } - - /** - * This function allows adding a value to the List qualifiers - * - * @param qualifiers desired value to be added - * @return Builder object with new value for qualifiers - */ - public B qualifiers(Qualifier qualifiers) { - getBuildingInstance().getQualifiers().add(qualifiers); - return getSelf(); - } - /** * This function allows setting a value for category * @@ -262,4 +207,59 @@ public B extensions(Extension extensions) { getBuildingInstance().getExtensions().add(extensions); return getSelf(); } + + /** + * This function allows setting a value for semanticId + * + * @param semanticId desired value to be set + * @return Builder object with new value for semanticId + */ + public B semanticId(Reference semanticId) { + getBuildingInstance().setSemanticId(semanticId); + return getSelf(); + } + + /** + * This function allows setting a value for supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be set + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(List supplementalSemanticIds) { + getBuildingInstance().setSupplementalSemanticIds(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows adding a value to the List supplementalSemanticIds + * + * @param supplementalSemanticIds desired value to be added + * @return Builder object with new value for supplementalSemanticIds + */ + public B supplementalSemanticIds(Reference supplementalSemanticIds) { + getBuildingInstance().getSupplementalSemanticIds().add(supplementalSemanticIds); + return getSelf(); + } + + /** + * This function allows setting a value for qualifiers + * + * @param qualifiers desired value to be set + * @return Builder object with new value for qualifiers + */ + public B qualifiers(List qualifiers) { + getBuildingInstance().setQualifiers(qualifiers); + return getSelf(); + } + + /** + * This function allows adding a value to the List qualifiers + * + * @param qualifiers desired value to be added + * @return Builder object with new value for qualifiers + */ + public B qualifiers(Qualifier qualifiers) { + getBuildingInstance().getQualifiers().add(qualifiers); + return getSelf(); + } } diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultAnnotatedRelationshipElement.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultAnnotatedRelationshipElement.java index 6ae2c1d6a..1f771a2d1 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultAnnotatedRelationshipElement.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultAnnotatedRelationshipElement.java @@ -86,14 +86,14 @@ public int hashCode() { this.first, this.second, this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -110,14 +110,14 @@ public boolean equals(Object obj) { Objects.equals(this.first, other.first) && Objects.equals(this.second, other.second) && Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -161,36 +161,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -241,6 +211,36 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultAnnotatedRelationshipElement (" + "annotations=%s," diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultAssetAdministrationShell.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultAssetAdministrationShell.java index 7fc97b452..755ef9896 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultAssetAdministrationShell.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultAssetAdministrationShell.java @@ -80,14 +80,14 @@ public int hashCode() { return Objects.hash(this.derivedFrom, this.assetInformation, this.submodels, - this.embeddedDataSpecifications, this.administration, this.id, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.embeddedDataSpecifications); } @Override @@ -103,14 +103,14 @@ public boolean equals(Object obj) { return Objects.equals(this.derivedFrom, other.derivedFrom) && Objects.equals(this.assetInformation, other.assetInformation) && Objects.equals(this.submodels, other.submodels) && - Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && Objects.equals(this.administration, other.administration) && Objects.equals(this.id, other.id) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications); } } @@ -144,16 +144,6 @@ public void setSubmodels(List submodels) { this.submodels = submodels; } - @Override - public List getEmbeddedDataSpecifications() { - return embeddedDataSpecifications; - } - - @Override - public void setEmbeddedDataSpecifications(List embeddedDataSpecifications) { - this.embeddedDataSpecifications = embeddedDataSpecifications; - } - @Override public AdministrativeInformation getAdministration() { return administration; @@ -224,6 +214,16 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public List getEmbeddedDataSpecifications() { + return embeddedDataSpecifications; + } + + @Override + public void setEmbeddedDataSpecifications(List embeddedDataSpecifications) { + this.embeddedDataSpecifications = embeddedDataSpecifications; + } + public String toString() { return String.format( "DefaultAssetAdministrationShell (" + "derivedFrom=%s," diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultAssetAdministrationShellDescriptor.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultAssetAdministrationShellDescriptor.java new file mode 100644 index 000000000..3d483e26a --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultAssetAdministrationShellDescriptor.java @@ -0,0 +1,274 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.AdministrativeInformation; +import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShellDescriptor; +import org.eclipse.digitaltwin.aas4j.v3.model.AssetKind; +import org.eclipse.digitaltwin.aas4j.v3.model.Endpoint; +import org.eclipse.digitaltwin.aas4j.v3.model.Extension; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringNameType; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; +import org.eclipse.digitaltwin.aas4j.v3.model.SpecificAssetId; +import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelDescriptor; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.AssetAdministrationShellDescriptorBuilder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Default implementation of package + * org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShellDescriptor + * + */ + +@IRI("aas:AssetAdministrationShellDescriptor") +public class DefaultAssetAdministrationShellDescriptor implements AssetAdministrationShellDescriptor { + + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/administration") + protected AdministrativeInformation administration; + + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/assetKind") + protected AssetKind assetKind; + + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/assetType") + protected String assetType; + + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/endpoints") + protected List endpoints = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/globalAssetId") + protected String globalAssetId; + + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/id") + protected String id; + + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/idShort") + protected String idShort; + + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/specificAssetIds") + protected List specificAssetIds = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/AssetAdministrationShellDescriptor/submodelDescriptors") + protected List submodelDescriptors = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/Descriptor/description") + protected List description = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/Descriptor/displayName") + protected List displayName = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/Descriptor/extensions") + protected List extensions = new ArrayList<>(); + + public DefaultAssetAdministrationShellDescriptor() {} + + @Override + public int hashCode() { + return Objects.hash(this.administration, + this.assetKind, + this.assetType, + this.endpoints, + this.globalAssetId, + this.idShort, + this.id, + this.specificAssetIds, + this.submodelDescriptors, + this.description, + this.displayName, + this.extensions); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultAssetAdministrationShellDescriptor other = (DefaultAssetAdministrationShellDescriptor) obj; + return Objects.equals(this.administration, other.administration) && + Objects.equals(this.assetKind, other.assetKind) && + Objects.equals(this.assetType, other.assetType) && + Objects.equals(this.endpoints, other.endpoints) && + Objects.equals(this.globalAssetId, other.globalAssetId) && + Objects.equals(this.idShort, other.idShort) && + Objects.equals(this.id, other.id) && + Objects.equals(this.specificAssetIds, other.specificAssetIds) && + Objects.equals(this.submodelDescriptors, other.submodelDescriptors) && + Objects.equals(this.description, other.description) && + Objects.equals(this.displayName, other.displayName) && + Objects.equals(this.extensions, other.extensions); + } + } + + @Override + public AdministrativeInformation getAdministration() { + return administration; + } + + @Override + public void setAdministration(AdministrativeInformation administration) { + this.administration = administration; + } + + @Override + public AssetKind getAssetKind() { + return assetKind; + } + + @Override + public void setAssetKind(AssetKind assetKind) { + this.assetKind = assetKind; + } + + @Override + public String getAssetType() { + return assetType; + } + + @Override + public void setAssetType(String assetType) { + this.assetType = assetType; + } + + @Override + public List getEndpoints() { + return endpoints; + } + + @Override + public void setEndpoints(List endpoints) { + this.endpoints = endpoints; + } + + @Override + public String getGlobalAssetId() { + return globalAssetId; + } + + @Override + public void setGlobalAssetId(String globalAssetId) { + this.globalAssetId = globalAssetId; + } + + @Override + public String getIdShort() { + return idShort; + } + + @Override + public void setIdShort(String idShort) { + this.idShort = idShort; + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + @Override + public List getSpecificAssetIds() { + return specificAssetIds; + } + + @Override + public void setSpecificAssetIds(List specificAssetIds) { + this.specificAssetIds = specificAssetIds; + } + + @Override + public List getSubmodelDescriptors() { + return submodelDescriptors; + } + + @Override + public void setSubmodelDescriptors(List submodelDescriptors) { + this.submodelDescriptors = submodelDescriptors; + } + + @Override + public List getDescription() { + return description; + } + + @Override + public void setDescription(List descriptions) { + this.description = descriptions; + } + + @Override + public List getDisplayName() { + return displayName; + } + + @Override + public void setDisplayName(List displayNames) { + this.displayName = displayNames; + } + + @Override + public List getExtensions() { + return extensions; + } + + @Override + public void setExtensions(List extensions) { + this.extensions = extensions; + } + + public String toString() { + return String.format( + "DefaultAssetAdministrationShellDescriptor (" + "administration=%s," + + "assetKind=%s," + + "assetType=%s," + + "endpoints=%s," + + "globalAssetId=%s," + + "idShort=%s," + + "id=%s," + + "specificAssetIds=%s," + + "submodelDescriptors=%s," + + ")", + this.administration, this.assetKind, this.assetType, this.endpoints, this.globalAssetId, this.idShort, this.id, + this.specificAssetIds, this.submodelDescriptors); + } + + /** + * This builder class can be used to construct a DefaultAssetAdministrationShellDescriptor bean. + */ + public static class Builder extends AssetAdministrationShellDescriptorBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultAssetAdministrationShellDescriptor newBuildingInstance() { + return new DefaultAssetAdministrationShellDescriptor(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultBaseOperationResult.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultBaseOperationResult.java new file mode 100644 index 000000000..e9507263c --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultBaseOperationResult.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.BaseOperationResult; +import org.eclipse.digitaltwin.aas4j.v3.model.ExecutionState; +import org.eclipse.digitaltwin.aas4j.v3.model.Message; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.BaseOperationResultBuilder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Default implementation of package org.eclipse.digitaltwin.aas4j.v3.model.BaseOperationResult + * + */ + +@IRI("aas:BaseOperationResult") +public class DefaultBaseOperationResult implements BaseOperationResult { + + @IRI("https://admin-shell.io/aas/3/0/BaseOperationResult/executionState") + protected ExecutionState executionState; + + @IRI("https://admin-shell.io/aas/3/0/BaseOperationResult/success") + protected boolean success; + + @IRI("https://admin-shell.io/aas/3/0/Result/messages") + protected List messages = new ArrayList<>(); + + public DefaultBaseOperationResult() {} + + @Override + public int hashCode() { + return Objects.hash(this.executionState, + this.success, + this.messages); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultBaseOperationResult other = (DefaultBaseOperationResult) obj; + return Objects.equals(this.executionState, other.executionState) && + Objects.equals(this.success, other.success) && + Objects.equals(this.messages, other.messages); + } + } + + @Override + public ExecutionState getExecutionState() { + return executionState; + } + + @Override + public void setExecutionState(ExecutionState executionState) { + this.executionState = executionState; + } + + @Override + public boolean getSuccess() { + return success; + } + + @Override + public void setSuccess(boolean success) { + this.success = success; + } + + @Override + public List getMessages() { + return messages; + } + + @Override + public void setMessages(List messages) { + this.messages = messages; + } + + public String toString() { + return String.format( + "DefaultBaseOperationResult (" + "executionState=%s," + + "success=%s," + + ")", + this.executionState, this.success); + } + + /** + * This builder class can be used to construct a DefaultBaseOperationResult bean. + */ + public static class Builder extends BaseOperationResultBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultBaseOperationResult newBuildingInstance() { + return new DefaultBaseOperationResult(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultBasicEventElement.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultBasicEventElement.java index 0763b8ba6..c7fbf209c 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultBasicEventElement.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultBasicEventElement.java @@ -105,14 +105,14 @@ public int hashCode() { this.minInterval, this.maxInterval, this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -134,14 +134,14 @@ public boolean equals(Object obj) { Objects.equals(this.minInterval, other.minInterval) && Objects.equals(this.maxInterval, other.maxInterval) && Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -235,36 +235,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -315,6 +285,36 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultBasicEventElement (" + "observed=%s," diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultBlob.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultBlob.java index ebf7e4ca4..c0208e296 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultBlob.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultBlob.java @@ -81,14 +81,14 @@ public int hashCode() { return Objects.hash(Arrays.hashCode(this.value), this.contentType, this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -104,14 +104,14 @@ public boolean equals(Object obj) { return Arrays.equals(this.value, other.value) && Objects.equals(this.contentType, other.contentType) && Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -145,36 +145,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -225,12 +195,42 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultBlob (" + "value=%s," + "contentType=%s," + ")", - Arrays.toString(this.value), this.contentType); + Arrays.toString(this.value), this.contentType); } /** diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultCapability.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultCapability.java index d4167b66a..4f249157c 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultCapability.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultCapability.java @@ -72,14 +72,14 @@ public DefaultCapability() {} @Override public int hashCode() { return Objects.hash(this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -93,14 +93,14 @@ public boolean equals(Object obj) { } else { DefaultCapability other = (DefaultCapability) obj; return Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -114,36 +114,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -194,6 +164,36 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultCapability (" diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultConceptDescription.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultConceptDescription.java index 51ad68c22..0e7d03eb7 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultConceptDescription.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultConceptDescription.java @@ -72,14 +72,14 @@ public DefaultConceptDescription() {} @Override public int hashCode() { return Objects.hash(this.isCaseOf, - this.embeddedDataSpecifications, this.administration, this.id, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.embeddedDataSpecifications); } @Override @@ -93,14 +93,14 @@ public boolean equals(Object obj) { } else { DefaultConceptDescription other = (DefaultConceptDescription) obj; return Objects.equals(this.isCaseOf, other.isCaseOf) && - Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && Objects.equals(this.administration, other.administration) && Objects.equals(this.id, other.id) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications); } } @@ -114,16 +114,6 @@ public void setIsCaseOf(List isCaseOfs) { this.isCaseOf = isCaseOfs; } - @Override - public List getEmbeddedDataSpecifications() { - return embeddedDataSpecifications; - } - - @Override - public void setEmbeddedDataSpecifications(List embeddedDataSpecifications) { - this.embeddedDataSpecifications = embeddedDataSpecifications; - } - @Override public AdministrativeInformation getAdministration() { return administration; @@ -194,6 +184,16 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public List getEmbeddedDataSpecifications() { + return embeddedDataSpecifications; + } + + @Override + public void setEmbeddedDataSpecifications(List embeddedDataSpecifications) { + this.embeddedDataSpecifications = embeddedDataSpecifications; + } + public String toString() { return String.format( "DefaultConceptDescription (" + "isCaseOf=%s," diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultDescriptor.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultDescriptor.java new file mode 100644 index 000000000..f3496933a --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultDescriptor.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.Descriptor; +import org.eclipse.digitaltwin.aas4j.v3.model.Extension; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringNameType; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.DescriptorBuilder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Default implementation of package org.eclipse.digitaltwin.aas4j.v3.model.Descriptor + * + */ + +@IRI("aas:Descriptor") +public class DefaultDescriptor implements Descriptor { + + @IRI("https://admin-shell.io/aas/3/0/Descriptor/description") + protected List description = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/Descriptor/displayName") + protected List displayName = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/Descriptor/extensions") + protected List extensions = new ArrayList<>(); + + public DefaultDescriptor() {} + + @Override + public int hashCode() { + return Objects.hash(this.description, + this.displayName, + this.extensions); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultDescriptor other = (DefaultDescriptor) obj; + return Objects.equals(this.description, other.description) && + Objects.equals(this.displayName, other.displayName) && + Objects.equals(this.extensions, other.extensions); + } + } + + @Override + public List getDescription() { + return description; + } + + @Override + public void setDescription(List descriptions) { + this.description = descriptions; + } + + @Override + public List getDisplayName() { + return displayName; + } + + @Override + public void setDisplayName(List displayNames) { + this.displayName = displayNames; + } + + @Override + public List getExtensions() { + return extensions; + } + + @Override + public void setExtensions(List extensions) { + this.extensions = extensions; + } + + public String toString() { + return String.format( + "DefaultDescriptor (" + "description=%s," + + "displayName=%s," + + "extensions=%s," + + ")", + this.description, this.displayName, this.extensions); + } + + /** + * This builder class can be used to construct a DefaultDescriptor bean. + */ + public static class Builder extends DescriptorBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultDescriptor newBuildingInstance() { + return new DefaultDescriptor(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultEndpoint.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultEndpoint.java new file mode 100644 index 000000000..91167f351 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultEndpoint.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.Endpoint; +import org.eclipse.digitaltwin.aas4j.v3.model.ProtocolInformation; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.EndpointBuilder; + +import java.util.Objects; + + +/** + * Default implementation of package org.eclipse.digitaltwin.aas4j.v3.model.Endpoint + * + */ + +@IRI("aas:Endpoint") +public class DefaultEndpoint implements Endpoint { + + @IRI("https://admin-shell.io/aas/3/0/Endpoint/_interface") + protected String _interface; + + @IRI("https://admin-shell.io/aas/3/0/Endpoint/protocolInformation") + protected ProtocolInformation protocolInformation; + + public DefaultEndpoint() {} + + @Override + public int hashCode() { + return Objects.hash(this._interface, + this.protocolInformation); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultEndpoint other = (DefaultEndpoint) obj; + return Objects.equals(this._interface, other._interface) && + Objects.equals(this.protocolInformation, other.protocolInformation); + } + } + + @Override + public String get_interface() { + return _interface; + } + + @Override + public void set_interface(String _interface) { + this._interface = _interface; + } + + @Override + public ProtocolInformation getProtocolInformation() { + return protocolInformation; + } + + @Override + public void setProtocolInformation(ProtocolInformation protocolInformation) { + this.protocolInformation = protocolInformation; + } + + public String toString() { + return String.format( + "DefaultEndpoint (" + "_interface=%s," + + "protocolInformation=%s," + + ")", + this._interface, this.protocolInformation); + } + + /** + * This builder class can be used to construct a DefaultEndpoint bean. + */ + public static class Builder extends EndpointBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultEndpoint newBuildingInstance() { + return new DefaultEndpoint(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultEntity.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultEntity.java index e39c60717..9df1c5a11 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultEntity.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultEntity.java @@ -90,14 +90,14 @@ public int hashCode() { this.globalAssetId, this.specificAssetIds, this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -115,14 +115,14 @@ public boolean equals(Object obj) { Objects.equals(this.globalAssetId, other.globalAssetId) && Objects.equals(this.specificAssetIds, other.specificAssetIds) && Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -176,36 +176,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -256,6 +226,36 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultEntity (" + "statements=%s," diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultEventPayload.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultEventPayload.java index 750f1c5ff..5e9a29003 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultEventPayload.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultEventPayload.java @@ -184,7 +184,7 @@ public String toString() { + "payload=%s," + ")", this.source, this.sourceSemanticId, this.observableReference, this.observableSemanticId, this.topic, this.subjectId, - this.timeStamp, this.payload); + this.timeStamp, Arrays.toString(this.payload)); } /** diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultExtension.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultExtension.java index cc7957958..eb013ed1f 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultExtension.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultExtension.java @@ -53,9 +53,7 @@ public class DefaultExtension implements Extension { @IRI("https://admin-shell.io/aas/3/0/HasSemantics/supplementalSemanticIds") protected List supplementalSemanticIds = new ArrayList<>(); - public DefaultExtension() { - this.valueType = DataTypeDefXsd.STRING; - } + public DefaultExtension() {} @Override public int hashCode() { diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultFile.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultFile.java index 5540d1eb0..0b0251441 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultFile.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultFile.java @@ -79,14 +79,14 @@ public int hashCode() { return Objects.hash(this.value, this.contentType, this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -102,14 +102,14 @@ public boolean equals(Object obj) { return Objects.equals(this.value, other.value) && Objects.equals(this.contentType, other.contentType) && Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -143,36 +143,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -223,6 +193,36 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultFile (" + "value=%s," diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultMessage.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultMessage.java new file mode 100644 index 000000000..89b06f102 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultMessage.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.Message; +import org.eclipse.digitaltwin.aas4j.v3.model.MessageTypeEnum; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.MessageBuilder; + +import java.util.Objects; + + +/** + * Default implementation of package org.eclipse.digitaltwin.aas4j.v3.model.Message + * + */ + +@IRI("aas:Message") +public class DefaultMessage implements Message { + + @IRI("https://admin-shell.io/aas/3/0/Message/code") + protected String code; + + @IRI("https://admin-shell.io/aas/3/0/Message/correlationId") + protected String correlationId; + + @IRI("https://admin-shell.io/aas/3/0/Message/messageType") + protected MessageTypeEnum messageType; + + @IRI("https://admin-shell.io/aas/3/0/Message/text") + protected String text; + + @IRI("https://admin-shell.io/aas/3/0/Message/timestamp") + protected String timestamp; + + public DefaultMessage() {} + + @Override + public int hashCode() { + return Objects.hash(this.code, + this.correlationId, + this.messageType, + this.text, + this.timestamp); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultMessage other = (DefaultMessage) obj; + return Objects.equals(this.code, other.code) && + Objects.equals(this.correlationId, other.correlationId) && + Objects.equals(this.messageType, other.messageType) && + Objects.equals(this.text, other.text) && + Objects.equals(this.timestamp, other.timestamp); + } + } + + @Override + public String getCode() { + return code; + } + + @Override + public void setCode(String code) { + this.code = code; + } + + @Override + public String getCorrelationId() { + return correlationId; + } + + @Override + public void setCorrelationId(String correlationId) { + this.correlationId = correlationId; + } + + @Override + public MessageTypeEnum getMessageType() { + return messageType; + } + + @Override + public void setMessageType(MessageTypeEnum messageType) { + this.messageType = messageType; + } + + @Override + public String getText() { + return text; + } + + @Override + public void setText(String text) { + this.text = text; + } + + @Override + public String getTimestamp() { + return timestamp; + } + + @Override + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public String toString() { + return String.format( + "DefaultMessage (" + "code=%s," + + "correlationId=%s," + + "messageType=%s," + + "text=%s," + + "timestamp=%s," + + ")", + this.code, this.correlationId, this.messageType, this.text, this.timestamp); + } + + /** + * This builder class can be used to construct a DefaultMessage bean. + */ + public static class Builder extends MessageBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultMessage newBuildingInstance() { + return new DefaultMessage(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultMultiLanguageProperty.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultMultiLanguageProperty.java index 2c0de4f5f..651b3beb7 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultMultiLanguageProperty.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultMultiLanguageProperty.java @@ -79,14 +79,14 @@ public int hashCode() { return Objects.hash(this.value, this.valueId, this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -102,14 +102,14 @@ public boolean equals(Object obj) { return Objects.equals(this.value, other.value) && Objects.equals(this.valueId, other.valueId) && Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -143,36 +143,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -223,6 +193,36 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultMultiLanguageProperty (" + "value=%s," diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperation.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperation.java index ff6d65c2e..5615c9158 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperation.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperation.java @@ -84,14 +84,14 @@ public int hashCode() { this.outputVariables, this.inoutputVariables, this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -108,14 +108,14 @@ public boolean equals(Object obj) { Objects.equals(this.outputVariables, other.outputVariables) && Objects.equals(this.inoutputVariables, other.inoutputVariables) && Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -159,36 +159,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -239,6 +209,36 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultOperation (" + "inputVariables=%s," diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperationHandle.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperationHandle.java new file mode 100644 index 000000000..7a1160c44 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperationHandle.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.OperationHandle; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.OperationHandleBuilder; + +import java.util.Objects; + + +/** + * Default implementation of package org.eclipse.digitaltwin.aas4j.v3.model.OperationHandle + * + */ + +@IRI("aas:OperationHandle") +public class DefaultOperationHandle implements OperationHandle { + + @IRI("https://admin-shell.io/aas/3/0/OperationHandle/handleId") + protected String handleId; + + public DefaultOperationHandle() {} + + @Override + public int hashCode() { + return Objects.hash(this.handleId); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultOperationHandle other = (DefaultOperationHandle) obj; + return Objects.equals(this.handleId, other.handleId); + } + } + + @Override + public String getHandleId() { + return handleId; + } + + @Override + public void setHandleId(String handleId) { + this.handleId = handleId; + } + + public String toString() { + return String.format( + "DefaultOperationHandle (" + "handleId=%s," + + ")", + this.handleId); + } + + /** + * This builder class can be used to construct a DefaultOperationHandle bean. + */ + public static class Builder extends OperationHandleBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultOperationHandle newBuildingInstance() { + return new DefaultOperationHandle(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperationRequest.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperationRequest.java new file mode 100644 index 000000000..71bda258e --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperationRequest.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.OperationRequest; +import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.OperationRequestBuilder; + +import javax.xml.datatype.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Default implementation of package org.eclipse.digitaltwin.aas4j.v3.model.OperationRequest + * + */ + +@IRI("aas:OperationRequest") +public class DefaultOperationRequest implements OperationRequest { + + @IRI("https://admin-shell.io/aas/3/0/OperationRequest/clientTimeoutDuration") + protected Duration clientTimeoutDuration; + + @IRI("https://admin-shell.io/aas/3/0/OperationRequest/inoutputArguments") + protected List inoutputArguments = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/OperationRequest/inputArguments") + protected List inputArguments = new ArrayList<>(); + + public DefaultOperationRequest() {} + + @Override + public int hashCode() { + return Objects.hash(this.inoutputArguments, + this.inputArguments, + this.clientTimeoutDuration); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultOperationRequest other = (DefaultOperationRequest) obj; + return Objects.equals(this.inoutputArguments, other.inoutputArguments) && + Objects.equals(this.inputArguments, other.inputArguments) && + Objects.equals(this.clientTimeoutDuration, other.clientTimeoutDuration); + } + } + + @Override + public List getInoutputArguments() { + return inoutputArguments; + } + + @Override + public void setInoutputArguments(List inoutputArguments) { + this.inoutputArguments = inoutputArguments; + } + + @Override + public List getInputArguments() { + return inputArguments; + } + + @Override + public void setInputArguments(List inputArguments) { + this.inputArguments = inputArguments; + } + + @Override + public Duration getClientTimeoutDuration() { + return clientTimeoutDuration; + } + + @Override + public void setClientTimeoutDuration(Duration clientTimeoutDuration) { + this.clientTimeoutDuration = clientTimeoutDuration; + } + + public String toString() { + return String.format( + "DefaultOperationRequest (" + "inoutputArguments=%s," + + "inputArguments=%s," + + "clientTimeoutDuration=%s," + + ")", + this.inoutputArguments, this.inputArguments, this.clientTimeoutDuration); + } + + /** + * This builder class can be used to construct a DefaultOperationRequest bean. + */ + public static class Builder extends OperationRequestBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultOperationRequest newBuildingInstance() { + return new DefaultOperationRequest(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperationResult.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperationResult.java new file mode 100644 index 000000000..763676200 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperationResult.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.OperationResult; +import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.OperationResultBuilder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Default implementation of package org.eclipse.digitaltwin.aas4j.v3.model.OperationResult + * + */ + +@IRI("aas:OperationResult") +public class DefaultOperationResult implements OperationResult { + + @IRI("https://admin-shell.io/aas/3/0/OperationResult/inoutputArguments") + protected List inoutputArguments = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/OperationResult/outputArguments") + protected List outputArguments = new ArrayList<>(); + + public DefaultOperationResult() {} + + @Override + public int hashCode() { + return Objects.hash(this.inoutputArguments, + this.outputArguments); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultOperationResult other = (DefaultOperationResult) obj; + return Objects.equals(this.inoutputArguments, other.inoutputArguments) && + Objects.equals(this.outputArguments, other.outputArguments); + } + } + + @Override + public List getInoutputArguments() { + return inoutputArguments; + } + + @Override + public void setInoutputArguments(List inoutputArguments) { + this.inoutputArguments = inoutputArguments; + } + + @Override + public List getOutputArguments() { + return outputArguments; + } + + @Override + public void setOutputArguments(List outputArguments) { + this.outputArguments = outputArguments; + } + + public String toString() { + return String.format( + "DefaultOperationResult (" + "inoutputArguments=%s," + + "outputArguments=%s," + + ")", + this.inoutputArguments, this.outputArguments); + } + + /** + * This builder class can be used to construct a DefaultOperationResult bean. + */ + public static class Builder extends OperationResultBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultOperationResult newBuildingInstance() { + return new DefaultOperationResult(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultPackageDescription.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultPackageDescription.java new file mode 100644 index 000000000..43612361c --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultPackageDescription.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.PackageDescription; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.PackageDescriptionBuilder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Default implementation of package org.eclipse.digitaltwin.aas4j.v3.model.PackageDescription + * + */ + +@IRI("aas:PackageDescription") +public class DefaultPackageDescription implements PackageDescription { + + @IRI("https://admin-shell.io/aas/3/0/PackageDescription/items") + protected List items = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/PackageDescription/packageId") + protected String packageId; + + public DefaultPackageDescription() {} + + @Override + public int hashCode() { + return Objects.hash(this.items, + this.packageId); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultPackageDescription other = (DefaultPackageDescription) obj; + return Objects.equals(this.items, other.items) && + Objects.equals(this.packageId, other.packageId); + } + } + + @Override + public List getItems() { + return items; + } + + @Override + public void setItems(List items) { + this.items = items; + } + + @Override + public String getPackageId() { + return packageId; + } + + @Override + public void setPackageId(String packageId) { + this.packageId = packageId; + } + + public String toString() { + return String.format( + "DefaultPackageDescription (" + "items=%s," + + "packageId=%s," + + ")", + this.items, this.packageId); + } + + /** + * This builder class can be used to construct a DefaultPackageDescription bean. + */ + public static class Builder extends PackageDescriptionBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultPackageDescription newBuildingInstance() { + return new DefaultPackageDescription(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultProperty.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultProperty.java index a53eaba9a..73bce3b3a 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultProperty.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultProperty.java @@ -84,14 +84,14 @@ public int hashCode() { this.value, this.valueId, this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -108,14 +108,14 @@ public boolean equals(Object obj) { Objects.equals(this.value, other.value) && Objects.equals(this.valueId, other.valueId) && Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -159,36 +159,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -239,6 +209,36 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultProperty (" + "valueType=%s," diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultProtocolInformation.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultProtocolInformation.java new file mode 100644 index 000000000..6b2639f9e --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultProtocolInformation.java @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.ProtocolInformation; +import org.eclipse.digitaltwin.aas4j.v3.model.SecurityAttributeObject; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.ProtocolInformationBuilder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Default implementation of package org.eclipse.digitaltwin.aas4j.v3.model.ProtocolInformation + * + */ + +@IRI("aas:ProtocolInformation") +public class DefaultProtocolInformation implements ProtocolInformation { + + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/endpointProtocol") + protected String endpointProtocol; + + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/endpointProtocolVersion") + protected List endpointProtocolVersion = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/href") + protected String href; + + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/securityAttributes") + protected List securityAttributes = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/subprotocol") + protected String subprotocol; + + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/subprotocolBody") + protected String subprotocolBody; + + @IRI("https://admin-shell.io/aas/3/0/ProtocolInformation/subprotocolBodyEncoding") + protected String subprotocolBodyEncoding; + + public DefaultProtocolInformation() {} + + @Override + public int hashCode() { + return Objects.hash(this.href, + this.endpointProtocol, + this.endpointProtocolVersion, + this.subprotocol, + this.subprotocolBody, + this.subprotocolBodyEncoding, + this.securityAttributes); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultProtocolInformation other = (DefaultProtocolInformation) obj; + return Objects.equals(this.href, other.href) && + Objects.equals(this.endpointProtocol, other.endpointProtocol) && + Objects.equals(this.endpointProtocolVersion, other.endpointProtocolVersion) && + Objects.equals(this.subprotocol, other.subprotocol) && + Objects.equals(this.subprotocolBody, other.subprotocolBody) && + Objects.equals(this.subprotocolBodyEncoding, other.subprotocolBodyEncoding) && + Objects.equals(this.securityAttributes, other.securityAttributes); + } + } + + @Override + public String getHref() { + return href; + } + + @Override + public void setHref(String href) { + this.href = href; + } + + @Override + public String getEndpointProtocol() { + return endpointProtocol; + } + + @Override + public void setEndpointProtocol(String endpointProtocol) { + this.endpointProtocol = endpointProtocol; + } + + @Override + public List getEndpointProtocolVersion() { + return endpointProtocolVersion; + } + + @Override + public void setEndpointProtocolVersion(List endpointProtocolVersions) { + this.endpointProtocolVersion = endpointProtocolVersions; + } + + @Override + public String getSubprotocol() { + return subprotocol; + } + + @Override + public void setSubprotocol(String subprotocol) { + this.subprotocol = subprotocol; + } + + @Override + public String getSubprotocolBody() { + return subprotocolBody; + } + + @Override + public void setSubprotocolBody(String subprotocolBody) { + this.subprotocolBody = subprotocolBody; + } + + @Override + public String getSubprotocolBodyEncoding() { + return subprotocolBodyEncoding; + } + + @Override + public void setSubprotocolBodyEncoding(String subprotocolBodyEncoding) { + this.subprotocolBodyEncoding = subprotocolBodyEncoding; + } + + @Override + public List getSecurityAttributes() { + return securityAttributes; + } + + @Override + public void setSecurityAttributes(List securityAttributes) { + this.securityAttributes = securityAttributes; + } + + public String toString() { + return String.format( + "DefaultProtocolInformation (" + "href=%s," + + "endpointProtocol=%s," + + "endpointProtocolVersion=%s," + + "subprotocol=%s," + + "subprotocolBody=%s," + + "subprotocolBodyEncoding=%s," + + "securityAttributes=%s," + + ")", + this.href, this.endpointProtocol, this.endpointProtocolVersion, this.subprotocol, this.subprotocolBody, + this.subprotocolBodyEncoding, this.securityAttributes); + } + + /** + * This builder class can be used to construct a DefaultProtocolInformation bean. + */ + public static class Builder extends ProtocolInformationBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultProtocolInformation newBuildingInstance() { + return new DefaultProtocolInformation(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultRange.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultRange.java index 4bcc919a3..546aa64f4 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultRange.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultRange.java @@ -84,14 +84,14 @@ public int hashCode() { this.min, this.max, this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -108,14 +108,14 @@ public boolean equals(Object obj) { Objects.equals(this.min, other.min) && Objects.equals(this.max, other.max) && Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -159,36 +159,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -239,6 +209,36 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultRange (" + "valueType=%s," diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultReferenceElement.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultReferenceElement.java index 6893d95a5..dfddd18e7 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultReferenceElement.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultReferenceElement.java @@ -76,14 +76,14 @@ public DefaultReferenceElement() {} public int hashCode() { return Objects.hash(this.value, this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -98,14 +98,14 @@ public boolean equals(Object obj) { DefaultReferenceElement other = (DefaultReferenceElement) obj; return Objects.equals(this.value, other.value) && Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -129,36 +129,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -209,6 +179,36 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultReferenceElement (" + "value=%s," diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultRelationshipElement.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultRelationshipElement.java index 755f7f359..475518459 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultRelationshipElement.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultRelationshipElement.java @@ -80,14 +80,14 @@ public int hashCode() { return Objects.hash(this.first, this.second, this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -103,14 +103,14 @@ public boolean equals(Object obj) { return Objects.equals(this.first, other.first) && Objects.equals(this.second, other.second) && Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -144,36 +144,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -224,6 +194,36 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultRelationshipElement (" + "first=%s," diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultResult.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultResult.java new file mode 100644 index 000000000..fa5e27a11 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultResult.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.Message; +import org.eclipse.digitaltwin.aas4j.v3.model.Result; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.ResultBuilder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Default implementation of package org.eclipse.digitaltwin.aas4j.v3.model.Result + * + */ + +@IRI("aas:Result") +public class DefaultResult implements Result { + + @IRI("https://admin-shell.io/aas/3/0/Result/messages") + protected List messages = new ArrayList<>(); + + public DefaultResult() {} + + @Override + public int hashCode() { + return Objects.hash(this.messages); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultResult other = (DefaultResult) obj; + return Objects.equals(this.messages, other.messages); + } + } + + @Override + public List getMessages() { + return messages; + } + + @Override + public void setMessages(List messages) { + this.messages = messages; + } + + public String toString() { + return String.format( + "DefaultResult (" + "messages=%s," + + ")", + this.messages); + } + + /** + * This builder class can be used to construct a DefaultResult bean. + */ + public static class Builder extends ResultBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultResult newBuildingInstance() { + return new DefaultResult(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultSecurityAttributeObject.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultSecurityAttributeObject.java new file mode 100644 index 000000000..e2497b864 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultSecurityAttributeObject.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.SecurityAttributeObject; +import org.eclipse.digitaltwin.aas4j.v3.model.SecurityTypeEnum; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.SecurityAttributeObjectBuilder; + +import java.util.Objects; + + +/** + * Default implementation of package org.eclipse.digitaltwin.aas4j.v3.model.SecurityAttributeObject + * + */ + +@IRI("aas:SecurityAttributeObject") +public class DefaultSecurityAttributeObject implements SecurityAttributeObject { + + @IRI("https://admin-shell.io/aas/3/0/SecurityAttributeObject/key") + protected String key; + + @IRI("https://admin-shell.io/aas/3/0/SecurityAttributeObject/type") + protected SecurityTypeEnum type; + + @IRI("https://admin-shell.io/aas/3/0/SecurityAttributeObject/value") + protected String value; + + public DefaultSecurityAttributeObject() {} + + @Override + public int hashCode() { + return Objects.hash(this.type, + this.key, + this.value); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultSecurityAttributeObject other = (DefaultSecurityAttributeObject) obj; + return Objects.equals(this.type, other.type) && + Objects.equals(this.key, other.key) && + Objects.equals(this.value, other.value); + } + } + + @Override + public SecurityTypeEnum getType() { + return type; + } + + @Override + public void setType(SecurityTypeEnum type) { + this.type = type; + } + + @Override + public String getKey() { + return key; + } + + @Override + public void setKey(String key) { + this.key = key; + } + + @Override + public String getValue() { + return value; + } + + @Override + public void setValue(String value) { + this.value = value; + } + + public String toString() { + return String.format( + "DefaultSecurityAttributeObject (" + "type=%s," + + "key=%s," + + "value=%s," + + ")", + this.type, this.key, this.value); + } + + /** + * This builder class can be used to construct a DefaultSecurityAttributeObject bean. + */ + public static class Builder extends SecurityAttributeObjectBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultSecurityAttributeObject newBuildingInstance() { + return new DefaultSecurityAttributeObject(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultSubmodelDescriptor.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultSubmodelDescriptor.java new file mode 100644 index 000000000..794fdf368 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultSubmodelDescriptor.java @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023, SAP SE or an SAP affiliate company + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.eclipse.digitaltwin.aas4j.v3.model.impl; + +import org.eclipse.digitaltwin.aas4j.v3.model.AdministrativeInformation; +import org.eclipse.digitaltwin.aas4j.v3.model.Endpoint; +import org.eclipse.digitaltwin.aas4j.v3.model.Extension; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringNameType; +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; +import org.eclipse.digitaltwin.aas4j.v3.model.Reference; +import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelDescriptor; +import org.eclipse.digitaltwin.aas4j.v3.model.annotations.IRI; +import org.eclipse.digitaltwin.aas4j.v3.model.builder.SubmodelDescriptorBuilder; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + + +/** + * Default implementation of package org.eclipse.digitaltwin.aas4j.v3.model.SubmodelDescriptor + * + */ + +@IRI("aas:SubmodelDescriptor") +public class DefaultSubmodelDescriptor implements SubmodelDescriptor { + + @IRI("https://admin-shell.io/aas/3/0/Descriptor/description") + protected List description = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/Descriptor/displayName") + protected List displayName = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/Descriptor/extensions") + protected List extensions = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/SubmodelDescriptor/administration") + protected AdministrativeInformation administration; + + @IRI("https://admin-shell.io/aas/3/0/SubmodelDescriptor/endpoints") + protected List endpoints = new ArrayList<>(); + + @IRI("https://admin-shell.io/aas/3/0/SubmodelDescriptor/id") + protected String id; + + @IRI("https://admin-shell.io/aas/3/0/SubmodelDescriptor/idShort") + protected String idShort; + + @IRI("https://admin-shell.io/aas/3/0/SubmodelDescriptor/semanticId") + protected Reference semanticId; + + @IRI("https://admin-shell.io/aas/3/0/SubmodelDescriptor/supplementalSemanticId") + protected List supplementalSemanticId = new ArrayList<>(); + + public DefaultSubmodelDescriptor() {} + + @Override + public int hashCode() { + return Objects.hash(this.administration, + this.endpoints, + this.idShort, + this.id, + this.semanticId, + this.supplementalSemanticId, + this.description, + this.displayName, + this.extensions); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } else if (obj == null) { + return false; + } else if (this.getClass() != obj.getClass()) { + return false; + } else { + DefaultSubmodelDescriptor other = (DefaultSubmodelDescriptor) obj; + return Objects.equals(this.administration, other.administration) && + Objects.equals(this.endpoints, other.endpoints) && + Objects.equals(this.idShort, other.idShort) && + Objects.equals(this.id, other.id) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticId, other.supplementalSemanticId) && + Objects.equals(this.description, other.description) && + Objects.equals(this.displayName, other.displayName) && + Objects.equals(this.extensions, other.extensions); + } + } + + @Override + public AdministrativeInformation getAdministration() { + return administration; + } + + @Override + public void setAdministration(AdministrativeInformation administration) { + this.administration = administration; + } + + @Override + public List getEndpoints() { + return endpoints; + } + + @Override + public void setEndpoints(List endpoints) { + this.endpoints = endpoints; + } + + @Override + public String getIdShort() { + return idShort; + } + + @Override + public void setIdShort(String idShort) { + this.idShort = idShort; + } + + @Override + public String getId() { + return id; + } + + @Override + public void setId(String id) { + this.id = id; + } + + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticId() { + return supplementalSemanticId; + } + + @Override + public void setSupplementalSemanticId(List supplementalSemanticIds) { + this.supplementalSemanticId = supplementalSemanticIds; + } + + @Override + public List getDescription() { + return description; + } + + @Override + public void setDescription(List descriptions) { + this.description = descriptions; + } + + @Override + public List getDisplayName() { + return displayName; + } + + @Override + public void setDisplayName(List displayNames) { + this.displayName = displayNames; + } + + @Override + public List getExtensions() { + return extensions; + } + + @Override + public void setExtensions(List extensions) { + this.extensions = extensions; + } + + public String toString() { + return String.format( + "DefaultSubmodelDescriptor (" + "administration=%s," + + "endpoints=%s," + + "idShort=%s," + + "id=%s," + + "semanticId=%s," + + "supplementalSemanticId=%s," + + ")", + this.administration, this.endpoints, this.idShort, this.id, this.semanticId, this.supplementalSemanticId); + } + + /** + * This builder class can be used to construct a DefaultSubmodelDescriptor bean. + */ + public static class Builder extends SubmodelDescriptorBuilder { + + @Override + protected Builder getSelf() { + return this; + } + + @Override + protected DefaultSubmodelDescriptor newBuildingInstance() { + return new DefaultSubmodelDescriptor(); + } + } +} diff --git a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultSubmodelElementCollection.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultSubmodelElementCollection.java index 2c6a0c9cd..d12c19192 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultSubmodelElementCollection.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultSubmodelElementCollection.java @@ -78,14 +78,14 @@ public DefaultSubmodelElementCollection() {} public int hashCode() { return Objects.hash(this.value, this.embeddedDataSpecifications, - this.semanticId, - this.supplementalSemanticIds, - this.qualifiers, this.category, this.idShort, this.displayName, this.description, - this.extensions); + this.extensions, + this.semanticId, + this.supplementalSemanticIds, + this.qualifiers); } @Override @@ -100,14 +100,14 @@ public boolean equals(Object obj) { DefaultSubmodelElementCollection other = (DefaultSubmodelElementCollection) obj; return Objects.equals(this.value, other.value) && Objects.equals(this.embeddedDataSpecifications, other.embeddedDataSpecifications) && - Objects.equals(this.semanticId, other.semanticId) && - Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && - Objects.equals(this.qualifiers, other.qualifiers) && Objects.equals(this.category, other.category) && Objects.equals(this.idShort, other.idShort) && Objects.equals(this.displayName, other.displayName) && Objects.equals(this.description, other.description) && - Objects.equals(this.extensions, other.extensions); + Objects.equals(this.extensions, other.extensions) && + Objects.equals(this.semanticId, other.semanticId) && + Objects.equals(this.supplementalSemanticIds, other.supplementalSemanticIds) && + Objects.equals(this.qualifiers, other.qualifiers); } } @@ -131,36 +131,6 @@ public void setEmbeddedDataSpecifications(List embedd this.embeddedDataSpecifications = embeddedDataSpecifications; } - @Override - public Reference getSemanticId() { - return semanticId; - } - - @Override - public void setSemanticId(Reference semanticId) { - this.semanticId = semanticId; - } - - @Override - public List getSupplementalSemanticIds() { - return supplementalSemanticIds; - } - - @Override - public void setSupplementalSemanticIds(List supplementalSemanticIds) { - this.supplementalSemanticIds = supplementalSemanticIds; - } - - @Override - public List getQualifiers() { - return qualifiers; - } - - @Override - public void setQualifiers(List qualifiers) { - this.qualifiers = qualifiers; - } - @Override public String getCategory() { return category; @@ -211,6 +181,36 @@ public void setExtensions(List extensions) { this.extensions = extensions; } + @Override + public Reference getSemanticId() { + return semanticId; + } + + @Override + public void setSemanticId(Reference semanticId) { + this.semanticId = semanticId; + } + + @Override + public List getSupplementalSemanticIds() { + return supplementalSemanticIds; + } + + @Override + public void setSupplementalSemanticIds(List supplementalSemanticIds) { + this.supplementalSemanticIds = supplementalSemanticIds; + } + + @Override + public List getQualifiers() { + return qualifiers; + } + + @Override + public void setQualifiers(List qualifiers) { + this.qualifiers = qualifiers; + } + public String toString() { return String.format( "DefaultSubmodelElementCollection (" + "value=%s,"