Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2014-08-21 22:37:31 +0000
committerRoberto E. Escobar2014-09-29 22:58:26 +0000
commit50acc616ddb167f2c0db9d6cec977b04393cddd7 (patch)
tree48823f9a7df167ffcef7e6b7213efc49f9c59c47
parent69fdf4da2cb9fd3fcc50f472ed072201cce81e02 (diff)
downloadorg.eclipse.osee-50acc616ddb167f2c0db9d6cec977b04393cddd7.tar.gz
org.eclipse.osee-50acc616ddb167f2c0db9d6cec977b04393cddd7.tar.xz
org.eclipse.osee-50acc616ddb167f2c0db9d6cec977b04393cddd7.zip
feature[ats_ATS98174]: CPA: Improve performance of Issues and CPA Resource
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaService.java3
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java26
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/NoOpCpaService.java7
3 files changed, 30 insertions, 6 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaService.java
index 6e93965ada8..4ff629ad814 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaService.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaService.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.ats.api.cpa;
import java.net.URI;
import java.util.List;
+import java.util.Map;
/**
* @author Donald G. Dunne
@@ -27,4 +28,6 @@ public interface IAtsCpaService {
URI getLocation(URI uri, String uuid);
ICpaPcr getPcr(String pcrId);
+
+ Map<String, ICpaPcr> getOriginatingPcr(Map<String, IAtsCpaDecision> origPcrIdToDecision);
}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java
index 5003284695a..b09266499b3 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java
@@ -13,7 +13,10 @@ package org.eclipse.osee.ats.rest.internal.cpa;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -54,6 +57,7 @@ import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.framework.jdk.core.util.DateUtil;
import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.jaxrs.OseeWebApplicationException;
+import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.EnumEntry;
import org.eclipse.osee.orcs.search.QueryBuilder;
@@ -67,7 +71,7 @@ import org.eclipse.osee.orcs.search.QueryBuilder;
public final class CpaResource {
private final OrcsApi orcsApi;
- private final IAtsServer atsServer;
+ private final IAtsServer atsServer;
private final CpaServiceRegistry cpaRegistry;
private String cpaBasepath;
@@ -105,12 +109,18 @@ public final class CpaResource {
queryBuilder.and(AtsAttributeTypes.CurrentStateType,
(open ? StateType.Working.name() : StateType.Completed.name()));
}
+ Map<String, IAtsCpaDecision> origPcrIdToDecision = new HashMap<String, IAtsCpaDecision>();
+ String pcrToolId = null;
for (ArtifactReadable art : queryBuilder.getResults()) {
IAtsTeamWorkflow teamWf = atsServer.getWorkItemFactory().getTeamWf(art);
CpaDecision decision = CpaFactory.getDecision(teamWf, null);
decision.setApplicability(art.getSoleAttributeValue(AtsAttributeTypes.ApplicableToProgram, ""));
decision.setRationale(art.getSoleAttributeValue(AtsAttributeTypes.Rationale, ""));
- decision.setPcrSystem(art.getSoleAttributeValue(AtsAttributeTypes.PcrToolId, ""));
+ String pcrToolIdValue = art.getSoleAttributeValue(AtsAttributeTypes.PcrToolId, "");
+ if (pcrToolId == null) {
+ pcrToolId = pcrToolIdValue;
+ }
+ decision.setPcrSystem(pcrToolIdValue);
boolean completed =
art.getSoleAttributeValue(AtsAttributeTypes.CurrentStateType, "").equals(StateType.Completed.name());
decision.setComplete(completed);
@@ -125,6 +135,7 @@ public final class CpaResource {
// set location of originating pcr
String origPcrId = art.getSoleAttributeValue(AtsAttributeTypes.OriginatingPcrId);
+ origPcrIdToDecision.put(origPcrId, decision);
decision.setOrigPcrLocation(getCpaPath().path(origPcrId).queryParam("pcrSystem", decision.getPcrSystem()).build().toString());
// set location of duplicated pcr (if any)
@@ -136,12 +147,15 @@ public final class CpaResource {
decision.setDuplicatedPcrId(duplicatedPcrId);
}
- IAtsCpaService service = cpaRegistry.getServiceById(decision.getPcrSystem());
- ICpaPcr origPcr = service.getPcr(origPcrId);
- decision.setOriginatingPcr(origPcr);
-
decisions.add(decision);
}
+
+ IAtsCpaService service = cpaRegistry.getServiceById(pcrToolId);
+ for (Entry<String, ICpaPcr> entry : service.getOriginatingPcr(origPcrIdToDecision).entrySet()) {
+ CpaDecision decision = (CpaDecision) origPcrIdToDecision.get(entry.getKey());
+ decision.setOriginatingPcr(entry.getValue());
+ }
+
return decisions;
}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/NoOpCpaService.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/NoOpCpaService.java
index d0eb6f64784..00851b5b628 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/NoOpCpaService.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/NoOpCpaService.java
@@ -13,6 +13,8 @@ package org.eclipse.osee.ats.rest.internal.cpa;
import java.net.URI;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
+import org.eclipse.osee.ats.api.cpa.IAtsCpaDecision;
import org.eclipse.osee.ats.api.cpa.IAtsCpaProgram;
import org.eclipse.osee.ats.api.cpa.IAtsCpaService;
import org.eclipse.osee.ats.api.cpa.ICpaPcr;
@@ -49,4 +51,9 @@ public class NoOpCpaService implements IAtsCpaService {
return null;
}
+ @Override
+ public Map<String, ICpaPcr> getOriginatingPcr(Map<String, IAtsCpaDecision> origPcrIdToDecision) {
+ return Collections.emptyMap();
+ }
+
}

Back to the top