Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2019-06-27 20:26:45 +0000
committerRyan D. Brooks2020-12-15 21:44:37 +0000
commit1d99a4b54502f196ad1a9857ad7183404b5d55eb (patch)
treedffb8136662a8aad5fbee92c76e5196ebfd62cf6
parent3b50235dfa4ae6ed01f419b3a548e482733655d5 (diff)
downloadorg.eclipse.osee-1d99a4b54502f196ad1a9857ad7183404b5d55eb.tar.gz
org.eclipse.osee-1d99a4b54502f196ad1a9857ad7183404b5d55eb.tar.xz
org.eclipse.osee-1d99a4b54502f196ad1a9857ad7183404b5d55eb.zip
refactor: Clarify txs alias names
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ObjectType.java24
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java6
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/SelectiveArtifactSqlWriter.java13
3 files changed, 35 insertions, 8 deletions
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ObjectType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ObjectType.java
index 0a0d1157cdd..8be5fa91008 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ObjectType.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ObjectType.java
@@ -17,11 +17,21 @@ package org.eclipse.osee.framework.core.enums;
* @author Roberto E. Escobar
*/
public enum ObjectType {
- UNKNOWN,
- BRANCH,
- TX,
- ARTIFACT,
- ATTRIBUTE,
- RELATION,
- TUPLE;
+ UNKNOWN(""),
+ BRANCH(""),
+ TX(""),
+ ARTIFACT("Art"),
+ ATTRIBUTE("Att"),
+ RELATION("Rel"),
+ TUPLE("Tp");
+
+ private final String prefix;
+
+ private ObjectType(String prefix) {
+ this.prefix = prefix;
+ }
+
+ public String getPrefix() {
+ return prefix;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java
index 5b1608ba9e7..d234ca9f287 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/AbstractSqlWriter.java
@@ -383,7 +383,7 @@ public abstract class AbstractSqlWriter implements HasOptions {
return getNextAlias(table.getPrefix(), table.getObjectType());
}
- private String getNextAlias(String prefix, ObjectType type) {
+ protected String getNextAlias(String prefix, ObjectType type) {
return getAliasManager().getNextAlias(prefix, type);
}
@@ -409,6 +409,10 @@ public abstract class AbstractSqlWriter implements HasOptions {
public String addTable(SqlTable table, ObjectType objectType) {
String alias = getNextAlias(table.getPrefix(), objectType);
+ return addTable(table, alias);
+ }
+
+ protected String addTable(TableEnum table, String alias) {
tableEntries.add(String.format("%s %s", table.getName(), alias));
return alias;
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/SelectiveArtifactSqlWriter.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/SelectiveArtifactSqlWriter.java
index 3df9b1dd302..cc656fd8996 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/SelectiveArtifactSqlWriter.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/SelectiveArtifactSqlWriter.java
@@ -19,6 +19,7 @@ import java.util.List;
import java.util.function.Consumer;
import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.enums.SqlTable;
+import org.eclipse.osee.framework.core.enums.ObjectType;
import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.jdbc.JdbcClient;
@@ -295,6 +296,18 @@ public class SelectiveArtifactSqlWriter extends AbstractSqlWriter {
}
@Override
+ public String addTable(TableEnum table, ObjectType objectType) {
+ String prefix;
+ if (table.equals(TableEnum.TXS_TABLE)) {
+ prefix = table.getPrefix() + objectType.getPrefix();
+ } else {
+ prefix = table.getPrefix();
+ }
+ String alias = getNextAlias(prefix, objectType);
+ return addTable(table, alias);
+ }
+
+ @Override
protected void reset() {
super.reset();
parameters.clear();

Back to the top