You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2022/02/23 13:40:31 UTC
[incubator-streampipes] branch dev updated: [hotfix] Improve pipeline validation message content
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 46419fe [hotfix] Improve pipeline validation message content
46419fe is described below
commit 46419fe71ee28a7d4c8d4438ddfef79ceb446c81
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Wed Feb 23 14:40:22 2022 +0100
[hotfix] Improve pipeline validation message content
---
.../model/client/matching/MatchingResultMessage.java | 16 +++++++++++++++-
.../streampipes/manager/matching/v2/AbstractMatcher.java | 14 +++++++++++---
.../manager/matching/v2/DomainPropertyMatch.java | 2 +-
3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/matching/MatchingResultMessage.java b/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/matching/MatchingResultMessage.java
index 17591a5..0fc9166 100644
--- a/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/matching/MatchingResultMessage.java
+++ b/streampipes-model-client/src/main/java/org/apache/streampipes/model/client/matching/MatchingResultMessage.java
@@ -20,6 +20,8 @@ package org.apache.streampipes.model.client.matching;
import org.apache.streampipes.model.shared.annotation.TsModel;
+import java.util.Objects;
+
@TsModel
public class MatchingResultMessage {
@@ -90,5 +92,17 @@ public class MatchingResultMessage {
public String toString() {
return title + " - " + description + "\n" + "(required: " +requirementSubject + ")";
}
-
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ MatchingResultMessage that = (MatchingResultMessage) o;
+ return matchingSuccessful == that.matchingSuccessful && Objects.equals(title, that.title) && Objects.equals(description, that.description) && Objects.equals(offerSubject, that.offerSubject) && Objects.equals(requirementSubject, that.requirementSubject) && Objects.equals(reasonText, that.reasonText);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(matchingSuccessful, title, description, offerSubject, requirementSubject, reasonText);
+ }
}
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/v2/AbstractMatcher.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/v2/AbstractMatcher.java
index bd3635a..83f363a 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/v2/AbstractMatcher.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/v2/AbstractMatcher.java
@@ -18,12 +18,12 @@
package org.apache.streampipes.manager.matching.v2;
-import java.util.List;
-
import org.apache.streampipes.model.client.matching.MatchingResultFactory;
import org.apache.streampipes.model.client.matching.MatchingResultMessage;
import org.apache.streampipes.model.client.matching.MatchingResultType;
+import java.util.List;
+
public abstract class AbstractMatcher<L, R> implements Matcher<L, R>{
protected MatchingResultType matchingResultType;
@@ -33,7 +33,10 @@ public abstract class AbstractMatcher<L, R> implements Matcher<L, R>{
}
protected void buildErrorMessage(List<MatchingResultMessage> errorLog, String rightSubject) {
- errorLog.add(MatchingResultFactory.build(matchingResultType, false, rightSubject));
+ MatchingResultMessage message = MatchingResultFactory.build(matchingResultType, false, rightSubject);
+ if (!containsMessage(errorLog, message)) {
+ errorLog.add(message);
+ }
}
protected void buildErrorMessage(List<MatchingResultMessage> errorLog, MatchingResultType type, String rightSubject) {
@@ -41,4 +44,9 @@ public abstract class AbstractMatcher<L, R> implements Matcher<L, R>{
}
public abstract boolean match(L offer, R requirement, List<MatchingResultMessage> errorLog);
+
+ private boolean containsMessage(List<MatchingResultMessage> errorLog,
+ MatchingResultMessage message) {
+ return errorLog.contains(message);
+ }
}
diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/v2/DomainPropertyMatch.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/v2/DomainPropertyMatch.java
index 653ff2e..b69e33d 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/v2/DomainPropertyMatch.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/matching/v2/DomainPropertyMatch.java
@@ -51,7 +51,7 @@ public class DomainPropertyMatch extends AbstractMatcher<List<URI>, List<URI>> {
private String buildText(List<URI> requirement) {
if (requirement == null || requirement.size() == 0) return "-";
- else return "Required domain property: " +requirement.get(0).toString();
+ else return requirement.get(0).toString();
}
}