diff options
Diffstat (limited to 'plugins/org.eclipse.osee.ats.core.client')
7 files changed, 17 insertions, 66 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java index a0965593f8b..7e1c4747e03 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/IAtsClient.java @@ -189,4 +189,5 @@ public interface IAtsClient extends IAtsServices, IAtsNotifier, IAttributeResolv IAtsCache getCache(); void reloadConfigCache(); + } diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/ActionableItemManager.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/ActionableItemManager.java index 5959e9ff96e..cfb8e8c7116 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/ActionableItemManager.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/ActionableItemManager.java @@ -12,19 +12,14 @@ package org.eclipse.osee.ats.core.client.config; import java.util.Collection; import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; import java.util.Set; -import java.util.logging.Level; import org.eclipse.osee.ats.api.ai.IAtsActionableItem; import org.eclipse.osee.ats.api.data.AtsAttributeTypes; -import org.eclipse.osee.ats.core.client.internal.Activator; import org.eclipse.osee.ats.core.client.internal.AtsClientService; import org.eclipse.osee.ats.core.util.AtsObjects; import org.eclipse.osee.ats.core.util.AtsUtilCore; import org.eclipse.osee.framework.core.util.Result; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; /** @@ -41,14 +36,10 @@ public class ActionableItemManager { public Set<IAtsActionableItem> getActionableItems() throws OseeCoreException { Set<IAtsActionableItem> ais = new HashSet<>(); if (!artifact.isDeleted()) { - for (Long uuid : getActionableItemUuids()) { - IAtsActionableItem aia = AtsClientService.get().getCache().getByUuid(uuid, IAtsActionableItem.class); - if (aia == null && !artifact.isDeleted()) { - OseeLog.logf(Activator.class, Level.SEVERE, - "Actionable Item Uuid [%d] from [%s] doesn't match item in AtsConfigCache", uuid, - artifact.toStringWithId()); - } else { - ais.add(aia); + for (String guid : artifact.getAttributesToStringList(AtsAttributeTypes.ActionableItem)) { + IAtsActionableItem ai = AtsClientService.get().getConfigItem(guid); + if (ai != null) { + ais.add(ai); } } } @@ -59,23 +50,8 @@ public class ActionableItemManager { return AtsObjects.toString("; ", getActionableItems()); } - /** - * Return cached guids stored in DB to uuids or query and fill cache. This cache will go away when ATS Team - * Definitions and AIs are referenced by uuid instead of guid in DB Store. - */ - public List<Long> getActionableItemUuids() throws OseeCoreException { - List<Long> uuids = new LinkedList<>(); - for (String guid : artifact.getAttributesToStringList(AtsAttributeTypes.ActionableItem)) { - Long uuid = AtsClientService.get().getStoreService().getUuidFromGuid(guid); - if (uuid != null) { - uuids.add(uuid); - } - } - return uuids; - } - public void addActionableItem(IAtsActionableItem aia) throws OseeCoreException { - if (!getActionableItemUuids().contains(aia.getUuid())) { + if (!getActionableItems().contains(aia)) { String guid = null; if (aia.getStoreObject() instanceof Artifact) { guid = ((Artifact) aia.getStoreObject()).getGuid(); @@ -111,4 +87,8 @@ public class ActionableItemManager { return Result.TrueResult; } + public boolean hasActionableItems() { + return artifact.getAttributeCount(AtsAttributeTypes.ActionableItem) > 0; + } + } 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 9178b6d924e..2656fc6fb47 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 @@ -234,7 +234,7 @@ public class AtsClientImpl extends AtsCoreServiceImpl implements IAtsClient { atsStoreService = new AtsStoreService(workItemFactory); atsQueryService = new AtsQueryServiceImpl(this); - actionableItemManager = new ActionableItemManager(atsQueryService, attributeResolverService, atsStoreService); + actionableItemManager = new ActionableItemManager(attributeResolverService, atsStoreService, this); sequenceProvider = new ISequenceProvider() { @Override @@ -740,7 +740,7 @@ public class AtsClientImpl extends AtsCoreServiceImpl implements IAtsClient { } return implementerService; } - + @Override public IAtsCache getCache() { return atsCache; diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java index 3fb318190d9..039d466354f 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/internal/AtsStoreService.java @@ -12,11 +12,9 @@ package org.eclipse.osee.ats.core.client.internal; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; -import java.util.Map; import java.util.Set; import org.eclipse.osee.ats.api.IAtsObject; import org.eclipse.osee.ats.api.IAtsWorkItem; @@ -26,7 +24,6 @@ import org.eclipse.osee.ats.api.user.IAtsUser; import org.eclipse.osee.ats.api.util.IAtsChangeSet; import org.eclipse.osee.ats.api.util.IAtsStoreService; import org.eclipse.osee.ats.core.client.util.AtsChangeSet; -import org.eclipse.osee.ats.core.util.AtsUtilCore; import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.IAttributeType; @@ -42,7 +39,6 @@ import org.eclipse.osee.framework.skynet.core.attribute.DateAttribute; * @author Donald G. Dunne */ public class AtsStoreService implements IAtsStoreService { - private static Map<String, Long> guidToUuid; private final IAtsWorkItemFactory workItemFactory; public AtsStoreService(IAtsWorkItemFactory workItemFactory) { @@ -84,26 +80,6 @@ public class AtsStoreService implements IAtsStoreService { } @Override - public Long getUuidFromGuid(String guid) { - Long result = AtsUtilCore.getUuidFromGuid(guid); - if (result == null) { - if (guidToUuid == null) { - guidToUuid = new HashMap<>(200); - } - if (guidToUuid.containsKey(guid)) { - result = guidToUuid.get(guid); - } else { - Artifact art = AtsClientService.get().getArtifactByGuid(guid); - if (art != null) { - result = art.getUuid(); - guidToUuid.put(guid, result); - } - } - } - return result; - } - - @Override public String getGuid(IAtsObject atsObject) { return ((Artifact) atsObject.getStoreObject()).getGuid(); } @@ -154,7 +130,7 @@ public class AtsStoreService implements IAtsStoreService { public IArtifactType getArtifactType(ArtifactId artifact) { return ((Artifact) artifact).getArtifactType(); } - + @Override public boolean isDateType(IAttributeType attributeType) { return AttributeTypeManager.isBaseTypeCompatible(DateAttribute.class, attributeType); diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/AbstractReviewArtifact.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/AbstractReviewArtifact.java index 31e64ea14ef..db0546315db 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/AbstractReviewArtifact.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/review/AbstractReviewArtifact.java @@ -29,8 +29,8 @@ import org.eclipse.osee.ats.core.client.internal.Activator; import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact; import org.eclipse.osee.ats.core.client.workflow.AbstractWorkflowArtifact; import org.eclipse.osee.ats.core.config.ActionableItems; -import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.BranchId; +import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; @@ -41,7 +41,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact; public abstract class AbstractReviewArtifact extends AbstractWorkflowArtifact implements IAtsAbstractReview { private ActionableItemManager actionableItemsDam; - private Boolean standAlone = null; public AbstractReviewArtifact(String guid, BranchId branch, IArtifactType artifactType) throws OseeCoreException { super(guid, branch, artifactType); @@ -161,10 +160,7 @@ public abstract class AbstractReviewArtifact extends AbstractWorkflowArtifact im } public boolean isStandAloneReview() throws OseeCoreException { - if (standAlone == null) { - standAlone = getActionableItemsDam().getActionableItemUuids().size() > 0; - } - return standAlone; + return getActionableItemsDam().hasActionableItems(); } @Override diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/AtsTeamDefinitionService.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/AtsTeamDefinitionService.java index 3a1b6402d0f..5440f318a7f 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/AtsTeamDefinitionService.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/AtsTeamDefinitionService.java @@ -45,8 +45,7 @@ public class AtsTeamDefinitionService implements IAtsTeamDefinitionService { String teamDefGuid = ((Artifact) workItem.getStoreObject()).getSoleAttributeValue(AtsAttributeTypes.TeamDefinition, ""); if (Strings.isValid(teamDefGuid)) { - Long uuid = AtsClientService.get().getStoreService().getUuidFromGuid(teamDefGuid); - teamDef = atsClient.getCache().getByUuid(uuid, IAtsTeamDefinition.class); + teamDef = atsClient.getConfigItem(teamDefGuid); } return teamDef; } diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/TeamWorkFlowArtifact.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/TeamWorkFlowArtifact.java index b28fdb86d56..b10eb573aba 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/TeamWorkFlowArtifact.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/team/TeamWorkFlowArtifact.java @@ -135,8 +135,7 @@ public class TeamWorkFlowArtifact extends AbstractWorkflowArtifact implements IA if (!Strings.isValid(guid)) { throw new OseeArgumentException("TeamWorkflow [%s] has no Team Definition associated.", getAtsId()); } - Long uuid = AtsClientService.get().getStoreService().getUuidFromGuid(guid); - IAtsTeamDefinition teamDef = AtsClientService.get().getCache().getByUuid(uuid, IAtsTeamDefinition.class); + IAtsTeamDefinition teamDef = AtsClientService.get().getConfigItem(guid); Conditions.checkNotNull(teamDef, String.format("TeamDef null for Team WF %s", toStringWithId())); return teamDef; } |