Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2018-10-18 13:38:11 -0400
committerDonald Dunne2018-10-18 15:44:23 -0400
commitf98e5d0eb2e387f424ca551d41a070f79ec46d05 (patch)
tree8106b2b785cdb882e382b696b9d16d6eba6e66a9
parentcfaab695848f13333d538b4506df8b68cecc947a (diff)
downloadorg.eclipse.osee-f98e5d0eb2e387f424ca551d41a070f79ec46d05.tar.gz
org.eclipse.osee-f98e5d0eb2e387f424ca551d41a070f79ec46d05.tar.xz
org.eclipse.osee-f98e5d0eb2e387f424ca551d41a070f79ec46d05.zip
bug[ats_TW11474]: Fix GlobalXViewerSettings.getCustomArtifact performance
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTokens.java1
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/GlobalXViewerSettings.java35
3 files changed, 34 insertions, 5 deletions
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTokens.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTokens.java
index 382fb37714..83e3293e10 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTokens.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTokens.java
@@ -16,6 +16,7 @@ import org.eclipse.osee.framework.core.data.TokenFactory;
public final class CoreArtifactTokens {
// @formatter:off
+ public static ArtifactToken XViewerGlobalCustomization = TokenFactory.createArtifactToken(78293, "AAABER+3rLwA8O7WMgtX1g", CoreArtifactTypes.XViewerGlobalCustomization.getName(), CoreArtifactTypes.XViewerGlobalCustomization);
public static ArtifactToken DefaultHierarchyRoot = TokenFactory.createArtifactToken(197818, "AEslkN+d4hWXjQvnZ1gA", "Default Hierarchy Root", CoreArtifactTypes.RootArtifact);
public static ArtifactToken UniversalGroupRoot = TokenFactory.createArtifactToken(60807, "AExdLMeOTGhhPY4CyvQA", "Root Artifact", CoreArtifactTypes.UniversalGroup);
public static ArtifactToken Everyone = TokenFactory.createArtifactToken(48656, "AAABEbn4DKoAaR82FZsL3A", "Everyone", CoreArtifactTypes.UserGroup);
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF
index a54ba6795d..83a87c1148 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.skynet.core/META-INF/MANIFEST.MF
@@ -47,7 +47,8 @@ Export-Package: org.eclipse.osee.framework.skynet.core,
org.eclipse.osee.framework.skynet.core.validation,
org.eclipse.osee.framework.skynet.core.word
Bundle-Vendor: Eclipse Open System Engineering Environment
-Import-Package: com.google.common.collect;version="15.0.0",
+Import-Package: com.google.common.base;version="15.0.0",
+ com.google.common.collect;version="15.0.0",
com.google.common.io;version="15.0.0",
javax.ws.rs.client;version="2.0.0",
javax.ws.rs.core;version="2.0.0",
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/GlobalXViewerSettings.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/GlobalXViewerSettings.java
index df556749e8..768eb71c39 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/GlobalXViewerSettings.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/GlobalXViewerSettings.java
@@ -12,10 +12,17 @@
package org.eclipse.osee.framework.skynet.core;
import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import java.util.concurrent.TimeUnit;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
/**
* This singleton artifact stores the default customizations for XViewers
@@ -24,13 +31,33 @@ import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
*/
public final class GlobalXViewerSettings {
+ private static final Supplier<Artifact> configurationsCache =
+ Suppliers.memoizeWithExpiration(getConfigArtifactSupplier(), 10, TimeUnit.MINUTES);
+
+ private static Supplier<Artifact> getConfigArtifactSupplier() {
+ return new Supplier<Artifact>() {
+ @Override
+ public Artifact get() {
+ return loadConfigArtifact();
+ }
+ };
+ }
+
+ private static Artifact loadConfigArtifact() {
+ Artifact configArt = ArtifactQuery.getArtifactFromTokenOrNull(CoreArtifactTokens.XViewerGlobalCustomization,
+ CoreBranches.COMMON, DeletionFlag.EXCLUDE_DELETED);
+ if (configArt == null) {
+ configArt = OseeSystemArtifacts.getCachedArtifact(CoreArtifactTypes.XViewerGlobalCustomization,
+ CoreArtifactTypes.XViewerGlobalCustomization.getName(), COMMON);
+ }
+ return configArt;
+ }
+
public static Artifact getCustomArtifact() throws OseeCoreException {
- return OseeSystemArtifacts.getCachedArtifact(CoreArtifactTypes.XViewerGlobalCustomization,
- CoreArtifactTypes.XViewerGlobalCustomization.getName(), COMMON);
+ return configurationsCache.get();
}
public static Artifact createCustomArtifact() throws OseeCoreException {
- return ArtifactTypeManager.addArtifact(CoreArtifactTypes.XViewerGlobalCustomization, COMMON,
- CoreArtifactTypes.XViewerGlobalCustomization.getName());
+ return ArtifactTypeManager.addArtifact(CoreArtifactTokens.XViewerGlobalCustomization, COMMON);
}
} \ No newline at end of file

Back to the top