Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-08-16 16:30:18 -0400
committerRyan D. Brooks2016-08-31 12:18:46 -0400
commit734bd8e38c9a69f76a86a7f56790979db34f87a9 (patch)
tree8a25dfca385ed1d8d212f393a6960f8e4933f6ef
parent9b9a5c3fa81ba1e2570df3f1739353c36d7fc8a2 (diff)
downloadorg.eclipse.osee-734bd8e38c9a69f76a86a7f56790979db34f87a9.tar.gz
org.eclipse.osee-734bd8e38c9a69f76a86a7f56790979db34f87a9.tar.xz
org.eclipse.osee-734bd8e38c9a69f76a86a7f56790979db34f87a9.zip
bug[ats_ATS302825]: NR Alpha - Convert BranchStatusColumn to pre-computed
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/column/BranchStatusColumnTest.java20
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/BranchStatusColumn.java87
2 files changed, 55 insertions, 52 deletions
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/column/BranchStatusColumnTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/column/BranchStatusColumnTest.java
index 856f3ae07a..3279950079 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/column/BranchStatusColumnTest.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/column/BranchStatusColumnTest.java
@@ -10,12 +10,12 @@
*******************************************************************************/
package org.eclipse.osee.ats.client.integration.tests.ats.column;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.client.integration.tests.util.DemoTestUtil;
import org.eclipse.osee.ats.column.BranchStatusColumn;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.demo.api.DemoWorkType;
import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.support.test.util.TestUtil;
import org.junit.Assert;
@@ -29,24 +29,16 @@ public class BranchStatusColumnTest {
public void testGetColumnText() throws Exception {
SevereLoggingMonitor loggingMonitor = TestUtil.severeLoggingStart();
- TeamWorkFlowArtifact reqArt =
+ IAtsTeamWorkflow reqArt =
(TeamWorkFlowArtifact) DemoTestUtil.getUncommittedActionWorkflow(DemoWorkType.Requirements);
- Assert.assertEquals("Working",
- BranchStatusColumn.getInstance().getColumnText(reqArt, BranchStatusColumn.getInstance(), 0));
+ Assert.assertEquals("Working", BranchStatusColumn.getInstance().getBranchStatus(reqArt));
- TeamWorkFlowArtifact testArt =
- (TeamWorkFlowArtifact) DemoTestUtil.getUncommittedActionWorkflow(DemoWorkType.Test);
- Assert.assertEquals("",
- BranchStatusColumn.getInstance().getColumnText(testArt, BranchStatusColumn.getInstance(), 0));
-
- Artifact actionArt = reqArt.getParentActionArtifact();
- Assert.assertEquals("Working",
- BranchStatusColumn.getInstance().getColumnText(actionArt, BranchStatusColumn.getInstance(), 0));
+ IAtsTeamWorkflow testArt = (TeamWorkFlowArtifact) DemoTestUtil.getUncommittedActionWorkflow(DemoWorkType.Test);
+ Assert.assertEquals("", BranchStatusColumn.getInstance().getBranchStatus(testArt));
TeamWorkFlowArtifact reqArt2 =
(TeamWorkFlowArtifact) DemoTestUtil.getCommittedActionWorkflow(DemoWorkType.Requirements);
- Assert.assertEquals("Committed",
- BranchStatusColumn.getInstance().getColumnText(reqArt2, BranchStatusColumn.getInstance(), 0));
+ Assert.assertEquals("Committed", BranchStatusColumn.getInstance().getBranchStatus(reqArt2));
TestUtil.severeLoggingEnd(loggingMonitor);
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/BranchStatusColumn.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/BranchStatusColumn.java
index 51ed1f0664..3cb119e7ec 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/BranchStatusColumn.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/BranchStatusColumn.java
@@ -10,28 +10,25 @@
*******************************************************************************/
package org.eclipse.osee.ats.column;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.nebula.widgets.xviewer.IXViewerValueColumn;
-import org.eclipse.nebula.widgets.xviewer.core.model.XViewerAlign;
+import java.util.Collection;
+import java.util.Map;
+import org.eclipse.nebula.widgets.xviewer.IXViewerPreComputedColumn;
import org.eclipse.nebula.widgets.xviewer.core.model.SortDataType;
-import org.eclipse.nebula.widgets.xviewer.core.model.XViewerColumn;
+import org.eclipse.nebula.widgets.xviewer.core.model.XViewerAlign;
+import org.eclipse.osee.ats.api.IAtsObject;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
-import org.eclipse.osee.ats.core.client.action.ActionManager;
-import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.internal.AtsClientService;
import org.eclipse.osee.ats.util.xviewer.column.XViewerAtsColumn;
import org.eclipse.osee.ats.world.WorldXViewerFactory;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Collections;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
import org.eclipse.osee.framework.ui.skynet.util.LogUtil;
/**
* @author Donald G. Dunne
*/
-public class BranchStatusColumn extends XViewerAtsColumn implements IXViewerValueColumn {
+public class BranchStatusColumn extends XViewerAtsColumn implements IXViewerPreComputedColumn {
public static BranchStatusColumn instance = new BranchStatusColumn();
@@ -56,38 +53,52 @@ public class BranchStatusColumn extends XViewerAtsColumn implements IXViewerValu
}
@Override
- public String getColumnText(Object element, XViewerColumn column, int columnIndex) {
- try {
- if (Artifacts.isOfType(element, AtsArtifactTypes.Action)) {
- Set<String> strs = new HashSet<>();
- for (TeamWorkFlowArtifact team : ActionManager.getTeams(element)) {
- String str = getColumnText(team, column, columnIndex);
- if (Strings.isValid(str)) {
- strs.add(str);
- }
+ public Long getKey(Object obj) {
+ Long result = 0L;
+ if (obj instanceof IAtsObject) {
+ result = ((IAtsObject) obj).getUuid();
+ }
+ return result;
+ }
+
+ @Override
+ public String getText(Object obj, Long key, String cachedValue) {
+ return cachedValue;
+ }
+
+ @Override
+ public void populateCachedValues(Collection<?> objects, Map<Long, String> preComputedValueMap) {
+ for (Object element : objects) {
+ Long key = getKey(element);
+ try {
+ if (Artifacts.isOfType(element, AtsArtifactTypes.TeamWorkflow)) {
+ String status = getBranchStatus((IAtsTeamWorkflow) element);
+ preComputedValueMap.put(key, status);
+ } else {
+ preComputedValueMap.put(key, "");
}
- return Collections.toString(", ", strs);
+ } catch (OseeCoreException ex) {
+ String cellExceptionString = LogUtil.getCellExceptionString(ex);
+ preComputedValueMap.put(key, cellExceptionString);
}
- if (Artifacts.isOfType(element, AtsArtifactTypes.TeamWorkflow)) {
- TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) element;
- try {
- if (AtsClientService.get().getBranchService().isWorkingBranchInWork(teamArt)) {
- return "Working";
- } else if (AtsClientService.get().getBranchService().isCommittedBranchExists(teamArt)) {
- if (!AtsClientService.get().getBranchService().isAllObjectsToCommitToConfigured(
- teamArt) || !AtsClientService.get().getBranchService().isBranchesAllCommitted(teamArt)) {
- return "Needs Commit";
- }
- return "Committed";
- }
- return "";
- } catch (Exception ex) {
- return "Exception: " + ex.getLocalizedMessage();
+ }
+ }
+
+ public String getBranchStatus(IAtsTeamWorkflow teamWf) {
+ try {
+ if (AtsClientService.get().getBranchService().isWorkingBranchInWork(teamWf)) {
+ return "Working";
+ } else if (AtsClientService.get().getBranchService().isCommittedBranchExists(teamWf)) {
+ if (!AtsClientService.get().getBranchService().isAllObjectsToCommitToConfigured(
+ teamWf) || !AtsClientService.get().getBranchService().isBranchesAllCommitted(teamWf)) {
+ return "Needs Commit";
}
+ return "Committed";
}
- } catch (OseeCoreException ex) {
- LogUtil.getCellExceptionString(ex);
+ return "";
+ } catch (Exception ex) {
+ return "Exception: " + ex.getLocalizedMessage();
}
- return "";
}
+
}

Back to the top