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 /plugins/org.eclipse.osee.framework.core.message/src/org
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
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.message/src/org')
-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
3 files changed, 19 insertions, 165 deletions
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