diff --git a/.github/workflows/maven-deploy-to-maven-central.yml b/.github/workflows/maven-deploy-to-maven-central.yml index 695ade856..11e4dd0dc 100644 --- a/.github/workflows/maven-deploy-to-maven-central.yml +++ b/.github/workflows/maven-deploy-to-maven-central.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up JDK 1.8 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 11 distribution: 'adopt' diff --git a/.github/workflows/maven-publish-snapshots.yml b/.github/workflows/maven-publish-snapshots.yml index 89d78c646..31d974da5 100644 --- a/.github/workflows/maven-publish-snapshots.yml +++ b/.github/workflows/maven-publish-snapshots.yml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up JDK 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '11' distribution: 'adopt' @@ -30,49 +30,49 @@ jobs: run: mvn -B package --file pom.xml - name: Delete old dataformat-parent package - uses: actions/delete-package-versions@v4 + uses: actions/delete-package-versions@v5 continue-on-error: true with: package-name: 'io.admin-shell.aas.dataformat-parent' - name: Delete old dataformat-core package - uses: actions/delete-package-versions@v4 + uses: actions/delete-package-versions@v5 continue-on-error: true with: package-name: 'io.admin-shell.aas.dataformat-core' - name: Delete old dataformat-aasx package - uses: actions/delete-package-versions@v4 + uses: actions/delete-package-versions@v5 continue-on-error: true with: package-name: 'io.admin-shell.aas.dataformat-aasx' - name: Delete old dataformat-xml package - uses: actions/delete-package-versions@v4 + uses: actions/delete-package-versions@v5 continue-on-error: true with: package-name: 'io.admin-shell.aas.dataformat-xml' - name: Delete old dataformat-aml package - uses: actions/delete-package-versions@v4 + uses: actions/delete-package-versions@v5 continue-on-error: true with: package-name: 'io.admin-shell.aas.dataformat-aml' - name: Delete old dataformat-rdf package - uses: actions/delete-package-versions@v4 + uses: actions/delete-package-versions@v5 continue-on-error: true with: package-name: 'io.admin-shell.aas.dataformat-rdf' - name: Delete old dataformat-json package - uses: actions/delete-package-versions@v4 + uses: actions/delete-package-versions@v5 continue-on-error: true with: package-name: 'io.admin-shell.aas.dataformat-json' - name: Delete old validator package - uses: actions/delete-package-versions@v4 + uses: actions/delete-package-versions@v5 continue-on-error: true with: package-name: 'io.admin-shell.aas.validator' diff --git a/.github/workflows/maven-run-tests.yml b/.github/workflows/maven-run-tests.yml index 107b154c4..43724271d 100644 --- a/.github/workflows/maven-run-tests.yml +++ b/.github/workflows/maven-run-tests.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up JDK 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '11' distribution: 'adopt' diff --git a/README.md b/README.md index bbd2739b3..fd11e3b66 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Eclipse AAS4J -> :newspaper: The _`Eclipse AAS4J 1.0.0-milestone-03`_ release is available on Maven Central Repository and includes the -> following artifacts implementing the _AAS Specs – Part 1 V3.0 (final)_: `dataformat-core`, `dataformat-aasx`, -> `dataformat-xml`, `dataformat-json`, `dataformat-parent`, and `model`. +> :newspaper: The _`Eclipse AAS4J 1.0.2`_ release is available on [Maven Central Repository](https://oss.sonatype.org/#nexus-search;quick~org.eclipse.digitaltwin.aas4j) and includes the +> following artifacts implementing the _AAS Specs – Part 1 V3.0 (final)_: `aas4j-dataformat-core`, `aas4j-dataformat-aasx`, +> `aas4j-dataformat-xml`, `aas4j-dataformat-json`, `aas4j-dataformat-parent`, and `aas4j-model`. [Eclipse AAS4J](https://projects.eclipse.org/projects/dt.aas4j) implements the specification of the Asset Administration Shell (AAS) such as metamodels, submodels, serialization and deserialization modules, validators, and transformation @@ -37,8 +37,6 @@ Please refer to [AAS Model README](model/README.md) for more information. ## Build and Use -Some examples can be found on the [documentation webpage](https://admin-shell-io.github.io/java-serializer/). - You can build the project using Maven by simply executing at the repository root: @@ -50,9 +48,9 @@ or by integrating the respective modules as dependencies from [Maven Central](ht ``` org.eclipse.digitaltwin.aas4j - dataformat-json - latest-version - + aas4j-model + 1.0.2 + ``` ## AAS4J Project Structure diff --git a/dataformat-aasx/pom.xml b/dataformat-aasx/pom.xml index c42a42903..121da2131 100644 --- a/dataformat-aasx/pom.xml +++ b/dataformat-aasx/pom.xml @@ -5,20 +5,24 @@ 4.0.0 org.eclipse.digitaltwin.aas4j - dataformat-parent + aas4j-dataformat-parent ${revision} - dataformat-aasx + aas4j-dataformat-aasx Asset Administration Shell AASX-Serializer ${project.groupId} - dataformat-xml + aas4j-dataformat-xml ${project.groupId} - dataformat-core + aas4j-dataformat-json + + + ${project.groupId} + aas4j-dataformat-core tests test @@ -36,7 +40,7 @@ ${project.groupId} - model + aas4j-model junit @@ -45,7 +49,12 @@ ${project.groupId} - dataformat-core + aas4j-dataformat-core + + org.slf4j + slf4j-simple + test + diff --git a/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/AASXDeserializer.java b/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/AASXDeserializer.java index 01674fab9..dc38c5250 100644 --- a/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/AASXDeserializer.java +++ b/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/AASXDeserializer.java @@ -15,41 +15,46 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + import org.apache.commons.io.IOUtils; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.PackagePart; import org.apache.poi.openxml4j.opc.PackageRelationshipCollection; import org.apache.poi.openxml4j.opc.PackagingURIHelper; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException; import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.internal.AASXUtils; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.DeserializationException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.visitor.AssetAdministrationShellElementWalkerVisitor; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.JsonDeserializer; import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.XmlDeserializer; import org.eclipse.digitaltwin.aas4j.v3.model.Environment; import org.eclipse.digitaltwin.aas4j.v3.model.File; -import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; -import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElementCollection; - -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * The AASX package converter converts a aasx package into a list of aas, a list * of submodels a list of assets, a list of Concept descriptions */ public class AASXDeserializer { + private static Logger logger = LoggerFactory.getLogger(AASXDeserializer.class); - private static final String XML_TYPE = "http://www.admin-shell.io/aasx/relationships/aas-spec"; - private static final String AASX_ORIGIN = "/aasx/aasx-origin"; + // In an older version of AAS4J/AASX Package Explorer, + // the wrong namespace was used + private static final String AASPEC_RELTYPE_BACKWARDSCOMPATIBLE = "http://www.admin-shell.io/aasx/relationships/aas-spec"; private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; - private final XmlDeserializer deserializer; + private final XmlDeserializer xmlDeserializer; + private final JsonDeserializer jsonDeserializer; private Environment environment; private final OPCPackage aasxRoot; @@ -63,20 +68,40 @@ public class AASXDeserializer { */ public AASXDeserializer(InputStream inputStream) throws InvalidFormatException, IOException { aasxRoot = OPCPackage.open(inputStream); - this.deserializer = new XmlDeserializer(); + this.xmlDeserializer = new XmlDeserializer(); + this.jsonDeserializer = new JsonDeserializer(); } /** - * Constructor for custom XML deserialization - * - * @param deserializer a custom deserializer used for deserializing the aas environment + * Constructor for custom deserialization + * + * @param xmlDeserializer a custom XML deserializer used for deserializing the aas environment + * @param inputStream an input stream to an aasx package that can be read with this instance + * @throws InvalidFormatException if aasx package format is invalid + * @throws IOException if creating input streams for aasx fails + */ + public AASXDeserializer(XmlDeserializer xmlDeserializer, + InputStream inputStream) throws InvalidFormatException, IOException { + aasxRoot = OPCPackage.open(inputStream); + this.xmlDeserializer = xmlDeserializer; + this.jsonDeserializer = new JsonDeserializer(); + } + + /** + * Constructor for custom deserialization + * + * @param xmlDeserializer a custom XML deserializer used for deserializing the aas environment + * @param jsonDeserializer a custom JSON deserializer used for deserializing the aas environment * @param inputStream an input stream to an aasx package that can be read with this instance * @throws InvalidFormatException if aasx package format is invalid * @throws IOException if creating input streams for aasx fails */ - public AASXDeserializer(XmlDeserializer deserializer, InputStream inputStream) throws InvalidFormatException, IOException { + public AASXDeserializer(XmlDeserializer xmlDeserializer, + JsonDeserializer jsonDeserializer, + InputStream inputStream) throws InvalidFormatException, IOException { aasxRoot = OPCPackage.open(inputStream); - this.deserializer = deserializer; + this.xmlDeserializer = xmlDeserializer; + this.jsonDeserializer = jsonDeserializer; } /** @@ -93,45 +118,141 @@ public Environment read() throws InvalidFormatException, IOException, Deserializ if (environment != null) { return environment; } - environment = deserializer.read(getXMLResourceString(aasxRoot)); + if (MetamodelContentType.XML.equals(getContentType())) { + environment = xmlDeserializer.read(getResourceString(aasxRoot)); + } + if (MetamodelContentType.JSON.equals(getContentType())) { + environment = jsonDeserializer.read(getResourceString(aasxRoot), Environment.class); + } return environment; } + /** + * Currently XML and JSON are supported for deserializing. + * @return The content type of the metafile + * @throws InvalidFormatException if aasx package format is invalid + * @throws IOException if creating input streams for aasx fails + */ + protected MetamodelContentType getContentType() throws InvalidFormatException, IOException { + MetamodelContentType contentType; + PackagePart packagePart = getPackagePart(aasxRoot); + // We also check for the none official content types "test/xml" and "text/json", which are commonly used + switch (packagePart.getContentType()) { + case "text/xml": + case "application/xml": + contentType = MetamodelContentType.XML; + break; + case "text/json": + case "application/json": + contentType = MetamodelContentType.JSON; + break; + default: + throw new RuntimeException("The following content type is not supported: " + packagePart.getContentType()); + } + return contentType; + } + /** * Return the Content of the xml file in the aasx-package as String - * + * + * @deprecated This method will be replaced by the method {@link AASXDeserializer#getResourceString()}. + * * @throws InvalidFormatException if aasx package format is invalid * @throws IOException if creating input streams for aasx fails */ + @Deprecated public String getXMLResourceString() throws InvalidFormatException, IOException { - return getXMLResourceString(this.aasxRoot); + return getResourceString(this.aasxRoot); } - private String getXMLResourceString(OPCPackage aasxPackage) throws InvalidFormatException, IOException { - // Get the "/aasx/aasx-origin" Part. It is Relationship source for the - // XML-Document - PackagePart originPart = aasxPackage.getPart(PackagingURIHelper.createPartName(AASX_ORIGIN)); - - // Get the Relation to the XML Document - PackageRelationshipCollection originRelationships = originPart.getRelationshipsByType(XML_TYPE); + /** + * Return the Content of the xml or json file in the aasx-package as String + * + * @throws InvalidFormatException if aasx package format is invalid + * @throws IOException if creating input streams for aasx fails + */ + public String getResourceString() throws InvalidFormatException, IOException { + return getResourceString(this.aasxRoot); + } - // If there is more than one or no XML-Document that is an error - if (originRelationships.size() > 1) { - throw new RuntimeException("More than one 'aasx-spec' document found in .aasx"); - } else if (originRelationships.size() == 0) { - throw new RuntimeException("No 'aasx-spec' document found in .aasx"); + /** + * Retrieves a list of related files from the deserialized aasx package + * + * @return the list of file in memory + * @throws InvalidFormatException + * if aasx package format is invalid + * @throws IOException + * if creating input streams for aasx fails + * @throws DeserializationException + * if deserialization of the serialized aas environment fails + */ + public List getRelatedFiles() throws InvalidFormatException, IOException, DeserializationException { + List filePaths = parseReferencedFilePathsFromAASX().stream().filter(AASXUtils::isFilePath).collect(Collectors.toList()); + List files = new ArrayList<>(); + for (String filePath : filePaths) { + try { + files.add(readFile(aasxRoot, filePath)); + } catch (Exception e) { + logger.warn("Loading file {} failed and will not be included.", filePath, e); + } } + return files; + } + + private PackagePart getPackagePart(OPCPackage aasxPackage) throws InvalidFormatException, IOException { + PackagePart originPart = getOriginPart(aasxPackage); + PackageRelationshipCollection originRelationships = getXMLDocumentRelation(originPart); + return originPart.getRelatedPart(originRelationships.getRelationship(0)); + } - // Get the PackagePart of the XML-Document - PackagePart xmlPart = originPart.getRelatedPart(originRelationships.getRelationship(0)); + private String getResourceString(OPCPackage aasxPackage) throws InvalidFormatException, IOException { + PackagePart xmlPart = getPackagePart(aasxPackage); + return readContentFromPackagePart(xmlPart); + } - // Read the content from the PackagePart + private String readContentFromPackagePart(PackagePart xmlPart) throws IOException { InputStream stream = xmlPart.getInputStream(); StringWriter writer = new StringWriter(); IOUtils.copy(stream, writer, DEFAULT_CHARSET); return writer.toString(); } + private PackagePart getOriginPart(OPCPackage aasxPackage) throws InvalidFormatException { + return aasxPackage.getPart(PackagingURIHelper.createPartName(AASXSerializer.ORIGIN_PATH)); + } + + private PackageRelationshipCollection getXMLDocumentRelation(PackagePart originPart) throws InvalidFormatException { + String xmlPart = getXMLPart(originPart); + PackageRelationshipCollection originRelationships = originPart.getRelationshipsByType(xmlPart); + + checkNumberOfRelationsForValidity(originRelationships); + + return originRelationships; + } + + private String getXMLPart(PackagePart originPart) throws InvalidFormatException { + if (isCompatibilityModeNeeded(originPart)) { + logger.info("AASX contains wrong Relationship namespace. This may be related to the AASX being created with an old version of AASX Package Explorer or an old version of AAS4J. Future compatibility with the wrong namespace may not be guaranteed"); + return AASPEC_RELTYPE_BACKWARDSCOMPATIBLE; + } else { + return AASXSerializer.AASSPEC_RELTYPE; + } + } + + private boolean isCompatibilityModeNeeded(PackagePart originPart) throws InvalidFormatException { + PackageRelationshipCollection originRelationshipsBackwardsCompatible = originPart.getRelationshipsByType(AASPEC_RELTYPE_BACKWARDSCOMPATIBLE); + + return originRelationshipsBackwardsCompatible.size() > 0; + } + + private void checkNumberOfRelationsForValidity(PackageRelationshipCollection originRelationships) throws InvalidFormatException { + if (originRelationships.size() > 1) { + throw new InvalidFormatException("More than one 'aasx-spec' document found in .aasx"); + } else if (originRelationships.size() == 0) { + throw new InvalidFormatException("No 'aasx-spec' document found in .aasx"); + } + } + /** * Load the referenced filepaths in the submodels such as PDF, PNG files from * the package @@ -150,49 +271,19 @@ private List parseReferencedFilePathsFromAASX() throws IOException, Inva && aas.getAssetInformation().getDefaultThumbnail() != null && aas.getAssetInformation().getDefaultThumbnail().getPath() != null) .forEach(aas -> paths.add(aas.getAssetInformation().getDefaultThumbnail().getPath())); - environment.getSubmodels().forEach(sm -> paths.addAll(parseElements(sm.getSubmodelElements()))); - return paths; - } - - /** - * Gets the file paths from a collection of ISubmodelElement - * - * @param elements the submodel elements to process - * @return the Paths from the File elements - */ - private List parseElements(Collection elements) { - List paths = new ArrayList<>(); - for (SubmodelElement element : elements) { - if (element instanceof File) { - File file = (File) element; - paths.add(file.getValue()); - } else if (element instanceof SubmodelElementCollection) { - SubmodelElementCollection collection = (SubmodelElementCollection) element; - paths.addAll(parseElements(collection.getValue())); + new AssetAdministrationShellElementWalkerVisitor() { + @Override + public void visit(File file) { + if(file != null && file.getValue() != null) { + paths.add(file.getValue()); + } } - } + }.visit(environment); return paths; } - /** - * Retrieves a list of related files from the deserialized aasx package - * - * @return the list of file in memory - * @throws InvalidFormatException if aasx package format is invalid - * @throws IOException if creating input streams for aasx fails - * @throws DeserializationException if deserialization of the serialized aas environment fails - */ - public List getRelatedFiles() throws InvalidFormatException, IOException, DeserializationException { - List filePaths = parseReferencedFilePathsFromAASX(); - List files = new ArrayList<>(); - for (String filePath : filePaths) { - files.add(readFile(aasxRoot, filePath)); - } - return files; - } - private InMemoryFile readFile(OPCPackage aasxRoot, String filePath) throws InvalidFormatException, IOException { - PackagePart part = aasxRoot.getPart(PackagingURIHelper.createPartName(AASXUtils.getPathFromURL(filePath))); + PackagePart part = aasxRoot.getPart(PackagingURIHelper.createPartName(AASXUtils.removeFilePartOfURI(filePath))); InputStream stream = part.getInputStream(); return new InMemoryFile(stream.readAllBytes(), filePath); } diff --git a/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/AASXSerializer.java b/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/AASXSerializer.java index 0dc26f626..6f3727e02 100644 --- a/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/AASXSerializer.java +++ b/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/AASXSerializer.java @@ -15,6 +15,14 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.Collection; +import java.util.HashSet; +import java.util.UUID; + import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.openxml4j.opc.PackagePart; @@ -23,25 +31,16 @@ import org.apache.poi.openxml4j.opc.RelationshipSource; import org.apache.poi.openxml4j.opc.TargetMode; import org.apache.poi.openxml4j.opc.internal.MemoryPackagePart; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.internal.AASXUtils; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.SerializationException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.visitor.AssetAdministrationShellElementWalkerVisitor; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.JsonSerializer; import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.XmlSerializer; import org.eclipse.digitaltwin.aas4j.v3.model.Environment; import org.eclipse.digitaltwin.aas4j.v3.model.File; -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.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.io.OutputStream; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collection; -import java.util.UUID; - /** * This class can be used to generate an .aasx file from Metamodel Objects and * the Files referred to in the Submodels @@ -51,39 +50,60 @@ public class AASXSerializer { private static final String MIME_PLAINTXT = "text/plain"; private static final String MIME_XML = "application/xml"; + private static final String MIME_JSON = "application/json"; + + public static final String OPC_NAMESPACE = "http://schemas.openxmlformats.org/package/2006/relationships"; + public static final String AASX_NAMESPACE = "http://admin-shell.io/aasx/relationships"; + + public static final String ORIGIN_RELTYPE = AASX_NAMESPACE + "/aasx-origin"; + public static final String ORIGIN_PATH = "/aasx/aasx-origin"; + public static final String ORIGIN_CONTENT = "Intentionally empty."; - private static final String ORIGIN_RELTYPE = "http://www.admin-shell.io/aasx/relationships/aasx-origin"; - private static final String ORIGIN_PATH = "/aasx/aasx-origin"; - private static final String ORIGIN_CONTENT = "Intentionally empty."; + public static final String AASSPEC_RELTYPE = AASX_NAMESPACE + "/aas-spec"; + public static final String XML_PATH = "/aasx/xml/content.xml"; + public static final String JSON_PATH = "/aasx/json/content.json"; - private static final String AASSPEC_RELTYPE = "http://www.admin-shell.io/aasx/relationships/aas-spec"; - private static final String XML_PATH = "/aasx/xml/content.xml"; + public static final String AASSUPPL_RELTYPE = AASX_NAMESPACE + "/aas-suppl"; - private static final String AASSUPPL_RELTYPE = "http://www.admin-shell.io/aasx/relationships/aas-suppl"; + public static final String AAS_THUMBNAIL_RELTYPE = OPC_NAMESPACE + "/metadata/thumbnail"; private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; private final XmlSerializer xmlSerializer; + private final JsonSerializer jsonSerializer; /** * Default constructor */ public AASXSerializer() { this.xmlSerializer = new XmlSerializer(); + this.jsonSerializer = new JsonSerializer(); } /** - * Constructor with a custom serializer for serializing the aas environment - * - * @param xmlSerializer a custom serializer used for serializing the aas environment + * Constructor with a custom XML serializer for serializing the aas environment + * + * @param xmlSerializer a custom serializer used for serializing the aas environment in XML */ public AASXSerializer(XmlSerializer xmlSerializer) { this.xmlSerializer = xmlSerializer; + this.jsonSerializer = new JsonSerializer(); } /** - * Generates the .aasx file and writes it to the given OutputStream - * + * Constructor with custom serializers for serializing the aas environment + * + * @param xmlSerializer a custom serializer used for serializing the aas environment in XML + * @param jsonSerializer a custom serializer used for serializing the aas environment in JSON + */ + public AASXSerializer(XmlSerializer xmlSerializer, JsonSerializer jsonSerializer) { + this.xmlSerializer = xmlSerializer; + this.jsonSerializer = jsonSerializer; + } + + /** + * Generates the .aasx file and writes it to the given OutputStream, by using XML as the default content type. + * * @param environment the aas environment that will be included in the aasx package as an xml serialization * @param files related inMemory files that belong to the given aas environment * @param os an output stream for writing the aasx package @@ -92,7 +112,22 @@ public AASXSerializer(XmlSerializer xmlSerializer) { */ public void write(Environment environment, Collection files, OutputStream os) throws SerializationException, IOException { - prepareFilePaths(environment.getSubmodels()); + + write(environment, files, os, MetamodelContentType.XML); + } + + /** + * Generates the .aasx file and writes it to the given OutputStream + * + * @param environment the aas environment that will be included in the aasx package as an xml serialization + * @param files related inMemory files that belong to the given aas environment + * @param os an output stream for writing the aasx package + * @param contentType the content type for the metamodel serialization + * @throws SerializationException if serializing the given elements fails + * @throws IOException if creating output streams for aasx fails + */ + public void write(Environment environment, Collection files, OutputStream os, MetamodelContentType contentType) + throws SerializationException, IOException { OPCPackage rootPackage = OPCPackage.create(os); @@ -100,20 +135,38 @@ public void write(Environment environment, Collection files, Outpu PackagePart origin = createAASXPart(rootPackage, rootPackage, ORIGIN_PATH, MIME_PLAINTXT, ORIGIN_RELTYPE, ORIGIN_CONTENT.getBytes()); - // Convert the given Metamodels to XML - String xml = xmlSerializer.write(environment); - - // Save the XML to aasx/xml/content.xml - PackagePart xmlPart = createAASXPart(rootPackage, origin, XML_PATH, MIME_XML, AASSPEC_RELTYPE, xml.getBytes(DEFAULT_CHARSET)); + PackagePart packagePart; + switch (contentType) { + case JSON: + // Convert the given Metamodels to JSON + String json = jsonSerializer.write(environment); + // Save the JSON to aasx/json/content.json + packagePart = createAASXPart(rootPackage, origin, JSON_PATH, MIME_JSON, AASSPEC_RELTYPE, json.getBytes(DEFAULT_CHARSET)); + break; + case XML: + // Convert the given Metamodels to XML + String xml = xmlSerializer.write(environment); + // Save the XML to aasx/xml/content.xml + packagePart = createAASXPart(rootPackage, origin, XML_PATH, MIME_XML, AASSPEC_RELTYPE, xml.getBytes(DEFAULT_CHARSET)); + break; + default: + throw new IllegalArgumentException("Unsupported content type: " + contentType); + } - storeFilesInAASX(environment, files, rootPackage, xmlPart); + environment.getAssetAdministrationShells().stream().filter(aas -> aas.getAssetInformation() != null + && aas.getAssetInformation().getDefaultThumbnail() != null + && aas.getAssetInformation().getDefaultThumbnail().getPath() != null) + .forEach(aas -> createParts(files, + AASXUtils.removeFilePartOfURI(aas.getAssetInformation().getDefaultThumbnail().getPath()), + rootPackage, rootPackage, aas.getAssetInformation().getDefaultThumbnail().getContentType(), AAS_THUMBNAIL_RELTYPE)); + storeFilesInAASX(environment, files, rootPackage, packagePart); saveAASX(os, rootPackage); } /** * Stores the files from the Submodels in the .aasx file - * + * * @param environment the Environment * @param files the content of the files * @param rootPackage the OPCPackage @@ -121,15 +174,8 @@ public void write(Environment environment, Collection files, Outpu */ private void storeFilesInAASX(Environment environment, Collection files, OPCPackage rootPackage, PackagePart xmlPart) { - environment.getAssetAdministrationShells().stream().filter(aas -> aas.getAssetInformation() != null - && aas.getAssetInformation().getDefaultThumbnail() != null - && aas.getAssetInformation().getDefaultThumbnail().getPath() != null) - .forEach(aas -> createParts(files, - AASXUtils.getPathFromURL(aas.getAssetInformation().getDefaultThumbnail().getPath()), - rootPackage, xmlPart, aas.getAssetInformation().getDefaultThumbnail().getContentType())); - environment.getSubmodels().forEach(sm -> - findFileElements(sm.getSubmodelElements()).forEach(file -> createParts(files, - AASXUtils.getPathFromURL(file.getValue()), rootPackage, xmlPart, file.getContentType()))); + findFileElements(environment).forEach(file -> createParts(files, + AASXUtils.removeFilePartOfURI(file.getValue()), rootPackage, xmlPart, file.getContentType(), AASSUPPL_RELTYPE)); } /** @@ -140,22 +186,23 @@ private void storeFilesInAASX(Environment environment, Collection * @param rootPackage the OPCPackage * @param xmlPart the Part the files should be related to * @param contentType the contentType of the file + * @param relType the relationship type */ private void createParts(Collection files, String filePath, OPCPackage rootPackage, - PackagePart xmlPart, String contentType) { + RelationshipSource xmlPart, String contentType, String relType) { try { InMemoryFile content = findFileByPath(files, filePath); - logger.trace("Writing file '" + filePath + "' to .aasx."); - createAASXPart(rootPackage, xmlPart, filePath, contentType, AASSUPPL_RELTYPE, content.getFileContent()); + logger.trace("Writing file '{}' to .aasx.", filePath); + createAASXPart(rootPackage, xmlPart, filePath, contentType, relType, content.getFileContent()); } catch (RuntimeException e) { // Log that a file is missing and continue building the .aasx - logger.warn("Could not add File '" + filePath + "'. It was not contained in given InMemoryFiles."); + logger.warn("Could not add File '{}'. It was not contained in given InMemoryFiles.", filePath, e); } } /** * Saves the OPCPackage to the given OutputStream - * + * * @param os the Stream to be saved to * @param rootPackage the Package to be saved * @throws IOException if creating output streams for aasx fails @@ -168,16 +215,17 @@ private void saveAASX(OutputStream os, OPCPackage rootPackage) throws IOExceptio /** * Generates a UUID. Every element of the .aasx needs a unique Id according to * the specification - * + * * @return UUID */ private String createUniqueID() { - return UUID.randomUUID().toString(); + // The unique id has to start with a letter (cf. xs:ID). UUIDs do this only sometimes + return "a" + UUID.randomUUID().toString(); } /** * Creates a Part (a file in the .aasx) of the .aasx and adds it to the Package - * + * * @param root the OPCPackage * @param relateTo the Part of the OPC the relationship of the new Part should be added to * @param path the path inside the .aasx where the new Part should be created @@ -209,7 +257,7 @@ private PackagePart createAASXPart(OPCPackage root, RelationshipSource relateTo, /** * Writes the content of a byte[] to a Part - * + * * @param part the Part to be written to * @param content the content to be written to the part */ @@ -223,65 +271,39 @@ private void writeDataToPart(PackagePart part, byte[] content) { } /** - * Gets the File elements from a collection of elements Also recursively + * Gets the File elements from an environment * searches in SubmodelElementCollections - * - * @param elements the Elements to be searched for File elements + * + * @param environment the Environment * @return the found Files */ - private Collection findFileElements(Collection elements) { - Collection files = new ArrayList<>(); - - for (SubmodelElement element : elements) { - if (element instanceof File) { - files.add((File) element); - } else if (element instanceof SubmodelElementCollection) { - // Recursive call to deal with SubmodelElementCollections - files.addAll(findFileElements(((SubmodelElementCollection) element).getValue())); + private Collection findFileElements(Environment environment) { + Collection files = new HashSet<>(); + new AssetAdministrationShellElementWalkerVisitor() { + @Override + public void visit(File file) { + if(file != null && file.getValue() != null) { + files.add(file); + } } - } - + }.visit(environment); return files; } - /** - * Replaces the path in all File Elements with the result of preparePath - * - * @param submodels the Submodels - */ - private void prepareFilePaths(Collection submodels) { - submodels.stream() - .forEach(sm -> findFileElements(sm.getSubmodelElements()).stream().forEach(f -> f.setValue(preparePath(f.getValue())))); - } - /** * Finds an InMemoryFile by its path - * + * * @param files the InMemoryFiles * @param path the path of the wanted file * @return the InMemoryFile if it was found; else null */ private InMemoryFile findFileByPath(Collection files, String path) { for (InMemoryFile file : files) { - if (AASXUtils.getPathFromURL(file.getPath()).equals(path)) { + if (AASXUtils.removeFilePartOfURI(file.getPath()).equals(path)) { return file; } } throw new RuntimeException("The wanted file '" + path + "' was not found in the given files."); } - /** - * Removes the serverpart from a path and ensures it starts with "file://" - * - * @param path the path to be prepared - * @return the prepared path - */ - private String preparePath(String path) { - String newPath = AASXUtils.getPathFromURL(path); - if (!newPath.startsWith("file://")) { - newPath = "file://" + newPath; - } - return newPath; - } - -} \ No newline at end of file +} diff --git a/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/AASXValidator.java b/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/AASXValidator.java index c11a8544c..a92ed8837 100644 --- a/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/AASXValidator.java +++ b/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/AASXValidator.java @@ -16,6 +16,8 @@ package org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.DeserializationException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.JsonSchemaValidator; import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.XmlSchemaValidator; import org.xml.sax.SAXException; @@ -29,10 +31,12 @@ public class AASXValidator { private XmlSchemaValidator xmlValidator; + private JsonSchemaValidator jsonValidator; private AASXDeserializer deserializer; public AASXValidator(InputStream is) throws SAXException, IOException, InvalidFormatException { this.xmlValidator = new XmlSchemaValidator(); + this.jsonValidator = new JsonSchemaValidator(); this.deserializer = new AASXDeserializer(is); } @@ -44,8 +48,15 @@ public AASXValidator(InputStream is) throws SAXException, IOException, InvalidFo * @throws InvalidFormatException specified URI is invalid */ public Set validateSchema() throws IOException, InvalidFormatException { - String file = deserializer.getXMLResourceString(); - return xmlValidator.validateSchema(file); + String file = deserializer.getResourceString(); + Set errorMessages = null; + if (MetamodelContentType.XML.equals(deserializer.getContentType())) { + errorMessages = xmlValidator.validateSchema(file); + } + else if (MetamodelContentType.JSON.equals(deserializer.getContentType())) { + errorMessages = jsonValidator.validateSchema(file); + } + return errorMessages; } } diff --git a/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/MetamodelContentType.java b/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/MetamodelContentType.java new file mode 100644 index 000000000..f6b1ccb4a --- /dev/null +++ b/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/MetamodelContentType.java @@ -0,0 +1,24 @@ +/* + * Copyright 2024 the original author or authors. + * + * 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.aasx; + +/** + * Supported ContentType's for serializing and deserializing Metamodels. + */ +public enum MetamodelContentType { + + JSON, + XML + +} diff --git a/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/internal/AASXUtils.java b/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/internal/AASXUtils.java index 6b3415b3c..710318277 100644 --- a/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/internal/AASXUtils.java +++ b/dataformat-aasx/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/internal/AASXUtils.java @@ -1,40 +1,45 @@ +/* + * Copyright (c) 2024 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.aasx.internal; public class AASXUtils { /** - * Gets the path from a URL e.g "http://localhost:8080/path/to/test.file" - * results in "/path/to/test.file" + * Removes the file: or file:// suffix of an URI * - * @param url URL to get the path for - * @return the path from the URL + * @param uri + * URI to remove the file suffix from + * @return the URI without the file suffix */ - public static String getPathFromURL(String url) { - if (url == null) { + public static String removeFilePartOfURI(String uri) { + if (uri == null) { return null; } - if (url.contains("://")) { - - // Find the ":" and and remove the "http://" from the url - int index = url.indexOf(":") + 3; - url = url.substring(index); - - // Find the first "/" from the URL (now without the "http://") and remove - // everything before that - index = url.indexOf("/"); - url = url.substring(index); - - // Recursive call to deal with more than one server parts - // (e.g. basyx://127.0.0.1:6998//https://localhost/test/) - return getPathFromURL(url); - } else { - // Make sure the path has a / at the start - if (!url.startsWith("/")) { - url = "/" + url; - } - return url; + if (uri.startsWith("file://")) { + return uri.replaceFirst("file://", ""); + } else if (uri.startsWith("file:")) { + return uri.replaceFirst("file:", ""); } + + return uri; + } + + public static boolean isFilePath(String uri) { + return uri.startsWith("/") || uri.startsWith("file:") || uri.startsWith("./") || uri.startsWith("../"); } } diff --git a/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/deserialization/AASXDeserializerTest.java b/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/deserialization/AASXDeserializerTest.java index 77007d622..84ab7eb7f 100644 --- a/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/deserialization/AASXDeserializerTest.java +++ b/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/deserialization/AASXDeserializerTest.java @@ -15,39 +15,49 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.deserialization; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import javax.xml.parsers.ParserConfigurationException; + import org.apache.commons.collections4.CollectionUtils; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.AASXDeserializer; import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.AASXSerializer; import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.InMemoryFile; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.MetamodelContentType; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASSimple; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.DeserializationException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.SerializationException; +import org.eclipse.digitaltwin.aas4j.v3.model.Environment; +import org.eclipse.digitaltwin.aas4j.v3.model.File; +import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; +import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultEnvironment; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultFile; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSubmodel; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSubmodelElementList; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.xml.sax.SAXException; -import javax.xml.parsers.ParserConfigurationException; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - public class AASXDeserializerTest { @Rule public TemporaryFolder tempFolder = new TemporaryFolder(); @Test - public void testRoundTrip() throws SerializationException, IOException, InvalidFormatException, DeserializationException, ParserConfigurationException, SAXException { - + public void roundTrip() throws SerializationException, IOException, InvalidFormatException, DeserializationException, ParserConfigurationException, SAXException { List fileList = new ArrayList<>(); byte[] operationManualContent = { 0, 1, 2, 3, 4 }; byte[] thumbnail = { 0, 1, 2, 3, 4 }; @@ -56,8 +66,8 @@ public void testRoundTrip() throws SerializationException, IOException, InvalidF fileList.add(inMemoryFile); fileList.add(inMemoryFileThumbnail); - File file = tempFolder.newFile("output.aasx"); - + // check round trip with XML content + java.io.File file = tempFolder.newFile("output-xml.aasx"); new AASXSerializer().write(AASSimple.createEnvironment(), fileList, new FileOutputStream(file)); InputStream in = new FileInputStream(file); @@ -65,5 +75,68 @@ public void testRoundTrip() throws SerializationException, IOException, InvalidF assertEquals(AASSimple.createEnvironment(), deserializer.read()); assertTrue(CollectionUtils.isEqualCollection(fileList, deserializer.getRelatedFiles())); + + // check round trip with JSON content + file = tempFolder.newFile("output-json.aasx"); + new AASXSerializer().write(AASSimple.createEnvironment(), fileList, new FileOutputStream(file), MetamodelContentType.JSON); + + in = new FileInputStream(file); + deserializer = new AASXDeserializer(in); + + assertEquals(AASSimple.createEnvironment(), deserializer.read()); + assertTrue(CollectionUtils.isEqualCollection(fileList, deserializer.getRelatedFiles())); + } + @Test + public void relatedFilesAreOnlyResolvedIfWithinAASX() throws IOException, SerializationException, InvalidFormatException, DeserializationException { + Submodel fileSm = new DefaultSubmodel.Builder().id("doesNotMatter").submodelElements(createFileSubmodelElements()).build(); + Environment env = new DefaultEnvironment.Builder().submodels(fileSm).build(); + + byte[] image = { 0, 1, 2, 3, 4 }; + InMemoryFile inMemoryFile = new InMemoryFile(image, "file:///aasx/internalFile.jpg"); + + java.io.File file = tempFolder.newFile("output.aasx"); + new AASXSerializer().write(env, Collections.singleton(inMemoryFile), new FileOutputStream(file)); + + InputStream in = new FileInputStream(file); + AASXDeserializer deserializer = new AASXDeserializer(in); + + assertEquals(Collections.singletonList(inMemoryFile), deserializer.getRelatedFiles()); + } + + @Test + public void emptyFiles() throws IOException, SerializationException, InvalidFormatException, DeserializationException { + File emptyFile = new DefaultFile.Builder().idShort("emptyFile").contentType(null).value(null).build(); + Submodel fileSm = new DefaultSubmodel.Builder().id("doesNotMatter").submodelElements(emptyFile).build(); + Environment env = new DefaultEnvironment.Builder().submodels(fileSm).build(); + + java.io.File file = tempFolder.newFile("output.aasx"); + new AASXSerializer().write(env, null, new FileOutputStream(file)); + + InputStream in = new FileInputStream(file); + AASXDeserializer deserializer = new AASXDeserializer(in); + assertTrue(deserializer.getRelatedFiles().isEmpty()); + } + + @Test + public void filesInElementList() throws IOException, SerializationException, InvalidFormatException, DeserializationException { + DefaultSubmodelElementList elementList = new DefaultSubmodelElementList.Builder().value(createFileSubmodelElements()).build(); + Submodel fileSm = new DefaultSubmodel.Builder().id("doesNotMatter").submodelElements(elementList).build(); + Environment env = new DefaultEnvironment.Builder().submodels(fileSm).build(); + + byte[] image = { 0, 1, 2, 3, 4 }; + InMemoryFile inMemoryFile = new InMemoryFile(image, "file:///aasx/internalFile.jpg"); + + java.io.File file = tempFolder.newFile("output.aasx"); + new AASXSerializer().write(env, Collections.singleton(inMemoryFile), new FileOutputStream(file)); + + InputStream in = new FileInputStream(file); + AASXDeserializer deserializer = new AASXDeserializer(in); + assertEquals(Collections.singletonList(inMemoryFile), deserializer.getRelatedFiles()); + } + + private static List createFileSubmodelElements() { + File internalFile = new DefaultFile.Builder().idShort("internalFile").contentType("image/jpeg").value("file:///aasx/internalFile.jpg").build(); + File externalFile = new DefaultFile.Builder().idShort("externalFile").contentType("image/jpeg").value("http://doesNotMatter.com/image").build(); + return Arrays.asList(internalFile, externalFile); } } diff --git a/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/deserialization/ValidationTest.java b/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/deserialization/ValidationTest.java index 856ed8916..9d77fbf0c 100644 --- a/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/deserialization/ValidationTest.java +++ b/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/deserialization/ValidationTest.java @@ -16,12 +16,12 @@ package org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.deserialization; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.AASXSerializer; import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.AASXValidator; import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.InMemoryFile; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASSimple; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.DeserializationException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.SerializationException; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -48,8 +48,11 @@ public class ValidationTest { public void validateXmlInsideAasx() throws SerializationException, IOException, InvalidFormatException, DeserializationException, ParserConfigurationException, SAXException { List fileList = new ArrayList<>(); byte[] operationManualContent = { 0, 1, 2, 3, 4 }; + byte[] thumbnail = { 0, 1, 2, 3, 4 }; InMemoryFile inMemoryFile = new InMemoryFile(operationManualContent, "file:///aasx/OperatingManual.pdf"); + InMemoryFile inMemoryFileThumbnail = new InMemoryFile(thumbnail, "file:///master/verwaltungsschale-detail-part1.png"); fileList.add(inMemoryFile); + fileList.add(inMemoryFileThumbnail); File file = tempFolder.newFile("output.aasx"); diff --git a/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/internal/TestAASXUtils.java b/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/internal/TestAASXUtils.java new file mode 100644 index 000000000..46959ea7f --- /dev/null +++ b/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/internal/TestAASXUtils.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 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.aasx.internal; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class TestAASXUtils { + + @Test + public void isFilePath() { + // Cf. RFC8089 + String[] filePaths = { + "file://a", "file:a", "./b/c", "../b/c/d", "/a" + }; + + String[] notFilePaths = { + "http://admin-shell.io/example", "ftp://admin-shell.io/example" + }; + + for (String filePath : filePaths) { + assertTrue(AASXUtils.isFilePath(filePath)); + } + + for (String filePath : notFilePaths) { + assertFalse(AASXUtils.isFilePath(filePath)); + } + } + + @Test + public void removeFilePartOfURI() { + String[] filePaths = { + "file:///a", "file:/a", "/a" + }; + + for (String filePath : filePaths) { + assertEquals("/a", AASXUtils.removeFilePartOfURI(filePath)); + } + } +} diff --git a/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/serialization/AASXSerializerTest.java b/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/serialization/AASXSerializerTest.java index aee0d6031..b5f86d6ce 100644 --- a/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/serialization/AASXSerializerTest.java +++ b/dataformat-aasx/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/aasx/serialization/AASXSerializerTest.java @@ -16,11 +16,12 @@ package org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.serialization; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.AASXSerializer; import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.InMemoryFile; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.aasx.MetamodelContentType; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASFull; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASSimple; -import org.junit.Before; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.SerializationException; import org.junit.Test; import javax.xml.parsers.ParserConfigurationException; @@ -28,8 +29,10 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; +import java.util.function.BiConsumer; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -38,57 +41,76 @@ public class AASXSerializerTest { + private static final String RELS_PATH_URI = "file:///_rels/.rels"; private static final String XML_PATH_URI = "file:///aasx/xml/content.xml"; + private static final String JSON_PATH_URI = "file:///aasx/json/content.json"; private static final String ORIGIN_PATH_URI = "file:///aasx/aasx-origin"; private List fileList = new ArrayList<>(); - @Before - public void setup() throws IOException { + @Test + public void testBuildAASXFull() throws IOException, TransformerException, ParserConfigurationException, SerializationException { byte[] operationManualContent = { 0, 1, 2, 3, 4 }; + InMemoryFile file = new InMemoryFile(operationManualContent, "file:///TestFile.pdf"); + fileList.add(file); + // This stream can be used to write the .aasx directly to a file + // FileOutputStream out = new FileOutputStream("path/to/test.aasx"); + + // This stream keeps the output of the AASXFactory only in memory + ByteArrayOutputStream out = new ByteArrayOutputStream(); + // validate AASX with XML content + new AASXSerializer().write(AASFull.createEnvironment(), fileList, out, MetamodelContentType.XML); + validateAASX(out, XML_PATH_URI, List.of(AASXSerializerTest::assertRootXml)); + + out = new ByteArrayOutputStream(); + // validate AASX with JSON content + new AASXSerializer().write(AASFull.createEnvironment(), fileList, out, MetamodelContentType.JSON); + validateAASX(out, JSON_PATH_URI, List.of(AASXSerializerTest::assertRootJson)); + } + + @Test + public void testBuildAASXSimple() throws IOException, TransformerException, ParserConfigurationException, SerializationException { byte[] thumbnail = { 0, 1, 2, 3, 4 }; + byte[] operationManualContent = { 0, 1, 2, 3, 4 }; InMemoryFile file = new InMemoryFile(operationManualContent, "file:///aasx/OperatingManual.pdf"); InMemoryFile inMemoryFileThumbnail = new InMemoryFile(thumbnail, "file:///master/verwaltungsschale-detail-part1.png"); fileList.add(file); fileList.add(inMemoryFileThumbnail); - } - - @Test - public void testBuildAASX() throws IOException, TransformerException, ParserConfigurationException, SerializationException { - // This stream can be used to write the .aasx directly to a file // FileOutputStream out = new FileOutputStream("path/to/test.aasx"); // This stream keeps the output of the AASXFactory only in memory ByteArrayOutputStream out = new ByteArrayOutputStream(); - + // validate AASX with XML content new AASXSerializer().write(AASSimple.createEnvironment(), fileList, out); + validateAASX(out, XML_PATH_URI, List.of(AASXSerializerTest::assertRootXml, AASXSerializerTest::assertThumbnailReference)); - validateAASX(out); + out = new ByteArrayOutputStream(); + // validate AASX with JSON content + new AASXSerializer().write(AASSimple.createEnvironment(), fileList, out, MetamodelContentType.JSON); + validateAASX(out, JSON_PATH_URI, List.of(AASXSerializerTest::assertRootJson, AASXSerializerTest::assertThumbnailReference)); } - private void validateAASX(ByteArrayOutputStream byteStream) throws IOException { + private void validateAASX(ByteArrayOutputStream byteStream, String contentFilePath, List> fileValidators) { ZipInputStream in = new ZipInputStream(new ByteArrayInputStream(byteStream.toByteArray())); - ZipEntry zipEntry = null; + ZipEntry zipEntry; ArrayList filePaths = new ArrayList<>(); - while ((zipEntry = in.getNextEntry()) != null) { - if (zipEntry.getName().equals(XML_PATH_URI)) { - - // Read the first 5 bytes of the XML file to make sure it is in fact XML file - // No further test of XML file necessary as XML-Converter is tested separately - byte[] buf = new byte[5]; - in.read(buf); - assertEquals(" validator : fileValidators) { + validator.accept(zipEntry, in); + } + // Write the paths of all files contained in the .aasx into filePaths + filePaths.add("file:///" + zipEntry.getName()); } - - // Write the paths of all files contained in the .aasx into filePaths - filePaths.add("file:///" + zipEntry.getName()); + } catch (IOException e) { + throw new RuntimeException(e); } - assertTrue(filePaths.contains(XML_PATH_URI)); + assertTrue(filePaths.contains(contentFilePath)); assertTrue(filePaths.contains(ORIGIN_PATH_URI)); // Check if all expected files are present @@ -99,4 +121,48 @@ private void validateAASX(ByteArrayOutputStream byteStream) throws IOException { } } + + private static void assertRootXml(ZipEntry zipEntry, ZipInputStream in) { + if (!XML_PATH_URI.endsWith(zipEntry.getName())) { + return; + } + // Read the first 5 bytes of the XML file to make sure it is in fact XML file + // No further test of XML file necessary as XML-Converter is tested separately + byte[] buf = new byte[5]; + try { + in.read(buf); + } catch (IOException e) { + throw new RuntimeException(e); + } + assertEquals("4.0.0 org.eclipse.digitaltwin.aas4j - dataformat-parent + aas4j-dataformat-parent ${revision} - dataformat-core + aas4j-dataformat-core Asset Administration Shell Serializer Core ${project.groupId} - model + aas4j-model com.fasterxml.jackson.core diff --git a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/DeserializationException.java b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/DeserializationException.java similarity index 94% rename from dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/DeserializationException.java rename to dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/DeserializationException.java index 26e0f1868..ac0262486 100644 --- a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/DeserializationException.java +++ b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/DeserializationException.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.core; @SuppressWarnings("serial") public class DeserializationException extends Exception { diff --git a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/SchemaValidator.java b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/SchemaValidator.java similarity index 95% rename from dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/SchemaValidator.java rename to dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/SchemaValidator.java index 3cff51469..c246a591e 100644 --- a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/SchemaValidator.java +++ b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/SchemaValidator.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.core; import java.util.Set; diff --git a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/SerializationException.java b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/SerializationException.java similarity index 94% rename from dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/SerializationException.java rename to dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/SerializationException.java index 981d657cb..e4da3d766 100644 --- a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/SerializationException.java +++ b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/SerializationException.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.core; @SuppressWarnings("serial") public class SerializationException extends Exception { diff --git a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/deserialization/EnumDeserializer.java b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/deserialization/EnumDeserializer.java similarity index 96% rename from dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/deserialization/EnumDeserializer.java rename to dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/deserialization/EnumDeserializer.java index ebd49fbff..74b46f252 100644 --- a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/deserialization/EnumDeserializer.java +++ b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/deserialization/EnumDeserializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.core.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.deserialization; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; 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/internal/serialization/EnumSerializer.java similarity index 89% rename from dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/serialization/EnumSerializer.java rename to dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/serialization/EnumSerializer.java index 425e9cfdc..842482d90 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/internal/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. @@ -14,15 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.core.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.serialization; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; 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 +54,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/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/util/GetChildrenVisitor.java b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/util/GetChildrenVisitor.java new file mode 100644 index 000000000..1122e7afa --- /dev/null +++ b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/util/GetChildrenVisitor.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2023 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.core.internal.util; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.visitor.AssetAdministrationShellElementVisitor; +import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell; +import org.eclipse.digitaltwin.aas4j.v3.model.Environment; +import org.eclipse.digitaltwin.aas4j.v3.model.Referable; +import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; +import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElementCollection; +import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElementList; + +public class GetChildrenVisitor implements AssetAdministrationShellElementVisitor { + + private final List children = new ArrayList<>(); + private Environment environment; + + public GetChildrenVisitor() { + } + + public void reset() { + children.clear(); + } + + public GetChildrenVisitor(Environment environment) { + this.environment = environment; + } + + public List getChildren() { + return children; + } + + @Override + public void visit(Environment environment) { + children.addAll(environment.getAssetAdministrationShells()); + children.addAll(environment.getConceptDescriptions()); + children.addAll(environment.getSubmodels()); + } + + @Override + public void visit(AssetAdministrationShell assetAdministrationShell) { + List submodelIds = assetAdministrationShell.getSubmodels().stream() + .map(x -> x.getKeys().get(x.getKeys().size() - 1).getValue()) + .collect(Collectors.toList()); + if (environment != null) { + children.addAll(environment.getSubmodels().stream() + .filter(x -> submodelIds.contains(x.getId())) + .collect(Collectors.toList())); + } + } + + @Override + public void visit(Submodel submodel) { + children.addAll(submodel.getSubmodelElements()); + } + + @Override + public void visit(SubmodelElementCollection submodelElementCollection) { + children.addAll(submodelElementCollection.getValue()); + } + + @Override + public void visit(SubmodelElementList submodelElementList) { + children.addAll(submodelElementList.getValue()); + } +} diff --git a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/util/GetIdentifierVisitor.java b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/util/GetIdentifierVisitor.java new file mode 100644 index 000000000..e3df45436 --- /dev/null +++ b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/util/GetIdentifierVisitor.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2023 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.core.internal.util; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.visitor.AssetAdministrationShellElementVisitor; +import org.eclipse.digitaltwin.aas4j.v3.model.Identifiable; +import org.eclipse.digitaltwin.aas4j.v3.model.Referable; + +public class GetIdentifierVisitor implements AssetAdministrationShellElementVisitor { + + private String identifier; + + public static String getIdentifier(Referable referable) { + GetIdentifierVisitor visitor = new GetIdentifierVisitor(); + visitor.visit(referable); + return visitor.getIdentifier(); + } + + public String getIdentifier() { + return identifier; + } + + @Override + public void visit(Referable referable) { + if (referable != null) { + identifier = referable.getIdShort(); + } + AssetAdministrationShellElementVisitor.super.visit(referable); + } + + @Override + public void visit(Identifiable identifiable) { + if (identifiable != null) { + identifier = identifiable.getId(); + } + AssetAdministrationShellElementVisitor.super.visit(identifiable); + } +} diff --git a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/util/ReflectionHelper.java b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/util/ReflectionHelper.java similarity index 95% rename from dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/util/ReflectionHelper.java rename to dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/util/ReflectionHelper.java index b69025640..b571972c7 100644 --- a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/util/ReflectionHelper.java +++ b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/util/ReflectionHelper.java @@ -13,19 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util; - -import com.google.common.reflect.TypeToken; -import io.github.classgraph.ClassGraph; -import io.github.classgraph.ClassInfo; -import io.github.classgraph.ClassInfoList; -import io.github.classgraph.ScanResult; -import org.apache.commons.lang3.ClassUtils; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.MostSpecificTypeTokenComparator; -import org.eclipse.digitaltwin.aas4j.v3.model.DataSpecificationContent; -import org.eclipse.digitaltwin.aas4j.v3.model.Referable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util; import java.lang.reflect.Field; import java.util.ArrayList; @@ -37,6 +25,19 @@ import java.util.Set; import java.util.stream.Collectors; +import org.apache.commons.lang3.ClassUtils; +import org.eclipse.digitaltwin.aas4j.v3.model.DataSpecificationContent; +import org.eclipse.digitaltwin.aas4j.v3.model.Referable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.reflect.TypeToken; + +import io.github.classgraph.ClassGraph; +import io.github.classgraph.ClassInfo; +import io.github.classgraph.ClassInfoList; +import io.github.classgraph.ScanResult; + /** * Helper class to collect relevant data needed for * ReflectionAnnotationIntrospector via reflection. @@ -58,12 +59,12 @@ public class ReflectionHelper { * Name of package where the json mixins are defined. These mixins are * automatically added to JsonSerializer and JsonDeserializer. */ - public static final String JSON_MIXINS_PACKAGE_NAME = ROOT_PACKAGE_NAME + ".dataformat.json.mixins"; + public static final String JSON_MIXINS_PACKAGE_NAME = ROOT_PACKAGE_NAME + ".dataformat.json.internal.mixins"; /** * Name of package where the xml mixins are defined. These mixins are * automatically added to XmlSerializer and XmlDeserializer. */ - public static final String XML_MIXINS_PACKAGE_NAME = ROOT_PACKAGE_NAME + ".dataformat.xml.mixins"; + public static final String XML_MIXINS_PACKAGE_NAME = ROOT_PACKAGE_NAME + ".dataformat.xml.internal.mixins"; /** * Suffix that identifies a class as a mixin. */ @@ -216,7 +217,7 @@ public static Class getAasInterface(Class type) { if (implementedAasInterfaces.size() == 1) { return implementedAasInterfaces.iterator().next(); } - logger.warn("class '{}' implements more than one AAS interface, but only most specific one is returned", type.getName()); + logger.debug("class '{}' implements more than one AAS interface, but only most specific one is returned", type.getName()); return implementedAasInterfaces.stream().map(x -> TypeToken.of(x)) .sorted(new MostSpecificTypeTokenComparator()) .findFirst().get() diff --git a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/visitor/AssetAdministrationShellElementVisitor.java b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/visitor/AssetAdministrationShellElementVisitor.java index d0e27b8f7..24eb8f9d5 100644 --- a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/visitor/AssetAdministrationShellElementVisitor.java +++ b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/visitor/AssetAdministrationShellElementVisitor.java @@ -58,6 +58,7 @@ 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; public interface AssetAdministrationShellElementVisitor { @@ -171,6 +172,8 @@ public default void visit(SubmodelElement submodelElement) { visit((Capability) submodelElement); } else if (SubmodelElementCollection.class.isAssignableFrom(type)) { visit((SubmodelElementCollection) submodelElement); + } else if (SubmodelElementList.class.isAssignableFrom(type)) { + visit((SubmodelElementList) submodelElement); } else if (Operation.class.isAssignableFrom(type)) { visit((Operation) submodelElement); } else if (EventElement.class.isAssignableFrom(type)) { @@ -231,8 +234,8 @@ public default void visit(Capability capability) { public default void visit(ConceptDescription conceptDescription) { } - public default void visit(DataSpecificationContent dataSpecificationContent) { - } + public default void visit(DataSpecificationContent dataSpecificationContent) { + } public default void visit(Entity entity) { } @@ -297,6 +300,9 @@ public default void visit(Submodel submodel) { public default void visit(SubmodelElementCollection submodelElementCollection) { } + public default void visit(SubmodelElementList submodelElementList) { + } + public default void visit(Resource resource) { } diff --git a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/visitor/AssetAdministrationShellElementWalkerVisitor.java b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/visitor/AssetAdministrationShellElementWalkerVisitor.java index 3c51c7700..f373b8620 100644 --- a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/visitor/AssetAdministrationShellElementWalkerVisitor.java +++ b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/internal/visitor/AssetAdministrationShellElementWalkerVisitor.java @@ -46,6 +46,7 @@ import org.eclipse.digitaltwin.aas4j.v3.model.SpecificAssetId; import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElementCollection; +import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElementList; public interface AssetAdministrationShellElementWalkerVisitor extends AssetAdministrationShellElementVisitor { @@ -129,7 +130,7 @@ public default void visit(HasSemantics hasSemantics) { return; } visit(hasSemantics.getSemanticId()); - hasSemantics.getSupplementalSemanticIds().forEach(x->visit(x)); + hasSemantics.getSupplementalSemanticIds().forEach(x -> visit(x)); AssetAdministrationShellElementVisitor.super.visit(hasSemantics); } @@ -208,36 +209,36 @@ public default void visit(Referable referable) { } @Override - public default void visit(LangStringNameType langString){ - if (langString == null){ + public default void visit(LangStringNameType langString) { + if (langString == null) { return; } AssetAdministrationShellElementVisitor.super.visit(langString); - }; + } @Override - public default void visit(LangStringPreferredNameTypeIec61360 langString){ - if (langString == null){ + public default void visit(LangStringPreferredNameTypeIec61360 langString) { + if (langString == null) { return; } AssetAdministrationShellElementVisitor.super.visit(langString); - }; + } @Override - public default void visit(LangStringDefinitionTypeIec61360 langString){ - if (langString == null){ + public default void visit(LangStringDefinitionTypeIec61360 langString) { + if (langString == null) { return; } AssetAdministrationShellElementVisitor.super.visit(langString); - }; + } @Override - public default void visit(LangStringTextType langString){ - if (langString == null){ + public default void visit(LangStringTextType langString) { + if (langString == null) { return; } AssetAdministrationShellElementVisitor.super.visit(langString); - }; + } @Override public default void visit(Reference reference) { @@ -315,6 +316,15 @@ public default void visit(SubmodelElementCollection submodelElementCollection) { AssetAdministrationShellElementVisitor.super.visit(submodelElementCollection); } + @Override + public default void visit(SubmodelElementList submodelElementList) { + if (submodelElementList == null) { + return; + } + submodelElementList.getValue().forEach(x -> visit(x)); + AssetAdministrationShellElementVisitor.super.visit(submodelElementList); + } + @Override public default void visit(Operation operation) { if (operation == null) { diff --git a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/util/AasUtils.java b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/util/AasUtils.java index 1621c2c92..b1f210bdd 100644 --- a/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/util/AasUtils.java +++ b/dataformat-core/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/util/AasUtils.java @@ -15,36 +15,39 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util; -import com.google.common.reflect.TypeToken; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.deserialization.EnumDeserializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.IdentifiableCollector; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.deserialization.EnumDeserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.serialization.EnumSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.GetChildrenVisitor; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.GetIdentifierVisitor; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.MostSpecificTypeTokenComparator; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.serialization.EnumSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; import org.eclipse.digitaltwin.aas4j.v3.model.Environment; import org.eclipse.digitaltwin.aas4j.v3.model.Identifiable; import org.eclipse.digitaltwin.aas4j.v3.model.Key; import org.eclipse.digitaltwin.aas4j.v3.model.KeyTypes; -import org.eclipse.digitaltwin.aas4j.v3.model.Operation; import org.eclipse.digitaltwin.aas4j.v3.model.Referable; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; import org.eclipse.digitaltwin.aas4j.v3.model.ReferenceTypes; +import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElementList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.HashSet; -import java.util.List; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; +import com.google.common.reflect.TypeToken; /** * Provides utility functions related to AAS @@ -53,26 +56,60 @@ public class AasUtils { private static final Logger log = LoggerFactory.getLogger(AasUtils.class); - private static final String REFERENCE_ELEMENT_DELIMITER = ", "; + private static final Map REFERENCE_TYPE_REPRESENTATION = Map.of( + ReferenceTypes.EXTERNAL_REFERENCE, "ExternalRef", + ReferenceTypes.MODEL_REFERENCE, "ModelRef"); private AasUtils() { } - /** - * Formats a Reference as string - * - * @param reference - * Reference to serialize - * @return string representation of the reference for serialization, null if - * reference is null - */ - private static String asString(Reference reference) { - if (reference == null) { - return null; - } - return String.format("[%s]%s", reference.getType(), - reference.getKeys().stream().map(x -> String.format("(%s)%s", EnumSerializer.serializeEnumName(x.getType().name()), x.getValue())).collect(Collectors.joining(REFERENCE_ELEMENT_DELIMITER))); - } + /** + * Formats a Reference as string + * + * @param reference Reference to serialize + * @return string representation of the reference for serialization, null if reference is null + */ + public static String asString(Reference reference) { + return asString(reference, true, true); + } + + /** + * Serializes a {@link Reference} to string. + * + * @param reference the reference to serialize + * @param includeReferenceType if reference type information should be included + * @param includeReferredSemanticId if referred semanticId should be included + * @return the serialized reference or null if reference is null, reference.keys is null or reference does not + * contain any keys + */ + public static String asString(Reference reference, boolean includeReferenceType, boolean includeReferredSemanticId) { + if (Objects.isNull(reference) || Objects.isNull(reference.getKeys()) || reference.getKeys().isEmpty()) { + return null; + } + String result = ""; + if (includeReferenceType) { + String referredSemanticId = includeReferredSemanticId + ? asString(reference.getReferredSemanticId(), includeReferenceType, false) + : ""; + result = String.format("[%s%s]", + asString(reference.getType()), + (Objects.nonNull(referredSemanticId) && !referredSemanticId.isBlank()) ? String.format("- %s -", referredSemanticId) + : ""); + } + result += reference.getKeys().stream() + .map(x -> String.format("(%s)%s", + EnumSerializer.serializeEnumName(x.getType().name()), + x.getValue())) + .collect(Collectors.joining(", ")); + return result; + } + + private static String asString(ReferenceTypes referenceType) { + if (!REFERENCE_TYPE_REPRESENTATION.containsKey(referenceType)) { + throw new IllegalArgumentException(String.format("Unsupported reference type '%s'", referenceType)); + } + return REFERENCE_TYPE_REPRESENTATION.get(referenceType); + } /** * Creates a reference for an Identifiable instance using provided implementation types for reference and key @@ -128,9 +165,9 @@ public static KeyTypes referableToKeyType(Referable referable) { * @return a Java interface representing the provided KeyElements type or null if no matching Class/interface could * be found. It also returns abstract types like SUBMODEL_ELEMENT or DATA_ELEMENT */ - private static Class keyTypeToClass(KeyTypes key) { + private static Class keyTypeToClass(KeyTypes key) { return Stream.concat(ReflectionHelper.INTERFACES.stream(), ReflectionHelper.INTERFACES_WITHOUT_DEFAULT_IMPLEMENTATION.stream()) - .filter(x -> x.getSimpleName().equals(EnumSerializer.serializeEnumName(key.name()))) + .filter(x -> x.getSimpleName().equals(EnumSerializer.serializeEnumName(key.name()))) .findAny() .orElse(null); } @@ -188,36 +225,53 @@ public static Reference toReference(Reference parent, Referable element) { } /** - * Checks if two references are refering to the same element + * Checks if two references are refering to the same element ignoring referredSemanticId. * * @param ref1 reference 1 * @param ref2 reference 2 * @return returns true if both references are refering to the same element, otherwise false */ public static boolean sameAs(Reference ref1, Reference ref2) { + return sameAs(ref1, ref2, false); + } + + /** + * Checks if two references are referring to the same element. + * + * @param ref1 reference 1 + * @param ref2 reference 2 + * @param compareReferredSemanticId true if referredSemanticId should be compared, false otherwise + * @return returns true if both references are referring to the same element, otherwise false + */ + public static boolean sameAs(Reference ref1, Reference ref2, boolean compareReferredSemanticId) { boolean ref1Empty = ref1 == null || ref1.getKeys() == null || ref1.getKeys().isEmpty(); boolean ref2Empty = ref2 == null || ref2.getKeys() == null || ref2.getKeys().isEmpty(); + if (ref1Empty != ref2Empty) { + return false; + } + if (ref1.getType() != ref2.getType()) { + return false; + } + if (compareReferredSemanticId && !sameAs(ref1.getReferredSemanticId(), ref2.getReferredSemanticId())) { + return false; + } if (ref1Empty && ref2Empty) { return true; } - if (ref1Empty != ref2Empty) { + if (ref1.getKeys().size() != ref2.getKeys().size()) { return false; } - int keyLength = Math.min(ref1.getKeys().size(), ref2.getKeys().size()); - for (int i = 0; i < keyLength; i++) { - Key ref1Key = ref1.getKeys().get(ref1.getKeys().size() - (i + 1)); - Key ref2Key = ref2.getKeys().get(ref2.getKeys().size() - (i + 1)); - Class ref1Type = keyTypeToClass(ref1Key.getType()); - Class ref2Type = keyTypeToClass(ref2Key.getType()); - if ((ref1Type == null && ref2Type != null) - || (ref1Type != null && ref2Type == null)) { + for (int i = 0; i < ref1.getKeys().size(); i++) { + Key key1 = ref1.getKeys().get(ref1.getKeys().size() - (i + 1)); + Key key2 = ref2.getKeys().get(ref2.getKeys().size() - (i + 1)); + if (Objects.isNull(key1) != Objects.isNull(key2)) { return false; } - if (ref1Type != ref2Type) { - if (!(ref1Type.isAssignableFrom(ref2Type) - || ref2Type.isAssignableFrom(ref1Type))) { - return false; - } + if (Objects.isNull(key1)) { + return true; + } + if (!Objects.equals(key1.getValue(), key2.getValue())) { + return false; } } return true; @@ -232,7 +286,7 @@ public static boolean sameAs(Reference ref1, Reference ref2) { * * @return the cloned reference */ - private static Reference clone(Reference reference, Class referenceType, Class keyType) { + private static Reference clone(Reference reference, Class referenceType, Class keyType) { if (reference == null || reference.getKeys() == null || reference.getKeys().isEmpty()) { return null; } @@ -278,114 +332,52 @@ public static Referable resolve(Reference reference, Environment env) { * @return returns an instance of T if the reference could successfully be resolved, otherwise null * @throws IllegalArgumentException if something goes wrong while resolving */ - @SuppressWarnings("unchecked") - public static T resolve(Reference reference, Environment env, Class type) { + @SuppressWarnings("unchecked") + public static T resolve(Reference reference, Environment env, Class type) { if (reference == null || reference.getKeys() == null || reference.getKeys().isEmpty()) { return null; } - Set identifiables = new IdentifiableCollector(env).collect(); - Object current = null; - int i = reference.getKeys().size() - 1; - if (type != null) { - Class actualType = keyTypeToClass(reference.getKeys().get(i).getType()); - if (actualType == null) { - log.warn("reference {} could not be resolved as key type has no known class.", - asString(reference)); - return null; - } - if (!type.isAssignableFrom(actualType)) { - log.warn("reference {} could not be resolved as target type is not assignable from actual type (target: {}, actual: {})", - asString(reference), type.getName(), actualType.getName()); - return null; - } - } - for (; i >= 0; i--) { + GetChildrenVisitor findChildrenVisitor = new GetChildrenVisitor(env); + findChildrenVisitor.visit(env); + Referable current = null; + for (int i = 0; i < reference.getKeys().size(); i++) { Key key = reference.getKeys().get(i); - Class referencedType = keyTypeToClass(key.getType()); - if (referencedType != null) { - List matchingIdentifiables = identifiables.stream() - .filter(x -> referencedType.isAssignableFrom(x.getClass())) - .filter(x -> x.getId().equals(key.getValue())) - .collect(Collectors.toList()); - if (matchingIdentifiables.size() > 1) { - throw new IllegalArgumentException("found multiple matching Identifiables for id '" + key.getValue() + "'"); + try { + int index = Integer.parseInt(key.getValue()); + if (Objects.isNull(current) || !SubmodelElementList.class.isAssignableFrom(current.getClass())) { + throw new IllegalArgumentException("reference uses index notation on an element that is not a SubmodelElementList"); } - if (matchingIdentifiables.size() == 1) { - current = matchingIdentifiables.get(0); - break; + List list = ((SubmodelElementList) current).getValue(); + if (list.size() <= index) { + throw new IllegalArgumentException(String.format( + "index notation out of bounds (list size: %s, requested index: %s)", + list.size(), + index)); } + current = list.get(index); + } catch (NumberFormatException e) { + current = findChildrenVisitor.getChildren().stream() + .filter(x -> Objects.equals(key.getValue(), GetIdentifierVisitor.getIdentifier(x))) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException(String.format( + "unable to resolve reference '%s' as element '%s' does not exist", + asString(reference), + key.getValue()))); } + findChildrenVisitor.reset(); + findChildrenVisitor.visit(current); } if (current == null) { return null; } - i++; - if (i == reference.getKeys().size()) { - return (T) current; - } - // follow idShort path until target - for (; i < reference.getKeys().size(); i++) { - Key key = reference.getKeys().get(i); - Class keyType = keyTypeToClass(key.getType()); - if (keyType != null) { - if (SubmodelElementList.class.isAssignableFrom(current.getClass())) { - try { - current = ((SubmodelElementList) current).getValue().get(Integer.parseInt(key.getValue())); - } catch (NumberFormatException ex) { - throw new IllegalArgumentException(String.format("invalid value for key with index %d, expected integer values >= 0, but found '%s'", - i, key.getValue())); - } catch (IndexOutOfBoundsException ex) { - throw new IllegalArgumentException(String.format("index out of bounds exception for key with index %d, expected integer values >= 0 and < %d, but found '%s'", - i, - ((SubmodelElementList) current).getValue().size(), - key.getValue())); - } - } else { - Collection collection; - if (Operation.class.isAssignableFrom(current.getClass())) { - Operation operation = (Operation) current; - collection = Stream.of(operation.getInputVariables().stream(), - operation.getOutputVariables().stream(), - operation.getInoutputVariables().stream()) - .flatMap(x -> x.map(y -> y.getValue())) - .collect(Collectors.toSet()); - } else { - List matchingProperties = getAasProperties(current.getClass()).stream() - .filter(x -> Collection.class.isAssignableFrom(x.getReadMethod().getReturnType())) - .filter(x -> TypeToken.of(x.getReadMethod().getGenericReturnType()) - .resolveType(Collection.class.getTypeParameters()[0]) - .isSupertypeOf(keyType)) - .collect(Collectors.toList()); - if (matchingProperties.isEmpty()) { - throw new IllegalArgumentException(String.format("error resolving reference - could not find matching property for type %s in class %s", - keyType.getSimpleName(), - current.getClass().getSimpleName())); - } - if (matchingProperties.size() > 1) { - throw new IllegalArgumentException(String.format("error resolving reference - found %d possible property paths for class %s (%s)", - matchingProperties.size(), - current.getClass().getSimpleName(), - matchingProperties.stream() - .map(x -> x.getName()) - .collect(Collectors.joining(", ")))); - } - try { - collection = (Collection) matchingProperties.get(0).getReadMethod().invoke(current); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { - throw new IllegalArgumentException("error resolving reference", ex); - } - } - Optional next = collection.stream() - .filter(x -> ((Referable) x).getIdShort().equals(key.getValue())) - .findFirst(); - if (next.isEmpty()) { - throw new IllegalArgumentException("error resolving reference - could not find idShort " + key.getValue()); - } - current = next.get(); - } - } + if (!type.isAssignableFrom(current.getClass())) { + throw new IllegalArgumentException(String.format( + "reference '%s' could not be resolved as target type is not assignable from actual type (target: %s, actual: %s)", + asString(reference), + type.getName(), + current.getClass().getName())); } - return (T) current; + return type.cast(current); } /** @@ -396,7 +388,7 @@ public static T resolve(Reference reference, Environment e * @return a list of all properties defined in any of AAS interface implemented by type. If type does not implement * any AAS interface an empty list is returned. */ - private static List getAasProperties(Class type) { + private static List getAasProperties(Class type) { Class aasType = ReflectionHelper.getAasInterface(type); if (aasType == null) { aasType = ReflectionHelper.INTERFACES_WITHOUT_DEFAULT_IMPLEMENTATION.stream() @@ -423,4 +415,4 @@ private static List getAasProperties(Class type) { .sorted(Comparator.comparing(x -> x.getName())) .collect(Collectors.toList()); } -} \ No newline at end of file +} diff --git a/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/EnumDeserializerTest.java b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/EnumDeserializerTest.java index 93ddbd6cf..b902d4b26 100644 --- a/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/EnumDeserializerTest.java +++ b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/EnumDeserializerTest.java @@ -18,7 +18,8 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.deserialization.EnumDeserializer; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.deserialization.EnumDeserializer; import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeIec61360; import org.eclipse.digitaltwin.aas4j.v3.model.Direction; import org.eclipse.digitaltwin.aas4j.v3.model.StateOfEvent; diff --git a/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/EnumSerializerTest.java b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/EnumSerializerTest.java index 33cae0017..88971eb85 100644 --- a/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/EnumSerializerTest.java +++ b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/EnumSerializerTest.java @@ -18,7 +18,8 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.serialization.EnumSerializer; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.serialization.EnumSerializer; import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeIec61360; import org.eclipse.digitaltwin.aas4j.v3.model.Direction; import org.eclipse.digitaltwin.aas4j.v3.model.ModellingKind; 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 d8bc3ef3b..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 @@ -1,5 +1,5 @@ /* - * Copyright 2023 jab. + * Copyright (c) 2023 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. @@ -17,15 +17,23 @@ import org.eclipse.digitaltwin.aas4j.v3.model.AssetKind; import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeDefXsd; +import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeIec61360; +import org.eclipse.digitaltwin.aas4j.v3.model.DefaultDummyDataSpecification; import org.eclipse.digitaltwin.aas4j.v3.model.Environment; import org.eclipse.digitaltwin.aas4j.v3.model.KeyTypes; import org.eclipse.digitaltwin.aas4j.v3.model.ReferenceTypes; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAssetAdministrationShell; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAssetInformation; +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.DefaultEnvironment; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultExtension; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultFile; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultKey; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultLangStringDefinitionTypeIec61360; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultLangStringNameType; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultReference; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSubmodel; public class Examples { @@ -34,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) @@ -77,4 +86,56 @@ public class Examples { .build()) .build()) .build(); + + public static final Environment ENVIRONMENT_WITH_DUMMYDATASPEC = new DefaultEnvironment.Builder() + .submodels( + new DefaultSubmodel.Builder() + .id("urn:test") + .submodelElements(new DefaultFile.Builder() + .idShort("myIdShort").value("FileValue") + .build()) + .embeddedDataSpecifications( + new DefaultEmbeddedDataSpecification.Builder() + .dataSpecificationContent( + new DefaultDummyDataSpecification.Builder() + .name(new DefaultLangStringNameType.Builder() + .language("en").text("myName").build()) + .text("myText") + .pages(42) + .build()) + .dataSpecification( + new DefaultReference.Builder() + .type(ReferenceTypes.EXTERNAL_REFERENCE) + .keys( + new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value("https://admin-shell.io/aas/3/0/CustomDataSpecification") + .build() + ) + .build() + ) + .build()) + .embeddedDataSpecifications( + new DefaultEmbeddedDataSpecification.Builder().dataSpecificationContent( + new DefaultDataSpecificationIec61360.Builder() + .dataType(DataTypeIec61360.BLOB) + .definition(new DefaultLangStringDefinitionTypeIec61360.Builder() + .language("en").text("myDefinition") + .build()) + .build() + ) + .dataSpecification( + new DefaultReference.Builder() + .type(ReferenceTypes.EXTERNAL_REFERENCE) + .keys( + new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value("https://admin-shell.io/aas/3/0/RC02/DataSpecificationIec61360") + .build() + ) + .build() + ) + .build()) + .build() + ).build(); } diff --git a/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/util/AasUtilsTest.java b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/util/AasUtilsTest.java index 1659d2e5b..247888ff4 100644 --- a/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/util/AasUtilsTest.java +++ b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/core/util/AasUtilsTest.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. @@ -19,27 +20,33 @@ import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASFull; import org.eclipse.digitaltwin.aas4j.v3.model.Environment; import org.eclipse.digitaltwin.aas4j.v3.model.KeyTypes; +import org.eclipse.digitaltwin.aas4j.v3.model.Operation; import org.eclipse.digitaltwin.aas4j.v3.model.Referable; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; +import org.eclipse.digitaltwin.aas4j.v3.model.ReferenceTypes; 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.DefaultEnvironment; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultKey; -import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultOperation; -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.DefaultReference; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSubmodel; +import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSubmodelElementCollection; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSubmodelElementList; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import java.util.ArrayList; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @RunWith(JUnitParamsRunner.class) public class AasUtilsTest { + @Test public void whenResolve_withProperty_success() { String submodelId = "http://example.org/submodel"; @@ -68,38 +75,124 @@ public void whenResolve_withProperty_success() { Assert.assertEquals(expected, actual); } + @Test(expected = IllegalArgumentException.class) + public void whenResolve_withInvalidType_fail() { + String submodelId = "http://example.org/submodel"; + String submodelElementIdShort = "foo"; + SubmodelElement expected = new DefaultProperty.Builder() + .idShort(submodelElementIdShort) + .value("bar") + .build(); + Environment environment = new DefaultEnvironment.Builder() + .submodels(new DefaultSubmodel.Builder() + .id(submodelId) + .submodelElements(expected) + .build()) + .build(); + Reference reference = new DefaultReference.Builder() + .type(ReferenceTypes.MODEL_REFERENCE) + .keys(new DefaultKey.Builder() + .type(KeyTypes.SUBMODEL) + .value(submodelId) + .build()) + .keys(new DefaultKey.Builder() + .type(KeyTypes.SUBMODEL_ELEMENT) + .value(submodelElementIdShort) + .build()) + .build(); + AasUtils.resolve(reference, environment, Operation.class); + } + @Test - public void whenResolve_withSubmodel_success() { - assertNotNull(AasUtils.resolve(AASFull.AAS_1.getSubmodels().get(0), AASFull.createEnvironment())); + public void whenResolve_insideSubmodelElementList_success() { + String submodelId = "http://example.org/submodel"; + String submodelElementIdShort = "foo"; + String submodelElementListIdShort = "list"; + SubmodelElement expected = new DefaultProperty.Builder() + .idShort(submodelElementIdShort) + .value("bar") + .build(); + SubmodelElementList list = new DefaultSubmodelElementList.Builder() + .idShort(submodelElementListIdShort) + .value(expected) + .build(); + Environment environment = new DefaultEnvironment.Builder() + .submodels(new DefaultSubmodel.Builder() + .id(submodelId) + .submodelElements(list) + .build()) + .build(); + Reference reference = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.SUBMODEL) + .value(submodelId) + .build()) + .keys(new DefaultKey.Builder() + .type(KeyTypes.SUBMODEL_ELEMENT_LIST) + .value(submodelElementListIdShort) + .build()) + .keys(new DefaultKey.Builder() + .type(KeyTypes.SUBMODEL_ELEMENT) + .value("0") + .build()) + .build(); + Referable actual = AasUtils.resolve(reference, environment); + Assert.assertEquals(expected, actual); + } - Submodel asSubmodel = AasUtils.resolve( - AASFull.AAS_1.getSubmodels().get(0), - AASFull.createEnvironment(), - Submodel.class - ); - - assertNotNull(asSubmodel); - assertEquals(DefaultSubmodel.class, asSubmodel.getClass()); + @Test(expected = IllegalArgumentException.class) + public void whenResolve_insideSubmodelElementList_indexOutOfBounds() { + String submodelId = "http://example.org/submodel"; + String submodelElementIdShort = "foo"; + String submodelElementListIdShort = "list"; + SubmodelElement expected = new DefaultProperty.Builder() + .idShort(submodelElementIdShort) + .value("bar") + .build(); + SubmodelElementList list = new DefaultSubmodelElementList.Builder() + .idShort(submodelElementListIdShort) + .value(expected) + .build(); + Environment environment = new DefaultEnvironment.Builder() + .submodels(new DefaultSubmodel.Builder() + .id(submodelId) + .submodelElements(list) + .build()) + .build(); + Reference reference = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.SUBMODEL) + .value(submodelId) + .build()) + .keys(new DefaultKey.Builder() + .type(KeyTypes.SUBMODEL_ELEMENT_LIST) + .value(submodelElementListIdShort) + .build()) + .keys(new DefaultKey.Builder() + .type(KeyTypes.SUBMODEL_ELEMENT) + .value("1") + .build()) + .build(); + AasUtils.resolve(reference, environment); } - + @Test - public void whenResolve_withOperation_success() { + public void whenResolve_insideSubmodelElementCollection_success() { String submodelId = "http://example.org/submodel"; String submodelElementIdShort = "foo"; - String submodelElement2IdShort = "bar"; + String submodelElementListIdShort = "list"; SubmodelElement expected = new DefaultProperty.Builder() - .idShort(submodelElement2IdShort) + .idShort(submodelElementIdShort) .value("bar") .build(); + SubmodelElementCollection list = new DefaultSubmodelElementCollection.Builder() + .idShort(submodelElementListIdShort) + .value(expected) + .build(); Environment environment = new DefaultEnvironment.Builder() .submodels(new DefaultSubmodel.Builder() .id(submodelId) - .submodelElements(new DefaultOperation.Builder() - .idShort(submodelElementIdShort) - .inputVariables(new DefaultOperationVariable.Builder() - .value(expected) - .build()) - .build()) + .submodelElements(list) .build()) .build(); Reference reference = new DefaultReference.Builder() @@ -108,18 +201,29 @@ public void whenResolve_withOperation_success() { .value(submodelId) .build()) .keys(new DefaultKey.Builder() - .type(KeyTypes.SUBMODEL_ELEMENT) - .value(submodelElementIdShort) + .type(KeyTypes.SUBMODEL_ELEMENT_LIST) + .value(submodelElementListIdShort) .build()) .keys(new DefaultKey.Builder() .type(KeyTypes.SUBMODEL_ELEMENT) - .value(submodelElement2IdShort) + .value(submodelElementIdShort) .build()) .build(); Referable actual = AasUtils.resolve(reference, environment); Assert.assertEquals(expected, actual); } + @Test + public void whenResolve_withSubmodel_success() { + Environment environment = AASFull.createEnvironment(); + Reference submodelRef = AASFull.AAS_1.getSubmodels().get(0); + Submodel expected = AASFull.SUBMODEL_3; + Referable asReferable = AasUtils.resolve(submodelRef, environment); + assertEquals(expected, asReferable); + Submodel asSubmodel = AasUtils.resolve(submodelRef, environment, Submodel.class); + assertEquals(expected, asSubmodel); + } + @Test public void whenResolve_withElementWithinSubmodelElementList_success() { String submodelId = "http://example.org/submodel"; @@ -154,4 +258,251 @@ public void whenResolve_withElementWithinSubmodelElementList_success() { Assert.assertEquals(expected, actual); } + @Test + public void whenSameAs_withDifferentKeyTypesButSameValues_success() { + String value = "0173-1#01-ADS698#010"; + Reference ref1 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value(value) + .build()) + .build(); + Reference ref2 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.FRAGMENT_REFERENCE) + .value(value) + .build()) + .build(); + Assert.assertTrue(AasUtils.sameAs(ref1, ref2)); + } + + @Test + public void whenSameAs_withoutKeys_success() { + Reference ref1 = new DefaultReference.Builder().type(ReferenceTypes.EXTERNAL_REFERENCE).build(); + ref1.setKeys(null); + Reference ref2 = new DefaultReference.Builder().type(ReferenceTypes.EXTERNAL_REFERENCE).build(); + ref2.setKeys(new ArrayList<>()); + Assert.assertTrue(AasUtils.sameAs(ref1, ref2)); + } + + @Test + public void whenSameAs_withoutKeysAndDifferentTypes_fail() { + Reference ref1 = new DefaultReference.Builder().type(ReferenceTypes.EXTERNAL_REFERENCE).build(); + ref1.setKeys(null); + Reference ref2 = new DefaultReference.Builder().type(ReferenceTypes.MODEL_REFERENCE).build(); + ref2.setKeys(new ArrayList<>()); + Assert.assertFalse(AasUtils.sameAs(ref1, ref2)); + } + + @Test + public void whenSameAs_withoutKeysAndDifferentSemaniticIDs_fail() { + Reference semanticId1 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .value("value1") + .build()) + .build(); + Reference semanticId2 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.FRAGMENT_REFERENCE) + .value("value2") + .build()) + .build(); + Reference ref1 = new DefaultReference.Builder() + .referredSemanticId(semanticId1) + .build(); + ref1.setKeys(null); + Reference ref2 = new DefaultReference.Builder() + .referredSemanticId(semanticId2) + .build(); + ref2.setKeys(new ArrayList<>()); + Assert.assertFalse(AasUtils.sameAs(ref1, ref2, true)); + } + + @Test + public void whenSameAs_withDifferentKeyTypesButSameValuesAndSemanticIDs_success() { + String value = "0173-1#01-ADS698#010"; + Reference semanticId1 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value(value) + .build()) + .build(); + Reference semanticId2 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.FRAGMENT_REFERENCE) + .value(value) + .build()) + .build(); + Reference ref1 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value(value) + .build()) + .referredSemanticId(semanticId1) + .build(); + Reference ref2 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.FRAGMENT_REFERENCE) + .value(value) + .build()) + .referredSemanticId(semanticId2) + .build(); + Assert.assertTrue(AasUtils.sameAs(ref1, ref2, true)); + } + + @Test + public void whenSameAs_withDifferentKeyTypesAndValues_fail() { + Reference ref1 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value("foo") + .build()) + .build(); + Reference ref2 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.FRAGMENT_REFERENCE) + .value("bar") + .build()) + .build(); + Assert.assertFalse(AasUtils.sameAs(ref1, ref2)); + } + + @Test + public void whenSameAs_withSameKeyTypesAndValues_success() { + String value = "0173-1#01-ADS698#010"; + Reference ref1 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value(value) + .build()) + .build(); + Reference ref2 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value(value) + .build()) + .build(); + Assert.assertTrue(AasUtils.sameAs(ref1, ref2)); + } + + @Test + public void whenSameAs_withSameKeyTypesButDifferentValues_fail() { + Reference ref1 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value("foo") + .build()) + .build(); + Reference ref2 = new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value("bar") + .build()) + .build(); + Assert.assertFalse(AasUtils.sameAs(ref1, ref2)); + } + + @Test + public void whenSameAs_withDifferentReferredSemanticId_success() { + String value = "0173-1#01-ADS698#010"; + Reference ref1 = new DefaultReference.Builder() + .referredSemanticId(new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value("foo") + .build()) + .build()) + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value(value) + .build()) + .build(); + Reference ref2 = new DefaultReference.Builder() + .referredSemanticId(new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value("bar") + .build()) + .build()) + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value(value) + .build()) + .build(); + Assert.assertTrue(AasUtils.sameAs(ref1, ref2)); + } + + @Test + public void whenSameAs_withDifferentReferredSemanticId_fail() { + String value = "0173-1#01-ADS698#010"; + Reference ref1 = new DefaultReference.Builder() + .referredSemanticId(new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value("foo") + .build()) + .build()) + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value(value) + .build()) + .build(); + Reference ref2 = new DefaultReference.Builder() + .referredSemanticId(new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value("bar") + .build()) + .build()) + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value(value) + .build()) + .build(); + Assert.assertFalse(AasUtils.sameAs(ref1, ref2, true)); + } + + @Test + public void whenAsString_withSubmodelElementList_success() { + Reference reference = new DefaultReference.Builder() + .type(ReferenceTypes.MODEL_REFERENCE) + .keys(new DefaultKey.Builder() + .type(KeyTypes.SUBMODEL) + .value("submodel") + .build()) + .keys(new DefaultKey.Builder() + .type(KeyTypes.SUBMODEL_ELEMENT_LIST) + .value("list") + .build()) + .keys(new DefaultKey.Builder() + .type(KeyTypes.PROPERTY) + .value("0") + .build()) + .build(); + String expected = "[ModelRef](Submodel)submodel, (SubmodelElementList)list, (Property)0"; + String actual = AasUtils.asString(reference); + Assert.assertEquals(expected, actual); + } + + @Test + public void whenAsString_withReferredSemanticId_success() { + String value = "0173-1#01-ADS698#010"; + Reference reference = new DefaultReference.Builder() + .type(ReferenceTypes.EXTERNAL_REFERENCE) + .referredSemanticId(new DefaultReference.Builder() + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value("foo") + .build()) + .type(ReferenceTypes.MODEL_REFERENCE) + .build()) + .keys(new DefaultKey.Builder() + .type(KeyTypes.GLOBAL_REFERENCE) + .value(value) + .build()) + .build(); + String expected = "[ExternalRef- [ModelRef](GlobalReference)foo -](GlobalReference)0173-1#01-ADS698#010"; + String actual = AasUtils.asString(reference); + Assert.assertEquals(expected, actual); + } } diff --git a/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/model/DefaultDummyDataSpecification.java b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/model/DefaultDummyDataSpecification.java new file mode 100644 index 000000000..8bd13c738 --- /dev/null +++ b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/model/DefaultDummyDataSpecification.java @@ -0,0 +1,89 @@ +/* + * 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 java.util.Objects; + +/** + * This interface is needed to test the serialization/deserialization of a custom data specification content. + * See: https://github.com/eclipse-aas4j/aas4j/issues/196 + */ +public class DefaultDummyDataSpecification implements DummyDataSpecification { + private LangStringNameType name; + private String text; + private int pages; + + public LangStringNameType getName() { + return name; + } + + public void setName(LangStringNameType name) { + this.name = name; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public int getPages() { + return pages; + }; + public void setPages(int pages) { + this.pages = pages; + } + + @Override + public int hashCode() { + return Objects.hash(this.name, this.text, this.pages); + } + + @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 { + DefaultDummyDataSpecification other = (DefaultDummyDataSpecification) obj; + return Objects.equals(this.name, other.name) && + Objects.equals(this.text, other.text) && + Objects.equals(this.pages, other.pages); + } + } + + /** + * This builder class can be used to construct a DefaultCustomDataSpecificationContent. + */ + public static class Builder extends DummyDataSpecificationBuilder { + + @Override + protected DefaultDummyDataSpecification.Builder getSelf() { + return this; + } + + @Override + protected DefaultDummyDataSpecification newBuildingInstance() { + return new DefaultDummyDataSpecification(); + } + } +} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelElementCollectionMixin.java b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/model/DummyDataSpecification.java similarity index 51% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelElementCollectionMixin.java rename to dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/model/DummyDataSpecification.java index f56304f81..349ea00e5 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelElementCollectionMixin.java +++ b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/model/DummyDataSpecification.java @@ -1,5 +1,5 @@ /* - * 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. @@ -13,18 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.model; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; +/** + * This interface is needed to test the serialization/deserialization of a custom data specification content. + * See: https://github.com/eclipse-aas4j/aas4j/issues/196 + */ +public interface DummyDataSpecification extends CustomDataSpecification { + + LangStringNameType getName(); + + void setName(LangStringNameType name); + + + String getText(); -import java.util.Collection; + void setText(String text); -public interface SubmodelElementCollectionMixin { - @JsonProperty("value") - public Collection getValue(); + int getPages(); - @JsonProperty("value") - public void setValue(Collection values); + void setPages(int pages); } diff --git a/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/model/DummyDataSpecificationBuilder.java b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/model/DummyDataSpecificationBuilder.java new file mode 100644 index 000000000..490ae42f7 --- /dev/null +++ b/dataformat-core/src/test/java/org/eclipse/digitaltwin/aas4j/v3/model/DummyDataSpecificationBuilder.java @@ -0,0 +1,42 @@ +/* + * 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.builder.ExtendableBuilder; + +/** + * This interface is needed to test the serialization/deserialization of a custom data specification content. + * + * See: https://github.com/eclipse-aas4j/aas4j/issues/196 + */ +public abstract class DummyDataSpecificationBuilder> extends ExtendableBuilder { + + public B name(LangStringNameType name) { + getBuildingInstance().setName(name); + return getSelf(); + } + + public B text(String text) { + getBuildingInstance().setText(text); + return getSelf(); + } + + public B pages(int pages) { + getBuildingInstance().setPages(pages); + return getSelf(); + } +} \ No newline at end of file diff --git a/dataformat-json/pom.xml b/dataformat-json/pom.xml index 996cf0bc4..9e6976ab3 100644 --- a/dataformat-json/pom.xml +++ b/dataformat-json/pom.xml @@ -5,20 +5,20 @@ 4.0.0 org.eclipse.digitaltwin.aas4j - dataformat-parent + aas4j-dataformat-parent ${revision} - dataformat-json + aas4j-dataformat-json Asset Administration Shell JSON-Serializer ${project.groupId} - dataformat-core + aas4j-dataformat-core ${project.groupId} - dataformat-core + aas4j-dataformat-core tests test @@ -46,7 +46,7 @@ ${project.groupId} - model + aas4j-model com.networknt 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 bfefb16e2..de24180aa 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,161 +16,34 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.json.JsonMapper; -import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver; -import com.fasterxml.jackson.databind.module.SimpleModule; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.deserialization.EnumDeserializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.ReflectionAnnotationIntrospector; -import org.eclipse.digitaltwin.aas4j.v3.model.Environment; -import org.eclipse.digitaltwin.aas4j.v3.model.Referable; - -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.core.DeserializationException; + +import com.fasterxml.jackson.core.JsonProcessingException; +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 static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; + private JsonMapperFactory jsonMapperFactory; public JsonDeserializer() { - initTypeResolver(); - buildMapper(); - } - - protected void buildMapper() { - mapper = JsonMapper.builder() - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .annotationIntrospector(new ReflectionAnnotationIntrospector()) - .addModule(buildEnumModule()) - .addModule(buildImplementationModule()) - .build(); - ReflectionHelper.JSON_MIXINS.entrySet().forEach(x -> mapper.addMixIn(x.getKey(), x.getValue())); - } - - @SuppressWarnings("unchecked") - private void initTypeResolver() { - typeResolver = new SimpleAbstractTypeResolver(); - ReflectionHelper.DEFAULT_IMPLEMENTATIONS - .stream() - .forEach(x -> typeResolver.addMapping(x.getInterfaceType(), x.getImplementationType())); - } - - protected SimpleModule buildEnumModule() { - SimpleModule module = new SimpleModule(); - ReflectionHelper.ENUMS.forEach(x -> module.addDeserializer(x, new EnumDeserializer<>(x))); - return module; - } - - protected SimpleModule buildImplementationModule() { - SimpleModule module = new SimpleModule(); - module.setAbstractTypes(typeResolver); - return module; - } - - /** - * 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()))); + typeResolver = new SimpleAbstractTypeResolverFactory().create(); + jsonMapperFactory = new JsonMapperFactory(); + mapper = jsonMapperFactory.create(typeResolver); } - /** - * 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 @@ -185,196 +58,138 @@ public Environment read(java.io.File file) throws FileNotFoundException, Deseria */ public void useImplementation(Class aasInterface, Class implementation) { typeResolver.addMapping(aasInterface, implementation); - buildMapper(); + mapper = jsonMapperFactory.create(typeResolver); } /** - * 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 - * - * @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 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 + * Generic method to deserialize a given string into a list of AAS instances * - * @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 + * @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(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 + * Deserializes a given JsonArray 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 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 */ - 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 - * - * @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 - * @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/JsonMapperFactory.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonMapperFactory.java new file mode 100644 index 000000000..4083f3ac3 --- /dev/null +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonMapperFactory.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2023 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; + +import java.util.Arrays; +import java.util.List; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.deserialization.EnumDeserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.serialization.EnumSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.ReflectionAnnotationIntrospector; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.databind.json.JsonMapper.Builder; +import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver; +import com.fasterxml.jackson.databind.module.SimpleModule; + +/** + * Factory for creating a {@link JsonMapper} configured to produce and consume AAS Version 3 conformant JSON serializations + * + * @author schnicke + * + */ +public class JsonMapperFactory { + + public JsonMapper create(SimpleAbstractTypeResolver typeResolver) { + Builder builder = JsonMapper.builder().enable(SerializationFeature.INDENT_OUTPUT).disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) + .annotationIntrospector(new ReflectionAnnotationIntrospector()) + .serializationInclusion(JsonInclude.Include.NON_NULL); + + getModulesToInstall(typeResolver).stream().forEach(m -> builder.addModule(m)); + + JsonMapper mapper = builder.build(); + ReflectionHelper.JSON_MIXINS.entrySet().forEach(x -> mapper.addMixIn(x.getKey(), x.getValue())); + + return mapper; + } + + protected List getModulesToInstall(SimpleAbstractTypeResolver typeResolver) { + return Arrays.asList(buildEnumModule(), buildImplementationModule(typeResolver)); + } + + protected SimpleModule buildImplementationModule(SimpleAbstractTypeResolver typeResolver) { + SimpleModule module = new SimpleModule(); + module.setAbstractTypes(typeResolver); + return module; + } + + protected SimpleModule buildEnumModule() { + SimpleModule module = new SimpleModule(); + ReflectionHelper.ENUMS.forEach(x -> module.addSerializer(x, new EnumSerializer())); + ReflectionHelper.ENUMS.forEach(x -> module.addDeserializer(x, new EnumDeserializer<>(x))); + return module; + } +} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonSchemaValidator.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonSchemaValidator.java index d873e4407..437a8351a 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonSchemaValidator.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/JsonSchemaValidator.java @@ -22,7 +22,6 @@ import com.networknt.schema.JsonSchemaFactory; import com.networknt.schema.SpecVersionDetector; import com.networknt.schema.ValidationMessage; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.SchemaValidator; import java.io.BufferedReader; import java.io.IOException; @@ -31,6 +30,8 @@ import java.util.Set; import java.util.stream.Collectors; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.SchemaValidator; + /** * Class for validating a serialized instance of AssetAdministrationShellEnvironment against a json-schema. */ 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 f370de8c0..3ffa080b8 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,23 +16,6 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.json; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.databind.json.JsonMapper; -import com.fasterxml.jackson.databind.module.SimpleModule; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.serialization.EnumSerializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.ReflectionAnnotationIntrospector; -import org.eclipse.digitaltwin.aas4j.v3.model.Environment; -import org.eclipse.digitaltwin.aas4j.v3.model.Referable; - -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; @@ -41,208 +24,146 @@ import java.util.Collection; import java.util.List; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.SerializationException; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +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() { - buildMapper(); - } - - protected void buildMapper() { - mapper = JsonMapper.builder().enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) - .serializationInclusion(JsonInclude.Include.NON_NULL) - .addModule(buildEnumModule()) - .addModule(buildCustomSerializerModule()) - .annotationIntrospector(new ReflectionAnnotationIntrospector()) - .build(); - ReflectionHelper.JSON_MIXINS.entrySet().forEach(x -> mapper.addMixIn(x.getKey(), x.getValue())); - } - - protected SimpleModule buildCustomSerializerModule() { - SimpleModule module = new SimpleModule(); - return module; - } - - protected SimpleModule buildEnumModule() { - SimpleModule module = new SimpleModule(); - module.addSerializer(Enum.class, new EnumSerializer()); - return module; + 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/SimpleAbstractTypeResolverFactory.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/SimpleAbstractTypeResolverFactory.java new file mode 100644 index 000000000..9a39c4d17 --- /dev/null +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/SimpleAbstractTypeResolverFactory.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023 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; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; + +import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver; + +/** + * Factory for creating a {@link SimpleAbstractTypeResolver} configured with the + * Default Implementations of AAS4J + * + * @author schnicke + * + */ +public class SimpleAbstractTypeResolverFactory { + @SuppressWarnings("unchecked") + public SimpleAbstractTypeResolver create() { + SimpleAbstractTypeResolver typeResolver = new SimpleAbstractTypeResolver(); + ReflectionHelper.DEFAULT_IMPLEMENTATIONS.stream().forEach(x -> typeResolver.addMapping(x.getInterfaceType(), x.getImplementationType())); + return typeResolver; + } +} diff --git a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/ReflectionAnnotationIntrospector.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/ReflectionAnnotationIntrospector.java index a461709b8..adbd3ead8 100644 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/ReflectionAnnotationIntrospector.java +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/ReflectionAnnotationIntrospector.java @@ -25,12 +25,13 @@ import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; import com.fasterxml.jackson.databind.jsontype.NamedType; import com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; + /** * This class helps to dynamically decide how to de-/serialize classes and * properties defined in the AAS model library. 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/internal/mixins/AssetAdministrationShellMixin.java similarity index 87% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AssetAdministrationShellMixin.java rename to dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/AssetAdministrationShellMixin.java index 01f4f53a1..df0a20a04 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/internal/mixins/AssetAdministrationShellMixin.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.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/internal/mixins/AssetInformationMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/AssetInformationMixin.java new file mode 100644 index 000000000..db04219fb --- /dev/null +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/AssetInformationMixin.java @@ -0,0 +1,25 @@ +/* + * 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.internal.mixins; + +import org.eclipse.digitaltwin.aas4j.v3.model.AssetKind; + +import com.fasterxml.jackson.annotation.JsonInclude; + +public interface AssetInformationMixin { + @JsonInclude(JsonInclude.Include.ALWAYS) + 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/internal/mixins/BlobMixin.java similarity index 88% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/BlobMixin.java rename to dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/BlobMixin.java index 7dec06cbe..2eee52732 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/internal/mixins/BlobMixin.java @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.mixins; 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/internal/mixins/DataSpecificationIec61360Mixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/DataSpecificationIec61360Mixin.java new file mode 100644 index 000000000..f1766b2a8 --- /dev/null +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/DataSpecificationIec61360Mixin.java @@ -0,0 +1,27 @@ +/* + * 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.internal.mixins; + +import java.util.List; + +import org.eclipse.digitaltwin.aas4j.v3.model.LangStringPreferredNameTypeIec61360; + +import com.fasterxml.jackson.annotation.JsonInclude; + +public interface DataSpecificationIec61360Mixin { + @JsonInclude(JsonInclude.Include.ALWAYS) + 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/internal/mixins/EndpointMixin.java similarity index 61% 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/internal/mixins/EndpointMixin.java index 328276991..7a99100f9 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/internal/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. @@ -13,16 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.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/internal/mixins/EntityMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/EntityMixin.java new file mode 100644 index 000000000..12752806f --- /dev/null +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/EntityMixin.java @@ -0,0 +1,26 @@ +/* + * 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.internal.mixins; + +import org.eclipse.digitaltwin.aas4j.v3.model.EntityType; + +import com.fasterxml.jackson.annotation.JsonInclude; + +public interface EntityMixin { + + @JsonInclude(JsonInclude.Include.ALWAYS) + 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/internal/mixins/EnvironmentMixin.java similarity index 82% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EnvironmentMixin.java rename to dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/EnvironmentMixin.java index c4aacb2c8..f1472970c 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/internal/mixins/EnvironmentMixin.java @@ -13,24 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.mixins; + +import java.util.List; +import java.util.Set; -import com.fasterxml.jackson.annotation.JsonInclude; 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/internal/mixins/ExtensionMixin.java similarity index 89% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ExtensionMixin.java rename to dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/ExtensionMixin.java index f169a29ed..391591e61 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/internal/mixins/ExtensionMixin.java @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.mixins; 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/internal/mixins/FileMixin.java similarity index 88% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/FileMixin.java rename to dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/FileMixin.java index 91b903b08..2efe8d5bb 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/internal/mixins/FileMixin.java @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.mixins; 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/IdentifiableMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/IdentifiableMixin.java similarity index 87% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/IdentifiableMixin.java rename to dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/IdentifiableMixin.java index 301a31bc6..dcf651251 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/internal/mixins/IdentifiableMixin.java @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.mixins; 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/internal/mixins/KeyMixin.java similarity index 87% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/KeyMixin.java rename to dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/KeyMixin.java index fbbe1f0e2..81195aa82 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/internal/mixins/KeyMixin.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.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/OperationVariableMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/OperationVariableMixin.java similarity index 89% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/OperationVariableMixin.java rename to dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/OperationVariableMixin.java index 33ca567e1..ebefc1a6f 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/internal/mixins/OperationVariableMixin.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.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/internal/mixins/QualifierMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/QualifierMixin.java new file mode 100644 index 000000000..1ec9ad926 --- /dev/null +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/QualifierMixin.java @@ -0,0 +1,23 @@ +/* + * 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.internal.mixins; + +import com.fasterxml.jackson.annotation.JsonInclude; + +public interface QualifierMixin { + @JsonInclude(JsonInclude.Include.ALWAYS) + 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/internal/mixins/RangeMixin.java similarity index 88% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/RangeMixin.java rename to dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/RangeMixin.java index 49fdef609..8fdf23376 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/internal/mixins/RangeMixin.java @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.mixins; 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/ReferenceMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/ReferenceMixin.java similarity index 75% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/ReferenceMixin.java rename to dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/ReferenceMixin.java index 9105bc8bf..b9020a071 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/internal/mixins/ReferenceMixin.java @@ -13,25 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.mixins; + +import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; 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/internal/mixins/RelationshipElementMixin.java similarity index 87% rename from dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/RelationshipElementMixin.java rename to dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/RelationshipElementMixin.java index 04abbe3a3..bba53c0ce 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/internal/mixins/RelationshipElementMixin.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.json.internal.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/internal/mixins/SubmodelElementListMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/SubmodelElementListMixin.java new file mode 100644 index 000000000..d4e9fbff0 --- /dev/null +++ b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/internal/mixins/SubmodelElementListMixin.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. + * Copyright (c) 2023 SAP SE + * + * 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.internal.mixins; + +import com.fasterxml.jackson.annotation.JsonInclude; + +public interface SubmodelElementListMixin { + @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/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/AssetInformationMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AssetInformationMixin.java deleted file mode 100644 index 810b7232c..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/AssetInformationMixin.java +++ /dev/null @@ -1,32 +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.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.AssetKind; - -public interface AssetInformationMixin { - - @JsonInclude(JsonInclude.Include.ALWAYS) - public AssetKind getAssetKind(); - - @JsonProperty("globalAssetId") - public String getGlobalAssetId(); - - @JsonProperty("globalAssetId") - public void setGlobalAssetId(String globalAssetId); -} 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 deleted file mode 100644 index 2d3281b2c..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/DataSpecificationIec61360Mixin.java +++ /dev/null @@ -1,46 +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.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(); - - @JsonProperty("levelType") - public void setLevelTypes(List levelTypes); - - @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); -} 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 deleted file mode 100644 index edc862bf9..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/EntityMixin.java +++ /dev/null @@ -1,32 +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.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.eclipse.digitaltwin.aas4j.v3.model.EntityType; - -public interface EntityMixin { - - @JsonInclude(JsonInclude.Include.ALWAYS) - public EntityType getEntityType(); - - @JsonProperty("globalAssetId") - public String getGlobalAssetId(); - - @JsonProperty("globalAssetId") - public void setGlobalAssetId(String globalAssetId); -} 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/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/QualifierMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/QualifierMixin.java deleted file mode 100644 index 3e1efbdef..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/QualifierMixin.java +++ /dev/null @@ -1,32 +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.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); -} 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/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/SubmodelElementListMixin.java b/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelElementListMixin.java deleted file mode 100644 index 7f3492674..000000000 --- a/dataformat-json/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/json/mixins/SubmodelElementListMixin.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2021 Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e. V. - * Copyright (c) 2023 SAP SE - * - * 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.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); -} \ 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..b82589878 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,243 @@ */ 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.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.DeserializationException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.SerializationException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.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()); + @BeforeClass + public static void initialize() { + deserializerToTest = new JsonDeserializer(); } @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); - } - - @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 +261,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 bc4597532..d857cd195 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 @@ -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. @@ -15,94 +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.SerializationException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASSimple; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.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.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.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); } - 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 testWriteShellDescriptor() { + writeAndCompare(Examples.SHELL_DESCRIPTOR); } - 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 testWriteShell() { + writeAndCompare(Examples.ASSET_ADMINISTRATION_SHELL); + } + + @Test + public void testWriteShellWithAssetInformation() { + writeAndCompare(Examples.ASSET_ADMINISTRATION_SHELL_WITH_ASSET_INFORMATION); + } + + @Test + public void testWriteShells() { + writeAndCompare(Examples.ASSET_ADMINISTRATION_SHELL_LIST_OF); + } + + @Test + @Ignore("Add test after DataSpecficationPhysicalUnit is supported again") + public void testWriteConceptDescriptionWithPhysicalUnit() { + writeAndCompare(Examples.CONCEPT_DESCRIPTION_DATA_SPECIFICATION_PHYSICAL_UNIT); + } + + @Test + public void testWriteSubmodel() { + writeAndCompare(Examples.SUBMODEL); + } + + @Test + public void testWriteSubmodels() { + writeAndCompare(Examples.SUBMODEL_LIST_OF); + } + + @Test + public void testWriteSubmodelElement() { + writeAndCompare(Examples.SUBMODEL_ELEMENT); + } + + @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/MotorAAS_reduced.json b/dataformat-json/src/test/resources/MotorAAS_reduced.json deleted file mode 100644 index 895605423..000000000 --- a/dataformat-json/src/test/resources/MotorAAS_reduced.json +++ /dev/null @@ -1,262 +0,0 @@ -{ - "assetAdministrationShells": [ - { - "modelType": "AssetAdministrationShell", - "idShort": "ExampleMotor", - "id": "http://customer.com/aas/9175_7013_7091_9168", - "assetInformation": { - "assetKind": "Instance", - "globalAssetId": { - "keys": [ - { - "type": "AssetAdministrationShell", - "value": "http://customer.com/assets/KHBVZJSQKIY" - } - ], - "type": "GlobalReference" - }, - "specificAssetIds": [ - { - "name": "EquipmentID", - "value": "538fd1b3-f99f-4a52-9c75-72e9fa921270", - "externalSubjectId": { - "keys": [ - { - "type": "GlobalReference", - "value": "http://customer.com/Systems/ERP/012" - } - ], - "type": "GlobalReference" - } - }, - { - "name": "DeviceID", - "value": "QjYgPggjwkiHk4RrQiYSLg==", - "externalSubjectId": { - "keys": [ - { - "type": "GlobalReference", - "value": "http://customer.com/Systems/IoT/1" - } - ], - "type": "GlobalReference" - } - } - ], - "thumbnail": { - "modelType": "File", - "kind": "Instance", - "idShort": "thumbnail", - "mimeType": "image/png", - "path": "https://github.com/admin-shell/io/blob/master/verwaltungsschale-detail-part1.png" - } - }, - "submodels": [ - { - "keys": [ - { - "type": "Submodel", - "value": "http.//i40.customer.com/type/1/1/7A7104BDAB57E184" - } - ], - "type": "GlobalReference" - }, - { - "keys": [ - { - "type": "Submodel", - "value": "http://i40.customer.com/instance/1/1/AC69B1CB44F07935" - } - ], - "type": "GlobalReference" - } - ] - } - ], - "submodels": [ - { - "modelType": "Submodel", - "semanticId": { - "keys": [ - { - "type": "GlobalReference", - "value": "0173-1#01-AFZ615#016" - } - ], - "type": "GlobalReference" - }, - "kind": "Instance", - "idShort": "TechnicalData", - "id": "http://i40.customer.com/type/1/1/7A7104BDAB57E184", - "submodelElements": [ - { - "modelType": "Property", - "kind": "Instance", - "semanticId": { - "keys": [ - { - "type": "ConceptDescription", - "value": "0173-1#02-BAA120#008" - } - ], - "type": "GlobalReference" - }, - "idShort": "MaxRotationSpeed", - "category": "PARAMETER", - "value": "5000", - "valueType": "xs:integer" - } - ] - }, - { - "modelType": "Submodel", - "kind": "Instance", - "idShort": "OperationalData", - "id": "http://i40.customer.com/instance/1/1/AC69B1CB44F07935", - "submodelElements": [ - { - "modelType": "Property", - "kind": "Instance", - "semanticId": { - "keys": [ - { - "type": "ConceptDescription", - "value": "http://customer.com/cd/1/1/18EBD56F6B43D895" - } - ], - "type": "GlobalReference" - }, - "idShort": "RotationSpeed", - "category": "Variable", - "value": "4370", - "valueType": "xs:integer" - } - ] - } - ], - "conceptDescriptions": [ - { - "modelType": "ConceptDescription", - "idShort": "MaxRotationSpeed", - "category": "PROPERTY", - "administration": { - "version": "0", - "revision": "2" - }, - "id": "0173-1#02-BAA120#008", - "embeddedDataSpecifications": [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": { - "modelType": "DataSpecificationIEC61360", - "preferredName": [ - { - "language": "de", - "text": "max.Drehzahl" - }, - { - "language": "en", - "text": "Max.rotationspeed" - } - ], - "shortNames": [], - "unit": "1/min", - "unitId": { - "keys": [ - { - "type": "GlobalReference", - "value": "0173-1#05-AAA650#002" - } - ], - "type": "GlobalReference" - }, - "sourceOfDefinition": "", - "dataType": "RealMeasure", - "definition": [ - { - "language": "de", - "text": "HöchstezulässigeDrehzahl,mitwelcherderMotoroderdieSpeiseinheitbetriebenwerdendarf" - }, - { - "language": "en", - "text": "Greatestpermissiblerotationspeedwithwhichthemotororfeedingunitmaybeoperated" - } - ] - } - } - ] - }, - { - "modelType": "ConceptDescription", - "idShort": "RotationSpeed", - "category": "PROPERTY", - "id": "http://customer.com/cd/1/1/18EBD56F6B43D895", - "embeddedDataSpecifications": [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": { - "modelType": "DataSpecificationIEC61360", - "preferredName": [ - { - "language": "DE", - "text": "AktuelleDrehzahl" - }, - { - "language": "EN", - "text": "Actualrotationspeed" - } - ], - "shortNames": [ - { - "language": "DE", - "text": "AktuelleDrehzahl" - }, - { - "language": "EN", - "text": "ActualRotationSpeed" - } - ], - "unit": "1/min", - "unitId": { - "keys": [ - { - "type": "GlobalReference", - "value": "0173-1#05-AAA650#002" - } - ], - "type": "GlobalReference" - }, - "sourceOfDefinition": "", - "dataType": "RealMeasure", - "definition": [ - { - "language": "DE", - "text": "Aktuelle Drehzahl, mitwelcher der Motor oder die Speiseinheit betrieben wird" - }, - { - "language": "EN", - "text": "Actual rotationspeed with which the motor or feedingunit is operated" - } - ] - } - } - ] - } - ] -} 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-json/src/test/resources/assetAdministrationShellList.json b/dataformat-json/src/test/resources/assetAdministrationShellList.json deleted file mode 100644 index d28d05007..000000000 --- a/dataformat-json/src/test/resources/assetAdministrationShellList.json +++ /dev/null @@ -1,108 +0,0 @@ -[ - { - "idShort": "TestAssetAdministrationShell", - "description": [ - { - "language": "en-us", - "text": "An Example Asset Administration Shell for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Verwaltungsschale für eine Test-Anwendung" - } - ], - "modelType": "AssetAdministrationShell", - "id": "https://acplt.org/Test_AssetAdministrationShell", - "administration": { - "version": "0.9", - "revision": "0" - }, - "derivedFrom": { - "keys": [ - { - "type": "AssetAdministrationShell", - "value": "https://acplt.org/TestAssetAdministrationShell2" - } - ], - "type": "ExternalReference" - }, - "assetInformation": { - "assetKind": "Instance", - "globalAssetId": { - "keys": [ - { - "type": "AssetAdministrationShell", - "value": "https://acplt.org/Test_Asset" - } - ], - "type": "ExternalReference" - } - }, - "submodels": [ - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel" - } - ], - "type": "ExternalReference" - }, - { - "keys": [ - { - "type": "Submodel", - "value": "http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial" - } - ], - "type": "ExternalReference" - }, - { - "keys": [ - { - "type": "Submodel", - "value": "http://acplt.org/Submodels/Assets/TestAsset/Identification" - } - ], - "type": "ExternalReference" - } - ] - }, - { - "idShort": "Test_AssetAdministrationShell_Mandatory", - "modelType": "AssetAdministrationShell", - "id": "https://acplt.org/Test_AssetAdministrationShell_Mandatory", - "assetInformation": { - "assetKind": "Instance", - "globalAssetId": { - "keys": [ - { - "type": "AssetAdministrationShell", - "value": "https://acplt.org/Test_Asset_Mandatory" - } - ], - "type": "ExternalReference" - } - }, - "submodels": [ - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - } - ], - "type": "ExternalReference" - }, - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel2_Mandatory" - } - ], - "type": "ExternalReference" - } - ] - } -] diff --git a/dataformat-json/src/test/resources/empty_aas.json b/dataformat-json/src/test/resources/empty_aas.json deleted file mode 100644 index 7a73a41bf..000000000 --- a/dataformat-json/src/test/resources/empty_aas.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} \ No newline at end of file diff --git a/dataformat-json/src/test/resources/invalidJsonExample.json b/dataformat-json/src/test/resources/invalidJsonExample.json deleted file mode 100644 index e9474c928..000000000 --- a/dataformat-json/src/test/resources/invalidJsonExample.json +++ /dev/null @@ -1,468 +0,0 @@ -{ - "assetAdministrationShells": [ - { - "modelType": "AssetAdministrationShell", - "idShort": "ExampleMotor", - "id": "http://customer.com/aas/9175_7013_7091_9168", - "assetInformation": { - "assetKind": "Instance", - "globalAssetId": { - "keys": [ - { - "type": "AssetAdministrationShell", - "value": "http://customer.com/assets/KHBVZJSQKIY" - } - ], - "type": "GlobalReference" - }, - "specificAssetIds": [ - { - "name": "EquipmentID", - "value": "538fd1b3-f99f-4a52-9c75-72e9fa921270", - "externalSubjectId": { - "keys": [ - { - "type": "GlobalReference", - "value": "http://customer.com/Systems/ERP/012" - } - ], - "type": "GlobalReference" - } - }, - { - "name": "DeviceID", - "value": "QjYgPggjwkiHk4RrQiYSLg==", - "externalSubjectId": { - "keys": [ - { - "type": "GlobalReference", - "value": "http://customer.com/Systems/IoT/1" - } - ], - "type": "GlobalReference" - } - } - ], - "thumbnail": { - "modelType": "File", - "kind": "Instance", - "idShort": "thumbnail", - "contentType": "image/png", - "path": "https://github.com/admin-shell/io/blob/master/verwaltungsschale-detail-part1.png" - } - }, - "submodels": [ - { - "keys": [ - { - "type": "Submodel", - "value": "http.//i40.customer.com/type/1/1/7A7104BDAB57E184" - } - ], - "type": "GlobalReference" - }, - { - "keys": [ - { - "type": "Submodel", - "value": "http://i40.customer.com/instance/1/1/AC69B1CB44F07935" - } - ], - "type": "GlobalReference" - }, - { - "keys": [ - { - "type": "Submodel", - "value": "http://i40.customer.com/type/1/1/1A7B62B529F19152" - } - ], - "type": "GlobalReference" - } - ] - } - ], - "submodels": [ - { - "modelType": "Submodel", - "semanticId": { - "keys": [ - { - "type": "GlobalReference", - "value": "0173-1#01-AFZ615#016" - } - ], - "type": "GlobalReference" - }, - "kind": "Instance", - "idShort": "TechnicalData", - "id": "http://i40.customer.com/type/1/1/7A7104BDAB57E184", - "submodelElements": [ - { - "modelType": "Property", - "kind": "Instance", - "semanticId": { - "keys": [ - { - "type": "ConceptDescription", - "value": "0173-1#02-BAA120#008" - } - ], - "type": "GlobalReference" - }, - "idShort": "MaxRotationSpeed", - "category": "PARAMETER", - "value": "5000", - "valueType": "xs:integer" - } - ] - }, - { - "modelType": "Submodel", - "kind": "Instance", - "idShort": "Documentation", - "id": "http://i40.customer.com/type/1/1/1A7B62B529F19152", - "submodelElements": [ - { - "modelType": "SubmodelElementCollection", - "kind": "Instance", - "semanticId": { - "keys": [ - { - "type": "ConceptDescription", - "value": "http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Document" - } - ], - "type": "GlobalReference" - }, - "idShort": "OperatingManual", - "value": [ - { - "modelType": "Property", - "kind": "Instance", - "semanticId": { - "keys": [ - { - "type": "ConceptDescription", - "value": "http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Description/Title" - } - ] - }, - "idShort": "Title", - "value": "OperatingManual", - "valueType": "langString" - }, - { - "modelType": "File", - "kind": "Instance", - "semanticId": { - "keys": [ - { - "type": "ConceptDescription", - "value": "http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/StoredDocumentRepresentation/DigitalFile" - } - ], - "type": "GlobalReference" - }, - "idShort": "DigitalFile_PDF", - "contentType": "application/pdf", - "value": "/aasx/OperatingManual.pdf" - } - ], - "ordered": false, - "allowDuplicates": false - } - ] - }, - { - "modelType": "Submodel", - "kind": "Instance", - "idShort": "OperationalData", - "id": "http://i40.customer.com/instance/1/1/AC69B1CB44F07935", - "submodelElements": [ - { - "modelType": "Property", - "kind": "Instance", - "semanticId": { - "keys": [ - { - "type": "ConceptDescription", - "value": "http://customer.com/cd/1/1/18EBD56F6B43D895" - } - ], - "type": "GlobalReference" - }, - "idShort": "RotationSpeed", - "category": "Variable", - "value": "4370", - "valueType": "xs:integer" - } - ] - } - ], - "conceptDescriptions": [ - { - "modelType": "ConceptDescription", - "idShort": "Title", - "id": "http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Description/Title", - "embeddedDataSpecifications": [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": { - "modelType": "DataSpecificationIEC61360", - "preferredName": [ - { - "language": "EN", - "text": "Title" - }, - { - "language": "DE", - "text": "Titel" - } - ], - "shortNames": [ - { - "language": "EN", - "text": "Title" - }, - { - "language": "DE", - "text": "Titel" - } - ], - "unit": "", - "sourceOfDefinition": "", - "dataType": "StringTranslatable", - "definition": [ - { - "language": "DE", - "text": "SprachabhängigerTiteldesDokuments." - } - ] - } - } - ] - }, - { - "modelType": "ConceptDescription", - "idShort": "DigitalFile", - "id": "http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/StoredDocumentRepresentation/DigitalFile", - "embeddedDataSpecifications": [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": { - "modelType": "DataSpecificationIEC61360", - "preferredName": [ - { - "language": "EN", - "text": "DigitalFile" - }, - { - "language": "DE", - "text": "DigitaleDatei" - } - ], - "shortNames": [ - { - "language": "EN", - "text": "DigitalFile" - }, - { - "language": "DE", - "text": "DigitaleDatei" - } - ], - "unit": "", - "sourceOfDefinition": "", - "dataType": "String", - "definition": [ - { - "language": "DE", - "text": "Eine Datei, die die Document Version repräsentiert. Neben der obligatorischen PDF Datei können weitere Dateien angegeben werden." - } - ] - } - } - ] - }, - { - "modelType": "ConceptDescription", - "idShort": "MaxRotationSpeed", - "category": "PROPERTY", - "administration": { - "version": "", - "revision": "2" - }, - "id": "0173-1#02-BAA120#008", - "embeddedDataSpecifications": [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": { - "modelType": "DataSpecificationIEC61360", - "preferredName": [ - { - "language": "de", - "text": "max.Drehzahl" - }, - { - "language": "en", - "text": "Max.rotationspeed" - } - ], - "unit": "1/min", - "unitId": { - "keys": [ - { - "type": "GlobalReference", - "value": "0173-1#05-AAA650#002" - } - ], - "type": "GlobalReference" - }, - "sourceOfDefinition": "", - "dataType": "RealMeasure", - "definition": [ - { - "language": "de", - "text": "HöchstezulässigeDrehzahl,mitwelcherderMotoroderdieSpeiseinheitbetriebenwerdendarf" - }, - { - "language": "en", - "text": "Greatestpermissiblerotationspeedwithwhichthemotororfeedingunitmaybeoperated" - } - ] - } - } - ] - }, - { - "modelType": "ConceptDescription", - "idShort": "RotationSpeed", - "category": "PROPERTY", - "id": "http://customer.com/cd/1/1/18EBD56F6B43D895", - "embeddedDataSpecifications": [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": { - "modelType": "DataSpecificationIEC61360", - "preferredName": [ - { - "language": "DE", - "text": "AktuelleDrehzahl" - }, - { - "language": "EN", - "text": "Actualrotationspeed" - } - ], - "shortNames": [ - { - "language": "DE", - "text": "AktuelleDrehzahl" - }, - { - "language": "EN", - "text": "ActualRotationSpeed" - } - ], - "unit": "1/min", - "unitId": { - "keys": [ - { - "type": "GlobalReference", - "value": "0173-1#05-AAA650#002" - } - ], - "type": "GlobalReference" - }, - "sourceOfDefinition": "", - "dataType": "RealMeasure", - "definition": [ - { - "language": "DE", - "text": "Aktuelle Drehzahl, mitwelcher der Motor oder die Speiseinheit betrieben wird" - }, - { - "language": "EN", - "text": "Actual rotationspeed with which the motor or feedingunit is operated" - } - ] - } - } - ] - }, - { - "idShort": "Document", - "id": "http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Document", - "embeddedDataSpecifications": [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": { - "modelType": "DataSpecificationIEC61360", - "preferredName": [ - ], - "shortNames": [ - { - "language": "EN", - "text": "Document" - }, - { - "language": "DE", - "text": "Dokument" - } - ], - "unit": "", - "sourceOfDefinition": "[ISO15519-1:2010]", - "dataType": "String", - "definition": [ - { - "language": "DE", - "text": "Feste und geordnete Menge von für die Verwendung durch Personen bestimmte Informationen, die verwaltet und als Einheit zwischen Benutzern und System ausgetauscht werden kann." - } - ] - } - } - ] - } - ] -} diff --git a/dataformat-json/src/test/resources/jsonExample.json b/dataformat-json/src/test/resources/jsonExample.json deleted file mode 100644 index 41fefacbd..000000000 --- a/dataformat-json/src/test/resources/jsonExample.json +++ /dev/null @@ -1,493 +0,0 @@ - -{ - "assetAdministrationShells": [ - { - "modelType": "AssetAdministrationShell", - "assetInformation": - { - "assetKind": "Instance", - "globalAssetId": - { - "keys": [ - { - "type": "AssetAdministrationShell", - "value": "http://customer.com/assets/KHBVZJSQKIY" - } - ], - "type": "GlobalReference" - }, - "specificAssetIds": [ - { - "name": "EquipmentID", - "value": "538fd1b3-f99f-4a52-9c75-72e9fa921270", - "externalSubjectId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://customer.com/Systems/ERP/012" - } - ], - "type": "GlobalReference" - } - }, - { - "name": "DeviceID", - "value": "QjYgPggjwkiHk4RrQiYSLg==", - "externalSubjectId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://customer.com/Systems/IoT/1" - } - ], - "type": "GlobalReference" - } - } - ], - "thumbnail": { - "contentType": "image/png", - "path": "file:///master/verwaltungsschale-detail-part1.png" - } - }, - "submodels": [ - { - "keys": [ - { - "type": "Submodel", - "value": "http://i40.customer.com/type/1/1/7A7104BDAB57E184" - } - ], - "type": "GlobalReference" - }, - { - "keys": [ - { - "type": "Submodel", - "value": "http://i40.customer.com/instance/1/1/AC69B1CB44F07935" - } - ], - "type": "GlobalReference" - }, - { - "keys": [ - { - "type": "Submodel", - "value": "http://i40.customer.com/type/1/1/1A7B62B529F19152" - } - ], - "type": "GlobalReference" - } - ], - "id": "http://customer.com/aas/9175_7013_7091_9168", - "idShort": "ExampleMotor" - } - ], - "conceptDescriptions": [ - { - "modelType": "ConceptDescription", - "category": "PROPERTY", - "embeddedDataSpecifications": [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": - { - "modelType": "DataSpecificationIEC61360", - "dataType": "STRING_TRANSLATABLE", - "sourceOfDefinition": "ExampleString", - "unit": "ExampleString", - "definition": [ - { - "language": "EN", - "text": "SprachabhängigerTiteldesDokuments." - } - ], - "preferredName": [ - { - "language": "EN", - "text": "Title" - }, - { - "language": "DE", - "text": "Titel" - } - ], - "shortName": [ - { - "language": "EN", - "text": "Title" - }, - { - "language": "DE", - "text": "Titel" - } - ] - } - } - ], - "id": "http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Description/Title", - "idShort": "Title" - }, - { - "modelType": "ConceptDescription", - "category": "PROPERTY", - "embeddedDataSpecifications": [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": - { - "modelType": "DataSpecificationIEC61360", - "dataType": "STRING", - "sourceOfDefinition": "ExampleString", - "unit": "ExampleString", - "definition": [ - { - "language": "EN", - "text": "A file representing the document version. In addition to the mandatory PDF file, other files can be specified." - } - ], - "preferredName": [ - { - "language": "EN", - "text": "DigitalFile" - }, - { - "language": "EN", - "text": "DigitalFile" - } - ], - "shortName": [ - { - "language": "EN", - "text": "DigitalFile" - }, - { - "language": "DE", - "text": "DigitaleDatei" - } - ] - } - } - ], - "id": "http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/StoredDocumentRepresentation/DigitalFile", - "idShort": "DigitalFile" - }, - { - "modelType": "ConceptDescription", - "embeddedDataSpecifications": [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": - { - "modelType": "DataSpecificationIEC61360", - "dataType": "REAL_MEASURE", - "sourceOfDefinition": "ExampleString", - "unit": "1/min", - "unitId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "0173-1#05-AAA650#002" - } - ], - "type": "GlobalReference" - }, - "definition": [ - { - "language": "de", - "text": "HöchstezulässigeDrehzahl,mitwelcherderMotoroderdieSpeiseinheitbetriebenwerdendarf" - }, - { - "language": "EN", - "text": "Greatestpermissiblerotationspeedwithwhichthemotororfeedingunitmaybeoperated" - } - ], - "preferredName": [ - { - "language": "de", - "text": "max.Drehzahl" - }, - { - "language": "en", - "text": "Max.rotationspeed" - } - ] - } - } - ], - "administration": - { - "revision": "2.1", - "version": "2" - }, - "id": "0173-1#02-BAA120#008", - "category": "PROPERTY", - "idShort": "MaxRotationSpeed" - }, - { - "modelType": "ConceptDescription", - "embeddedDataSpecifications": [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": - { - "modelType": "DataSpecificationIEC61360", - "dataType": "REAL_MEASURE", - "sourceOfDefinition": "ExampleString", - "unit": "1/min", - "unitId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "0173-1#05-AAA650#002" - } - ], - "type": "GlobalReference" - }, - "definition": [ - { - "language": "DE", - "text": "Aktuelle Drehzahl, mitwelcher der Motor oder die Speiseinheit betrieben wird" - }, - { - "language": "EN", - "text": "Actual rotationspeed with which the motor or feedingunit is operated" - } - ], - "preferredName": [ - { - "language": "DE", - "text": "AktuelleDrehzahl" - }, - { - "language": "EN", - "text": "Actualrotationspeed" - } - ], - "shortName": [ - { - "language": "DE", - "text": "AktuelleDrehzahl" - }, - { - "language": "EN", - "text": "ActualRotationSpeed" - } - ] - } - } - ], - "id": "http://customer.com/cd/1/1/18EBD56F6B43D895", - "category": "PROPERTY", - "idShort": "RotationSpeed" - }, - { - "modelType": "ConceptDescription", - "category": "PROPERTY", - "embeddedDataSpecifications": [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": - { - "modelType": "DataSpecificationIEC61360", - "dataType": "STRING", - "sourceOfDefinition": "[ISO15519-1:2010]", - "unit": "ExampleString", - "definition": [ - { - "language": "EN", - "text": "Feste und geordnete Menge von für die Verwendung durch Personen bestimmte Informationen, die verwaltet und als Einheit zwischen Benutzern und System ausgetauscht werden kann." - } - ], - "preferredName": [ - { - "language": "EN", - "text": "Document" - } - ], - "shortName": [ - { - "language": "EN", - "text": "Document" - }, - { - "language": "DE", - "text": "Dokument" - } - ] - } - } - ], - "id": "http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Document", - "idShort": "Document" - } - ], - "submodels": [ - { - "modelType": "Submodel", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "0173-1#01-AFZ615#016" - } - ], - "type": "GlobalReference" - }, - "id": "http://i40.customer.com/type/1/1/7A7104BDAB57E184", - "idShort": "TechnicalData", - "submodelElements": [ - { - "modelType": "Property", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "ConceptDescription", - "value": "0173-1#02-BAA120#008" - } - ], - "type": "GlobalReference" - }, - "value": "5000", - "valueType": "xs:integer", - "category": "PARAMETER", - "idShort": "MaxRotationSpeed" - } - ] - }, - { - "modelType": "Submodel", - "kind": "Instance", - "id": "http://i40.customer.com/type/1/1/1A7B62B529F19152", - "idShort": "Documentation", - "submodelElements": [ - { - "modelType":"SubmodelElementCollection", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "ConceptDescription", - "value": "http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Document" - } - ], - "type": "GlobalReference" - }, - "idShort": "OperatingManual", - "value": [ - { - "modelType": "Property", - "category": "VARIABLE", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "ConceptDescription", - "value": "http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Description/Title" - } - ], - "type": "GlobalReference" - }, - "value": "OperatingManual", - "valueType": "xs:string", - "idShort": "Title" - }, - { - "modelType": "File", - "category": "VARIABLE", - "contentType": "application/pdf", - "value": "file:///aasx/OperatingManual.pdf", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "ConceptDescription", - "value": "http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/StoredDocumentRepresentation/DigitalFile" - } - ], - "type": "GlobalReference" - }, - "idShort": "DigitalFile_PDF" - } - ] - } - ] - }, - { - "modelType": "Submodel", - "kind": "Instance", - "id": "http://i40.customer.com/instance/1/1/AC69B1CB44F07935", - "idShort": "OperationalData", - "submodelElements": [ - { - "modelType": "Property", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "ConceptDescription", - "value": "http://customer.com/cd/1/1/18EBD56F6B43D895" - } - ], - "type": "GlobalReference" - }, - "value": "4370", - "valueType": "xs:integer", - "category": "VARIABLE", - "idShort": "RotationSpeed" - } - ] - } - ] -} diff --git a/dataformat-json/src/test/resources/listOfSubmodelElements.json b/dataformat-json/src/test/resources/listOfSubmodelElements.json deleted file mode 100644 index 8073bcbe8..000000000 --- a/dataformat-json/src/test/resources/listOfSubmodelElements.json +++ /dev/null @@ -1,92 +0,0 @@ -[ - { - "modelType": "Property", - "kind": "Instance", - "category": "VARIABLE", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "0173-1#02-AAO677#002" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ACPLT", - "valueId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ACPLT" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "qualifiers": [ - { - "type": "http://acplt.org/Qualifier/ExampleQualifier", - "value": "100", - "valueType": "xs:int", - "kind": "ConceptQualifier" - }, - { - "type": "http://acplt.org/Qualifier/ExampleQualifier2", - "value": "50", - "valueType": "xs:int", - "kind": "ConceptQualifier" - } - ], - "idShort": "ManufacturerName", - "description": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - }, - { - "modelType": "Property", - "kind": "Instance", - "category": "VARIABLE", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber" - } - ], - "type": "GlobalReference" - }, - "value": "978-8234-234-342", - "valueId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "978-8234-234-342" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "idShort": "InstanceId", - "description": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - } -] diff --git a/dataformat-json/src/test/resources/submodelElementListEmpty.json b/dataformat-json/src/test/resources/submodelElementListEmpty.json deleted file mode 100644 index ca37a7d6a..000000000 --- a/dataformat-json/src/test/resources/submodelElementListEmpty.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "modelType" : "SubmodelElementList", - "idShort" : "submodelElementList", - "orderRelevant" : true, - "kind": "Instance" -} \ No newline at end of file diff --git a/dataformat-json/src/test/resources/submodelList.json b/dataformat-json/src/test/resources/submodelList.json deleted file mode 100644 index 9337b3480..000000000 --- a/dataformat-json/src/test/resources/submodelList.json +++ /dev/null @@ -1,297 +0,0 @@ -[ - { - "modelType": "Submodel", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "Submodel", - "value": "http://acplt.org/SubmodelTemplates/AssetIdentification" - } - ], - "type": "GlobalReference" - }, - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "http://acplt.org/Submodels/Assets/TestAsset/Identification", - "idShort": "Identification", - "submodelElements": [ - { - "modelType": "Property", - "kind": "Instance", - "category": "VARIABLE", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "0173-1#02-AAO677#002" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ACPLT", - "valueId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ACPLT" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "qualifiers": [ - { - "type": "http://acplt.org/Qualifier/ExampleQualifier", - "value": "100", - "valueType": "xs:int", - "kind": "ConceptQualifier" - }, - { - "type": "http://acplt.org/Qualifier/ExampleQualifier2", - "value": "50", - "valueType": "xs:int", - "kind": "ConceptQualifier" - } - ], - "idShort": "ManufacturerName", - "description": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - }, - { - "modelType": "Property", - "kind": "Instance", - "category": "VARIABLE", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber" - } - ], - "type": "GlobalReference" - }, - "value": "978-8234-234-342", - "valueId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "978-8234-234-342" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "idShort": "InstanceId", - "description": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - } - ], - "description": [ - { - "language": "en-us", - "text": "An example asset identification submodel for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Identifikations-Submodel für eine Test-Anwendung" - } - ] - }, - { - "modelType": "Submodel", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "Submodel", - "value": "http://acplt.org/SubmodelTemplates/BillOfMaterial" - } - ], - "type": "GlobalReference" - }, - "administration": - { - "version": "0.9" - }, - "id": "http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial", - "idShort": "BillOfMaterial", - "submodelElements": [ - { - "modelType": "Entity", - "kind": "Instance", - "entityType": "CoManagedEntity", - "statements": [ - { - "modelType": "Property", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValue2", - "valueId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValue2" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "CONSTANT", - "idShort": "ExampleProperty2", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - }, - { - "modelType": "Property", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "CONSTANT", - "idShort": "ExampleProperty", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - ], - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber" - } - ], - "type": "GlobalReference" - }, - "idShort": "ExampleEntity", - "description": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - }, - { - "modelType": "Entity", - "entityType": "SelfManagedEntity", - "kind": "Instance", - "globalAssetId": - { - "keys": [ - { - "type": "AssetAdministrationShell", - "value": "https://acplt.org/Test_Asset2" - } - ], - "type": "GlobalReference" - }, - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber" - } - ], - "type": "GlobalReference" - }, - "idShort": "ExampleEntity2", - "description": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - } - ], - "description": [ - { - "language": "en-us", - "text": "An example bill of material submodel for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-BillofMaterial-Submodel für eine Test-Anwendung" - } - ] - } -] diff --git a/dataformat-json/src/test/resources/test_demo_full_example.json b/dataformat-json/src/test/resources/test_demo_full_example.json deleted file mode 100644 index 5a6adcd08..000000000 --- a/dataformat-json/src/test/resources/test_demo_full_example.json +++ /dev/null @@ -1,2878 +0,0 @@ - -{ - "assetAdministrationShells": [ - { - "modelType": "AssetAdministrationShell", - "assetInformation": - { - "assetKind": "Instance", - "globalAssetId": - { - "keys": [ - { - "type": "AssetAdministrationShell", - "value": "https://acplt.org/Test_Asset" - } - ], - "type": "GlobalReference" - } - }, - "derivedFrom": - { - "keys": [ - { - "type": "AssetAdministrationShell", - "value": "https://acplt.org/TestAssetAdministrationShell2" - } - ], - "type": "GlobalReference" - }, - "submodels": [ - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel" - } - ], - "type": "GlobalReference" - }, - { - "keys": [ - { - - "type": "Submodel", - "value": "http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial" - } - ], - "type": "GlobalReference" - }, - { - "keys": [ - { - - "type": "Submodel", - "value": "http://acplt.org/Submodels/Assets/TestAsset/Identification" - } - ], - "type": "GlobalReference" - } - ], - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_AssetAdministrationShell", - "idShort": "TestAssetAdministrationShell", - "description": [ - { - "language": "en-us", - "text": "An Example Asset Administration Shell for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Verwaltungsschale für eine Test-Anwendung" - } - ] - - }, - { - "modelType": "AssetAdministrationShell", - "assetInformation": - { - "assetKind": "Instance", - "globalAssetId": - { - "keys": [ - { - - "type": "AssetAdministrationShell", - "value": "https://acplt.org/Test_Asset_Mandatory" - } - ], - "type": "GlobalReference" - } - }, - "submodels": [ - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - } - ], - "type": "GlobalReference" - }, - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel2_Mandatory" - } - ], - "type": "GlobalReference" - } - ], - "id": "https://acplt.org/Test_AssetAdministrationShell_Mandatory", - "idShort": "Test_AssetAdministrationShell_Mandatory" - }, - { - "modelType": "AssetAdministrationShell", - "assetInformation": - { - "assetKind": "Instance", - "globalAssetId": - { - "keys": [ - { - - "type": "AssetAdministrationShell", - "value": "https://acplt.org/Test_Asset_Mandatory" - } - ], - "type": "GlobalReference" - } - }, - "id": "https://acplt.org/Test_AssetAdministrationShell2_Mandatory", - "idShort": "Test_AssetAdministrationShell2_Mandatory" - }, - { - "modelType": "AssetAdministrationShell", - "assetInformation": - { - "assetKind": "Instance", - "globalAssetId": - { - "keys": [ - { - - "type": "AssetAdministrationShell", - "value": "https://acplt.org/Test_Asset_Missing" - } - ], - "type": "GlobalReference" - } - }, - "submodels": [ - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - } - ], - "type": "GlobalReference" - } - ], - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_AssetAdministrationShell_Missing", - "idShort": "TestAssetAdministrationShell", - "description": [ - { - "language": "en-us", - "text": "An Example Asset Administration Shell for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Verwaltungsschale für eine Test-Anwendung" - } - ] - - } - ], - "conceptDescriptions": [ - { - "modelType": "ConceptDescription", - "category": "PROPERTY", - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_ConceptDescription", - "idShort": "TestConceptDescription", - "isCaseOf": [ - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/DataSpecifications/Conceptdescription/TestConceptDescription" - } - ], - "type": "GlobalReference" - } - ], - "description": [ - { - "language": "en-us", - "text": "An example concept description for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-ConceptDescription für eine Test-Anwendung" - } - ] - - }, - { - "modelType": "ConceptDescription", - "category": "PROPERTY", - "id": "https://acplt.org/Test_ConceptDescription_Mandatory", - "idShort": "Test_ConceptDescription_Mandatory" - }, - { - "modelType": "ConceptDescription", - "category": "PROPERTY", - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_ConceptDescription_Missing", - "idShort": "TestConceptDescription1", - "description": [ - { - "language": "en-us", - "text": "An example concept description for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-ConceptDescription für eine Test-Anwendung" - } - ] - - }, - { - "modelType": "ConceptDescription", - "category": "PROPERTY", - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "http://acplt.org/DataSpecifciations/Example/Identification", - "idShort": "TestSpec_01", - "isCaseOf": [ - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ReferenceElements/ConceptDescriptionX" - } - ], - "type": "GlobalReference" - } - ], - "embeddedDataSpecifications": - [ - { - "dataSpecification": { - "keys": [ - { - "type": "GlobalReference", - "value": "https://admin-shell.io/aas/3/0/RC02/DataSpecificationIEC61360" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": { - "modelType": "DataSpecificationIEC61360", - "dataType": "REAL_MEASURE", - "sourceOfDefinition": "http://acplt.org/DataSpec/ExampleDef", - "symbol": "SU", - "unit": "SpaceUnit", - "unitId": { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Units/SpaceUnit" - } - ], - "type": "GlobalReference" - }, - "value": "TEST", - "valueFormat": "string", - "valueList": { - "valueReferencePairs": [ - { - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - } - }, - { - "value": "http://acplt.org/ValueId/ExampleValueId2", - "valueId": { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId2" - } - ], - "type": "GlobalReference" - } - } - ] - }, - "definition": [ - { - "language": "de", - "text": "Dies ist eine Data Specification für Testzwecke" - }, - { - "language": "en-us", - "text": "This is a DataSpecification for testing purposes" - } - ], - "levelType": "Max", - "preferredName": [ - { - "language": "de", - "text": "Test Specification" - }, - { - "language": "en-us", - "text": "TestSpecification" - } - ], - "shortName": [ - { - "language": "de", - "text": "Test Spec" - }, - { - "language": "en-us", - "text": "TestSpec" - } - ] - } - } - ] - } - ], - "submodels": [ - { - "modelType": "Submodel", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "Submodel", - "value": "http://acplt.org/SubmodelTemplates/AssetIdentification" - } - ], - "type": "GlobalReference" - }, - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "http://acplt.org/Submodels/Assets/TestAsset/Identification", - "idShort": "Identification", - "submodelElements": [ - { - "modelType": "Property", - "kind": "Instance", - "category": "VARIABLE", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "0173-1#02-AAO677#002" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ACPLT", - "valueId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ACPLT" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "qualifiers": [ - { - "type": "http://acplt.org/Qualifier/ExampleQualifier", - "value": "100", - "valueType": "xs:int", - "kind": "ConceptQualifier" - }, - { - "type": "http://acplt.org/Qualifier/ExampleQualifier2", - "value": "50", - "valueType": "xs:int", - "kind": "ConceptQualifier" - } - ], - "idShort": "ManufacturerName", - "description": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - - }, - { - "modelType": "Property", - "kind": "Instance", - "category": "VARIABLE", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber" - } - ], - "type": "GlobalReference" - }, - "value": "978-8234-234-342", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "978-8234-234-342" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "idShort": "InstanceId", - "description": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - - } - ], - "description": [ - { - "language": "en-us", - "text": "An example asset identification submodel for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Identifikations-Submodel für eine Test-Anwendung" - } - ] - - }, - { - "modelType": "Submodel", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - - "type": "Submodel", - "value": "http://acplt.org/SubmodelTemplates/BillOfMaterial" - } - ], - "type": "GlobalReference" - }, - "administration": - { - "version": "0.9" - }, - "id": "http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial", - "idShort": "BillOfMaterial", - "submodelElements": [ - { - "modelType": "Entity", - "kind": "Instance", - "entityType": "CoManagedEntity", - "statements": [ - { - "modelType": "Property", - "kind": "Instance", - "category": "VARIABLE", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValue2", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValue2" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "CONSTANT", - "idShort": "ExampleProperty2", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - }, - { - "modelType": "Property", - "kind": "Instance", - "category": "VARIABLE", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "CONSTANT", - "idShort": "ExampleProperty", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - } - ], - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber" - } - ], - "type": "GlobalReference" - }, - "idShort": "ExampleEntity", - "description": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - - }, - { - "modelType": "Entity", - "kind": "Instance", - "entityType": "SelfManagedEntity", - "globalAssetId": - { - "keys": [ - { - - "type": "AssetAdministrationShell", - "value": "https://acplt.org/Test_Asset2" - } - ], - "type": "GlobalReference" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber" - } - ], - "type": "GlobalReference" - }, - "idShort": "ExampleEntity2", - "description": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - - } - ], - "description": [ - { - "language": "en-us", - "text": "An example bill of material submodel for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-BillofMaterial-Submodel für eine Test-Anwendung" - } - ] - - }, - { - "modelType": "Submodel", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelTemplates/ExampleSubmodel" - } - ], - "type": "GlobalReference" - }, - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_Submodel", - "idShort": "TestSubmodel", - "submodelElements": [ - { - "modelType": "RelationshipElement", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/RelationshipElements/ExampleRelationshipElement" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleRelationshipElement", - "first": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "ModelReference" - }, - "second": - { - "keys": [ - { - "type": "Submodel", - "value": "http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial" - }, - { - "type": "Entity", - "value": "ExampleEntity" - }, - { - "type": "Property", - "value": "ExampleProperty2" - } - ], - "type": "ModelReference" - }, - "description": [ - { - "language": "en-us", - "text": "Example RelationshipElement object" - }, - { - "language": "de", - "text": "Beispiel RelationshipElement Element" - } - ] - - }, - { - "modelType": "AnnotatedRelationshipElement", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/RelationshipElements/ExampleAnnotatedRelationshipElement" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleAnnotatedRelationshipElement", - "first": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "ModelReference" - }, - "second": - { - "keys": [ - { - "type": "Submodel", - "value": "http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial" - }, - { - "type": "Entity", - "value": "ExampleEntity" - }, - { - "type": "Property", - "value": "ExampleProperty2" - } - ], - "type": "ModelReference" - }, - "annotations": [ - { - "modelType": "Property", - "kind": "Instance", - "value": "some example annotation", - "valueType": "xs:string", - "category": "PARAMETER", - "idShort": "ExampleProperty3" - } - ], - "description": [ - { - "language": "en-us", - "text": "Example AnnotatedRelationshipElement object" - }, - { - "language": "de", - "text": "Beispiel AnnotatedRelationshipElement Element" - } - ] - - }, - { - "modelType": "Operation", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Operations/ExampleOperation" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleOperation", - "inoutputVariables": [ - { - "value": - { - "modelType": "Property", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "CONSTANT", - "idShort": "ExampleProperty3", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - } - } - ], - "inputVariables": [ - { - "value": - { - "modelType": "Property", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "CONSTANT", - "idShort": "ExampleProperty1", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - } - } - ], - "outputVariables": [ - { - "value": - { - "modelType": "Property", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "CONSTANT", - "idShort": "ExampleProperty2", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - } - } - ], - "description": [ - { - "language": "en-us", - "text": "Example Operation object" - }, - { - "language": "de", - "text": "Beispiel Operation Element" - } - ] - - }, - { - "modelType": "Capability", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Capabilities/ExampleCapability" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleCapability", - "description": [ - { - "language": "en-us", - "text": "Example Capability object" - }, - { - "language": "de", - "text": "Beispiel Capability Element" - } - ] - - }, - { - "modelType": "BasicEventElement", - "kind": "Instance", - "observed": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "ModelReference" - }, - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Events/ExampleBasicEvent" - } - ], - "type": "GlobalReference" - }, - "direction": "INPUT", - "state": "ON", - "category": "PARAMETER", - "idShort": "ExampleBasicEvent", - "description": [ - { - "language": "en-us", - "text": "Example BasicEvent object" - }, - { - "language": "de", - "text": "Beispiel BasicEvent Element" - } - ], - "direction": "INPUT", - "state": "ON" - }, - { - "modelType": "SubmodelElementList", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementLists/ExampleSubmodelElementListOrdered" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleSubmodelElementListOrdered", - "orderRelevant": true, - "description": [ - { - "language": "en-us", - "text": "Example ExampleSubmodelElementListOrdered object" - }, - { - "language": "de", - "text": "Beispiel ExampleSubmodelElementListOrdered Element" - } - ], - "typeValueListElement": "SubmodelElement", - "value": [ - { - "modelType": "Property", - "kind": "Instance", - - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "CONSTANT", - "idShort": "ExampleProperty", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - }, - { - "modelType": "MultiLanguageProperty", - "kind": "Instance", - - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/MultiLanguageProperties/ExampleMultiLanguageProperty" - } - ], - "type": "GlobalReference" - }, - "valueId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleMultiLanguageValueId" - } - ], - "type": "GlobalReference" - }, - "category": "CONSTANT", - "idShort": "ExampleMultiLanguageProperty", - "value": [ - { - "language": "en-us", - "text": "Example value of a MultiLanguageProperty element" - }, - { - "language": "de", - "text": "Beispielswert für ein MultiLanguageProperty-Element" - } - ], - "description": [ - { - "language": "en-us", - "text": "Example MultiLanguageProperty object" - }, - { - "language": "de", - "text": "Beispiel MultiLanguageProperty Element" - } - ] - - }, - { - "modelType": "Range", - "kind": "Instance", - - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Ranges/ExampleRange" - } - ], - "type": "GlobalReference" - }, - "max": "100", - "min": "0", - "valueType": "xs:int", - "category": "PARAMETER", - "idShort": "ExampleRange", - "description": [ - { - "language": "en-us", - "text": "Example Range object" - }, - { - "language": "de", - "text": "Beispiel Range Element" - } - ] - - } - ] - }, - { - "modelType": "SubmodelElementCollection", - "kind": "Instance", - - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollection" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleSubmodelElementCollection", - "description": [ - { - "language": "en-us", - "text": "Example SubmodelElementCollection object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementCollection Element" - } - ], - "value": [ - { - "modelType": "Blob", - "kind": "Instance", - - "contentType": "application/pdf", - "value": "AQIDBAU=", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Blobs/ExampleBlob" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleBlob", - "description": [ - { - "language": "en-us", - "text": "Example Blob object" - }, - { - "language": "de", - "text": "Beispiel Blob Element" - } - ] - - }, - { - "modelType": "File", - "kind": "Instance", - - "contentType": "application/pdf", - "value": "file:///TestFile.pdf", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Files/ExampleFile" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleFile", - "description": [ - { - "language": "en-us", - "text": "Example File object" - }, - { - "language": "de", - "text": "Beispiel File Element" - } - ] - - }, - { - "modelType": "ReferenceElement", - "kind": "Instance", - - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ReferenceElements/ExampleReferenceElement" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleReferenceElement", - "value": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "description": [ - { - "language": "en-us", - "text": "Example Reference Element object" - }, - { - "language": "de", - "text": "Beispiel Reference Element Element" - } - ] - - } - ] - } - ], - "description": [ - { - "language": "en-us", - "text": "An example submodel for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Teilmodell für eine Test-Anwendung" - } - ] - - }, - { - "modelType": "Submodel", - "kind": "Template", - "id": "https://acplt.org/Test_Submodel_Mandatory", - "idShort": "Test_Submodel_Mandatory", - "submodelElements": [ - { - "modelType": "RelationshipElement", - "kind": "Instance", - "idShort": "ExampleRelationshipElement", - "first": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListUnordered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "ModelReference" - }, - "second": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListUnordered" - }, - { - "type": "MultiLanguageProperty", - "value": "ExampleMultiLanguageProperty" - } - ], - "type": "ModelReference" - } - }, - { - "modelType": "AnnotatedRelationshipElement", - "kind": "Instance", - "idShort": "ExampleAnnotatedRelationshipElement", - "first": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelElementCollection" - }, - { - "type": "Blob", - "value": "ExampleBlob" - } - ], - "type": "ModelReference" - }, - "second": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListUnordered" - }, - { - "type": "MultiLanguageProperty", - "value": "ExampleMultiLanguageProperty" - } - ], - "type": "ModelReference" - } - }, - { - "modelType": "Operation", - "kind": "Template", - "idShort": "ExampleOperation" - }, - { - "modelType": "Capability", - "kind": "Instance", - - "idShort": "ExampleCapability" - }, - { - "modelType": "BasicEventElement", - "kind": "Instance", - - "observed": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListUnordered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "ModelReference" - }, - "idShort": "ExampleBasicEvent", - "direction": "OUTPUT", - "state": "OFF" - }, - { - "modelType": "SubmodelElementList", - "kind": "Instance", - - "idShort": "ExampleSubmodelElementListUnordered", - "orderRelevant": false, - "typeValueListElement": "SubmodelElement", - "value": [ - { - "modelType": "Property", - "kind": "Instance", - "category": "VARIABLE", - "valueType": "xs:string", - "idShort": "ExampleProperty" - }, - { - "modelType": "MultiLanguageProperty", - "kind": "Instance", - "category": "VARIABLE", - "idShort": "ExampleMultiLanguageProperty" - }, - { - "modelType": "Range", - "kind": "Instance", - "category": "VARIABLE", - "valueType": "xs:int", - "idShort": "ExampleRange" - } - ] - }, - { - "modelType": "SubmodelElementCollection", - "kind": "Instance", - "idShort": "ExampleSubmodelElementCollection", - "value": [ - { - "modelType": "Blob", - "kind": "Instance", - "category": "VARIABLE", - "contentType": "application/pdf", - "idShort": "ExampleBlob" - }, - { - "modelType": "File", - "kind": "Instance", - "category": "VARIABLE", - "contentType": "application/pdf", - "idShort": "ExampleFile" - }, - { - "modelType": "ReferenceElement", - "kind": "Instance", - "category": "VARIABLE", - "idShort": "ExampleReferenceElement" - } - ] - }, - { - "modelType": "SubmodelElementCollection", - "kind": "Instance", - "idShort": "ExampleSubmodelElementCollection2" - } - ] - }, - { - "modelType": "Submodel", - "kind": "Instance", - "id": "https://acplt.org/Test_Submodel2_Mandatory", - "idShort": "Test_Submodel2_Mandatory" - }, - { - "modelType": "Submodel", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelTemplates/ExampleSubmodel" - } - ], - "type": "GlobalReference" - }, - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_Submodel_Missing", - "idShort": "TestSubmodelMissing", - "submodelElements": [ - { - "modelType": "RelationshipElement", - "kind": "Instance", - - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/RelationshipElements/ExampleRelationshipElement" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleRelationshipElement", - "first": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "ModelReference" - }, - "second": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListOrdered" - }, - { - "type": "MultiLanguageProperty", - "value": "ExampleMultiLanguageProperty" - } - ], - "type": "ModelReference" - }, - "description": [ - { - "language": "en-us", - "text": "Example RelationshipElement object" - }, - { - "language": "de", - "text": "Beispiel RelationshipElement Element" - } - ] - - }, - { - "modelType": "AnnotatedRelationshipElement", - "kind": "Instance", - - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/RelationshipElements/ExampleAnnotatedRelationshipElement" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleAnnotatedRelationshipElement", - "first": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "ModelReference" - }, - "second": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListOrdered" - }, - { - "type": "MultiLanguageProperty", - "value": "ExampleMultiLanguageProperty" - } - ], - "type": "ModelReference" - }, - "annotations": [ - { - "modelType": "Property", - "kind": "Instance", - "category": "VARIABLE", - "value": "some example annotation", - "valueType": "xs:string", - "category": "PARAMETER", - "idShort": "ExampleProperty" - } - ], - "description": [ - { - "language": "en-us", - "text": "Example AnnotatedRelationshipElement object" - }, - { - "language": "de", - "text": "Beispiel AnnotatedRelationshipElement Element" - } - ] - - }, - { - "modelType": "Operation", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Operations/ExampleOperation" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleOperation", - "inoutputVariables": [ - { - "value": - { - "modelType": "Property", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "exampleValue", - "valueType": "xs:string", - "qualifiers": [ - { - "type": "http://acplt.org/Qualifier/ExampleQualifier", - "valueType": "xs:string", - "kind": "ConceptQualifier" - } - ], - "category": "CONSTANT", - "idShort": "ExampleProperty3", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - } - } - ], - "inputVariables": [ - { - "value": { - "modelType": "Property", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "exampleValue", - "valueType": "xs:string", - "qualifiers": [ - { - "type": "http://acplt.org/Qualifier/ExampleQualifier", - "valueType": "xs:string", - "kind": "ConceptQualifier" - } - ], - "category": "CONSTANT", - "idShort": "ExampleProperty1", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - } - ], - "outputVariables": [ - { - "value": - { - "modelType": "Property", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "exampleValue", - "valueType": "xs:string", - "qualifiers": [ - { - "type": "http://acplt.org/Qualifier/ExampleQualifier", - "valueType": "xs:string", - "kind": "ConceptQualifier" - } - ], - "category": "CONSTANT", - "idShort": "ExampleProperty2", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - } - } - ], - "description": [ - { - "language": "en-us", - "text": "Example Operation object" - }, - { - "language": "de", - "text": "Beispiel Operation Element" - } - ] - - }, - { - "modelType": "Capability", - "kind": "Instance", - - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Capabilities/ExampleCapability" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleCapability", - "description": [ - { - "language": "en-us", - "text": "Example Capability object" - }, - { - "language": "de", - "text": "Beispiel Capability Element" - } - ] - - }, - { - "modelType": "BasicEventElement", - "kind": "Instance", - - "observed": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - }, - { - "type": "SubmodelElementList", - "value": "ExampleSubmodelElementListOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Events/ExampleBasicEvent" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleBasicEvent", - "direction": "INPUT", - "state": "ON", - "description": [ - { - "language": "en-us", - "text": "Example BasicEvent object" - }, - { - "language": "de", - "text": "Beispiel BasicEvent Element" - } - ], - "direction": "INPUT", - "state": "ON" - }, - { - "kind": "Instance", - - "modelType": "SubmodelElementList", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementLists/ExampleSubmodelElementListOrdered" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleSubmodelElementListOrdered", - "orderRelevant": true, - "description": [ - { - "language": "en-us", - "text": "Example SubmodelElementListOrdered object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementListOrdered Element" - } - ], - "typeValueListElement": "SubmodelElement", - "value": [ - { - "modelType": "Property", - "kind": "Instance", - - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "exampleValue", - "valueType": "xs:string", - "qualifiers": [ - { - "type": "http://acplt.org/Qualifier/ExampleQualifier", - "valueType": "xs:string", - "kind": "ConceptQualifier" - } - ], - "category": "CONSTANT", - "idShort": "ExampleProperty", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - }, - { - "modelType": "MultiLanguageProperty", - "kind": "Instance", - - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/MultiLanguageProperties/ExampleMultiLanguageProperty" - } - ], - "type": "GlobalReference" - }, - "category": "CONSTANT", - "idShort": "ExampleMultiLanguageProperty", - "value": [ - { - "language": "en-us", - "text": "Example value of a MultiLanguageProperty element" - }, - { - "language": "de", - "text": "Beispielswert für ein MultiLanguageProperty-Element" - } - ], - "description": [ - { - "language": "en-us", - "text": "Example MultiLanguageProperty object" - }, - { - "language": "de", - "text": "Beispiel MultiLanguageProperty Element" - } - ] - }, - { - "modelType": "Range", - "kind": "Instance", - - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Ranges/ExampleRange" - } - ], - "type": "GlobalReference" - }, - "max": "100", - "min": "0", - "valueType": "xs:int", - "category": "PARAMETER", - "idShort": "ExampleRange", - "description": [ - { - "language": "en-us", - "text": "Example Range object" - }, - { - "language": "de", - "text": "Beispiel Range Element" - } - ] - - } - ] - }, - { - "modelType": "SubmodelElementCollection", - "kind": "Instance", - - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollection" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleSubmodelElementCollection", - "description": [ - { - "language": "en-us", - "text": "Example SubmodelElementCollection object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementCollection Element" - } - ], - "value": [ - { - "modelType": "Blob", - "kind": "Instance", - - "contentType": "application/pdf", - "value": "AQIDBAU=", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Blobs/ExampleBlob" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleBlob", - "description": [ - { - "language": "en-us", - "text": "Example Blob object" - }, - { - "language": "de", - "text": "Beispiel Blob Element" - } - ] - - }, - { - "modelType": "File", - "kind": "Instance", - "contentType": "application/pdf", - "value": "file:///TestFile.pdf", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Files/ExampleFile" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleFile", - "description": [ - { - "language": "en-us", - "text": "Example File object" - }, - { - "language": "de", - "text": "Beispiel File Element" - } - ] - - }, - { - "modelType": "ReferenceElement", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ReferenceElements/ExampleReferenceElement" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleReferenceElement", - "value": { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelElementCollection" - }, - { - "type": "File", - "value": "ExampleFile" - } - ], - "type": "ModelReference" - }, - "description": [ - { - "language": "en-us", - "text": "Example Reference Element object" - }, - { - "language": "de", - "text": "Beispiel Reference Element Element" - } - ] - - } - ] - } - ], - "description": [ - { - "language": "en-us", - "text": "An example submodel for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Teilmodell für eine Test-Anwendung" - } - ] - - }, - { - "modelType": "Submodel", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelTemplates/ExampleSubmodel" - } - ], - "type": "GlobalReference" - }, - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_Submodel_Template", - "idShort": "TestSubmodelTemplate", - "submodelElements": [ - { - "modelType": "RelationshipElement", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/RelationshipElements/ExampleRelationshipElement" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleRelationshipElement", - "first": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Template" - }, - { - "type": "Operation", - "value": "ExampleOperation" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "ModelReference" - }, - "second": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Template" - }, - { - "type": "Operation", - "value": "ExampleOperation" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "ModelReference" - }, - "description": [ - { - "language": "en-us", - "text": "Example RelationshipElement object" - }, - { - "language": "de", - "text": "Beispiel RelationshipElement Element" - } - ] - - }, - { - "modelType": "AnnotatedRelationshipElement", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/RelationshipElements/ExampleAnnotatedRelationshipElement" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleAnnotatedRelationshipElement", - "first": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Template" - }, - { - "type": "Operation", - "value": "ExampleOperation" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "ModelReference" - }, - "second": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Template" - }, - { - "type": "Operation", - "value": "ExampleOperation" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "ModelReference" - }, - "description": [ - { - "language": "en-us", - "text": "Example AnnotatedRelationshipElement object" - }, - { - "language": "de", - "text": "Beispiel AnnotatedRelationshipElement Element" - } - ] - }, - { - "modelType": "Operation", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Operations/ExampleOperation" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleOperation", - "inoutputVariables": [ - { - "value": - { - "modelType": "Property", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "CONSTANT", - "idShort": "ExampleProperty", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - } - } - ], - "inputVariables": [ - { - "value": - { - "modelType": "Property", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "CONSTANT", - "idShort": "ExampleProperty", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - } - } - ], - "outputVariables": [ - { - "value": - { - "modelType": "Property", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "CONSTANT", - "idShort": "ExampleProperty", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - } - } - ], - "description": [ - { - "language": "en-us", - "text": "Example Operation object" - }, - { - "language": "de", - "text": "Beispiel Operation Element" - } - ] - - }, - { - "modelType": "Capability", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Capabilities/ExampleCapability" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleCapability", - "description": [ - { - "language": "en-us", - "text": "Example Capability object" - }, - { - "language": "de", - "text": "Beispiel Capability Element" - } - ] - - }, - { - "modelType": "BasicEventElement", - "observed": - { - "keys": [ - { - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Template" - }, - { - "type": "Operation", - "value": "ExampleOperation" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "ModelReference" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Events/ExampleBasicEvent" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleBasicEvent", - "direction": "OUTPUT", - "state": "OFF", - "description": [ - { - "language": "en-us", - "text": "Example BasicEvent object" - }, - { - "language": "de", - "text": "Beispiel BasicEvent Element" - } - ], - "direction": "OUTPUT", - "state": "OFF" - }, - { - "modelType": "SubmodelElementList", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementLists/ExampleSubmodelElementListOrdered" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleSubmodelElementListOrdered", - "orderRelevant": true, - "description": [ - { - "language": "en-us", - "text": "Example SubmodelElementListOrdered object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementListOrdered Element" - } - ], - "typeValueListElement": "SubmodelElement", - "value": [ - { - "modelType": "Property", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "CONSTANT", - "idShort": "ExampleProperty", - "description": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - - }, - { - "modelType": "MultiLanguageProperty", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/MultiLanguageProperties/ExampleMultiLanguageProperty" - } - ], - "type": "GlobalReference" - }, - "category": "CONSTANT", - "idShort": "ExampleMultiLanguageProperty", - "description": [ - { - "language": "en-us", - "text": "Example MultiLanguageProperty object" - }, - { - "language": "de", - "text": "Beispiel MultiLanguageProperty Element" - } - ] - - }, - { - "modelType": "Range", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Ranges/ExampleRange" - } - ], - "type": "GlobalReference" - }, - "max": "100", - "valueType": "xs:int", - "category": "PARAMETER", - "idShort": "ExampleRange", - "description": [ - { - "language": "en-us", - "text": "Example Range object" - }, - { - "language": "de", - "text": "Beispiel Range Element" - } - ] - - }, - { - "modelType": "Range", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Ranges/ExampleRange" - } - ], - "type": "GlobalReference" - }, - "min": "0", - "valueType": "xs:int", - "category": "PARAMETER", - "idShort": "ExampleRange2", - "description": [ - { - "language": "en-us", - "text": "Example Range object" - }, - { - "language": "de", - "text": "Beispiel Range Element" - } - ] - - } - ] - }, - { - "modelType": "SubmodelElementCollection", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollection" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleSubmodelElementCollection", - "description": [ - { - "language": "en-us", - "text": "Example SubmodelElementCollection object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementCollection Element" - } - ], - "value": [ - { - "modelType": "Blob", - "contentType": "application/pdf", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Blobs/ExampleBlob" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleBlob", - "description": [ - { - "language": "en-us", - "text": "Example Blob object" - }, - { - "language": "de", - "text": "Beispiel Blob Element" - } - ] - - }, - { - "modelType": "File", - "contentType": "application/pdf", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/Files/ExampleFile" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleFile", - "description": [ - { - "language": "en-us", - "text": "Example File object" - }, - { - "language": "de", - "text": "Beispiel File Element" - } - ] - - }, - { - "modelType": "ReferenceElement", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/ReferenceElements/ExampleReferenceElement" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleReferenceElement", - "description": [ - { - "language": "en-us", - "text": "Example Reference Element object" - }, - { - "language": "de", - "text": "Beispiel Reference Element Element" - } - ] - - } - ] - }, - { - "modelType": "SubmodelElementCollection", - "kind": "Template", - "semanticId": - { - "keys": [ - { - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollection" - } - ], - "type": "GlobalReference" - }, - "category": "PARAMETER", - "idShort": "ExampleSubmodelElementCollection2", - "description": [ - { - "language": "en-us", - "text": "Example SubmodelElementCollection object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementCollection Element" - } - ] - - } - ], - "description": [ - { - "language": "en-us", - "text": "An example submodel for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Teilmodell für eine Test-Anwendung" - } - ] - - } - ] -} diff --git a/dataformat-json/src/test/resources/test_demo_full_example_withEmbeddedConceptDescription.json b/dataformat-json/src/test/resources/test_demo_full_example_withEmbeddedConceptDescription.json deleted file mode 100644 index 16a24778e..000000000 --- a/dataformat-json/src/test/resources/test_demo_full_example_withEmbeddedConceptDescription.json +++ /dev/null @@ -1,3135 +0,0 @@ - -{ - "assetAdministrationShells": [ - { - "modelType": "AssetAdministrationShell", - "assetInformation": - { - "assetKind": "Instance", - "globalAssetId": - { - "keys": [ - { - "type": "AssetAdministrationShell", - "value": "https://acplt.org/Test_Asset" - } - ], - "type": "GlobalReference" - } - }, - "derivedFrom": - { - "keys": [ - { - "type": "AssetAdministrationShell", - "value": "https://acplt.org/TestAssetAdministrationShell2" - } - ], - "type": "GlobalReference" - }, - "submodels": [ - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel" - } - ], - "type": "GlobalReference" - }, - { - "keys": [ - { - - "type": "Submodel", - "value": "http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial" - } - ], - "type": "GlobalReference" - }, - { - "keys": [ - { - - "type": "Submodel", - "value": "http://acplt.org/Submodels/Assets/TestAsset/Identification" - } - ], - "type": "GlobalReference" - } - ], - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_AssetAdministrationShell", - "idShort": "TestAssetAdministrationShell", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "An Example Asset Administration Shell for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Verwaltungsschale für eine Test-Anwendung" - } - ] - } - }, - { - "modelType": "AssetAdministrationShell", - "assetInformation": - { - "assetKind": "Instance", - "globalAssetId": - { - "keys": [ - { - - "type": "AssetAdministrationShell", - "value": "https://acplt.org/Test_Asset_Mandatory" - } - ], - "type": "GlobalReference" - } - }, - "submodels": [ - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - } - ], - "type": "GlobalReference" - }, - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel2_Mandatory" - } - ], - "type": "GlobalReference" - } - ], - "id": "https://acplt.org/Test_AssetAdministrationShell_Mandatory", - "idShort": "Test_AssetAdministrationShell_Mandatory" - }, - { - "modelType": "AssetAdministrationShell", - "assetInformation": - { - "assetKind": "Instance", - "globalAssetId": - { - "keys": [ - { - - "type": "AssetAdministrationShell", - "value": "https://acplt.org/Test_Asset_Mandatory" - } - ], - "type": "GlobalReference" - } - }, - "id": "https://acplt.org/Test_AssetAdministrationShell2_Mandatory", - "idShort": "Test_AssetAdministrationShell2_Mandatory" - }, - { - "modelType": "AssetAdministrationShell", - "assetInformation": - { - "assetKind": "Instance", - "globalAssetId": - { - "keys": [ - { - - "type": "AssetAdministrationShell", - "value": "https://acplt.org/Test_Asset_Missing" - } - ], - "type": "GlobalReference" - } - }, - "submodels": [ - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - } - ], - "type": "GlobalReference" - } - ], - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_AssetAdministrationShell_Missing", - "idShort": "TestAssetAdministrationShell", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "An Example Asset Administration Shell for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Verwaltungsschale für eine Test-Anwendung" - } - ] - } - } - ], - "conceptDescriptions": [ - { - "modelType": "ConceptDescription", - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_ConceptDescription", - "idShort": "TestConceptDescription", - "isCaseOf": [ - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/DataSpecifications/ConceptDescriptions/TestConceptDescription" - } - ], - "type": "GlobalReference" - } - ], - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "An Example Asset Administration Shell for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Verwaltungsschale für eine Test-Anwendung" - } - ] - } - }, - { - "modelType": "ConceptDescription", - "id": "https://acplt.org/Test_ConceptDescription_Mandatory", - "idShort": "Test_ConceptDescription_Mandatory" - }, - { - "modelType": "ConceptDescription", - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_ConceptDescription_Missing", - "idShort": "TestConceptDescription1", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "An Example Asset Administration Shell for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Verwaltungsschale für eine Test-Anwendung" - } - ] - } - }, - { - "modelType": "ConceptDescription", - "embeddedDataSpecifications": [ - { - "dataSpecification": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360/2/0" - } - ], - "type": "GlobalReference" - }, - "dataSpecificationContent": - { - "dataType": "RealMeasure", - "sourceOfDefinition": "http://acplt.org/DataSpec/ExampleDef", - "symbol": "SU", - "unit": "SpaceUnit", - "unitId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Units/SpaceUnit" - } - ], - "type": "GlobalReference" - }, - "value": "TEST", - "valueFormat": "xs:string", - "valueList": - { - "valueReferencePairTypes": [ - { - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - } - }, - { - "value": "http://acplt.org/ValueId/ExampleValueId2", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId2" - } - ], - "type": "GlobalReference" - } - } - ] - }, - "definition": [ - { - "language": "de", - "text": "Dies ist eine Data Specification für Testzwecke" - }, - { - "language": "en-us", - "text": "This is a DataSpecification for testing purposes" - } - ], - "levelType": ["Min", "Max"], - "preferredName": [ - { - "language": "de", - "text": "Test Specification" - }, - { - "language": "en-us", - "text": "TestSpecification" - } - ], - "shortNames": [ - { - "language": "de", - "text": "Test Spec" - }, - { - "language": "en-us", - "text": "TestSpec" - } - ] - } - } - ], - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "http://acplt.org/DataSpecifciations/Example/Identification", - "idShort": "TestSpec_01", - "isCaseOf": [ - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ReferenceElements/ConceptDescriptionX" - } - ], - "type": "GlobalReference" - } - ] - } - ], - "submodels": [ - { - "modelType": "Submodel", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - - "type": "Submodel", - "value": "http://acplt.org/SubmodelTemplates/AssetIdentification" - } - ], - "type": "GlobalReference" - }, - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "http://acplt.org/Submodels/Assets/TestAsset/Identification", - "idShort": "Identification", - "submodelElements": [ - { - "modelType": "Property", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "0173-1#02-AAO677#002" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ACPLT", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ACPLT" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "qualifiers": [ - { - "modelType": "Qualifier", - "type": "http://acplt.org/Qualifier/ExampleQualifier", - "value": "100", - "valueType": "Int" - }, - { - "modelType": - { - "name": "Qualifier" - }, - "type": "http://acplt.org/Qualifier/ExampleQualifier2", - "value": "50", - "valueType": "Int" - } - ], - "idShort": "ManufacturerName", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - } - }, - { - "modelType": "Property", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber" - } - ], - "type": "GlobalReference" - }, - "value": "978-8234-234-342", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "978-8234-234-342" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "idShort": "InstanceId", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - } - } - ], - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "An Example Asset Administration Shell for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Verwaltungsschale für eine Test-Anwendung" - } - ] - } - }, - { - "modelType": "Submodel", - "kind": "Instance", - "semanticId": - { - "keys": [ - { - - "type": "Submodel", - "value": "http://acplt.org/SubmodelTemplates/BillOfMaterial" - } - ], - "type": "GlobalReference" - }, - "administration": - { - "version": "0.9" - }, - "id": "http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial", - "idShort": "BillOfMaterial", - "submodelElements": [ - { - "modelType": "Entity", - "entityType": "CoManagedEntity", - "statements": [ - { - "modelType": "Property", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValue2", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValue2" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "Constant", - "idShort": "ExampleProperty2", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - }, - { - "modelType": "Property", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "Constant", - "idShort": "ExampleProperty", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - } - ], - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber" - } - ], - "type": "GlobalReference" - }, - "idShort": "ExampleEntity", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - } - }, - { - "modelType": - { - "name": "Entity" - }, - "entityType": "SelfManagedEntity", - "globalAssetId": - { - "keys": [ - { - - "type": "Asset", - "value": "https://acplt.org/Test_Asset2" - } - ], - "type": "GlobalReference" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://opcfoundation.org/UA/DI/1.1/DeviceType/Serialnumber" - } - ], - "type": "GlobalReference" - }, - "idShort": "ExampleEntity2", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Legally valid designation of the natural or judicial person which is directly responsible for the design, production, packaging and labeling of a product in respect to its being brought into circulation." - }, - { - "language": "de", - "text": "Bezeichnung für eine natürliche oder juristische Person, die für die Auslegung, Herstellung und Verpackung sowie die Etikettierung eines Produkts im Hinblick auf das 'Inverkehrbringen' im eigenen Namen verantwortlich ist" - } - ] - } - } - ], - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "An Example Asset Administration Shell for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Verwaltungsschale für eine Test-Anwendung" - } - ] - } - }, - { - "modelType": - { - "name": "Submodel" - }, - "kind": "Instance", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelTemplates/ExampleSubmodel" - } - ], - "type": "GlobalReference" - }, - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_Submodel", - "idShort": "TestSubmodel", - "submodelElements": [ - { - "modelType": - { - "name": "RelationshipElement" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/RelationshipElements/ExampleRelationshipElement" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleRelationshipElement", - "first": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "second": - { - "keys": [ - { - - "type": "Submodel", - "value": "http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial" - }, - { - "type": "Entity", - "value": "ExampleEntity" - }, - { - "type": "Property", - "value": "ExampleProperty2" - } - ], - "type": "GlobalReference" - }, -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example RelationshipElement object" - }, - { - "language": "de", - "text": "Beispiel RelationshipElement Element" - } - ] - } - }, - { - "modelType": - { - "name": "AnnotatedRelationshipElement" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/RelationshipElements/ExampleAnnotatedRelationshipElement" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleAnnotatedRelationshipElement", - "first": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "second": - { - "keys": [ - { - - "type": "Submodel", - "value": "http://acplt.org/Submodels/Assets/TestAsset/BillOfMaterial" - }, - { - "type": "Entity", - "value": "ExampleEntity" - }, - { - "type": "Property", - "value": "ExampleProperty2" - } - ], - "type": "GlobalReference" - }, - "annotation": [ - { - "modelType": - { - "name": "Property" - }, - "kind": "Instance", - "value": "some example annotation", - "valueType": "xs:string", - "category": "Parameter", - "idShort": "ExampleProperty3" - } - ], -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example AnnotatedRelationshipElement object" - }, - { - "language": "de", - "text": "Beispiel AnnotatedRelationshipElement Element" - } - ] - } - }, - { - "modelType": - { - "name": "Operation" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Operations/ExampleOperation" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleOperation", - "inoutputVariable": [ - { - "value": - { - "modelType": - { - "name": "Property" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "Constant", - "idShort": "ExampleProperty3", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - } - } - ], - "inputVariable": [ - { - "value": - { - "modelType": - { - "name": "Property" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "Constant", - "idShort": "ExampleProperty1", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - } - } - ], - "outputVariable": [ - { - "value": - { - "modelType": - { - "name": "Property" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "Constant", - "idShort": "ExampleProperty2", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - } - } - ], -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Operation object" - }, - { - "language": "de", - "text": "Beispiel Operation Element" - } - ] - } - }, - { - "modelType": - { - "name": "Capability" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Capabilities/ExampleCapability" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleCapability", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Capability object" - }, - { - "language": "de", - "text": "Beispiel Capability Element" - } - ] - } - }, - { - "modelType": - { - "name": "BasicEventElement" - }, - "observed": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Events/ExampleBasicEvent" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleBasicEvent", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example BasicEvent object" - }, - { - "language": "de", - "text": "Beispiel BasicEvent Element" - } - ] - } - }, - { - "modelType": - { - "name": "SubmodelElementCollection" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionOrdered" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleSubmodelCollectionOrdered", - "ordered": true, - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example SubmodelElementCollectionOrdered object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementCollectionOrdered Element" - } - ] - }, - "value": [ - { - "modelType": - { - "name": "Property" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "http://acplt.org/ValueId/ExampleValueId", - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleValueId" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "Constant", - "idShort": "ExampleProperty", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - }, - { - "modelType": - { - "name": "MultiLanguageProperty" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/MultiLanguageProperties/ExampleMultiLanguageProperty" - } - ], - "type": "GlobalReference" - }, - "valueId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ValueId/ExampleMultiLanguageValueId" - } - ], - "type": "GlobalReference" - }, - "category": "Constant", - "idShort": "ExampleMultiLanguageProperty", - "value": [ - { - "language": "en-us", - "text": "Example value of a MultiLanguageProperty element" - }, - { - "language": "de", - "text": "Beispielswert für ein MulitLanguageProperty-Element" - } - ], - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example MulitLanguageProperty object" - }, - { - "language": "de", - "text": "Beispiel MulitLanguageProperty Element" - } - ] - } - }, - { - "modelType": - { - "name": "Range" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Ranges/ExampleRange" - } - ], - "type": "GlobalReference" - }, - "max": "100", - "min": "0", - "valueType": "Int", - "category": "Parameter", - "idShort": "ExampleRange", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Range object" - }, - { - "language": "de", - "text": "Beispiel Range Element" - } - ] - } - } - ] - }, - { - "modelType": - { - "name": "SubmodelElementCollection" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionUnordered" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleSubmodelCollectionUnordered", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example SubmodelElementCollectionUnordered object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementCollectionUnordered Element" - } - ] - }, - "value": [ - { - "modelType": - { - "name": "Blob" - }, - "mimeType": "application/pdf", - "value": "AQIDBAU=", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Blobs/ExampleBlob" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleBlob", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Blob object" - }, - { - "language": "de", - "text": "Beispiel Blob Element" - } - ] - } - }, - { - "modelType": - { - "name": "File" - }, - "mimeType": "application/pdf", - "value": "/TestFile.pdf", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Files/ExampleFile" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleFile", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example File object" - }, - { - "language": "de", - "text": "Beispiel File Element" - } - ] - } - }, - { - "modelType": - { - "name": "ReferenceElement" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ReferenceElements/ExampleReferenceElement" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleReferenceElement", - "value": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel" - }, - { - "idType": "IdShort", - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "idType": "IdShort", - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Reference Element object" - }, - { - "language": "de", - "text": "Beispiel Reference Element Element" - } - ] - } - } - ] - } - ], - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "An Example Asset Administration Shell for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Verwaltungsschale für eine Test-Anwendung" - } - ] - } - }, - { - "modelType": - { - "name": "Submodel" - }, - "kind": "Template", - "id": "https://acplt.org/Test_Submodel_Mandatory", - "idShort": "Test_Submodel_Mandatory", - "submodelElements": [ - { - "modelType": - { - "name": "RelationshipElement" - }, - "idShort": "ExampleRelationshipElement", - "first": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "second": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "MultiLanguageProperty", - "value": "ExampleMultiLanguageProperty" - } - ], - "type": "GlobalReference" - } - }, - { - "modelType": - { - "name": "AnnotatedRelationshipElement" - }, - "idShort": "ExampleAnnotatedRelationshipElement", - "first": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "second": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "MultiLanguageProperty", - "value": "ExampleMultiLanguageProperty" - } - ], - "type": "GlobalReference" - } - }, - { - "modelType": - { - "name": "Operation" - }, - "kind": "Template", - "idShort": "ExampleOperation" - }, - { - "modelType": - { - "name": "Capability" - }, - "idShort": "ExampleCapability" - }, - { - "modelType": - { - "name": "BasicEventElement" - }, - "observed": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Mandatory" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "idShort": "ExampleBasicEvent" - }, - { - "modelType": - { - "name": "SubmodelElementCollection" - }, - "idShort": "ExampleSubmodelCollectionOrdered", - "ordered": true, - "value": [ - { - "modelType": - { - "name": "Property" - }, - "valueType": "xs:string", - "idShort": "ExampleProperty" - }, - { - "modelType": - { - "name": "MultiLanguageProperty" - }, - "idShort": "ExampleMultiLanguageProperty" - }, - { - "modelType": - { - "name": "Range" - }, - "valueType": "Int", - "idShort": "ExampleRange" - } - ] - }, - { - "modelType": - { - "name": "SubmodelElementCollection" - }, - "idShort": "ExampleSubmodelCollectionUnordered", - "value": [ - { - "modelType": - { - "name": "Blob" - }, - "mimeType": "application/pdf", - "idShort": "ExampleBlob" - }, - { - "modelType": - { - "name": "File" - }, - "mimeType": "application/pdf", - "idShort": "ExampleFile" - }, - { - "modelType": - { - "name": "ReferenceElement" - }, - "idShort": "ExampleReferenceElement" - } - ] - }, - { - "modelType": - { - "name": "SubmodelElementCollection" - }, - "idShort": "ExampleSubmodelCollectionUnordered2" - } - ] - }, - { - "modelType": - { - "name": "Submodel" - }, - "kind": "Instance", - "id": "https://acplt.org/Test_Submodel2_Mandatory", - "idShort": "Test_Submodel2_Mandatory" - }, - { - "modelType": - { - "name": "Submodel" - }, - "kind": "Instance", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelTemplates/ExampleSubmodel" - } - ], - "type": "GlobalReference" - }, - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_Submodel_Missing", - "idShort": "TestSubmodel", - "submodelElements": [ - { - "modelType": - { - "name": "RelationshipElement" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/RelationshipElements/ExampleRelationshipElement" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleRelationshipElement", - "first": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "second": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "MultiLanguageProperty", - "value": "ExampleMultiLanguageProperty" - } - ], - "type": "GlobalReference" - }, -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example RelationshipElement object" - }, - { - "language": "de", - "text": "Beispiel RelationshipElement Element" - } - ] - } - }, - { - "modelType": - { - "name": "AnnotatedRelationshipElement" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/RelationshipElements/ExampleAnnotatedRelationshipElement" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleAnnotatedRelationshipElement", - "first": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "second": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "MultiLanguageProperty", - "value": "ExampleMultiLanguageProperty" - } - ], - "type": "GlobalReference" - }, - "annotation": [ - { - "modelType": - { - "name": "Property" - }, - "kind": "Instance", - "value": "some example annotation", - "valueType": "xs:string", - "category": "Parameter", - "idShort": "ExampleProperty" - } - ], -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example AnnotatedRelationshipElement object" - }, - { - "language": "de", - "text": "Beispiel AnnotatedRelationshipElement Element" - } - ] - } - }, - { - "modelType": - { - "name": "Operation" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Operations/ExampleOperation" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleOperation", - "inoutputVariable": [ - { - "value": - { - "modelType": - { - "name": "Property" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "exampleValue", - "valueType": "xs:string", - "qualifiers": [ - { - "modelType": - { - "name": "Qualifier" - }, - "type": "http://acplt.org/Qualifier/ExampleQualifier", - "valueType": "xs:string" - } - ], - "category": "Constant", - "idShort": "ExampleProperty3", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - } - } - ], - "inputVariable": [ - { - "value": - { - "modelType": - { - "name": "Property" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "exampleValue", - "valueType": "xs:string", - "qualifiers": [ - { - "modelType": - { - "name": "Qualifier" - }, - "type": "http://acplt.org/Qualifier/ExampleQualifier", - "valueType": "xs:string" - } - ], - "category": "Constant", - "idShort": "ExampleProperty1", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - } - } - ], - "outputVariable": [ - { - "value": - { - "modelType": - { - "name": "Property" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "exampleValue", - "valueType": "xs:string", - "qualifiers": [ - { - "modelType": - { - "name": "Qualifier" - }, - "type": "http://acplt.org/Qualifier/ExampleQualifier", - "valueType": "xs:string" - } - ], - "category": "Constant", - "idShort": "ExampleProperty2", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - } - } - ], -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Operation object" - }, - { - "language": "de", - "text": "Beispiel Operation Element" - } - ] - } - }, - { - "modelType": - { - "name": "Capability" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Capabilities/ExampleCapability" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleCapability", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Capability object" - }, - { - "language": "de", - "text": "Beispiel Capability Element" - } - ] - } - }, - { - "modelType": - { - "name": "BasicEventElement" - }, - "observed": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - }, - { - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Events/ExampleBasicEvent" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleBasicEvent", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example BasicEvent object" - }, - { - "language": "de", - "text": "Beispiel BasicEvent Element" - } - ] - } - }, - { - "modelType": - { - "name": "SubmodelElementCollection" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionOrdered" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleSubmodelCollectionOrdered", - "ordered": true, - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example SubmodelElementCollectionOrdered object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementCollectionOrdered Element" - } - ] - }, - "value": [ - { - "modelType": - { - "name": "Property" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "value": "exampleValue", - "valueType": "xs:string", - "qualifiers": [ - { - "modelType": - { - "name": "Qualifier" - }, - "type": "http://acplt.org/Qualifier/ExampleQualifier", - "valueType": "xs:string" - } - ], - "category": "Constant", - "idShort": "ExampleProperty", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - }, - { - "modelType": - { - "name": "MultiLanguageProperty" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/MultiLanguageProperties/ExampleMultiLanguageProperty" - } - ], - "type": "GlobalReference" - }, - "category": "Constant", - "idShort": "ExampleMultiLanguageProperty", - "value": [ - { - "language": "en-us", - "text": "Example value of a MultiLanguageProperty element" - }, - { - "language": "de", - "text": "Beispielswert für ein MulitLanguageProperty-Element" - } - ], - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example MulitLanguageProperty object" - }, - { - "language": "de", - "text": "Beispiel MulitLanguageProperty Element" - } - ] - } - }, - { - "modelType": - { - "name": "Range" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Ranges/ExampleRange" - } - ], - "type": "GlobalReference" - }, - "max": "100", - "min": "0", - "valueType": "Int", - "category": "Parameter", - "idShort": "ExampleRange", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Range object" - }, - { - "language": "de", - "text": "Beispiel Range Element" - } - ] - } - } - ] - }, - { - "modelType": - { - "name": "SubmodelElementCollection" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionUnordered" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleSubmodelCollectionUnordered", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example SubmodelElementCollectionUnordered object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementCollectionUnordered Element" - } - ] - }, - "value": [ - { - "modelType": - { - "name": "Blob" - }, - "mimeType": "application/pdf", - "value": "AQIDBAU=", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Blobs/ExampleBlob" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleBlob", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Blob object" - }, - { - "language": "de", - "text": "Beispiel Blob Element" - } - ] - } - }, - { - "modelType": - { - "name": "File" - }, - "mimeType": "application/pdf", - "value": "/TestFile.pdf", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Files/ExampleFile" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleFile", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example File object" - }, - { - "language": "de", - "text": "Beispiel File Element" - } - ] - } - }, - { - "modelType": - { - "name": "ReferenceElement" - }, - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ReferenceElements/ExampleReferenceElement" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleReferenceElement", - "value": - { - "keys": [ - { - - "type": "Submodel", - "value": "https://acplt.org/Test_Submodel_Missing" - }, - { - "idType": "IdShort", - "type": "SubmodelElementCollection", - "value": "ExampleSubmodelCollectionOrdered" - }, - { - "idType": "IdShort", - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Reference Element object" - }, - { - "language": "de", - "text": "Beispiel Reference Element Element" - } - ] - } - } - ] - } - ], - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "An Example Asset Administration Shell for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Verwaltungsschale für eine Test-Anwendung" - } - ] - } - }, - { - "modelType": - { - "name": "Submodel" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelTemplates/ExampleSubmodel" - } - ], - "type": "GlobalReference" - }, - "administration": - { - "revision": "0", - "version": "0.9" - }, - "id": "https://acplt.org/Test_Submodel_Template", - "idShort": "TestSubmodel", - "submodelElements": [ - { - "modelType": - { - "name": "RelationshipElement" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/RelationshipElements/ExampleRelationshipElement" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleRelationshipElement", - "first": - { - "keys": [ - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "second": - { - "keys": [ - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example RelationshipElement object" - }, - { - "language": "de", - "text": "Beispiel RelationshipElement Element" - } - ] - } - }, - { - "modelType": - { - "name": "AnnotatedRelationshipElement" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/RelationshipElements/ExampleAnnotatedRelationshipElement" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleAnnotatedRelationshipElement", - "first": - { - "keys": [ - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "second": - { - "keys": [ - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example AnnotatedRelationshipElement object" - }, - { - "language": "de", - "text": "Beispiel AnnotatedRelationshipElement Element" - } - ] - } - }, - { - "modelType": - { - "name": "Operation" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Operations/ExampleOperation" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleOperation", - "inoutputVariable": [ - { - "value": - { - "modelType": - { - "name": "Property" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "Constant", - "idShort": "ExampleProperty", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - } - } - ], - "inputVariable": [ - { - "value": - { - "modelType": - { - "name": "Property" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "Constant", - "idShort": "ExampleProperty", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - } - } - ], - "outputVariable": [ - { - "value": - { - "modelType": - { - "name": "Property" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "Constant", - "idShort": "ExampleProperty", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - } - } - ], -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Operation object" - }, - { - "language": "de", - "text": "Beispiel Operation Element" - } - ] - } - }, - { - "modelType": - { - "name": "Capability" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Capabilities/ExampleCapability" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleCapability", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Capability object" - }, - { - "language": "de", - "text": "Beispiel Capability Element" - } - ] - } - }, - { - "modelType": - { - "name": "BasicEventElement" - }, - "observed": - { - "keys": [ - { - "type": "Property", - "value": "ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Events/ExampleBasicEvent" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleBasicEvent", -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example BasicEvent object" - }, - { - "language": "de", - "text": "Beispiel BasicEvent Element" - } - ] - } - }, - { - "modelType": - { - "name": "SubmodelElementCollection" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionOrdered" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleSubmodelCollectionOrdered", - "ordered": true, -"description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example SubmodelElementCollectionOrdered object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementCollectionOrdered Element" - } - ] - }, - "value": [ - { - "modelType": - { - "name": "Property" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Properties/ExampleProperty" - } - ], - "type": "GlobalReference" - }, - "valueType": "xs:string", - "category": "Constant", - "idShort": "ExampleProperty", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Property object" - }, - { - "language": "de", - "text": "Beispiel Property Element" - } - ] - } - }, - { - "modelType": - { - "name": "MultiLanguageProperty" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/MultiLanguageProperties/ExampleMultiLanguageProperty" - } - ], - "type": "GlobalReference" - }, - "category": "Constant", - "idShort": "ExampleMultiLanguageProperty", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example MulitLanguageProperty object" - }, - { - "language": "de", - "text": "Beispiel MulitLanguageProperty Element" - } - ] - } - }, - { - "modelType": - { - "name": "Range" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Ranges/ExampleRange" - } - ], - "type": "GlobalReference" - }, - "max": "100", - "valueType": "Int", - "category": "Parameter", - "idShort": "ExampleRange", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Range object" - }, - { - "language": "de", - "text": "Beispiel Range Element" - } - ] - } - }, - { - "modelType": - { - "name": "Range" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Ranges/ExampleRange" - } - ], - "type": "GlobalReference" - }, - "min": "0", - "valueType": "Int", - "category": "Parameter", - "idShort": "ExampleRange2", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Range object" - }, - { - "language": "de", - "text": "Beispiel Range Element" - } - ] - } - } - ] - }, - { - "modelType": - { - "name": "SubmodelElementCollection" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionUnordered" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleSubmodelCollectionUnordered", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example SubmodelElementCollectionUnordered object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementCollectionUnordered Element" - } - ] - }, - "value": [ - { - "modelType": - { - "name": "Blob" - }, - "mimeType": "application/pdf", - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Blobs/ExampleBlob" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleBlob", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Blob object" - }, - { - "language": "de", - "text": "Beispiel Blob Element" - } - ] - } - }, - { - "modelType": - { - "name": "File" - }, - "mimeType": "application/pdf", - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/Files/ExampleFile" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleFile", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example File object" - }, - { - "language": "de", - "text": "Beispiel File Element" - } - ] - } - }, - { - "modelType": - { - "name": "ReferenceElement" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/ReferenceElements/ExampleReferenceElement" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleReferenceElement", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example Reference Element object" - }, - { - "language": "de", - "text": "Beispiel Reference Element Element" - } - ] - } - } - ] - }, - { - "modelType": - { - "name": "SubmodelElementCollection" - }, - "kind": "Template", - "semanticId": - { - "keys": [ - { - - "type": "GlobalReference", - "value": "http://acplt.org/SubmodelElementCollections/ExampleSubmodelElementCollectionUnordered" - } - ], - "type": "GlobalReference" - }, - "category": "Parameter", - "idShort": "ExampleSubmodelCollectionUnordered2", - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "Example SubmodelElementCollectionUnordered object" - }, - { - "language": "de", - "text": "Beispiel SubmodelElementCollectionUnordered Element" - } - ] - } - } - ], - "description": { - "langStrings": [ - { - "language": "en-us", - "text": "An Example Asset Administration Shell for the test application" - }, - { - "language": "de", - "text": "Ein Beispiel-Verwaltungsschale für eine Test-Anwendung" - } - ] - } - } - ] -} diff --git a/dataformat-xml/pom.xml b/dataformat-xml/pom.xml index 4ed49f74a..35c5d327e 100644 --- a/dataformat-xml/pom.xml +++ b/dataformat-xml/pom.xml @@ -5,20 +5,20 @@ 4.0.0 org.eclipse.digitaltwin.aas4j - dataformat-parent + aas4j-dataformat-parent ${revision} - dataformat-xml + aas4j-dataformat-xml Asset Administration Shell XML-Serializer ${project.groupId} - dataformat-core + aas4j-dataformat-core ${project.groupId} - dataformat-core + aas4j-dataformat-core tests test @@ -61,15 +61,19 @@ org.slf4j slf4j-api - test ${project.groupId} - model + aas4j-model com.fasterxml.jackson.core jackson-core + + org.slf4j + slf4j-simple + test + diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlDeserializer.java index 38965664a..679760b05 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlDeserializer.java @@ -23,11 +23,12 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.dataformat.xml.XmlFactory; import com.fasterxml.jackson.dataformat.xml.XmlMapper; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.deserialization.EnumDeserializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.SubmodelElementDeserializer; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.DeserializationException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.deserialization.EnumDeserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.XmlDataformatAnnotationIntrospector; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.SubmodelElementDeserializer; import org.eclipse.digitaltwin.aas4j.v3.model.Environment; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlSchemaValidator.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlSchemaValidator.java index 35dd015bb..deef0614c 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlSchemaValidator.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlSchemaValidator.java @@ -15,7 +15,7 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.SchemaValidator; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.SchemaValidator; import org.xml.sax.SAXException; import javax.xml.XMLConstants; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlSerializer.java index eda8f98f7..86990f7a7 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlSerializer.java @@ -24,12 +24,13 @@ import com.fasterxml.jackson.dataformat.xml.XmlFactory; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.serialization.EnumSerializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.SerializationException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.serialization.EnumSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.XmlDataformatAnnotationIntrospector; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.AssetAdministrationShellEnvironmentSerializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.OperationVariableSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.AssetAdministrationShellEnvironmentSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.OperationVariableSerializer; import org.eclipse.digitaltwin.aas4j.v3.model.Environment; import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/EmbeddedDataSpecificationsDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/EmbeddedDataSpecificationsDeserializer.java deleted file mode 100644 index 7aa3b263b..000000000 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/EmbeddedDataSpecificationsDeserializer.java +++ /dev/null @@ -1,53 +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.xml.deserialization; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import org.eclipse.digitaltwin.aas4j.v3.model.DataSpecificationIec61360; -import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultDataSpecificationIec61360; - -import java.io.IOException; - -public class EmbeddedDataSpecificationsDeserializer extends JsonDeserializer { - - private static final String PROP_DATA_SPECIFICATION_CONTENT = "dataSpecificationIec61360"; - - @Override - public DataSpecificationIec61360 deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException, JsonProcessingException { - ObjectNode node = DeserializationHelper.getRootObjectNode(parser); - if (node == null) { - return null; - } - - return createEmbeddedDataSpecificationsFromContent(parser, node); - } - - - private DataSpecificationIec61360 createEmbeddedDataSpecificationsFromContent(JsonParser parser, JsonNode node) throws IOException { - JsonNode nodeContent = node.get(PROP_DATA_SPECIFICATION_CONTENT); - return createDefaultDataSpecificationIec61360FromNode(parser, nodeContent); - } - - private DataSpecificationIec61360 createDefaultDataSpecificationIec61360FromNode(JsonParser parser, JsonNode nodeContent) throws IOException { - return DeserializationHelper.createInstanceFromNode(parser, nodeContent, DefaultDataSpecificationIec61360.class); - } - -} diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/XmlDataformatAnnotationIntrospector.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/XmlDataformatAnnotationIntrospector.java index 2fc785819..e0ac3d224 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/XmlDataformatAnnotationIntrospector.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/XmlDataformatAnnotationIntrospector.java @@ -21,10 +21,11 @@ import com.fasterxml.jackson.databind.introspect.AnnotatedClass; import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; import com.fasterxml.jackson.dataformat.xml.JacksonXmlAnnotationIntrospector; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; import java.util.Collection; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; + /** * This class helps to dynamically decide how to de-/serialize classes and * properties defined in the AAS model library. It will automatically add a default namespace diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/AbstractLangStringsDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/AbstractLangStringsDeserializer.java similarity index 92% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/AbstractLangStringsDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/AbstractLangStringsDeserializer.java index dec133fca..04d215e8a 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/AbstractLangStringsDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/AbstractLangStringsDeserializer.java @@ -14,14 +14,15 @@ * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonNode; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.helper.LangStringContent; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.util.LangStringContent; import org.eclipse.digitaltwin.aas4j.v3.model.AbstractLangString; import java.io.IOException; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/CustomJsonNodeDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/CustomJsonNodeDeserializer.java similarity index 91% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/CustomJsonNodeDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/CustomJsonNodeDeserializer.java index 7d15fab24..20d96da24 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/CustomJsonNodeDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/CustomJsonNodeDeserializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/DataElementsDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/DataElementsDeserializer.java similarity index 95% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/DataElementsDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/DataElementsDeserializer.java index cc3972177..4c259b453 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/DataElementsDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/DataElementsDeserializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; @@ -28,7 +28,6 @@ import java.io.IOException; import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -47,7 +46,7 @@ public DataElementsDeserializer() { public List deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException, JsonProcessingException { TreeNode treeNode = DeserializationHelper.getRootTreeNode(parser); if (treeNode instanceof TextNode) { - return Collections.emptyList(); + return new ArrayList<>(); } ObjectNode node = (ObjectNode) treeNode; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/DeserializationHelper.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/DeserializationHelper.java similarity index 96% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/DeserializationHelper.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/DeserializationHelper.java index 6b5e559c6..9e106483f 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/DeserializationHelper.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/DeserializationHelper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.TreeNode; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/EmbeddedDataSpecificationsDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/EmbeddedDataSpecificationsDeserializer.java new file mode 100644 index 000000000..c7bee01b4 --- /dev/null +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/EmbeddedDataSpecificationsDeserializer.java @@ -0,0 +1,64 @@ +/* + * 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.xml.internal.deserialization; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; +import org.eclipse.digitaltwin.aas4j.v3.model.DataSpecificationContent; + +import java.io.IOException; +import java.util.Iterator; +import java.util.Set; + +public class EmbeddedDataSpecificationsDeserializer extends JsonDeserializer { + + + @Override + public DataSpecificationContent deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException { + ObjectNode node = DeserializationHelper.getRootObjectNode(parser); + if (node == null) { + return null; + } + + return createEmbeddedDataSpecificationsFromContent(parser, node); + } + + + private DataSpecificationContent createEmbeddedDataSpecificationsFromContent(JsonParser parser, JsonNode node) throws IOException { + String class_name = node.fieldNames().next(); + Set> subtypes = ReflectionHelper.SUBTYPES.get(DataSpecificationContent.class); + Iterator> iter = subtypes.iterator(); + while (iter.hasNext()) { + Class clazz = iter.next(); + if (clazz.getSimpleName().toLowerCase().contains(class_name.toLowerCase())) { + try { + JsonNode nodeContent = node.get(class_name); + return (DataSpecificationContent) DeserializationHelper.createInstanceFromNode(parser, nodeContent, clazz); + } catch (Exception e) { + // do nothing and try next in list + } + } + }; + + throw new IOException("Was expecting a known subclass of DataSpecificationContent but found " + class_name); + } + +} diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/KeyDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/KeyDeserializer.java similarity index 95% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/KeyDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/KeyDeserializer.java index 044fc3f1c..421d43354 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/KeyDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/KeyDeserializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/KeysDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/KeysDeserializer.java similarity index 91% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/KeysDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/KeysDeserializer.java index 6ebee33d9..b050ff8b6 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/KeysDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/KeysDeserializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; import org.eclipse.digitaltwin.aas4j.v3.model.Key; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringContentDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringContentDeserializer.java similarity index 86% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringContentDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringContentDeserializer.java index 000fcd369..7cb741f9c 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringContentDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringContentDeserializer.java @@ -13,14 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.helper.LangStringContent; import java.io.IOException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.util.LangStringContent; + public class LangStringContentDeserializer implements CustomJsonNodeDeserializer { @Override public LangStringContent readValue(JsonNode node, JsonParser parser) throws IOException { diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsDefinitionTypeIec61360Deserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsDefinitionTypeIec61360Deserializer.java similarity index 88% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsDefinitionTypeIec61360Deserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsDefinitionTypeIec61360Deserializer.java index 6979ff592..c3e6cb63b 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsDefinitionTypeIec61360Deserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsDefinitionTypeIec61360Deserializer.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.helper.LangStringContent; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.util.LangStringContent; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringDefinitionTypeIec61360; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultLangStringDefinitionTypeIec61360; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsNameTypeDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsNameTypeDeserializer.java similarity index 87% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsNameTypeDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsNameTypeDeserializer.java index 3a605ae5b..2030944b5 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsNameTypeDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsNameTypeDeserializer.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.helper.LangStringContent; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.util.LangStringContent; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringNameType; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultLangStringNameType; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsPreferredNameTypeIec61360Deserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsPreferredNameTypeIec61360Deserializer.java similarity index 89% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsPreferredNameTypeIec61360Deserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsPreferredNameTypeIec61360Deserializer.java index ba55c0b7c..77761280a 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsPreferredNameTypeIec61360Deserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsPreferredNameTypeIec61360Deserializer.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.helper.LangStringContent; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.util.LangStringContent; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringPreferredNameTypeIec61360; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultLangStringPreferredNameTypeIec61360; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsShortNameTypeIec61360Deserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsShortNameTypeIec61360Deserializer.java similarity index 88% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsShortNameTypeIec61360Deserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsShortNameTypeIec61360Deserializer.java index 7d03df54c..d0bbb37b3 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsShortNameTypeIec61360Deserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsShortNameTypeIec61360Deserializer.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.helper.LangStringContent; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.util.LangStringContent; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringShortNameTypeIec61360; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultLangStringShortNameTypeIec61360; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsTextTypeDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsTextTypeDeserializer.java similarity index 87% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsTextTypeDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsTextTypeDeserializer.java index 0979967fd..edea9160c 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/LangStringsTextTypeDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/LangStringsTextTypeDeserializer.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.helper.LangStringContent; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.util.LangStringContent; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultLangStringTextType; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/NoEntryWrapperListDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/NoEntryWrapperListDeserializer.java similarity index 69% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/NoEntryWrapperListDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/NoEntryWrapperListDeserializer.java index 3134a00a4..550a2fe3c 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/NoEntryWrapperListDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/NoEntryWrapperListDeserializer.java @@ -13,7 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; @@ -22,20 +29,17 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import com.google.common.collect.Lists; /** * Custom deserializer for lists without individual list entry wrappers for parametrized classes. * * @param deserialized class within the list */ -public class NoEntryWrapperListDeserializer extends JsonDeserializer> { +public class NoEntryWrapperListDeserializer extends JsonDeserializer> { protected final String elementName; private CustomJsonNodeDeserializer nodeDeserializer; + private static Logger logger = LoggerFactory.getLogger(NoEntryWrapperListDeserializer.class); public NoEntryWrapperListDeserializer(String elementName, CustomJsonNodeDeserializer nodeDeserializer) { this.elementName = elementName; @@ -44,12 +48,17 @@ public NoEntryWrapperListDeserializer(String elementName, CustomJsonNodeDeserial @Override public List deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException, JsonProcessingException { - ObjectNode node = DeserializationHelper.getRootObjectNode(parser); - JsonNode langStringNode = node.get(elementName); - if (langStringNode.isObject()) { - return createEntriesFromObjectNode(langStringNode, parser); - } else { - return createEntriesFromArrayNode((ArrayNode) langStringNode, parser); + try { + ObjectNode node = DeserializationHelper.getRootObjectNode(parser); + JsonNode langStringNode = node.get(elementName); + if (langStringNode.isObject()) { + return createEntriesFromObjectNode(langStringNode, parser); + } else { + return createEntriesFromArrayNode((ArrayNode) langStringNode, parser); + } + } catch (ClassCastException e) { + logger.info("Found empty list item (e.g., '' of dataSpecificationIec61360) in XML. This is most likely an error."); + return new ArrayList(); } } @@ -64,6 +73,6 @@ private List createEntriesFromArrayNode(ArrayNode langStringsNode, JsonParser private List createEntriesFromObjectNode(JsonNode langStringNode, JsonParser parser) throws IOException { T entry = nodeDeserializer.readValue(langStringNode, parser); - return Collections.singletonList(entry); + return Lists.newArrayList(entry); } } diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/OperationVariableDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/OperationVariableDeserializer.java similarity index 60% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/OperationVariableDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/OperationVariableDeserializer.java index 441a20e85..a67fbd3f7 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/OperationVariableDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/OperationVariableDeserializer.java @@ -14,7 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; @@ -23,30 +31,31 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; -import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; +import com.google.common.collect.Lists; public class OperationVariableDeserializer extends JsonDeserializer> { + private static Logger logger = LoggerFactory.getLogger(OperationVariableDeserializer.class); @Override public List deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException, JsonProcessingException { - ObjectNode node = DeserializationHelper.getRootObjectNode(parser); + try { + ObjectNode node = DeserializationHelper.getRootObjectNode(parser); - if (!node.has("operationVariable")) { - return Collections.emptyList(); + if (!node.has("operationVariable")) { + return new ArrayList<>(); + } + JsonNode operationVariableNode = node.get("operationVariable"); + if (operationVariableNode.isArray()) { + return createOperationVariablesFromArrayNode(parser, node); + } else { + OperationVariable operationVariable = DeserializationHelper.createInstanceFromNode(parser, operationVariableNode, OperationVariable.class); + return Lists.newArrayList(operationVariable); + } + } catch (ClassCastException e) { + logger.info("Found empty list item in Operation (e.g., '') in XML. This is most likely an error."); + return new ArrayList<>(); } - JsonNode operationVariableNode = node.get("operationVariable"); - if (operationVariableNode.isArray()) { - return createOperationVariablesFromArrayNode(parser, node); - } else { - OperationVariable operationVariable = DeserializationHelper.createInstanceFromNode(parser, operationVariableNode, OperationVariable.class); - return Collections.singletonList(operationVariable); - } - } diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/QualifierDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/QualifierDeserializer.java similarity index 73% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/QualifierDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/QualifierDeserializer.java index c20002096..5f9cffa9d 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/QualifierDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/QualifierDeserializer.java @@ -39,7 +39,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.digitaltwin.aas4j.v3.model.Qualifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; @@ -48,28 +56,31 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; -import org.eclipse.digitaltwin.aas4j.v3.model.Qualifier; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; - +import com.google.common.collect.Lists; public class QualifierDeserializer extends JsonDeserializer> { + private static Logger logger = LoggerFactory.getLogger(QualifierDeserializer.class); + @Override public List deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException, JsonProcessingException { - ObjectNode node = DeserializationHelper.getRootObjectNode(parser); + try { + ObjectNode node = DeserializationHelper.getRootObjectNode(parser); - if (!node.has("qualifier")) { - return Collections.emptyList(); - } - JsonNode qualifierNode = node.get("qualifier"); - if (qualifierNode.isArray()) { - return createConstraintsFromArrayNode(parser, node); - } else { - Qualifier qualifier = DeserializationHelper.createInstanceFromNode(parser, qualifierNode, Qualifier.class); - return Collections.singletonList(qualifier); + if (!node.has("qualifier")) { + return new ArrayList<>(); + } + JsonNode qualifierNode = node.get("qualifier"); + if (qualifierNode.isArray()) { + return createConstraintsFromArrayNode(parser, node); + } else { + Qualifier qualifier = DeserializationHelper.createInstanceFromNode(parser, qualifierNode, + Qualifier.class); + return Lists.newArrayList(qualifier); + } + } catch (ClassCastException e) { + logger.info("Found empty list item of qualifiers ('') in XML. This is most likely an error."); + return new ArrayList(); } } diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/ReferencesDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/ReferencesDeserializer.java similarity index 92% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/ReferencesDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/ReferencesDeserializer.java index 6aac5f8ba..df02b914b 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/ReferencesDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/ReferencesDeserializer.java @@ -13,7 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.digitaltwin.aas4j.v3.model.Reference; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; @@ -22,19 +28,14 @@ import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; -import org.eclipse.digitaltwin.aas4j.v3.model.Reference; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; +import com.google.common.collect.Lists; public class ReferencesDeserializer extends JsonDeserializer> { @Override public List deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException, JsonProcessingException { TreeNode treeNode = DeserializationHelper.getRootTreeNode(parser); - treeNode = treeNode.get("reference"); + treeNode = treeNode.get("reference"); if (treeNode.isArray()) { return createReferencesFromArray(parser, (ArrayNode) treeNode); } else { @@ -44,7 +45,7 @@ public List deserialize(JsonParser parser, DeserializationContext ctx private List createReferencesFromObjectNode(JsonParser parser, ObjectNode node) throws IOException { Reference reference = createReference(parser, node); - return Collections.singletonList(reference); + return Lists.newArrayList(reference); } private List createReferencesFromArray(JsonParser parser, ArrayNode arrayNode) throws IOException { diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/SubmodelElementDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/SubmodelElementDeserializer.java similarity index 96% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/SubmodelElementDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/SubmodelElementDeserializer.java index ee5a2c233..346091cd3 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/SubmodelElementDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/SubmodelElementDeserializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/SubmodelElementsDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/SubmodelElementsDeserializer.java similarity index 95% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/SubmodelElementsDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/SubmodelElementsDeserializer.java index 987ade7a3..e77e85e9b 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/SubmodelElementsDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/SubmodelElementsDeserializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; @@ -29,7 +29,6 @@ import java.io.IOException; import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -48,14 +47,14 @@ public SubmodelElementsDeserializer() { public List deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException, JsonProcessingException { TreeNode treeNode = DeserializationHelper.getRootTreeNode(parser); if (treeNode instanceof TextNode) { - return Collections.emptyList(); + return new ArrayList<>(); } else { return createSubmodelElements(parser, ctxt, treeNode); } } private List createSubmodelElements(JsonParser parser, DeserializationContext ctxt, TreeNode treeNode) throws IOException, JsonProcessingException { - if (treeNode.isArray()) { + if (treeNode.isArray()) { return getSubmodelElementsFromArrayNode(parser, ctxt, (ArrayNode) treeNode); } else { return getSubmodelElementsFromObjectNode(parser, ctxt, (JsonNode) treeNode); @@ -100,7 +99,7 @@ private List getSubmodelElementsFromArrayNode(JsonParser parser private SubmodelElement getSubmodelElementFromJsonNode(JsonParser parser, DeserializationContext ctxt, JsonNode nodeSubmodelElement) throws IOException, JsonProcessingException { JsonParser parserReference = parser.getCodec().getFactory().getCodec().treeAsTokens(nodeSubmodelElement); - return deserializer.deserialize(parserReference, ctxt); + return deserializer.deserialize(parserReference, ctxt); } } diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/ValueReferencePairNodeDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/ValueReferencePairNodeDeserializer.java similarity index 94% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/ValueReferencePairNodeDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/ValueReferencePairNodeDeserializer.java index 0d4c23a07..b30635b15 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/ValueReferencePairNodeDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/ValueReferencePairNodeDeserializer.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JsonNode; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/ValueReferencePairsDeserializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/ValueReferencePairsDeserializer.java similarity index 92% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/ValueReferencePairsDeserializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/ValueReferencePairsDeserializer.java index 9b8fcc78e..1a7f1d20f 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/deserialization/ValueReferencePairsDeserializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/deserialization/ValueReferencePairsDeserializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization; import org.eclipse.digitaltwin.aas4j.v3.model.ValueReferencePair; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/AdministrativeInformationMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/AdministrativeInformationMixin.java similarity index 93% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/AdministrativeInformationMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/AdministrativeInformationMixin.java index 4a2eaa89f..c00ca6da0 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/AdministrativeInformationMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/AdministrativeInformationMixin.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonPropertyOrder; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/AnnotatedRelationshipElementMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/AnnotatedRelationshipElementMixin.java similarity index 79% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/AnnotatedRelationshipElementMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/AnnotatedRelationshipElementMixin.java index ae16bbcb3..dc412810f 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/AnnotatedRelationshipElementMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/AnnotatedRelationshipElementMixin.java @@ -13,12 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.DataElementsDeserializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.DataElementsSerializer; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.DataElementsDeserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.DataElementsSerializer; import org.eclipse.digitaltwin.aas4j.v3.model.DataElement; import java.util.List; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/AssetAdministrationShellMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/AssetAdministrationShellMixin.java similarity index 95% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/AssetAdministrationShellMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/AssetAdministrationShellMixin.java index 83f36a12a..a86fbe4f6 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/AssetAdministrationShellMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/AssetAdministrationShellMixin.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/AssetInformationMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/AssetInformationMixin.java similarity index 96% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/AssetInformationMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/AssetInformationMixin.java index ae73124a9..d535001e8 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/AssetInformationMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/AssetInformationMixin.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ConceptDescriptionMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ConceptDescriptionMixin.java similarity index 95% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ConceptDescriptionMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ConceptDescriptionMixin.java index f7d7f7643..938c32d62 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ConceptDescriptionMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ConceptDescriptionMixin.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/DataSpecificationIec61360Mixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/DataSpecificationIec61360Mixin.java similarity index 83% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/DataSpecificationIec61360Mixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/DataSpecificationIec61360Mixin.java index 64cf17940..1bb111ecd 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/DataSpecificationIec61360Mixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/DataSpecificationIec61360Mixin.java @@ -13,20 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.serialization.EnumSerializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.LangStringsDefinitionTypeIec61360Deserializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.LangStringsPreferredNameTypeIec61360Deserializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.LangStringsShortNameTypeIec61360Deserializer; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.serialization.EnumSerializer; import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.LangStringsDefinitionTypeIec61360Serializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.LangStringsPreferredNameTypeIec61360Serializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.LangStringsShortNameTypeIec61360Serializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.LangStringsDefinitionTypeIec61360Deserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.LangStringsPreferredNameTypeIec61360Deserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.LangStringsShortNameTypeIec61360Deserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.LangStringsDefinitionTypeIec61360Serializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.LangStringsPreferredNameTypeIec61360Serializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.LangStringsShortNameTypeIec61360Serializer; import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeIec61360; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringDefinitionTypeIec61360; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringPreferredNameTypeIec61360; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/EmbeddedDataSpecificationMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/EmbeddedDataSpecificationMixin.java similarity index 85% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/EmbeddedDataSpecificationMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/EmbeddedDataSpecificationMixin.java index ed615bf18..949e03d1e 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/EmbeddedDataSpecificationMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/EmbeddedDataSpecificationMixin.java @@ -13,15 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.EmbeddedDataSpecificationsDeserializer; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.EmbeddedDataSpecificationSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.EmbeddedDataSpecificationsDeserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.EmbeddedDataSpecificationSerializer; import org.eclipse.digitaltwin.aas4j.v3.model.DataSpecificationContent; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/EntityMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/EntityMixin.java similarity index 84% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/EntityMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/EntityMixin.java index 0a2f38932..4635a7a5a 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/EntityMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/EntityMixin.java @@ -13,15 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.SubmodelElementsDeserializer; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.SubmodelElementsSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.SubmodelElementsDeserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.SubmodelElementsSerializer; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; import java.util.List; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/EnvironmentMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/EnvironmentMixin.java similarity index 96% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/EnvironmentMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/EnvironmentMixin.java index 31e29a9b0..0ad244fb3 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/EnvironmentMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/EnvironmentMixin.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ExtensionMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ExtensionMixin.java similarity index 86% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ExtensionMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ExtensionMixin.java index 2c279d707..5a31c4d03 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ExtensionMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ExtensionMixin.java @@ -13,11 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.RefersToSerializer; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.RefersToSerializer; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; import java.util.List; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/HasDataSpecificationMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/HasDataSpecificationMixin.java similarity index 95% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/HasDataSpecificationMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/HasDataSpecificationMixin.java index ca344f604..404e26f29 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/HasDataSpecificationMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/HasDataSpecificationMixin.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/HasExtensionsMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/HasExtensionsMixin.java similarity index 94% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/HasExtensionsMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/HasExtensionsMixin.java index c5228f9a0..b7641ba79 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/HasExtensionsMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/HasExtensionsMixin.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/HasSemanticsMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/HasSemanticsMixin.java similarity index 90% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/HasSemanticsMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/HasSemanticsMixin.java index cd2ae17ee..3a7596e33 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/HasSemanticsMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/HasSemanticsMixin.java @@ -13,14 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.ReferencesDeserializer; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.ReferencesDeserializer; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; import java.util.List; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/KeyMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/KeyMixin.java similarity index 95% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/KeyMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/KeyMixin.java index 78190506e..c1d197557 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/KeyMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/KeyMixin.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/LevelTypeMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/LevelTypeMixin.java similarity index 96% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/LevelTypeMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/LevelTypeMixin.java index db54e96eb..5e3555d25 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/LevelTypeMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/LevelTypeMixin.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/MultiLanguagePropertyMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/MultiLanguagePropertyMixin.java similarity index 89% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/MultiLanguagePropertyMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/MultiLanguagePropertyMixin.java index 66437999d..747aba825 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/MultiLanguagePropertyMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/MultiLanguagePropertyMixin.java @@ -13,13 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.LangStringsTextTypeDeserializer; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.LangStringsTextTypeDeserializer; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/OperationMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/OperationMixin.java similarity index 87% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/OperationMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/OperationMixin.java index 14926181b..0e78c1fb4 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/OperationMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/OperationMixin.java @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.OperationVariableDeserializer; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.OperationVariableDeserializer; import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; import java.util.List; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/OperationVariableMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/OperationVariableMixin.java similarity index 83% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/OperationVariableMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/OperationVariableMixin.java index 582926deb..f1fae21a7 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/OperationVariableMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/OperationVariableMixin.java @@ -13,14 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.SubmodelElementDeserializer; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.SubmodelElementSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.SubmodelElementDeserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.SubmodelElementSerializer; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; public interface OperationVariableMixin { diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/PropertyMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/PropertyMixin.java similarity index 93% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/PropertyMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/PropertyMixin.java index 68a0c229e..c6eddadc4 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/PropertyMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/PropertyMixin.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/QualifiableMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/QualifiableMixin.java similarity index 90% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/QualifiableMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/QualifiableMixin.java index 871c4daba..d231c82c4 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/QualifiableMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/QualifiableMixin.java @@ -13,13 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.QualifierDeserializer; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.QualifierDeserializer; import org.eclipse.digitaltwin.aas4j.v3.model.Qualifier; import java.util.List; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/QualifierMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/QualifierMixin.java similarity index 96% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/QualifierMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/QualifierMixin.java index 29f0b0775..5dba27387 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/QualifierMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/QualifierMixin.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ReferableMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ReferableMixin.java similarity index 80% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ReferableMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ReferableMixin.java index af190e8f5..4c91318b4 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ReferableMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ReferableMixin.java @@ -13,17 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.LangStringsNameTypeDeserializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.LangStringsTextTypeDeserializer; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.LangStringsNameTypeSerializer; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.LangStringsTextTypeSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.LangStringsNameTypeDeserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.LangStringsTextTypeDeserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.LangStringsNameTypeSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.LangStringsTextTypeSerializer; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringNameType; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ReferenceMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ReferenceMixin.java similarity index 91% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ReferenceMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ReferenceMixin.java index c6a2a26b8..a8eacf3c1 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ReferenceMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ReferenceMixin.java @@ -13,14 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.KeysDeserializer; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.KeysDeserializer; import org.eclipse.digitaltwin.aas4j.v3.model.Key; import org.eclipse.digitaltwin.aas4j.v3.model.ReferenceTypes; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ResourceMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ResourceMixin.java similarity index 94% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ResourceMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ResourceMixin.java index 21a6963e8..ae2f10e93 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ResourceMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ResourceMixin.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SpecificAssetIdMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SpecificAssetIdMixin.java similarity index 95% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SpecificAssetIdMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SpecificAssetIdMixin.java index cc15f92f7..e03c0b401 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SpecificAssetIdMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SpecificAssetIdMixin.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SubmodelElementCollectionMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SubmodelElementCollectionMixin.java similarity index 82% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SubmodelElementCollectionMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SubmodelElementCollectionMixin.java index 511c53779..bd11afad7 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SubmodelElementCollectionMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SubmodelElementCollectionMixin.java @@ -13,14 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.SubmodelElementsDeserializer; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.SubmodelElementsSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.SubmodelElementsDeserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.SubmodelElementsSerializer; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; import java.util.List; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SubmodelElementListMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SubmodelElementListMixin.java similarity index 90% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SubmodelElementListMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SubmodelElementListMixin.java index 9ee63793f..5da6ae1ae 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SubmodelElementListMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SubmodelElementListMixin.java @@ -14,14 +14,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.SubmodelElementsDeserializer; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.SubmodelElementsSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.SubmodelElementsDeserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.SubmodelElementsSerializer; import org.eclipse.digitaltwin.aas4j.v3.model.AasSubmodelElements; import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeDefXsd; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SubmodelElementMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SubmodelElementMixin.java similarity index 95% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SubmodelElementMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SubmodelElementMixin.java index 4992fb50f..b2c981b42 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SubmodelElementMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SubmodelElementMixin.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SubmodelMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SubmodelMixin.java similarity index 85% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SubmodelMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SubmodelMixin.java index 4e9525647..d69cd5e17 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/SubmodelMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/SubmodelMixin.java @@ -13,15 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.SubmodelElementsDeserializer; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization.SubmodelElementsSerializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.SubmodelElementsDeserializer; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization.SubmodelElementsSerializer; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; import java.util.List; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ValueListMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ValueListMixin.java similarity index 90% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ValueListMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ValueListMixin.java index 6121f1230..71c626640 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ValueListMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ValueListMixin.java @@ -13,13 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.ValueReferencePairsDeserializer; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.deserialization.ValueReferencePairsDeserializer; import org.eclipse.digitaltwin.aas4j.v3.model.ValueReferencePair; import java.util.List; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ValueReferencePairMixin.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ValueReferencePairMixin.java similarity index 94% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ValueReferencePairMixin.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ValueReferencePairMixin.java index a09a92494..3ba0e496b 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/mixins/ValueReferencePairMixin.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/mixins/ValueReferencePairMixin.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/AbstractLangStringSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/AbstractLangStringSerializer.java similarity index 96% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/AbstractLangStringSerializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/AbstractLangStringSerializer.java index 4f88b81ee..22d3f47cf 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/AbstractLangStringSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/AbstractLangStringSerializer.java @@ -17,7 +17,7 @@ /** * */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/AbstractLangStringsSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/AbstractLangStringsSerializer.java similarity index 92% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/AbstractLangStringsSerializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/AbstractLangStringsSerializer.java index 5937ab007..505980d9d 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/AbstractLangStringsSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/AbstractLangStringsSerializer.java @@ -14,12 +14,13 @@ * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.SubmodelElementManager; import org.eclipse.digitaltwin.aas4j.v3.model.AbstractLangString; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/AssetAdministrationShellEnvironmentSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/AssetAdministrationShellEnvironmentSerializer.java similarity index 97% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/AssetAdministrationShellEnvironmentSerializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/AssetAdministrationShellEnvironmentSerializer.java index ea3261e55..2c608b8b6 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/AssetAdministrationShellEnvironmentSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/AssetAdministrationShellEnvironmentSerializer.java @@ -13,13 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell; import org.eclipse.digitaltwin.aas4j.v3.model.ConceptDescription; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/DataElementsSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/DataElementsSerializer.java similarity index 95% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/DataElementsSerializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/DataElementsSerializer.java index 3e0a20e5a..96c18d879 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/DataElementsSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/DataElementsSerializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/EmbeddedDataSpecificationSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/EmbeddedDataSpecificationSerializer.java similarity index 60% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/EmbeddedDataSpecificationSerializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/EmbeddedDataSpecificationSerializer.java index cfad82bb1..88bc537c0 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/EmbeddedDataSpecificationSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/EmbeddedDataSpecificationSerializer.java @@ -13,14 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import org.eclipse.digitaltwin.aas4j.v3.model.DataSpecificationIec61360; +import com.google.common.base.CaseFormat; +import org.eclipse.digitaltwin.aas4j.v3.model.DataSpecificationContent; import java.io.IOException; @@ -30,22 +31,30 @@ * of a reference. Uses DataSpecificationManager to resolve java type to * reference. */ -public class EmbeddedDataSpecificationSerializer extends JsonSerializer { +public class EmbeddedDataSpecificationSerializer extends JsonSerializer { @Override - public void serialize(DataSpecificationIec61360 data, JsonGenerator generator, SerializerProvider provider) + public void serialize(DataSpecificationContent data, JsonGenerator generator, SerializerProvider provider) throws IOException { if (data == null) { return; } + String class_name = "dataSpecification"; // default + try { + // known limitation: Only one interface must be implemented by the class, and the name of this interface must match exactly to the name of the DataSpecification + class_name = data.getClass().getInterfaces()[0].getSimpleName(); + } catch (Exception e) { + // do nothing and continue with the default + } + class_name = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, class_name); generator.writeStartObject(); - generator.writeObjectField("dataSpecificationIec61360", data); + generator.writeObjectField(class_name, data); generator.writeEndObject(); } @Override - public void serializeWithType(DataSpecificationIec61360 data, JsonGenerator generator, SerializerProvider provider, + public void serializeWithType(DataSpecificationContent data, JsonGenerator generator, SerializerProvider provider, TypeSerializer typedSerializer) throws IOException, JsonProcessingException { serialize(data, generator, provider); } diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsDefinitionTypeIec61360Serializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsDefinitionTypeIec61360Serializer.java similarity index 92% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsDefinitionTypeIec61360Serializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsDefinitionTypeIec61360Serializer.java index c80f8f3d5..da102f4cb 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsDefinitionTypeIec61360Serializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsDefinitionTypeIec61360Serializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringDefinitionTypeIec61360; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsNameTypeSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsNameTypeSerializer.java similarity index 92% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsNameTypeSerializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsNameTypeSerializer.java index f22a61c91..7f2604ef7 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsNameTypeSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsNameTypeSerializer.java @@ -13,12 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.SubmodelElementManager; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringNameType; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsPreferredNameTypeIec61360Serializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsPreferredNameTypeIec61360Serializer.java similarity index 93% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsPreferredNameTypeIec61360Serializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsPreferredNameTypeIec61360Serializer.java index af86ea5cf..f3d83321f 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsPreferredNameTypeIec61360Serializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsPreferredNameTypeIec61360Serializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringPreferredNameTypeIec61360; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsShortNameTypeIec61360Serializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsShortNameTypeIec61360Serializer.java similarity index 92% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsShortNameTypeIec61360Serializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsShortNameTypeIec61360Serializer.java index 6fdd248f9..5ffc734ec 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsShortNameTypeIec61360Serializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsShortNameTypeIec61360Serializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringShortNameTypeIec61360; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsTextTypeSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsTextTypeSerializer.java similarity index 92% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsTextTypeSerializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsTextTypeSerializer.java index a7749b6da..f539b8c0d 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/LangStringsTextTypeSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/LangStringsTextTypeSerializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import org.eclipse.digitaltwin.aas4j.v3.model.LangStringTextType; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/NoEntryWrapperListSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/NoEntryWrapperListSerializer.java similarity index 97% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/NoEntryWrapperListSerializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/NoEntryWrapperListSerializer.java index ca6c57055..f548b8761 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/NoEntryWrapperListSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/NoEntryWrapperListSerializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/OperationVariableSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/OperationVariableSerializer.java similarity index 95% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/OperationVariableSerializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/OperationVariableSerializer.java index cb79710fa..7d37b3a1e 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/OperationVariableSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/OperationVariableSerializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/RefersToSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/RefersToSerializer.java similarity index 93% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/RefersToSerializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/RefersToSerializer.java index 653fc24f2..38701d3d0 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/RefersToSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/RefersToSerializer.java @@ -23,13 +23,14 @@ * SPDX-License-Identifier: MIT ******************************************************************************/ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.mixins.HasSemanticsMixin; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.mixins.HasSemanticsMixin; import org.eclipse.digitaltwin.aas4j.v3.model.Extension; import org.eclipse.digitaltwin.aas4j.v3.model.Reference; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/SubmodelElementSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/SubmodelElementSerializer.java similarity index 96% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/SubmodelElementSerializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/SubmodelElementSerializer.java index 75361c374..a73b2b641 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/SubmodelElementSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/SubmodelElementSerializer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/SubmodelElementsSerializer.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/SubmodelElementsSerializer.java similarity index 92% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/SubmodelElementsSerializer.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/SubmodelElementsSerializer.java index 66e2b626f..b1d05a419 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/serialization/SubmodelElementsSerializer.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/serialization/SubmodelElementsSerializer.java @@ -13,13 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.serialization; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.serialization; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.util.ReflectionHelper; + +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.SubmodelElementManager; import org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement; diff --git a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/helper/LangStringContent.java b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/util/LangStringContent.java similarity index 93% rename from dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/helper/LangStringContent.java rename to dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/util/LangStringContent.java index 014b559d6..afc3e2fdf 100644 --- a/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/helper/LangStringContent.java +++ b/dataformat-xml/src/main/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/internal/util/LangStringContent.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.helper; +package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.util; /** * 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/dataformat-xml/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XMLDeserializerTest.java b/dataformat-xml/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XMLDeserializerTest.java index f3d698768..d1e8a6e3b 100644 --- a/dataformat-xml/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XMLDeserializerTest.java +++ b/dataformat-xml/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XMLDeserializerTest.java @@ -15,11 +15,14 @@ */ package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; +import java.io.FileNotFoundException; +import java.util.List; + import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASFull; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASSimple; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.DeserializationException; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.Examples; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.SerializationException; import org.eclipse.digitaltwin.aas4j.v3.model.Environment; import org.eclipse.digitaltwin.aas4j.v3.model.Operation; import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; @@ -30,9 +33,6 @@ import org.junit.Test; import org.xml.sax.SAXException; -import java.io.FileNotFoundException; -import java.util.List; - public class XMLDeserializerTest { @Test @@ -133,4 +133,10 @@ public void deserializeAASWithExtensionMaximal() throws SerializationException, Assert.assertEquals(Examples.EXTENSION_MAXIMAL, env); } + + @Test + public void deserializeWithEmptyKeys() throws FileNotFoundException, DeserializationException { + java.io.File file = new java.io.File("src/test/resources/empty_entries.xml"); + new XmlDeserializer().read(file); + } } diff --git a/dataformat-xml/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlSerializerTest.java b/dataformat-xml/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlSerializerTest.java index aaa6b2e13..0be7247f5 100644 --- a/dataformat-xml/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlSerializerTest.java +++ b/dataformat-xml/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlSerializerTest.java @@ -17,14 +17,18 @@ package org.eclipse.digitaltwin.aas4j.v3.dataformat.xml; -import org.eclipse.digitaltwin.aas4j.v3.dataformat.SerializationException; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASFull; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.AASSimple; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.DeserializationException; import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.Examples; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.SerializationException; +import org.eclipse.digitaltwin.aas4j.v3.dataformat.core.internal.util.ReflectionHelper; import org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.internal.AasXmlNamespaceContext; import org.eclipse.digitaltwin.aas4j.v3.model.AssetKind; import org.eclipse.digitaltwin.aas4j.v3.model.ConceptDescription; +import org.eclipse.digitaltwin.aas4j.v3.model.DataSpecificationContent; import org.eclipse.digitaltwin.aas4j.v3.model.DataTypeDefXsd; +import org.eclipse.digitaltwin.aas4j.v3.model.DefaultDummyDataSpecification; import org.eclipse.digitaltwin.aas4j.v3.model.Environment; import org.eclipse.digitaltwin.aas4j.v3.model.Submodel; import org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultAssetAdministrationShell; @@ -54,6 +58,7 @@ import java.util.Set; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -186,6 +191,32 @@ public void serializeAASWithExtensionMaximal() throws SerializationException, SA } + /** + * 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, SAXException { + XmlSerializer serializer = new XmlSerializer(); + XmlDeserializer deserializer = new XmlDeserializer(); + + // This is the only way to make the serialization to work. + Set> subtypes = ReflectionHelper.SUBTYPES.get(DataSpecificationContent.class); + subtypes.add(DefaultDummyDataSpecification.class); + + String xmlString = serializer.write(Examples.ENVIRONMENT_WITH_DUMMYDATASPEC); + assertNotNull(xmlString); + + validateAgainstXsdSchema(xmlString); + + Environment copy = deserializer.read(xmlString); + assertNotNull(copy); + + assertTrue(Examples.ENVIRONMENT_WITH_DUMMYDATASPEC.equals(copy)); + } + private Set validateAgainstXsdSchema(String xml) throws SAXException { return new XmlSchemaValidator().validateSchema(xml); } @@ -259,7 +290,7 @@ private boolean ignoreDefaults(Node node) { private void logErrors(String validatedFileName, Set errors) { if (errors.isEmpty()) return; - logger.info("Validate file: " + validatedFileName); + logger.info("Validate file: {}", validatedFileName); for (String error : errors) { logger.info(error); } diff --git a/dataformat-xml/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlValidationTest.java b/dataformat-xml/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlValidationTest.java index 67940aa60..9745b7eb6 100644 --- a/dataformat-xml/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlValidationTest.java +++ b/dataformat-xml/src/test/java/org/eclipse/digitaltwin/aas4j/v3/dataformat/xml/XmlValidationTest.java @@ -66,7 +66,7 @@ private void logErrors(String validatedFileName, Set errors) { if (errors.isEmpty()) { return; } - logger.info("Validate file: " + validatedFileName); + logger.info("Validate file: {}", validatedFileName); for (String error : errors) { logger.info(error); } diff --git a/dataformat-xml/src/test/resources/Example_AAS_ServoDCMotor - Simplified V2.0.xml b/dataformat-xml/src/test/resources/Example_AAS_ServoDCMotor - Simplified V2.0.xml deleted file mode 100644 index 4d4a18d3d..000000000 --- a/dataformat-xml/src/test/resources/Example_AAS_ServoDCMotor - Simplified V2.0.xml +++ /dev/null @@ -1,436 +0,0 @@ - - - - - ExampleMotor - - http://customer.com/aas/9175_7013_7091_9168 - - - Instance - - GlobalReference - - - AssetAdministrationShell - http://customer.com/assets/KHBVZJSQKIY - - - - - - - GlobalReference - - - Submodel - http://i40.customer.com/instance/1/1/AC69B1CB44F07935 - - - - - GlobalReference - - - Submodel - http://i40.customer.com/type/1/1/1A7B62B529F19152 - - - - - GlobalReference - - - Submodel - http://i40.customer.com/type/1/1/7A7104BDAB57E184 - - - - - - - - - Documentation - - http://i40.customer.com/type/1/1/1A7B62B529F19152 - - Instance - - - OperatingManual - Instance - - GlobalReference - - - ConceptDescription - http://www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Document - - - - - - Parameter - DigitalFile_PDF - Instance - - GlobalReference - - - ConceptDescription - http://vdi2770.com/blatt1/Entwurf/Okt18/cd/StoredDocumentRepresentation/DigitalFile - - - - file:///aasx/OperatingManual.pdf - application/pdf - - - Title - Instance - - GlobalReference - - - ConceptDescription - http://vdi2770.com/blatt1/Entwurf/Okt18/cd/Description/Title - - - - - - en - Operating Manual - - - - - - - - - TechnicalData - - http://i40.customer.com/type/1/1/7A7104BDAB57E184 - - Instance - - GlobalReference - - - ConceptDescription - 0173-1#01-AFZ615#016 - - - - - - Parameter - MaxRotationSpeed - Instance - - GlobalReference - - - ConceptDescription - 0173-1#02-BAA120#008 - - - - xs:int - 5000 - - - - - OperationalData - - http://i40.customer.com/instance/1/1/AC69B1CB44F07935 - - Instance - - - Variable - RotationSpeed - Instance - - GlobalReference - - - ConceptDescription - http://customer.com/cd/1/1/18EBD56F6B43D895 - - - - xs:int - 4370 - - - - - - - MaxRotationSpeed - - 2 - 0 - - - 0173-1#02-BAA120#008 - - - - - GlobalReference - - - ConceptDescription - http://admin-shell.io/DataSpecificationTemplates/DataSpecificationaas - - - - - - - - de - max. Drehzahl - - - en - Max. rotation speed - - - - 1/min - - - GlobalReference - - - ConceptDescription - 0173-1#05-AAA650#002 - - - - REAL_MEASURE - - - de - Höchste zulässige Drehzahl, mit welcher der Motor oder die Speiseinheit betrieben werden darf - - - en - Greatest permissible rotation speed with which the motor or feeding unit may be operated - - - - - - - - - - Title - - http://vdi2770.com/blatt1/Entwurf/Okt18/cd/Description/Title - - - - - GlobalReference - - - ConceptDescription - http://admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360 - - - - - - - - de - Titel - - - en - Title - - - - - de - Titel - - - STRING_TRANSLATABLE - - - de - Sprachabhängiger Titel des Dokuments. - - - - - - - - - RotationSpeed - - http://customer.com/cd/1/1/18EBD56F6B43D895 - - - - - GlobalReference - - - ConceptDescription - http://admin-shell.io/DataSpecificationTemplates/DataSpecificationaas - - - - - - - - de - Aktuelle Drehzahl - - - en - Actual rotation speed - - - - - en - RotationSpeed - - - - 1/min - - - GlobalReference - - - ConceptDescription - 0173-1#05-AAA650#002 - - - - REAL_MEASURE - - - de - Aktuelle Drehzahl, mit welcher der Motor oder die Speiseinheit betrieben wird - - - en - Actual rotation speed with which the motor or feeding unit is operated - - - - - - - - - Document - - http://vdi2770.com/blatt1/Entwurf/Okt18/cd/Document - - - - - GlobalReference - - - ConceptDescription - http://admin-shell.io/DataSpecificationTemplates/DataSpecificationaas - - - - - - - - de - Dokument - - - en - Document - - - - - en - Document - - - - [ISO 15519-1:2010] - - IRI - - - de - Feste und geordnete Menge von für die Verwendung durch Personen bestimmte Informationen, die verwaltet und als Einheit zwischen Benutzern und System ausgetauscht werden kann. - - - - - - - - - DigitalFile - - http://vdi2770.com/blatt1/Entwurf/Okt18/cd/StoredDocumentRepresentation/DigitalFile - - - - - GlobalReference - - - ConceptDescription - http://admin-shell.io/DataSpecificationTemplates/DataSpecificationaas - - - - - - - - de - Digitale Datei - - - - - de - digitale Datei - - - IRI - - - de - Eine Datei, die die DocumentVersion repräsentiert. Neben der obligatorischen PDF/A Datei können weitere Dateien angegeben werden. - - - - - - - - - \ No newline at end of file diff --git a/dataformat-xml/src/test/resources/ServoDCMotor_invalid_V2.0.xml b/dataformat-xml/src/test/resources/ServoDCMotor_invalid_V2.0.xml deleted file mode 100644 index ba39af8bd..000000000 --- a/dataformat-xml/src/test/resources/ServoDCMotor_invalid_V2.0.xml +++ /dev/null @@ -1,469 +0,0 @@ - - - - - - ExampleMotor - - CONSTANT - - http://customer.com/aas/9175_7013_7091_9168 - - - - - http://customer.com/assets/KHBVZJSQKIY - - - - - - - - - http://i40.customer.com/instance/1/1/AC69B1CB44F07935 - - - - - - - http://i40.customer.com/type/1/1/1A7B62B529F19152 - - - - - - - http://i40.customer.com/type/1/1/7A7104BDAB57E184 - - - - - - - - - - Documentation - - - CONSTANT - - - http://i40.customer.com/type/1/1/1A7B62B529F19152 - - Instance - - - - - - OperatingManual - - Instance - - - - www.vdi2770.com/blatt1/Entwurf/Okt18/cd/Document - - - - - - - - DigitalFile_PDF - - - PARAMETER - - Instance - - - - http://vdi2770.com/blatt1/Entwurf/Okt18/cd/StoredDocumentRepresentation/DigitalFile - - - - - application/pdf - - - /aasx/OperatingManual.pdf - - - - - - - Title - - Instance - - - - http://vdi2770.com/blatt1/Entwurf/Okt18/cd/Description/Title - - - - - - Operating Manual - - - - - - false - false - - - - - - - TechnicalData - - - CONSTANT - - - http://i40.customer.com/type/1/1/7A7104BDAB57E184 - - Instance - - - - 0173-1#01-AFZ615#016 - - - - - - - - MaxRotationSpeed - - - PARAMETER - - Instance - - - - 0173-1#02-BAA120#008 - - - - - integer - - - 5000 - - - - - - - - - OperationalData - - - VARIABLE - - - http://i40.customer.com/instance/1/1/AC69B1CB44F07935 - - - Instance - - - - - - - - RotationSpeed - - - VARIABLE - - Instance - - - - http://customer.com/cd/1/1/18EBD56F6B43D895 - - - - - - - - - - integer - - - 4370 - - - - - - - - - - - MaxRotationSpeed - - PROPERTY - - 0173-1#02-BAA120#008 - - - 2 - 0 - - - - - REAL_MEASURE - - - Höchste zulässige Drehzahl, mit welcher der Motor oder die Speiseinheit betrieben werden darf - - - Greatest permissible rotation speed with which the motor or feeding unit may be operated - - - - - max. Drehzahl - - - Max. rotation speed - - - - - - - - 1/min - - - - - 0173-1#05-AAA650#002 - - - - - - - - - - - - - Title - - PROPERTY - - http://vdi2770.com/blatt1/Entwurf/Okt18/cd/Description/Title - - - - - STRING_TRANSLATABLE - - - Sprachabhängiger Titel des Dokuments. - - - - - Titel - - - Title - - - - - Titel - - - - - - - - - - http://admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360 - - - - - - - - RotationSpeed - - PROPERTY - - http://customer.com/cd/1/1/18EBD56F6B43D895 - - - - - - REAL_MEASURE - - - Aktuelle Drehzahl, mit welcher der Motor oder die Speiseinheit betrieben wird - - - Actual rotation speed with which the motor or feeding unit is operated - - - - - Aktuelle Drehzahl - - - Actual rotation speed - - - - - RotationSpeed - - - - - 1/min - - - - - 0173-1#05-AAA650#002 - - - - - - - - - http://admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360 - - - - - - - - Document - - - COLLECTION - - - - - - http://vdi2770.com/blatt1/Entwurf/Okt18/cd/Document - - - - - URL - - - Feste und geordnete Menge von für die Verwendung durch Personen bestimmte Informationen, die verwaltet und als Einheit zwischen Benutzern und System ausgetauscht werden kann. - - - - - Dokument - - - Document - - - - - Document - - - - [ISO 15519-1:2010] - - - - - - - - http://admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360 - - - - - - - - - DigitalFile - - - DOCUMENT - - - http://vdi2770.com/blatt1/Entwurf/Okt18/cd/StoredDocumentRepresentation/DigitalFile - - - - - URL - - - Eine Datei, die die DocumentVersion repräsentiert. Neben der obligatorischen PDF/A Datei können weitere Dateien angegeben werden. - - - - - Digitale Datei - - - - - digitale Datei - - - - - - - - - - http://admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360 - - - - - - - diff --git a/dataformat-xml/src/test/resources/empty_entries.xml b/dataformat-xml/src/test/resources/empty_entries.xml new file mode 100644 index 000000000..255b2c71a --- /dev/null +++ b/dataformat-xml/src/test/resources/empty_entries.xml @@ -0,0 +1,88 @@ + + + + Nameplate + https://example.com/ids/sm/2593_9052_1042_2364 + Template + + ExternalReference + + + GlobalReference + https://admin-shell.io/zvei/nameplate/2/0/Nameplate + + + + + + ManufacturerName + + + en + Note: see also [IRDI] 0112/2///61987#ABA565#007 manufacturer Note: mandatory property according to EU Machine Directive 2006/42/EC. + + + + ExternalReference + + + GlobalReference + 0173-1#02-AAO677#002 + + + + + + Multiplicity + xs:string + One + + + + + + ExternalReference + + + GlobalReference + http://admin-shell.io/DataSpecificationTemplates/DataSpecificationIEC61360/3/0 + + + + + + + + + + + + ModelReference + + + + + + + + + + + + de + Muster AG + + + en + Muster AG + + + + ExternalReference + + + + + + + \ No newline at end of file diff --git a/model/pom.xml b/model/pom.xml index adf5b86a5..c713af6c7 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -2,13 +2,14 @@ - - dataformat-parent + 4.0.0 + org.eclipse.digitaltwin.aas4j + aas4j-dataformat-parent ${revision} - 4.0.0 - model + + aas4j-model ${model.version} @@ -19,10 +20,9 @@ 1.8 1.8 - 1.5.0 - 3.6.2 - 3.4.5 - 0xDFCC34A6 + 1.6.0 + 3.6.3 + 3.5.0 @@ -76,7 +76,7 @@ org.apache.maven.plugins maven-source-plugin - 3.3.0 + 3.3.1 attach-sources @@ -107,7 +107,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.1.0 + 3.2.2 ${gpg.keyname} ${gpg.keyname} 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/CustomDataSpecification.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/CustomDataSpecification.java new file mode 100644 index 000000000..a9a3eacd5 --- /dev/null +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/CustomDataSpecification.java @@ -0,0 +1,24 @@ +/* + * 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; + +/** + * This interface is needed to test the serialization/deserialization of a custom data specification content. + * See: https://github.com/eclipse-aas4j/aas4j/issues/196 + */ +public interface CustomDataSpecification extends DataSpecificationContent { + +} \ No newline at end of file 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/DataSpecificationContent.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/DataSpecificationContent.java index 7fd9aaeec..1fb8d800d 100644 --- a/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/DataSpecificationContent.java +++ b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/DataSpecificationContent.java @@ -25,7 +25,8 @@ * and meta information about the template itself. */ @KnownSubtypes({ - @KnownSubtypes.Type(value = DataSpecificationIec61360.class) + @KnownSubtypes.Type(value = DataSpecificationIec61360.class), + @KnownSubtypes.Type(value = CustomDataSpecification.class) }) public interface DataSpecificationContent { 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," diff --git a/pom.xml b/pom.xml index 36493e781..01c5d7e4a 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ 4.0.0 org.eclipse.digitaltwin.aas4j - dataformat-parent + aas4j-dataformat-parent ${revision} pom @@ -38,49 +38,48 @@ 1 - 0 - 0 - -SNAPSHOT - ${revision.major}.${revision.minor}.${revision.patch}${revision.suffix} - 1.0.0-SNAPSHOT + 1 + 0-SNAPSHOT + ${revision.major}.${revision.minor}.${revision.patch} + 1.1.0-SNAPSHOT UTF-8 UTF-8 - 3.11.0 + 3.13.0 3.3.1 - 1.5.0 + 1.6.0 3.0.1 - 3.3.0 - 3.6.2 - 3.4.5 - 3.3.0 - 0.8.11 - 4.8.164 + 3.4.0 + 3.6.3 + 3.5.0 + 3.3.1 + 0.8.12 + 4.8.170 1.15 - 2.15.0 - 1.24.0 - 3.13.0 - 32.1.3-jre + 2.16.1 + 1.26.1 + 3.14.0 + 33.1.0-jre 5.0.1 2.2 - 2.15.3 + 2.16.2 2.0.1.Final 2.3.1 2.1.0 4.1.0 1.5.1 - 1.0.87 + 1.4.0 4.13.2 1.1.1 2.7.8 - 5.2.4 - 2.0.9 + 5.2.5 + 2.0.13 1.3.2 4.4.1 2.12.1 2.9.1 - 5.7.0 + 5.11.0 0.0.20131108.vaadin1 @@ -206,7 +205,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.1.0 + 3.2.2 sign-artifacts @@ -290,22 +289,27 @@ ${project.groupId} - dataformat-core + aas4j-dataformat-core ${revision} ${project.groupId} - dataformat-xml + aas4j-dataformat-xml ${revision} ${project.groupId} - model + aas4j-dataformat-json + ${revision} + + + ${project.groupId} + aas4j-model ${model.version} ${project.groupId} - dataformat-core + aas4j-dataformat-core tests ${revision}