Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2013-07-03 17:59:48 -0400
committerGerrit Code Review @ Eclipse.org2013-07-09 10:58:21 -0400
commit92831feee82893530a6e49c3de0f551f0c777fdc (patch)
treefbe6fda5dc19532699ce7154ec007f63a1dfe86f
parent0ec5da5e58d84e50dabf04e13fa80195bb15e5aa (diff)
downloadorg.eclipse.osee-92831feee82893530a6e49c3de0f551f0c777fdc.tar.gz
org.eclipse.osee-92831feee82893530a6e49c3de0f551f0c777fdc.tar.xz
org.eclipse.osee-92831feee82893530a6e49c3de0f551f0c777fdc.zip
bug[ats_94LH1]: Targeted Version not getting updated via remote events
- Fix AtsVersionCache to only cache one version per teamWf - Allow cache to invalidate for a single teamWf - Add invalidateCache to version cache and call from AtsClientImpl.invalidateAllCaches - Fix AtsCacheManagerUpdateListener to only invalidate AtsVersionCache for teamWf(s) Change-Id: I678c59b727c1c0db2e9218844fe43c79c138e4bc
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsVersionAdmin.java5
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsCacheManagerUpdateListener.java19
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java1
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/store/AtsVersionCache.java14
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/store/AtsVersionServiceImpl.java10
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/AtsConfigCache.java15
6 files changed, 42 insertions, 22 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsVersionAdmin.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsVersionAdmin.java
index a4cde0c45c2..176035392a9 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsVersionAdmin.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsVersionAdmin.java
@@ -13,6 +13,7 @@ package org.eclipse.osee.ats.core.client;
import java.util.Collection;
import org.eclipse.osee.ats.api.version.IAtsVersion;
import org.eclipse.osee.ats.api.version.IAtsVersionService;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -23,4 +24,8 @@ public interface IAtsVersionAdmin extends IAtsVersionService {
Collection<TeamWorkFlowArtifact> getTargetedForTeamWorkflowArtifacts(IAtsVersion verArt) throws OseeCoreException;
+ void invalidateVersionCache();
+
+ void invalidateVersionCache(IAtsTeamWorkflow teamWf) throws OseeCoreException;
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsCacheManagerUpdateListener.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsCacheManagerUpdateListener.java
index 1661ef9fe56..da3fa26c2fd 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsCacheManagerUpdateListener.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsCacheManagerUpdateListener.java
@@ -15,7 +15,6 @@ import java.util.List;
import java.util.logging.Level;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.data.AtsRelationTypes;
-import org.eclipse.osee.ats.api.version.IAtsVersion;
import org.eclipse.osee.ats.core.client.IAtsClient;
import org.eclipse.osee.ats.core.client.config.AtsBulkLoad;
import org.eclipse.osee.ats.core.client.review.AbstractReviewArtifact;
@@ -24,8 +23,6 @@ import org.eclipse.osee.ats.core.client.task.AbstractTaskableArtifact;
import org.eclipse.osee.ats.core.client.task.TaskArtifact;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.util.AtsTaskCache;
-import org.eclipse.osee.ats.core.config.AtsVersionService;
-import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -96,19 +93,9 @@ public class AtsCacheManagerUpdateListener implements IArtifactEventListener {
for (EventBasicGuidRelation guidRel : artifactEvent.getRelations()) {
try {
if (guidRel.is(AtsRelationTypes.TeamWorkflowTargetedForVersion_Workflow)) {
- for (TeamWorkFlowArtifact teamArt : ArtifactCache.getActive(guidRel, TeamWorkFlowArtifact.class)) {
- Artifact verArt = null;
- try {
- verArt = teamArt.getRelatedArtifact(AtsRelationTypes.TeamWorkflowTargetedForVersion_Version);
- } catch (ArtifactDoesNotExist ex) {
- // do nothing
- }
- if (verArt == null) {
- AtsVersionService.get().removeTargetedVersion(teamArt);
- } else {
- IAtsVersion version = atsClient.getAtsConfig().getSoleByGuid(verArt.getGuid(), IAtsVersion.class);
- AtsVersionService.get().setTargetedVersion(teamArt, version);
- }
+ for (TeamWorkFlowArtifact teamWf : ArtifactCache.getActive(guidRel, TeamWorkFlowArtifact.class)) {
+ // Just remove teamWf from cache; reload will occur upon next call to get version
+ atsClient.getAtsVersionService().invalidateVersionCache(teamWf);
}
}
if (guidRel.is(AtsRelationTypes.TeamWfToTask_Task)) {
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java
index 925beaee35b..82b4496eda1 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java
@@ -221,6 +221,7 @@ public class AtsClientImpl implements IAtsClient {
public void invalidateAllCaches() {
invalidateConfigCache();
invalidateWorkDefinitionCache();
+ versionService.invalidateVersionCache();
}
@Override
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/store/AtsVersionCache.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/store/AtsVersionCache.java
index dd4430c1628..bb1fc7441b1 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/store/AtsVersionCache.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/store/AtsVersionCache.java
@@ -17,7 +17,8 @@ import org.eclipse.osee.ats.core.client.internal.config.AtsArtifactConfigCache;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
/**
- * This uses the config cache to cache the relation between the team workflow and version
+ * This uses the config cache to cache the relation between the team workflow and version.<br/>
+ * NOTE: Each teamWf can only have one version
*
* @author Donald G. Dunne
*/
@@ -39,15 +40,16 @@ public class AtsVersionCache {
}
public IAtsVersion cache(IAtsTeamWorkflow teamWf, IAtsVersion version) throws OseeCoreException {
- configCacheProvider.get().cacheByTag(teamWf.getGuid(), version);
+ configCacheProvider.get().cacheSoleByTag(teamWf.getGuid(), version);
return version;
}
public void deCache(IAtsTeamWorkflow teamWf) throws OseeCoreException {
- IAtsVersion version = configCacheProvider.get().getSoleByGuid(teamWf.getGuid(), IAtsVersion.class);
- if (version != null) {
- configCacheProvider.get().invalidate(version);
- }
+ configCacheProvider.get().invalidateByTag(teamWf.getGuid());
+ }
+
+ public void invalidateCache() {
+ configCacheProvider.invalidate();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/store/AtsVersionServiceImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/store/AtsVersionServiceImpl.java
index ea8a2e769e3..b4ceffb81c3 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/store/AtsVersionServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/store/AtsVersionServiceImpl.java
@@ -241,4 +241,14 @@ public class AtsVersionServiceImpl implements IAtsVersionAdmin {
return teamWorkflows;
}
+ @Override
+ public void invalidateVersionCache() {
+ versionCache.invalidateCache();
+ }
+
+ @Override
+ public void invalidateVersionCache(IAtsTeamWorkflow teamWf) throws OseeCoreException {
+ versionCache.deCache(teamWf);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/AtsConfigCache.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/AtsConfigCache.java
index 6e86aaa3847..b3cf2dd149f 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/AtsConfigCache.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/config/AtsConfigCache.java
@@ -38,6 +38,17 @@ public class AtsConfigCache implements IAtsConfig {
tagToConfigObject.put(tag, configObject);
}
+ /**
+ * Clear out all values cached by tag and add sole tag to this configObject
+ */
+ public void cacheSoleByTag(String tag, IAtsConfigObject configObject) {
+ Collection<IAtsConfigObject> values = tagToConfigObject.getValues(tag);
+ if (values != null) {
+ values.clear();
+ }
+ cacheByTag(tag, configObject);
+ }
+
@Override
@SuppressWarnings("unchecked")
public final <A extends IAtsConfigObject> List<A> getByTag(String tag, Class<A> clazz) {
@@ -118,4 +129,8 @@ public class AtsConfigCache implements IAtsConfig {
}
}
+ public void invalidateByTag(String tag) {
+ tagToConfigObject.removeValues(tag);
+ }
+
}

Back to the top