Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ArtifactCollectorsCache.java31
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsClientImpl.java5
2 files changed, 21 insertions, 15 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ArtifactCollectorsCache.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ArtifactCollectorsCache.java
index 827f6d6409..ddb89001d4 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ArtifactCollectorsCache.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/ArtifactCollectorsCache.java
@@ -18,9 +18,9 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.eclipse.osee.ats.api.data.AtsRelationTypes;
import org.eclipse.osee.ats.core.client.artifact.CollectorArtifact;
import org.eclipse.osee.ats.core.client.util.IArtifactMembersCache;
+import org.eclipse.osee.framework.core.data.IRelationTypeSide;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.jdk.core.type.DoubleKeyHashMap;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -38,16 +38,21 @@ import org.eclipse.osee.framework.skynet.core.event.model.Sender;
public class ArtifactCollectorsCache<T extends CollectorArtifact> implements IArtifactMembersCache<T> {
private static Map<Integer, List<Artifact>> cache;
- private static DoubleKeyHashMap<Integer, Integer, String> goalMemberOrderMap;
+ private static DoubleKeyHashMap<Integer, Integer, String> collectorMemberOrderMap;
private static Set<Integer> registered;
private static volatile boolean initialized = false;
+ private final IRelationTypeSide memberRelationType;
+
+ public ArtifactCollectorsCache(IRelationTypeSide memberRelationType) {
+ this.memberRelationType = memberRelationType;
+ }
private void initializeStructures() {
if (!initialized) {
initialized = true;
cache = new HashMap<Integer, List<Artifact>>();
registered = new HashSet<Integer>();
- goalMemberOrderMap = new DoubleKeyHashMap<Integer, Integer, String>();
+ collectorMemberOrderMap = new DoubleKeyHashMap<Integer, Integer, String>();
}
}
@@ -80,7 +85,7 @@ public class ArtifactCollectorsCache<T extends CollectorArtifact> implements IAr
registerForEvents(collector);
List<Artifact> members = cache.get(collector.getArtId());
if (members == null) {
- members = collector.getRelatedArtifacts(AtsRelationTypes.Goal_Member, DeletionFlag.EXCLUDE_DELETED);
+ members = collector.getRelatedArtifacts(memberRelationType, DeletionFlag.EXCLUDE_DELETED);
synchronized (cache) {
cache.put(collector.getArtId(), members);
fillOrderCache(collector, members);
@@ -96,7 +101,7 @@ public class ArtifactCollectorsCache<T extends CollectorArtifact> implements IAr
synchronized (cache) {
cache.remove(collectorArt.getArtId());
}
- synchronized (goalMemberOrderMap) {
+ synchronized (collectorMemberOrderMap) {
clearOrderCache(collectorArt);
}
}
@@ -108,8 +113,8 @@ public class ArtifactCollectorsCache<T extends CollectorArtifact> implements IAr
synchronized (cache) {
cache.clear();
}
- synchronized (goalMemberOrderMap) {
- goalMemberOrderMap.clear();
+ synchronized (collectorMemberOrderMap) {
+ collectorMemberOrderMap.clear();
}
}
}
@@ -117,20 +122,20 @@ public class ArtifactCollectorsCache<T extends CollectorArtifact> implements IAr
@Override
public String getMemberOrder(T collectorArt, Artifact member) throws OseeCoreException {
initializeStructures();
- if (goalMemberOrderMap.getSubHash(collectorArt.getArtId()) == null) {
+ if (collectorMemberOrderMap.getSubHash(collectorArt.getArtId()) == null) {
fillOrderCache(collectorArt, getMembers(collectorArt));
}
- String order = goalMemberOrderMap.get(collectorArt.getArtId(), member.getArtId());
+ String order = collectorMemberOrderMap.get(collectorArt.getArtId(), member.getArtId());
return order == null ? "" : order;
}
private void fillOrderCache(T collectorArt, List<Artifact> members) {
initializeStructures();
- synchronized (goalMemberOrderMap) {
+ synchronized (collectorMemberOrderMap) {
clearOrderCache(collectorArt);
int x = 1;
for (Artifact artifact : members) {
- goalMemberOrderMap.put(collectorArt.getArtId(), artifact.getArtId(), String.valueOf(x++));
+ collectorMemberOrderMap.put(collectorArt.getArtId(), artifact.getArtId(), String.valueOf(x++));
}
}
}
@@ -138,11 +143,11 @@ public class ArtifactCollectorsCache<T extends CollectorArtifact> implements IAr
private void clearOrderCache(T collectorArt) {
if (initialized) {
List<Integer> memberIds = new ArrayList<Integer>();
- Map<Integer, String> subHash = goalMemberOrderMap.getSubHash(collectorArt.getArtId());
+ Map<Integer, String> subHash = collectorMemberOrderMap.getSubHash(collectorArt.getArtId());
if (subHash != null) {
memberIds.addAll(subHash.keySet());
for (Integer memberId : memberIds) {
- goalMemberOrderMap.remove(collectorArt.getArtId(), memberId);
+ collectorMemberOrderMap.remove(collectorArt.getArtId(), memberId);
}
}
}
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 e7c49973b8..dd2da19f07 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
@@ -26,6 +26,7 @@ import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
import org.eclipse.osee.ats.api.data.AtsArtifactToken;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.api.data.AtsRelationTypes;
import org.eclipse.osee.ats.api.ev.IAtsEarnedValueService;
import org.eclipse.osee.ats.api.ev.IAtsEarnedValueServiceProvider;
import org.eclipse.osee.ats.api.notify.AtsNotificationCollector;
@@ -732,7 +733,7 @@ public class AtsClientImpl implements IAtsClient {
@Override
public IArtifactMembersCache<GoalArtifact> getGoalMembersCache() {
if (goalMembersCache == null) {
- goalMembersCache = new ArtifactCollectorsCache<GoalArtifact>();
+ goalMembersCache = new ArtifactCollectorsCache<GoalArtifact>(AtsRelationTypes.Goal_Member);
}
return goalMembersCache;
}
@@ -740,7 +741,7 @@ public class AtsClientImpl implements IAtsClient {
@Override
public IArtifactMembersCache<SprintArtifact> getSprintItemsCache() {
if (sprintItemsCache == null) {
- sprintItemsCache = new ArtifactCollectorsCache<SprintArtifact>();
+ sprintItemsCache = new ArtifactCollectorsCache<SprintArtifact>(AtsRelationTypes.AgileSprint_Item);
}
return sprintItemsCache;
}

Back to the top