Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan D. Brooks2016-12-09 18:05:00 +0000
committerDavid W. Miller2016-12-09 18:05:00 +0000
commit04a28a571bafd395c21ea1d0db1f2771fbbb5bc7 (patch)
treea6ba7e4626cc213d0a88dd1b16d270adb2e7e0cc /plugins/org.eclipse.osee.orcs.db
parent0c502415a236da6c933f435e4c2edb9040317ae8 (diff)
downloadorg.eclipse.osee-04a28a571bafd395c21ea1d0db1f2771fbbb5bc7.tar.gz
org.eclipse.osee-04a28a571bafd395c21ea1d0db1f2771fbbb5bc7.tar.xz
org.eclipse.osee-04a28a571bafd395c21ea1d0db1f2771fbbb5bc7.zip
refactor: Extend IAttributeType from AttributeTypeToken
Diffstat (limited to 'plugins/org.eclipse.osee.orcs.db')
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeAttributeTypeDatabaseTxCallable.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/console/FixDuplicateAttributesCommand.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/AttributeSqlHandler.java24
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeOtherSqlHandler.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTokenSqlHandler.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTypeExistsSqlHandler.java20
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTypeNotExistsSqlHandler.java9
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/indexer/callable/producer/IndexBranchesDatabaseCallable.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/IdJoinQuery.java5
10 files changed, 36 insertions, 52 deletions
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeAttributeTypeDatabaseTxCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeAttributeTypeDatabaseTxCallable.java
index 21093d5e57..d940103823 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeAttributeTypeDatabaseTxCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/PurgeAttributeTypeDatabaseTxCallable.java
@@ -69,10 +69,10 @@ public final class PurgeAttributeTypeDatabaseTxCallable extends AbstractDatastor
IdJoinQuery joinQuery = joinFactory.createIdJoinQuery();
try {
if (types.size() == 1) {
- chStmt.runPreparedQuery(RETRIEVE_GAMMAS_OF_ATTR_TYPE, types.iterator().next().getGuid());
+ chStmt.runPreparedQuery(RETRIEVE_GAMMAS_OF_ATTR_TYPE, types.iterator().next());
} else {
for (IAttributeType type : types) {
- joinQuery.add(type.getGuid());
+ joinQuery.add(type);
}
joinQuery.store(connection);
chStmt.runPreparedQuery(RETRIEVE_GAMMAS_OF_ATTR_MULT_TYPES, joinQuery.getQueryId());
@@ -93,10 +93,10 @@ public final class PurgeAttributeTypeDatabaseTxCallable extends AbstractDatastor
IdJoinQuery joinQuery = joinFactory.createIdJoinQuery();
try {
if (types.size() == 1) {
- chStmt.runPreparedQuery(RETRIEVE_GAMMAS_WITH_BRANCH_IDS, types.iterator().next().getGuid());
+ chStmt.runPreparedQuery(RETRIEVE_GAMMAS_WITH_BRANCH_IDS, types.iterator().next());
} else {
for (IAttributeType type : types) {
- joinQuery.add(type.getGuid());
+ joinQuery.add(type);
}
chStmt.runPreparedQuery(RETRIEVE_GAMMAS_WITH_BRANCH_IDS_MULT_TYPES, joinQuery.getQueryId());
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/console/FixDuplicateAttributesCommand.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/console/FixDuplicateAttributesCommand.java
index cf12c63c95..c88b5df680 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/console/FixDuplicateAttributesCommand.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/console/FixDuplicateAttributesCommand.java
@@ -128,7 +128,7 @@ public class FixDuplicateAttributesCommand extends AbstractDatastoreConsoleComma
AttributeTypes types = orcsApi.getOrcsTypes().getAttributeTypes();
for (IAttributeType attributeType : types.getAll()) {
if (types.getMaxOccurrences(attributeType) == 1) {
- typeJoin.add(attributeType.getGuid());
+ typeJoin.add(attributeType);
}
}
typeJoin.store();
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java
index b46fb40c09..9613566c71 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/data/OrcsObjectFactoryImpl.java
@@ -126,7 +126,7 @@ public class OrcsObjectFactoryImpl implements OrcsObjectFactory {
@Override
public AttributeData createAttributeData(VersionData version, Integer localId, IAttributeType type, ModificationType modType, int artId, ApplicabilityId applicId) throws OseeCoreException {
- long typeId = type.getGuid();
+ long typeId = type.getId();
DataProxy proxy = proxyFactory.createProxy(typeId, "", "");
return createAttributeFromRow(version, localId, typeId, modType, typeId, modType, artId, proxy, applicId);
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/AttributeSqlHandler.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/AttributeSqlHandler.java
index b39bb0ea67..13c23e9267 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/AttributeSqlHandler.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/handlers/AttributeSqlHandler.java
@@ -11,8 +11,7 @@
package org.eclipse.osee.orcs.db.internal.loader.handlers;
import java.util.Collection;
-import java.util.HashSet;
-import org.eclipse.osee.framework.jdk.core.type.Identity;
+import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.db.internal.loader.criteria.CriteriaAttribute;
import org.eclipse.osee.orcs.db.internal.sql.AbstractSqlWriter;
@@ -32,7 +31,6 @@ public class AttributeSqlHandler extends SqlHandler<CriteriaAttribute> {
private String attrAlias;
private String txsAlias;
- private Collection<Long> typeIds;
private AbstractJoinQuery joinIdQuery;
private AbstractJoinQuery joinTypeQuery;
@@ -59,8 +57,7 @@ public class AttributeSqlHandler extends SqlHandler<CriteriaAttribute> {
jIdAlias = writer.addTable(TableEnum.ID_JOIN_TABLE);
}
- typeIds = getLocalTypeIds();
- if (typeIds.size() > 1) {
+ if (criteria.getTypes().size() > 1) {
jTypeIdAlias = writer.addTable(TableEnum.ID_JOIN_TABLE);
}
@@ -68,14 +65,6 @@ public class AttributeSqlHandler extends SqlHandler<CriteriaAttribute> {
txsAlias = writer.addTable(TableEnum.TXS_TABLE);
}
- private Collection<Long> getLocalTypeIds() throws OseeCoreException {
- Collection<Long> toReturn = new HashSet<>();
- for (Identity<Long> type : criteria.getTypes()) {
- toReturn.add(type.getGuid());
- }
- return toReturn;
- }
-
@Override
public boolean addPredicates(AbstractSqlWriter writer) throws OseeCoreException {
writer.write(attrAlias);
@@ -105,10 +94,11 @@ public class AttributeSqlHandler extends SqlHandler<CriteriaAttribute> {
}
}
- if (!typeIds.isEmpty()) {
+ Collection<? extends AttributeTypeId> types = criteria.getTypes();
+ if (!types.isEmpty()) {
writer.write(" AND ");
- if (typeIds.size() > 1) {
- joinTypeQuery = writer.writeIdJoin(typeIds);
+ if (types.size() > 1) {
+ joinTypeQuery = writer.writeJoin(types);
writer.write(attrAlias);
writer.write(".attr_type_id = ");
writer.write(jTypeIdAlias);
@@ -119,7 +109,7 @@ public class AttributeSqlHandler extends SqlHandler<CriteriaAttribute> {
} else {
writer.write(attrAlias);
writer.write(".attr_type_id = ?");
- writer.addParameter(typeIds.iterator().next());
+ writer.addParameter(types.iterator().next());
}
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeOtherSqlHandler.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeOtherSqlHandler.java
index 379d80c453..f6a4dd862e 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeOtherSqlHandler.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeOtherSqlHandler.java
@@ -62,7 +62,7 @@ public class AttributeOtherSqlHandler extends SqlHandler<CriteriaAttributeOther>
types = criteria.getAttributeTypes();
if (types.size() > 1) {
- typeJoinQuery = writer.writeIdentifiableJoin(types);
+ typeJoinQuery = writer.writeJoin(types);
typeJoinAlias = writer.addTable(TableEnum.ID_JOIN_TABLE);
}
@@ -102,7 +102,7 @@ public class AttributeOtherSqlHandler extends SqlHandler<CriteriaAttributeOther>
if (attributeTypes.size() == 1) {
writer.write(attrAlias);
writer.write(".attr_type_id = ?");
- writer.addParameter(attributeTypes.iterator().next().getGuid());
+ writer.addParameter(attributeTypes.iterator().next());
} else if (attributeTypes.size() > 1) {
writer.write(attrAlias);
writer.write(".attr_type_id = ");
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTokenSqlHandler.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTokenSqlHandler.java
index 1b819052fc..462e416147 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTokenSqlHandler.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTokenSqlHandler.java
@@ -16,6 +16,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Strings;
@@ -70,12 +71,12 @@ public class AttributeTokenSqlHandler extends SqlHandler<CriteriaAttributeKeywor
AbstractJoinQuery joinQuery = null;
String jIdAlias = null;
if (!criteria.isIncludeAllTypes() && types.size() > 1) {
- Set<Long> typeIds = new HashSet<>();
+ Set<AttributeTypeId> typeIds = new HashSet<>();
for (IAttributeType type : types) {
- typeIds.add(type.getGuid());
+ typeIds.add(type);
}
jIdAlias = writer.getNextAlias(TableEnum.ID_JOIN_TABLE);
- joinQuery = writer.writeIdJoin(typeIds);
+ joinQuery = writer.writeJoin(typeIds);
}
Collection<String> values = criteria.getValues();
@@ -104,7 +105,7 @@ public class AttributeTokenSqlHandler extends SqlHandler<CriteriaAttributeKeywor
gammaSb.append(" AND attr_type_id = ");
if (types.size() == 1) {
gammaSb.append("?");
- writer.addParameter(types.iterator().next().getGuid());
+ writer.addParameter(types.iterator().next());
} else {
gammaSb.append(jIdAlias);
gammaSb.append(".id AND ");
@@ -151,8 +152,7 @@ public class AttributeTokenSqlHandler extends SqlHandler<CriteriaAttributeKeywor
attrSb.append(" AND att.attr_type_id = ");
if (types.size() == 1) {
attrSb.append("?");
- long typeId = criteria.getTypes().iterator().next().getGuid();
- writer.addParameter(typeId);
+ writer.addParameter(criteria.getTypes().iterator().next());
} else {
attrSb.append(jIdAlias);
attrSb.append(".id AND ");
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTypeExistsSqlHandler.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTypeExistsSqlHandler.java
index a644a0a66b..270daf91c7 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTypeExistsSqlHandler.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTypeExistsSqlHandler.java
@@ -11,9 +11,7 @@
package org.eclipse.osee.orcs.db.internal.search.handlers;
import java.util.Collection;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.core.ds.OptionsUtil;
@@ -65,18 +63,12 @@ public class AttributeTypeExistsSqlHandler extends SqlHandler<CriteriaAttributeT
}
sb.append(" WHERE txs.gamma_id = attr.gamma_id\n");
if (types.size() > 1) {
- Set<Long> typeIds = new HashSet<>();
- for (IAttributeType type : types) {
- typeIds.add(type.getGuid());
- }
- AbstractJoinQuery joinQuery = writer.writeIdJoin(typeIds);
+ AbstractJoinQuery joinQuery = writer.writeJoin(types);
sb.append(" AND attr.attr_type_id = id.id AND id.query_id = ?");
writer.addParameter(joinQuery.getQueryId());
} else {
- IAttributeType type = types.iterator().next();
- long localId = type.getGuid();
sb.append(" AND att.attr_type_id = ?");
- writer.addParameter(localId);
+ writer.addParameter(types.iterator().next());
}
sb.append(" AND ");
sb.append(writer.getWithClauseTxBranchFilter("txs", false));
@@ -115,11 +107,7 @@ public class AttributeTypeExistsSqlHandler extends SqlHandler<CriteriaAttributeT
Collection<? extends IAttributeType> types = criteria.getTypes();
if (types.size() > 1) {
- Set<Long> typeIds = new HashSet<>();
- for (IAttributeType type : types) {
- typeIds.add(type.getGuid());
- }
- joinQuery = writer.writeIdJoin(typeIds);
+ joinQuery = writer.writeJoin(types);
writer.write(attrAlias);
writer.write(".attr_type_id = ");
@@ -133,7 +121,7 @@ public class AttributeTypeExistsSqlHandler extends SqlHandler<CriteriaAttributeT
IAttributeType type = types.iterator().next();
writer.write(attrAlias);
writer.write(".attr_type_id = ?");
- writer.addParameter(type.getGuid());
+ writer.addParameter(type);
}
List<String> aliases = writer.getAliases(TableEnum.ARTIFACT_TABLE);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTypeNotExistsSqlHandler.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTypeNotExistsSqlHandler.java
index 66821297b0..f4d25ba64e 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTypeNotExistsSqlHandler.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/handlers/AttributeTypeNotExistsSqlHandler.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.orcs.db.internal.search.handlers;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.osee.framework.core.data.AttributeTypeId;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaAttributeTypeNotExists;
@@ -63,11 +64,11 @@ public class AttributeTypeNotExistsSqlHandler extends SqlHandler<CriteriaAttribu
writer.write(" txs WHERE ");
if (types.size() > 1) {
- Set<Long> typeIds = new HashSet<>();
+ Set<AttributeTypeId> typeIds = new HashSet<>();
for (IAttributeType type : types) {
- typeIds.add(type.getGuid());
+ typeIds.add(type);
}
- joinQuery = writer.writeIdJoin(typeIds);
+ joinQuery = writer.writeJoin(typeIds);
writer.write("attr.attr_type_id = ");
writer.write(jIdAlias);
@@ -78,7 +79,7 @@ public class AttributeTypeNotExistsSqlHandler extends SqlHandler<CriteriaAttribu
} else {
IAttributeType type = types.iterator().next();
writer.write("attr.attr_type_id = ?");
- writer.addParameter(type.getGuid());
+ writer.addParameter(type);
}
writer.writeAndLn();
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/indexer/callable/producer/IndexBranchesDatabaseCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/indexer/callable/producer/IndexBranchesDatabaseCallable.java
index f459968b40..b98de0a13f 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/indexer/callable/producer/IndexBranchesDatabaseCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/indexer/callable/producer/IndexBranchesDatabaseCallable.java
@@ -97,7 +97,7 @@ public final class IndexBranchesDatabaseCallable extends AbstractDatastoreCallab
for (IAttributeType attributeType : typesToTag) {
if (types.isTaggable(attributeType)) {
- typeJoin.add(attributeType.getGuid());
+ typeJoin.add(attributeType);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/IdJoinQuery.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/IdJoinQuery.java
index 7b06c2cb2f..42288f9cbe 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/IdJoinQuery.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/sql/join/IdJoinQuery.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.sql.join;
+import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.orcs.db.internal.sql.join.DatabaseJoinAccessor.JoinItem;
/**
@@ -80,4 +81,8 @@ public class IdJoinQuery extends AbstractJoinQuery {
public void add(Number id) {
entries.add(new TempIdEntry(id.longValue()));
}
+
+ public void add(Id id) {
+ entries.add(new TempIdEntry(id.getId()));
+ }
} \ No newline at end of file

Back to the top