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 index 7ba79ee4..bc22534e 100644 --- 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 @@ -27,7 +27,7 @@ @KnownSubtypes({ @KnownSubtypes.Type(value = DefaultOperationResult.class) }) -public interface OperationResult { +public interface OperationResult extends BaseOperationResult { /** * 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 index edf5b944..ed36ee47 100644 --- 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 @@ -1,12 +1,9 @@ /* * 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 @@ -19,14 +16,28 @@ import org.eclipse.digitaltwin.aas4j.v3.model.OperationVariable; import java.util.List; +import org.eclipse.digitaltwin.aas4j.v3.model.ExecutionState; +import org.eclipse.digitaltwin.aas4j.v3.model.Message; public abstract class OperationResultBuilder> - extends ExtendableBuilder { + 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 inoutputArguments - * + * * @param inoutputArguments desired value to be set * @return Builder object with new value for inoutputArguments */ @@ -35,9 +46,10 @@ public B inoutputArguments(List 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 */ @@ -46,9 +58,34 @@ public B inoutputArguments(OperationVariable inoutputArguments) { 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(); + } + + /** * This function allows setting a value for outputArguments - * + * * @param outputArguments desired value to be set * @return Builder object with new value for outputArguments */ @@ -57,9 +94,10 @@ public B outputArguments(List 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 */ @@ -67,4 +105,17 @@ public B outputArguments(OperationVariable outputArguments) { getBuildingInstance().getOutputArguments().add(outputArguments); 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(); + } + } 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 index e9507263..4997b863 100644 --- 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 @@ -1,12 +1,9 @@ /* * 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 @@ -73,37 +70,44 @@ 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); + "DefaultBaseOperationResult (" + "executionState=%s," + + "messages=%s," + + "success=%s," + + ")", + this.executionState, this.messages, this.success); } /** @@ -116,6 +120,7 @@ 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/DefaultOperationResult.java b/model/src/main/java/org/eclipse/digitaltwin/aas4j/v3/model/impl/DefaultOperationResult.java index 76367620..a01d8432 100644 --- 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 @@ -23,6 +23,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import org.eclipse.digitaltwin.aas4j.v3.model.ExecutionState; +import org.eclipse.digitaltwin.aas4j.v3.model.Message; /** @@ -33,6 +35,15 @@ @IRI("aas:OperationResult") public class DefaultOperationResult implements OperationResult { + @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<>(); + @IRI("https://admin-shell.io/aas/3/0/OperationResult/inoutputArguments") protected List inoutputArguments = new ArrayList<>(); @@ -41,12 +52,17 @@ public class DefaultOperationResult implements OperationResult { public DefaultOperationResult() {} + @Override public int hashCode() { - return Objects.hash(this.inoutputArguments, - this.outputArguments); + return Objects.hash(this.executionState, + this.success, + this.messages, + this.inoutputArguments, + this.outputArguments); } + @Override public boolean equals(Object obj) { if (this == obj) { @@ -58,36 +74,83 @@ public boolean equals(Object obj) { } else { DefaultOperationResult other = (DefaultOperationResult) obj; return Objects.equals(this.inoutputArguments, other.inoutputArguments) && - Objects.equals(this.outputArguments, other.outputArguments); + Objects.equals(this.outputArguments, other.outputArguments) && + Objects.equals(this.executionState, other.executionState) && + Objects.equals(this.success, other.success) && + Objects.equals(this.messages, other.messages); } } + @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; } + + @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( - "DefaultOperationResult (" + "inoutputArguments=%s," - + "outputArguments=%s," - + ")", - this.inoutputArguments, this.outputArguments); + "DefaultOperationResult (" + "executionState=%s," + + "inoutputArguments=%s," + + "messages=%s," + + "outputArguments=%s," + + "success=%s," + + ")", + this.executionState, this.inoutputArguments, this.messages, this.outputArguments, this.success); } /** @@ -100,6 +163,7 @@ protected Builder getSelf() { return this; } + @Override protected DefaultOperationResult newBuildingInstance() { return new DefaultOperationResult();