Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraudrey.e.denk2020-07-09 13:45:42 +0000
committeraudrey.e.denk2020-07-09 15:40:25 +0000
commit4b44b313426f1896c562dbaed80f17aab5b27da4 (patch)
tree3b40c387bd87cd6a785e1e2346dd3a338398946d
parentf7d59707fc556a225f23ca70871297b1cffebc05 (diff)
downloadorg.eclipse.osee-dev.tar.gz
org.eclipse.osee-dev.tar.xz
org.eclipse.osee-dev.zip
feature[TW17574]: Allow & in new applicability tagsdev
Change-Id: I6fa1c8c9f6ddf8a737aa17f8620b15dddd5ba301 Signed-off-by: audrey.e.denk <audrey.e.denk@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/applicability/OrcsApplicabilityOps.java49
1 files changed, 37 insertions, 12 deletions
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/applicability/OrcsApplicabilityOps.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/applicability/OrcsApplicabilityOps.java
index d4ffc0d8ee1..5e5a8b70c65 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/applicability/OrcsApplicabilityOps.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/applicability/OrcsApplicabilityOps.java
@@ -734,26 +734,51 @@ public class OrcsApplicabilityOps implements OrcsApplicability {
tx.commit();
return results;
}
- if (applicability.contains("|")) {
- boolean validApplicability = true;
- for (String value : applicability.split("|")) {
- /**
- * loop through existing applicabilities for view and see if new applicability exists if so, stop else check
- * that at least one of the | separated applicability exists
- **/
- Iterable<String> existingApps =
- orcsApi.getQueryFactory().tupleQuery().getTuple2(CoreTupleTypes.ViewApplicability, branch, viewId);
- for (String appl : existingApps) {
- if (appl.equals(value)) {
- validApplicability = true;
+ if (applicability.contains("|") || applicability.contains("&")) {
+ boolean validApplicability = false;
+ if (applicability.contains("|")) {
+ for (String value : applicability.split("\\|")) {
+ /**
+ * loop through existing applicabilities for view and see if new applicability exists if so, stop else
+ * check that at least one of the | separated applicability exists
+ **/
+ Iterable<String> existingApps =
+ orcsApi.getQueryFactory().tupleQuery().getTuple2(CoreTupleTypes.ViewApplicability, branch, viewId);
+ for (String appl : existingApps) {
+ if (appl.equals(value.trim())) {
+ validApplicability = true;
+ }
}
}
+ } else {
+ int cnt = applicability.split("&").length;
+ int validCnt = 0;
+ for (String value : applicability.split("&")) {
+ /**
+ * loop through existing applicabilities for view and see if new applicability exists if so, stop else
+ * check that ALL of the & separated applicability exist
+ **/
+ Iterable<String> existingApps =
+ orcsApi.getQueryFactory().tupleQuery().getTuple2(CoreTupleTypes.ViewApplicability, branch, viewId);
+ for (String appl : existingApps) {
+ if (appl.equals(value.trim())) {
+ validCnt++;
+ }
+ }
+
+ }
+ if (cnt == validCnt) {
+ validApplicability = true;
+ }
}
if (validApplicability) {
TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, user,
"Apply " + applicability + " applicability");
tx.createApplicabilityForView(viewId, applicability);
tx.commit();
+ } else {
+ results.error(
+ "Invalid applicability tag. One of the applicabilities used is not valid for the given view.");
}
} else {

Back to the top