From b3a73c6915c8e1f820bd6ef567e374041eff996e Mon Sep 17 00:00:00 2001 From: jmisinco Date: Tue, 30 Aug 2011 11:05:17 -0700 Subject: feature[ats_M1Y56]: Type types use Long for guid --- .../message/ArtifactTypeCacheUpdateResponse.java | 22 +++++++-------- .../message/OseeEnumTypeCacheUpdateResponse.java | 4 +-- .../message/RelationTypeCacheUpdateResponse.java | 10 +++---- .../framework/core/message/TranslationUtil.java | 31 +++++++++++++++++++++- .../ArtifactTypeCacheUpdateResponseTranslator.java | 6 ++--- ...AttributeTypeCacheUpdateResponseTranslator.java | 6 ++--- .../translation/SearchRequestTranslator.java | 6 ++--- 7 files changed, 57 insertions(+), 28 deletions(-) (limited to 'plugins/org.eclipse.osee.framework.core.message/src/org') diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java index a006fd522ac..7606053a6de 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/ArtifactTypeCacheUpdateResponse.java @@ -30,9 +30,9 @@ public class ArtifactTypeCacheUpdateResponse { private final List rows; private final Map baseToSuper; - private final List> artAttrs; + private final List> artAttrs; - public ArtifactTypeCacheUpdateResponse(List rows, Map baseToSuper, List> artAttrs) { + public ArtifactTypeCacheUpdateResponse(List rows, Map baseToSuper, List> artAttrs) { this.rows = rows; this.baseToSuper = baseToSuper; this.artAttrs = artAttrs; @@ -46,18 +46,18 @@ public class ArtifactTypeCacheUpdateResponse { return baseToSuper; } - public List> getAttributeTypes() { + public List> getAttributeTypes() { return artAttrs; } public static final class ArtifactTypeRow { private final int id; private final String name; - private final String guid; + private final Long guid; private final boolean isAbstract; private StorageState storageState; - protected ArtifactTypeRow(int id, String guid, String name, boolean isAbstract, StorageState storageState) { + protected ArtifactTypeRow(int id, Long guid, String name, boolean isAbstract, StorageState storageState) { this.id = id; this.guid = guid; this.name = name; @@ -73,7 +73,7 @@ public class ArtifactTypeCacheUpdateResponse { return name; } - public String getGuid() { + public Long getGuid() { return guid; } @@ -92,7 +92,7 @@ public class ArtifactTypeCacheUpdateResponse { public String[] toArray() { return new String[] { String.valueOf(getId()), - getGuid(), + String.valueOf(getGuid()), getName(), String.valueOf(isAbstract()), getStorageState().name()}; @@ -100,11 +100,11 @@ public class ArtifactTypeCacheUpdateResponse { public static ArtifactTypeRow fromArray(String[] data) { int id = Integer.valueOf(data[0]); - String guid = data[1]; + long remoteId = Long.parseLong(data[1]); String name = data[2]; boolean isAbstract = Boolean.valueOf(data[3]); StorageState storageState = StorageState.valueOf(data[4]); - return new ArtifactTypeRow(id, guid, name, isAbstract, storageState); + return new ArtifactTypeRow(id, remoteId, name, isAbstract, storageState); } @Override @@ -116,7 +116,7 @@ public class ArtifactTypeCacheUpdateResponse { public static ArtifactTypeCacheUpdateResponse fromCache(Collection types) throws OseeCoreException { List rows = new ArrayList(); Map baseToSuper = new HashMap(); - List> artAttrs = new ArrayList>(); + List> artAttrs = new ArrayList>(); for (ArtifactType artType : types) { rows.add(new ArtifactTypeRow(artType.getId(), artType.getGuid(), artType.getName(), artType.isAbstract(), artType.getStorageState())); @@ -137,7 +137,7 @@ public class ArtifactTypeCacheUpdateResponse { IOseeBranch branch = entry.getKey(); Collection attrTypes = entry.getValue(); for (AttributeType type : attrTypes) { - artAttrs.add(new Triplet(artType.getGuid(), branch.getGuid(), type.getGuid())); + artAttrs.add(new Triplet(artType.getGuid(), branch.getGuid(), type.getGuid())); } } diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeEnumTypeCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeEnumTypeCacheUpdateResponse.java index bfbfafd2f57..709d03c5503 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeEnumTypeCacheUpdateResponse.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/OseeEnumTypeCacheUpdateResponse.java @@ -45,11 +45,11 @@ public class OseeEnumTypeCacheUpdateResponse { enumTypeRows.add(new String[] { String.valueOf(type.getId()), type.getStorageState().toString(), - type.getGuid(), + String.valueOf(type.getGuid()), type.getName()}); for (OseeEnumEntry entry : type.values()) { enumEntryRows.add(new String[] { - type.getGuid(), + String.valueOf(type.getGuid()), entry.getGuid(), entry.getName(), String.valueOf(entry.ordinal())}); diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/RelationTypeCacheUpdateResponse.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/RelationTypeCacheUpdateResponse.java index 974ad9d2403..07609a39ad4 100644 --- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/RelationTypeCacheUpdateResponse.java +++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/RelationTypeCacheUpdateResponse.java @@ -38,7 +38,7 @@ public class RelationTypeCacheUpdateResponse { public static final class RelationTypeRow { private final int id; private final String name; - private final String guid; + private final long guid; private StorageState storageState; private final String sideAName; @@ -48,7 +48,7 @@ public class RelationTypeCacheUpdateResponse { private final RelationTypeMultiplicity multiplicity; private final String defaultOrderTypeGuid; - public RelationTypeRow(int id, String name, String guid, StorageState storageState, String sideAName, String sideBName, int artifactTypeSideA, int artifactTypeSideB, RelationTypeMultiplicity multiplicity, String defaultOrderTypeGuid) { + public RelationTypeRow(int id, String name, long guid, StorageState storageState, String sideAName, String sideBName, int artifactTypeSideA, int artifactTypeSideB, RelationTypeMultiplicity multiplicity, String defaultOrderTypeGuid) { super(); this.id = id; this.name = name; @@ -78,7 +78,7 @@ public class RelationTypeCacheUpdateResponse { return name; } - public String getGuid() { + public long getGuid() { return guid; } @@ -109,7 +109,7 @@ public class RelationTypeCacheUpdateResponse { public String[] toArray() { return new String[] { String.valueOf(getId()), - getGuid(), + String.valueOf(getGuid()), getName(), getStorageState().name(), getSideAName(), @@ -124,7 +124,7 @@ public class RelationTypeCacheUpdateResponse { int index = 0; int id = Integer.valueOf(data[index++]); - String guid = data[index++]; + long guid = Long.valueOf(data[index++]); String name = data[index++]; StorageState storageState = StorageState.valueOf(data[index++]); 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 2f62fc65a5e..ea91355d141 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 @@ -42,6 +42,10 @@ public final class TranslationUtil { } public static void loadTripletList(List> data, PropertyStore store, Enum key) { + storeToStringTripletList(data, store.getPropertyStore(key.name())); + } + + public static void loadTripletLongList(List> data, PropertyStore store, Enum key) { storeToTripletList(data, store.getPropertyStore(key.name())); } @@ -49,6 +53,10 @@ public final class TranslationUtil { store.put(key.name(), tripletListToStore(list)); } + public static void putTripletLongList(PropertyStore store, Enum key, List> list) { + store.put(key.name(), tripletLongListToStore(list)); + } + private static PropertyStore arrayMapToStore(Map map) { PropertyStore innerStore = new PropertyStore(); for (Entry entry : map.entrySet()) { @@ -106,7 +114,14 @@ public final class TranslationUtil { } } - private static void storeToTripletList(List> data, PropertyStore innerStore) { + private static void storeToTripletList(List> data, PropertyStore innerStore) { + for (String strKey : innerStore.arrayKeySet()) { + String[] value = innerStore.getArray(strKey); + data.add(new Triplet(Long.valueOf(value[0]), value[1], Long.valueOf(value[2]))); + } + } + + private static void storeToStringTripletList(List> data, PropertyStore innerStore) { for (String strKey : innerStore.arrayKeySet()) { String[] value = innerStore.getArray(strKey); data.add(new Triplet(value[0], value[1], value[2])); @@ -123,6 +138,19 @@ public final class TranslationUtil { return innerStore; } + private static PropertyStore tripletLongListToStore(List> list) { + PropertyStore innerStore = new PropertyStore(); + int index = 0; + for (Triplet entry : list) { + innerStore.put(String.valueOf(index), new String[] { + String.valueOf(entry.getFirst()), + entry.getSecond(), + String.valueOf(entry.getThird())}); + index++; + } + return innerStore; + } + public static void loadIntArrayMap(Map map, PropertyStore store, Enum key) { storeToIntArrayMap(map, store.getPropertyStore(key.name())); } @@ -134,4 +162,5 @@ public final class TranslationUtil { 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 b3a69e39b05..42a0d312291 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 @@ -37,7 +37,7 @@ public class ArtifactTypeCacheUpdateResponseTranslator implements ITranslator rows = new ArrayList(); Map baseToSuper = new HashMap(); - List> artAttrs = new ArrayList>(); + List> artAttrs = new ArrayList>(); int rowCount = store.getInt(Fields.ITEM_COUNT.name()); for (int index = 0; index < rowCount; index++) { @@ -46,7 +46,7 @@ public class ArtifactTypeCacheUpdateResponseTranslator implements ITranslator { String[] typeFilterNames = store.getArray(Entry.OPTION_ATTRIBUTE_TYPE_FILTER_NAMES.name()); if (typeFilterGuids.length > 0 && typeFilterNames.length > 0) { for (int index = 0; index < typeFilterGuids.length; index++) { - guid = typeFilterGuids[index]; + long id = Long.valueOf(typeFilterGuids[index]); name = index < typeFilterNames.length ? typeFilterNames[index] : Strings.emptyString(); - IAttributeType type = TokenFactory.createAttributeType(guid, name); + IAttributeType type = TokenFactory.createAttributeType(id, name); options.addAttributeTypeFilter(type); } } @@ -89,7 +89,7 @@ public class SearchRequestTranslator implements ITranslator { String[] names = new String[types.size()]; int index = 0; for (IAttributeType type : types) { - guids[index] = type.getGuid(); + guids[index] = String.valueOf(type.getGuid()); names[index] = type.getName(); index++; } -- cgit v1.2.3