Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan E. Cook2016-08-12 17:24:33 -0400
committerRyan Brooks2016-09-12 11:28:43 -0400
commit253868a3571e19665795215c1ebafc151740cdfd (patch)
tree026674210a4f17c8e41365f956b4af183ca3c034
parent286a601fd271e225ff6f5c4d1ea0f91e7464405a (diff)
downloadorg.eclipse.osee-253868a3571e19665795215c1ebafc151740cdfd.tar.gz
org.eclipse.osee-253868a3571e19665795215c1ebafc151740cdfd.tar.xz
org.eclipse.osee-253868a3571e19665795215c1ebafc151740cdfd.zip
refactor: Remove guid replace for attribute loading on server
Change-Id: Ic69089c6b4dea8d3791f6eda8ce2438994fd7888 Signed-off-by: Morgan E. Cook <Morgan.e.cook@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/AttributeDataProxyFactoryTest.java35
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/AttributeDataProxyFactory.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/AttributeDataUtil.java19
3 files changed, 2 insertions, 60 deletions
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/AttributeDataProxyFactoryTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/AttributeDataProxyFactoryTest.java
index 306594a298..acaa4a1c5a 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/AttributeDataProxyFactoryTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/AttributeDataProxyFactoryTest.java
@@ -162,39 +162,4 @@ public class AttributeDataProxyFactoryTest {
Assert.assertEquals(proxy, theProxy);
Mockito.verify(proxy).setData(null, null);
}
-
- @Test
- public void testCreateFromStringsCheckIntern() throws OseeCoreException {
- long typeUuid = 45L;
- String value = "hello";
- String uri = null;
-
- Mockito.when(attributeTypeCache.getByUuid(45L)).thenReturn(attributeType);
- Mockito.when(attributeTypeCache.getAttributeProviderId(attributeType)).thenReturn("org.eclipse.proxyfactory");
- Mockito.when(proxyProvider.getFactory("proxyfactory")).thenReturn(dataProxyFactory);
- Mockito.when(dataProxyFactory.createInstance("proxyfactory")).thenReturn(proxy);
-
- AttributeDataProxyFactory spy = Mockito.spy(factory);
-
- spy.createProxy(typeUuid, value, uri);
- Mockito.verify(spy, Mockito.times(0)).intern(value);
-
- Mockito.reset(spy);
-
- Mockito.when(attributeTypeCache.isEnumerated(attributeType)).thenReturn(true);
- spy.createProxy(typeUuid, value, uri);
- Mockito.verify(spy).intern(value);
-
- Mockito.reset(spy);
-
- Mockito.when(attributeTypeCache.isEnumerated(attributeType)).thenReturn(false);
- spy.createProxy(typeUuid, value, uri);
- Mockito.verify(spy, Mockito.times(0)).intern(value);
-
- Mockito.reset(spy);
-
- Mockito.when(attributeTypeCache.isBooleanType(attributeType)).thenReturn(true);
- spy.createProxy(typeUuid, value, uri);
- Mockito.verify(spy).intern(value);
- }
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/AttributeDataProxyFactory.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/AttributeDataProxyFactory.java
index 7852be6cbc..2b163d1513 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/AttributeDataProxyFactory.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/loader/AttributeDataProxyFactory.java
@@ -19,7 +19,6 @@ import org.eclipse.osee.jdbc.JdbcClient;
import org.eclipse.osee.orcs.core.ds.DataProxy;
import org.eclipse.osee.orcs.core.ds.DataProxyFactory;
import org.eclipse.osee.orcs.data.AttributeTypes;
-import org.eclipse.osee.orcs.db.internal.util.AttributeDataUtil;
/**
* @author Roberto E. Escobar
@@ -60,16 +59,11 @@ public class AttributeDataProxyFactory implements ProxyDataFactory {
private String intern(IAttributeType attributeType, String original) throws OseeCoreException {
String value = original;
if (isEnumOrBoolean(attributeType)) {
- value = intern(value);
+ value = Strings.intern(value);
}
- value = AttributeDataUtil.replaceGuidsWithName(original, jdbcClient);
return value;
}
- protected String intern(String value) {
- return Strings.intern(value);
- }
-
protected boolean isEnumOrBoolean(IAttributeType attributeType) throws OseeCoreException {
boolean isEnumAttribute = attributeTypeCache.isEnumerated(attributeType);
boolean isBooleanAttribute = attributeTypeCache.isBooleanType(attributeType);
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/AttributeDataUtil.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/AttributeDataUtil.java
index 3e9b942d5f..9f133a10c3 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/AttributeDataUtil.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/util/AttributeDataUtil.java
@@ -42,24 +42,7 @@ public class AttributeDataUtil {
return null;
}
- public static String replaceGuidsWithName(String value, JdbcClient jdbcClient) {
- if (value != null) {
- StringBuffer sb = new StringBuffer();
- Matcher matcher = guidPattern.matcher(value);
- while (matcher.find()) {
- String guid = matcher.group(2);
- String name = getName(guid, jdbcClient);
- if (name != null) {
- matcher.appendReplacement(sb, name.substring(0, name.indexOf('}') + 1));
- }
- }
- matcher.appendTail(sb);
- return sb.toString();
- }
- return null;
- }
-
- public static String getName(String guid, JdbcClient jdbcClient) {
+ private static String getName(String guid, JdbcClient jdbcClient) {
final StringBuffer sb = new StringBuffer();
Consumer<JdbcStatement> consumer = stmt -> {
sb.append(stmt.getString("value"));

Back to the top