Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2014-12-03 19:50:42 -0500
committerAngel Avila2014-12-03 19:50:42 -0500
commitf8572479f464f8ccfeb1b286c099709607a87d9b (patch)
tree797ed2988023270c5300b207ccbab94521378994
parent35e3447c960cd6ac36c47f152c21722ec0a264a5 (diff)
downloadorg.eclipse.osee-f8572479f464f8ccfeb1b286c099709607a87d9b.tar.gz
org.eclipse.osee-f8572479f464f8ccfeb1b286c099709607a87d9b.tar.xz
org.eclipse.osee-f8572479f464f8ccfeb1b286c099709607a87d9b.zip
feature[ats_ATS139503]: Remove old compatibility code from core.message
Remove uses of IOseeDatabaseService Remove obsolete compatibility code using dbService Change-Id: Icaa63edb91d199c164fc56d36974ddcb82e71da6
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/META-INF/MANIFEST.MF9
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java1
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF7
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/OSGI-INF/osee.database.service.ref.xml5
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java124
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TranslationUtil.java30
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DatabaseService.java30
7 files changed, 27 insertions, 179 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.message.test/META-INF/MANIFEST.MF
index a9eac17aef..b742912a2b 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.core.message.test/META-INF/MANIFEST.MF
@@ -6,6 +6,11 @@ Bundle-Version: 0.20.0.qualifier
Bundle-Vendor: Eclipse Open System Engineering Environment
Fragment-Host: org.eclipse.osee.framework.core.message
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Require-Bundle: org.junit
-Import-Package: org.eclipse.osee.framework.core.model.change,
+Import-Package: org.junit,
+ org.junit.rules,
+ org.junit.runner,
+ org.junit.runners,
+ org.eclipse.core.runtime,
+ org.eclipse.osee.framework.core.model.cache,
+ org.eclipse.osee.framework.core.model.change,
org.eclipse.osee.framework.jdk.core.util
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
index 02cee890d2..e8b0de7dd2 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
@@ -16,7 +16,6 @@ import java.util.List;
import org.eclipse.osee.framework.core.message.BranchCommitResponse;
import org.eclipse.osee.framework.core.message.internal.translation.BranchCommitResponseTranslator;
import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
-import org.eclipse.osee.framework.core.model.cache.TransactionCache;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.junit.runner.RunWith;
diff --git a/plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF
index d8b53e58b0..2c4e7a6fa2 100644
--- a/plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF
@@ -8,17 +8,12 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.osee.framework.core.message
Bundle-ActivationPolicy: lazy
Service-Component: OSGI-INF/*.xml
-Require-Bundle: org.eclipse.core.runtime
-Import-Package: org.eclipse.osee.framework.core.data,
- org.eclipse.osee.framework.core.enums,
+Import-Package: org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.core.model,
- org.eclipse.osee.framework.core.model.cache,
org.eclipse.osee.framework.core.model.change,
org.eclipse.osee.framework.core.model.type,
org.eclipse.osee.framework.core.services,
org.eclipse.osee.framework.core.translation,
- org.eclipse.osee.framework.core.util,
- org.eclipse.osee.framework.database,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util
diff --git a/plugins/org.eclipse.osee.framework.core.message/OSGI-INF/osee.database.service.ref.xml b/plugins/org.eclipse.osee.framework.core.message/OSGI-INF/osee.database.service.ref.xml
deleted file mode 100644
index dd554e4ef4..0000000000
--- a/plugins/org.eclipse.osee.framework.core.message/OSGI-INF/osee.database.service.ref.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.osee.framework.core.message.internal.DatabaseService">
- <implementation class="org.eclipse.osee.framework.core.message.internal.DatabaseService"/>
- <reference bind="setDatabaseService" cardinality="1..1" interface="org.eclipse.osee.framework.database.DatabaseService" name="DatabaseService" policy="static"/>
-</scr:component>
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java
index 53c0d9f973..c3d58f07c2 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchRow.java
@@ -10,14 +10,10 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.message;
-import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.osee.framework.core.enums.BranchArchivedState;
import org.eclipse.osee.framework.core.enums.BranchState;
import org.eclipse.osee.framework.core.enums.BranchType;
import org.eclipse.osee.framework.core.enums.StorageState;
-import org.eclipse.osee.framework.core.message.internal.DatabaseService;
-import org.eclipse.osee.framework.jdk.core.util.Conditions;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
public final class BranchRow {
private final long branchUuid;
@@ -26,14 +22,9 @@ public final class BranchRow {
private final BranchType branchType;
private final BranchState branchState;
private final BranchArchivedState branchArchived;
- private StorageState storageState;
+ private final StorageState storageState;
private final boolean inheritAccessControl;
- // TODO remove
- public void setStorageState(StorageState storageState) {
- this.storageState = storageState;
- }
-
public BranchRow(long branchUuid, String branchName, BranchType branchType, BranchState branchState, BranchArchivedState branchArchived, StorageState storageState, boolean inheritAccessControl) {
this.branchUuid = branchUuid;
this.branchName = branchName;
@@ -73,111 +64,26 @@ public final class BranchRow {
}
public String[] toArray() {
- if (isOseeUsingGuidsForAppServerMessaging()) {
- return new String[] {
- getBranchArchived().name(),
- getBranchGuidLegacy(getBranchId()),
- String.valueOf(getBranchId()),
- getBranchName(),
- getBranchState().name(),
- getBranchType().name(),
- getStorageState().name(),
- Boolean.toString(isInheritAccessControl())};
- } else {
- return new String[] {
- getBranchArchived().name(),
- String.valueOf(getBranchId()),
- getBranchName(),
- getBranchState().name(),
- getBranchType().name(),
- getStorageState().name(),
- Boolean.toString(isInheritAccessControl())};
- }
+ return new String[] {
+ getBranchArchived().name(),
+ String.valueOf(getBranchId()),
+ getBranchName(),
+ getBranchState().name(),
+ getBranchType().name(),
+ getStorageState().name(),
+ Boolean.toString(isInheritAccessControl())};
}
public static BranchRow fromArray(String[] data) {
BranchArchivedState archived = BranchArchivedState.valueOf(data[0]);
- long branchUuid = 0;
- boolean inheritAccessControl = false;
- String branchName = null;
- BranchState branchState = null;
- BranchType branchType = null;
- StorageState storageState = null;
- if (isOseeUsingGuidsForAppServerMessaging()) {
- // skip guid
- branchUuid = Long.valueOf(data[2]);
- branchName = data[3];
- branchState = BranchState.valueOf(data[4]);
- branchType = BranchType.valueOf(data[5]);
- storageState = StorageState.valueOf(data[6]);
- } else {
- branchUuid = Long.valueOf(data[1]);
- branchName = data[2];
- branchState = BranchState.valueOf(data[3]);
- branchType = BranchType.valueOf(data[4]);
- storageState = StorageState.valueOf(data[5]);
- inheritAccessControl = Boolean.parseBoolean(data[6]);
- }
+ long branchUuid = Long.valueOf(data[1]);
+ String branchName = data[2];
+ BranchState branchState = BranchState.valueOf(data[3]);
+ BranchType branchType = BranchType.valueOf(data[4]);
+ StorageState storageState = StorageState.valueOf(data[5]);
+ boolean inheritAccessControl = Boolean.parseBoolean(data[6]);
return new BranchRow(branchUuid, branchName, branchType, branchState, archived, storageState,
inheritAccessControl);
}
- // Temporary cache till all code uses branch uuid. Remove after 0.17.0
- private static final String SELECT_OSEE_INFO =
- "select osee_value from osee_info where osee_key = 'osee.using.guids.for.app.server.messaging'";
- private static Boolean oseeUsingGuidsForAppServerMessaging = null;
-
- public static boolean isOseeUsingGuidsForAppServerMessaging() {
- if (oseeUsingGuidsForAppServerMessaging == null) {
- oseeUsingGuidsForAppServerMessaging =
- DatabaseService.getDatabaseService().runPreparedQueryFetchObject("", SELECT_OSEE_INFO).equals("true");
- }
- return oseeUsingGuidsForAppServerMessaging;
- }
-
- private static final String SELECT_BRANCH_GUID_BY_ID = "select branch_guid from osee_branch where branch_id = ?";
- // Temporary cache till all code uses branch uuid. Remove after 0.17.0
- private static final ConcurrentHashMap<Long, String> longToGuidCache = new ConcurrentHashMap<Long, String>(50);
-
- /**
- * Temporary method till all code uses branch uuid. Remove after 0.17.0
- */
- public static String getBranchGuidLegacy(long branchUuid) {
- String guid = longToGuidCache.get(branchUuid);
- if (!Strings.isValid(guid)) {
- guid =
- DatabaseService.getDatabaseService().runPreparedQueryFetchObject("", SELECT_BRANCH_GUID_BY_ID, branchUuid);
- Conditions.checkExpressionFailOnTrue(!Strings.isValid(guid), "Error getting branch_guid for branch: [%d]",
- branchUuid);
- longToGuidCache.putIfAbsent(branchUuid, guid);
- }
- return guid;
- }
-
- // Temporary cache till all code uses branch uuid. Remove after 0.17.0
- private static final String SELECT_BRANCH_ID_BY_GUID = "select branch_id from osee_branch where branch_guid = ?";
- // Temporary cache till all code uses branch uuid. Remove after 0.17.0
- private static final ConcurrentHashMap<String, Long> guidToLongCache = new ConcurrentHashMap<String, Long>(50);
-
- /**
- * Temporary method till all code uses branch uuid. Remove after 0.17.0
- */
- public static long getBranchIdLegacy(String branchGuid) {
- Long longId = guidToLongCache.get(branchGuid);
- if (longId == null) {
- if (branchGuid.equals("-1")) {
- longId = -1L;
- } else if (branchGuid.matches("\\d+")) {
- longId = Long.valueOf(branchGuid);
- } else {
- longId =
- DatabaseService.getDatabaseService().runPreparedQueryFetchObject(0L, SELECT_BRANCH_ID_BY_GUID,
- branchGuid);
- Conditions.checkExpressionFailOnTrue(longId <= 0, "Error getting branch_id for branch: [%s]", branchGuid);
- }
- guidToLongCache.putIfAbsent(branchGuid, longId);
- }
- return longId;
- }
-
}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TranslationUtil.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TranslationUtil.java
index c551f2953e..ab93c73816 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TranslationUtil.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TranslationUtil.java
@@ -145,39 +145,21 @@ public final class TranslationUtil {
private static void storeToTripletList(List<Triplet<Long, Long, Long>> data, PropertyStore innerStore) {
for (String strKey : innerStore.arrayKeySet()) {
String[] value = innerStore.getArray(strKey);
- if (BranchRow.isOseeUsingGuidsForAppServerMessaging()) {
- data.add(new Triplet<Long, Long, Long>(Long.valueOf(value[0]), BranchRow.getBranchIdLegacy(value[1]),
- Long.valueOf(value[2])));
- } else {
- data.add(new Triplet<Long, Long, Long>(Long.valueOf(value[0]), Long.valueOf(value[1]),
- Long.valueOf(value[2])));
- }
+ data.add(new Triplet<Long, Long, Long>(Long.valueOf(value[0]), Long.valueOf(value[1]), Long.valueOf(value[2])));
}
}
private static void storeToStringTripletList(List<Triplet<Long, Long, Long>> data, PropertyStore innerStore) {
for (String strKey : innerStore.arrayKeySet()) {
String[] value = innerStore.getArray(strKey);
- if (BranchRow.isOseeUsingGuidsForAppServerMessaging()) {
- data.add(new Triplet<Long, Long, Long>(Long.valueOf(value[0]), BranchRow.getBranchIdLegacy(value[1]),
- Long.valueOf(value[2])));
- } else {
- data.add(new Triplet<Long, Long, Long>(Long.valueOf(value[0]), Long.valueOf(value[1]),
- Long.valueOf(value[2])));
- }
+ data.add(new Triplet<Long, Long, Long>(Long.valueOf(value[0]), Long.valueOf(value[1]), Long.valueOf(value[2])));
}
}
private static void storeToStringTripletListForMergeBranches(List<Triplet<Long, Long, Long>> data, PropertyStore innerStore) {
for (String strKey : innerStore.arrayKeySet()) {
String[] value = innerStore.getArray(strKey);
- if (BranchRow.isOseeUsingGuidsForAppServerMessaging()) {
- data.add(new Triplet<Long, Long, Long>(BranchRow.getBranchIdLegacy(value[0]),
- BranchRow.getBranchIdLegacy(value[1]), BranchRow.getBranchIdLegacy(value[2])));
- } else {
- data.add(new Triplet<Long, Long, Long>(Long.valueOf(value[0]), Long.valueOf(value[1]),
- Long.valueOf(value[2])));
- }
+ data.add(new Triplet<Long, Long, Long>(Long.valueOf(value[0]), Long.valueOf(value[1]), Long.valueOf(value[2])));
}
}
@@ -195,11 +177,7 @@ public final class TranslationUtil {
}
private static String getStringBranchGuid(Long second) {
- String result = String.valueOf(second);
- if (BranchRow.isOseeUsingGuidsForAppServerMessaging() && second > 0) {
- result = BranchRow.getBranchGuidLegacy(second);
- }
- return result;
+ return String.valueOf(second);
}
private static PropertyStore tripletLongListToStore(List<Triplet<Long, Long, Long>> list) {
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DatabaseService.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DatabaseService.java
deleted file mode 100644
index 14b41285c1..0000000000
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DatabaseService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.message.internal;
-
-/**
- * Temporary till all code uses branch uuid. Remove after 0.17.0
- *
- * @author Donald G Dunne
- */
-public class DatabaseService {
-
- public static org.eclipse.osee.framework.database.DatabaseService databaseService;
-
- public static org.eclipse.osee.framework.database.DatabaseService getDatabaseService() {
- return databaseService;
- }
-
- public static void setDatabaseService(org.eclipse.osee.framework.database.DatabaseService databaseService) {
- DatabaseService.databaseService = databaseService;
- }
-
-}

Back to the top