Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-06-21 16:24:38 -0400
committerrescobar2010-06-21 16:24:38 -0400
commit4c847faeae700427b0efde5add10fb6ff95ccdcf (patch)
tree9cd45837d239d13afff02f32d0a5571adf718fb3 /plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core
parent96805f356146cbdd7b7162e347576abe487dc53c (diff)
downloadorg.eclipse.osee-4c847faeae700427b0efde5add10fb6ff95ccdcf.tar.gz
org.eclipse.osee-4c847faeae700427b0efde5add10fb6ff95ccdcf.tar.xz
org.eclipse.osee-4c847faeae700427b0efde5add10fb6ff95ccdcf.zip
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core')
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java1
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TranslationUtil.java143
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java2
6 files changed, 147 insertions, 5 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
index c33f831528..437392743e 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
@@ -24,7 +24,6 @@ import org.eclipse.osee.framework.core.model.MergeBranch;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.cache.IOseeCache;
import org.eclipse.osee.framework.core.model.cache.TransactionCache;
-import org.eclipse.osee.framework.core.translation.TranslationUtil;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.type.Triplet;
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
new file mode 100644
index 0000000000..304fa66eca
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/TranslationUtil.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+import org.eclipse.osee.framework.jdk.core.type.Triplet;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class TranslationUtil {
+
+ private TranslationUtil() {
+ }
+
+ public static void loadArrayMap(Map<Integer, String[]> map, PropertyStore store, Enum<?> key) {
+ storeToArrayMap(map, store.getPropertyStore(key.name()));
+ }
+
+ public static void loadMap(Map<Integer, Integer> map, PropertyStore store, Enum<?> key) {
+ storeToMap(map, store.getPropertyStore(key.name()));
+ }
+
+ public static void putMap(PropertyStore store, Enum<?> key, Map<Integer, Integer> map) {
+ store.put(key.name(), mapToStore(map));
+ }
+
+ public static void putArrayMap(PropertyStore store, Enum<?> key, Map<Integer, String[]> map) {
+ store.put(key.name(), arrayMapToStore(map));
+ }
+
+ public static void loadTripletList(List<Triplet<Integer, Integer, Integer>> data, PropertyStore store, Enum<?> key) {
+ storeToTripletList(data, store.getPropertyStore(key.name()));
+ }
+
+ public static void putTripletList(PropertyStore store, Enum<?> key, List<Triplet<Integer, Integer, Integer>> list) {
+ store.put(key.name(), tripletListToStore(list));
+ }
+
+ private static PropertyStore arrayMapToStore(Map<Integer, String[]> map) {
+ PropertyStore innerStore = new PropertyStore();
+ for (Entry<Integer, String[]> entry : map.entrySet()) {
+ innerStore.put(String.valueOf(entry.getKey()), entry.getValue());
+ }
+ return innerStore;
+ }
+
+ private static PropertyStore intArrayMapToStore(Map<Integer, Integer[]> map) {
+ PropertyStore innerStore = new PropertyStore();
+ for (Entry<Integer, Integer[]> entry : map.entrySet()) {
+ Integer[] values = entry.getValue();
+ String[] data = new String[values.length];
+ for (int index = 0; index < values.length; index++) {
+ data[index] = String.valueOf(values[index]);
+ }
+ innerStore.put(String.valueOf(entry.getKey()), data);
+ }
+ return innerStore;
+ }
+
+ private static PropertyStore mapToStore(Map<Integer, Integer> map) {
+ PropertyStore innerStore = new PropertyStore();
+ for (Entry<Integer, Integer> entry : map.entrySet()) {
+ innerStore.put(String.valueOf(entry.getKey()), entry.getValue());
+ }
+ return innerStore;
+ }
+
+ private static void storeToMap(Map<Integer, Integer> map, PropertyStore innerStore) {
+ for (String strkey : innerStore.keySet()) {
+ Integer key = Integer.valueOf(strkey);
+ Integer value = innerStore.getInt(strkey);
+ map.put(key, value);
+ }
+ }
+
+ private static void storeToArrayMap(Map<Integer, String[]> map, PropertyStore innerStore) {
+ for (String strkey : innerStore.arrayKeySet()) {
+ Integer key = Integer.valueOf(strkey);
+ String[] value = innerStore.getArray(strkey);
+ map.put(key, value);
+ }
+ }
+
+ private static void storeToIntArrayMap(Map<Integer, Integer[]> map, PropertyStore innerStore) {
+ for (String strkey : innerStore.arrayKeySet()) {
+ Integer key = Integer.valueOf(strkey);
+ String[] value = innerStore.getArray(strkey);
+ Integer[] intValues = new Integer[value.length];
+ for (int index = 0; index < value.length; index++) {
+ intValues[index] = Integer.valueOf(value[index]);
+ }
+ map.put(key, intValues);
+ }
+ }
+
+ private static void storeToTripletList(List<Triplet<Integer, Integer, Integer>> data, PropertyStore innerStore) {
+ for (String strKey : innerStore.arrayKeySet()) {
+ String[] value = innerStore.getArray(strKey);
+ Integer first = Integer.valueOf(value[0]);
+ Integer second = Integer.valueOf(value[1]);
+ Integer third = Integer.valueOf(value[2]);
+ data.add(new Triplet<Integer, Integer, Integer>(first, second, third));
+ }
+ }
+
+ private static PropertyStore tripletListToStore(List<Triplet<Integer, Integer, Integer>> list) {
+ PropertyStore innerStore = new PropertyStore();
+ int index = 0;
+ for (Triplet<Integer, Integer, Integer> entry : list) {
+ String[] data = new String[3];
+ data[0] = String.valueOf(entry.getFirst());
+ data[1] = String.valueOf(entry.getSecond());
+ data[2] = String.valueOf(entry.getThird());
+ innerStore.put(String.valueOf(index), data);
+ index++;
+ }
+ return innerStore;
+ }
+
+ public static void loadIntArrayMap(Map<Integer, Integer[]> map, PropertyStore store, Enum<?> key) {
+ storeToIntArrayMap(map, store.getPropertyStore(key.name()));
+ }
+
+ public static void putIntArrayMap(PropertyStore store, Enum<?> key, Map<Integer, Integer[]> map) {
+ store.put(key.name(), intArrayMapToStore(map));
+ }
+
+ public static String createKey(Enum<?> prefix, int index) {
+ return prefix.name() + "_" + index;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java
index 530633d466..b845ac883a 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ArtifactTypeCacheUpdateResponseTranslator.java
@@ -16,9 +16,9 @@ import java.util.List;
import java.util.Map;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.message.ArtifactTypeCacheUpdateResponse;
+import org.eclipse.osee.framework.core.message.TranslationUtil;
import org.eclipse.osee.framework.core.message.ArtifactTypeCacheUpdateResponse.ArtifactTypeRow;
import org.eclipse.osee.framework.core.translation.ITranslator;
-import org.eclipse.osee.framework.core.translation.TranslationUtil;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.type.Triplet;
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java
index 32cec8fe72..3cbce96ee4 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java
@@ -17,11 +17,11 @@ import java.util.Map;
import org.eclipse.osee.framework.core.enums.StorageState;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.message.AttributeTypeCacheUpdateResponse;
+import org.eclipse.osee.framework.core.message.TranslationUtil;
import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory;
import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
import org.eclipse.osee.framework.core.translation.ITranslator;
-import org.eclipse.osee.framework.core.translation.TranslationUtil;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
/**
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java
index 265889f811..a3bcc3dcaf 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/ChangeReportResponseTranslator.java
@@ -15,9 +15,9 @@ import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.message.ChangeItem;
import org.eclipse.osee.framework.core.message.ChangeReportResponse;
+import org.eclipse.osee.framework.core.message.TranslationUtil;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.core.translation.ITranslator;
-import org.eclipse.osee.framework.core.translation.TranslationUtil;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
/**
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java
index 14e67c1a89..f9ed40c6f0 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TableDataTranslator.java
@@ -14,8 +14,8 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.message.TableData;
+import org.eclipse.osee.framework.core.message.TranslationUtil;
import org.eclipse.osee.framework.core.translation.ITranslator;
-import org.eclipse.osee.framework.core.translation.TranslationUtil;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
/**

Back to the top