Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-10-13 02:28:17 +0000
committerdonald.g.dunne2016-10-13 02:28:17 +0000
commitdb1fab9b64eebc2d4de7d5d76ed7c0f252694cb3 (patch)
tree734ce80d01979647fd43336b4c15d3a110300f7a /plugins/org.eclipse.osee.orcs.db
parent4667d79569d689bd73bf0e63cc88d6fa84884e01 (diff)
downloadorg.eclipse.osee-db1fab9b64eebc2d4de7d5d76ed7c0f252694cb3.tar.gz
org.eclipse.osee-db1fab9b64eebc2d4de7d5d76ed7c0f252694cb3.tar.xz
org.eclipse.osee-db1fab9b64eebc2d4de7d5d76ed7c0f252694cb3.zip
feature[ats_ATS314065]: Convert types and type tokens to long.
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/OrcsTypeLoaderCallable.java19
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/DbTableExportItem.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/TupleQueryImpl.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java3
4 files changed, 16 insertions, 17 deletions
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java
index 4ffe786baa2..f6e707f2ab0 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java
@@ -17,12 +17,11 @@ import java.net.URI;
import java.util.Collection;
import java.util.LinkedHashSet;
import org.eclipse.osee.framework.core.data.OrcsTypesData;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.CoreTupleTypes;
import org.eclipse.osee.framework.core.enums.TxChange;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.jdk.core.util.Lib;
@@ -33,20 +32,13 @@ import org.eclipse.osee.framework.resource.management.StandardOptions;
import org.eclipse.osee.jdbc.JdbcClient;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
+import org.eclipse.osee.orcs.OrcsTypes;
/**
* @author Roberto E. Escobar
*/
public class OrcsTypeLoaderCallable extends AbstractDatastoreCallable<IResource> {
- /**
- * e2 stores
- */
- private static final String LOAD_OSEE_TYPE_DEF_URIS =
- "select uri from osee_tuple2 t2, osee_txs txs1, osee_attribute attr, osee_txs txs2 where tuple_type = ? and " //
- + "t2.gamma_id = txs1.gamma_id and txs1.branch_id = ? and txs1.tx_current = ? and e1 = ? and e2 = attr.attr_id and " //
- + "attr.gamma_id = txs2.gamma_id and txs2.branch_id = txs1.branch_id and txs2.tx_current = ?";
-
private final IResourceManager resourceManager;
public OrcsTypeLoaderCallable(Log logger, OrcsSession session, JdbcClient jdbcClient, IResourceManager resourceManager) {
@@ -70,7 +62,7 @@ public class OrcsTypeLoaderCallable extends AbstractDatastoreCallable<IResource>
getJdbcClient().runQuery(stmt -> {
String uri = stmt.getString("uri");
paths.add(uri);
- } , LOAD_OSEE_TYPE_DEF_URIS, CoreTupleTypes.OseeTypeDef, CoreBranches.COMMON,
+ }, OrcsTypes.LOAD_OSEE_TYPE_DEF_URIS, CoreTupleTypes.OseeTypeDef, CoreBranches.COMMON,
TxChange.CURRENT.getValue(), OrcsTypesData.OSEE_TYPE_VERSION, TxChange.CURRENT.getValue());
return paths;
}
@@ -109,11 +101,14 @@ public class OrcsTypeLoaderCallable extends AbstractDatastoreCallable<IResource>
private InputStream asInputStream(Collection<String> resources) throws OseeCoreException {
PropertyStore options = new PropertyStore();
options.put(StandardOptions.DecompressOnAquire.name(), "true");
-
+ getLogger().info("osee types uri [" + uri + "] resources [" + resources + "]");
StringBuilder builder = new StringBuilder();
for (String path : resources) {
IResourceLocator locator = resourceManager.getResourceLocator(path);
IResource resource = resourceManager.acquire(locator, options);
+ if (resource == null) {
+ throw new OseeStateException("Types resource can not be null for %s", path);
+ }
InputStream inputStream = null;
try {
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/DbTableExportItem.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/DbTableExportItem.java
index bab6bfc58c1..0cb03548912 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/DbTableExportItem.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/exchange/export/DbTableExportItem.java
@@ -21,7 +21,6 @@ import java.math.BigInteger;
import java.sql.Timestamp;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
-import org.eclipse.osee.framework.jdk.core.util.HexUtil;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.jdk.core.util.xml.Xml;
@@ -217,7 +216,7 @@ public class DbTableExportItem extends AbstractXmlExportItem {
} else {
throw new OseeCoreException("Undefined Type [%s]", value != null ? value.getClass().getSimpleName() : value);
}
- String uuidString = HexUtil.toString(typeId);
+ String uuidString = String.valueOf(typeId);
ExportImportXml.addXmlAttribute(appendable, ExportImportXml.TYPE_GUID, uuidString);
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/TupleQueryImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/TupleQueryImpl.java
index ba0dc10cb02..2aacee83034 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/TupleQueryImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/search/engines/TupleQueryImpl.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.search.engines;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -37,6 +38,9 @@ public class TupleQueryImpl implements TupleQuery {
private static final String SELECT_E2_BY_TUPLE_TYPE =
"select distinct e2, value from osee_txs txs, osee_tuple2 app, osee_key_value where tuple_type = ? and app.gamma_id = txs.gamma_id and branch_id = ? and tx_current = 1 and e2 = key";
+ private static final String SELECT_E2_BY_TUPLE_TYPE_RAW =
+ "select distinct e2 from osee_txs txs, osee_tuple2 app where tuple_type = ? and app.gamma_id = txs.gamma_id and branch_id = ? and tx_current = 1 and e1 = ?";
+
private static final String SELECT_KEY_VALUE_FROM_BRANCH_VIEW =
"SELECT distinct e2, value from osee_tuple2 app, osee_txs txs1, osee_key_value where app.e1 = ? and tuple_type = ? and app.gamma_id = txs1.gamma_id and txs1.branch_id = ? AND txs1.tx_current = 1 and app.e2 = key";
@@ -79,7 +83,9 @@ public class TupleQueryImpl implements TupleQuery {
@Override
public <E1, E2> Iterable<Long> getTuple2Raw(Tuple2Type<E1, E2> tupleType, BranchId branchId, E1 e1) {
- return null;
+ List<Long> consumer = new ArrayList<Long>();
+ runQuery("e2", consumer, SELECT_E2_BY_TUPLE_TYPE_RAW, tupleType, branchId, e1);
+ return consumer;
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java
index 153a16335c6..97154092e36 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/IdentityManagerImpl.java
@@ -15,7 +15,6 @@ import org.eclipse.osee.framework.core.data.TransactionId;
import org.eclipse.osee.framework.core.exception.OseeDataStoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
-import org.eclipse.osee.framework.jdk.core.util.HexUtil;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.jdbc.JdbcClient;
import org.eclipse.osee.orcs.db.internal.IdentityManager;
@@ -69,7 +68,7 @@ public class IdentityManagerImpl implements IdentityManager {
@Override
public Long parseToLocalId(String value) throws OseeCoreException {
- return HexUtil.toLong(value);
+ return Long.valueOf(value);
}
@Override

Back to the top