Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-09-07 13:22:52 -0400
committerDonald Dunne2016-09-08 18:47:38 -0400
commitb0ab21b34cc3c6d17f9302fc6893f6cabd668888 (patch)
treecce1ce7fc979dc74b0c378c8c693b4aeda2d85b5
parentc56dd91abf352e8fd8d497af0e57197597493022 (diff)
downloadorg.eclipse.osee-b0ab21b34cc3c6d17f9302fc6893f6cabd668888.tar.gz
org.eclipse.osee-b0ab21b34cc3c6d17f9302fc6893f6cabd668888.tar.xz
org.eclipse.osee-b0ab21b34cc3c6d17f9302fc6893f6cabd668888.zip
refinement: Remove percent complete value if not applicable
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsAction.java3
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsTeamWorkflow.java4
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/PercentCompleteTasksColumn.java9
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/PercentCompleteReviewsColumn.java16
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/PercentCompleteTasksReviewsColumn.java13
5 files changed, 31 insertions, 14 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsAction.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsAction.java
index 4360faeb66..3a12f275f7 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsAction.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsAction.java
@@ -24,4 +24,7 @@ public interface IAtsAction extends IAtsObject, IAtsTeamWorkflowProvider {
void setAtsId(String atsId) throws OseeCoreException;
+ public static boolean isOfType(Object object) {
+ return object instanceof IAtsAction;
+ }
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsTeamWorkflow.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsTeamWorkflow.java
index 53b8bf9e75..32779803b5 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsTeamWorkflow.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsTeamWorkflow.java
@@ -25,4 +25,8 @@ public interface IAtsTeamWorkflow extends IAtsWorkItem, IAtsActionableItemProvid
IAtsTeamDefinition getTeamDefinition() throws OseeCoreException;
+ public static boolean isOfType(Object object) {
+ return object instanceof IAtsTeamWorkflow;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/PercentCompleteTasksColumn.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/PercentCompleteTasksColumn.java
index cba7128679..ea3f3dee48 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/PercentCompleteTasksColumn.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/PercentCompleteTasksColumn.java
@@ -30,14 +30,17 @@ public class PercentCompleteTasksColumn extends AbstractServicesColumn {
@Override
public String getText(IAtsObject atsObject) throws Exception {
- return String.valueOf(getPercentCompleteFromTasks(atsObject, services));
+ if (IAtsAction.isOfType(atsObject) || IAtsTeamWorkflow.isOfType(atsObject)) {
+ return String.valueOf(getPercentCompleteFromTasks(atsObject, services));
+ }
+ return "";
}
/**
* Return Percent Complete ONLY on tasks. Total Percent / # Tasks
*/
public static int getPercentCompleteFromTasks(IAtsObject atsObject, IAtsServices services) throws OseeCoreException {
- if (atsObject instanceof IAtsAction) {
+ if (IAtsAction.isOfType(atsObject)) {
IAtsAction action = (IAtsAction) atsObject;
double percent = 0;
for (IAtsTeamWorkflow teamWf : action.getTeamWorkflows()) {
@@ -51,7 +54,7 @@ public class PercentCompleteTasksColumn extends AbstractServicesColumn {
Double rollPercent = percent / action.getTeamWorkflows().size();
return rollPercent.intValue();
}
- if (atsObject instanceof IAtsTeamWorkflow) {
+ if (IAtsTeamWorkflow.isOfType(atsObject)) {
return getPercentCompleteFromTasks((IAtsTeamWorkflow) atsObject, services);
}
return 0;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/PercentCompleteReviewsColumn.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/PercentCompleteReviewsColumn.java
index 4d2aa686a5..942477ca88 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/PercentCompleteReviewsColumn.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/PercentCompleteReviewsColumn.java
@@ -11,10 +11,13 @@
package org.eclipse.osee.ats.column;
import org.eclipse.nebula.widgets.xviewer.IXViewerValueColumn;
-import org.eclipse.nebula.widgets.xviewer.core.model.XViewerAlign;
import org.eclipse.nebula.widgets.xviewer.core.model.SortDataType;
+import org.eclipse.nebula.widgets.xviewer.core.model.XViewerAlign;
import org.eclipse.nebula.widgets.xviewer.core.model.XViewerColumn;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
+import org.eclipse.osee.ats.api.workflow.IAtsAction;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.core.client.action.ActionManager;
import org.eclipse.osee.ats.core.client.review.ReviewManager;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
@@ -36,8 +39,8 @@ public class PercentCompleteReviewsColumn extends XViewerAtsColumn implements IX
}
private PercentCompleteReviewsColumn() {
- super(WorldXViewerFactory.COLUMN_NAMESPACE + ".reviewPercentComplete", "Review Percent Complete", 40, XViewerAlign.Center,
- false, SortDataType.Percent, false,
+ super(WorldXViewerFactory.COLUMN_NAMESPACE + ".reviewPercentComplete", "Review Percent Complete", 40,
+ XViewerAlign.Center, false, SortDataType.Percent, false,
"Percent Complete for the reviews.\n\nCalculation: total percent of all reviews / number of reviews");
}
@@ -55,8 +58,11 @@ public class PercentCompleteReviewsColumn extends XViewerAtsColumn implements IX
@Override
public String getColumnText(Object element, XViewerColumn column, int columnIndex) {
try {
- if (element instanceof Artifact) {
- return String.valueOf(getPercentCompleteReview((Artifact) element));
+ if (IAtsAction.isOfType(element) || IAtsTeamWorkflow.isOfType(element)) {
+ IAtsWorkItem workItem = (IAtsWorkItem) element;
+ if (workItem.isTeamWorkflow()) {
+ return String.valueOf(getPercentCompleteReview((Artifact) element));
+ }
}
} catch (OseeCoreException ex) {
return LogUtil.getCellExceptionString(ex);
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/PercentCompleteTasksReviewsColumn.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/PercentCompleteTasksReviewsColumn.java
index 8432a007b7..24265cb74c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/PercentCompleteTasksReviewsColumn.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/column/PercentCompleteTasksReviewsColumn.java
@@ -12,11 +12,12 @@ package org.eclipse.osee.ats.column;
import java.util.Collection;
import org.eclipse.nebula.widgets.xviewer.IXViewerValueColumn;
-import org.eclipse.nebula.widgets.xviewer.core.model.XViewerAlign;
import org.eclipse.nebula.widgets.xviewer.core.model.SortDataType;
+import org.eclipse.nebula.widgets.xviewer.core.model.XViewerAlign;
import org.eclipse.nebula.widgets.xviewer.core.model.XViewerColumn;
-import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.review.IAtsAbstractReview;
+import org.eclipse.osee.ats.api.workflow.IAtsAction;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
import org.eclipse.osee.ats.core.client.action.ActionManager;
import org.eclipse.osee.ats.core.client.task.TaskArtifact;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
@@ -59,7 +60,7 @@ public class PercentCompleteTasksReviewsColumn extends XViewerAtsColumn implemen
@Override
public String getColumnText(Object element, XViewerColumn column, int columnIndex) {
try {
- if (element instanceof Artifact) {
+ if (IAtsAction.isOfType(element) || IAtsTeamWorkflow.isOfType(element)) {
return String.valueOf(getPercentCompleteFromTasksAndReviews((Artifact) element));
}
} catch (OseeCoreException ex) {
@@ -72,7 +73,7 @@ public class PercentCompleteTasksReviewsColumn extends XViewerAtsColumn implemen
* Return Percent Complete ONLY on tasks. Total Percent / # Tasks
*/
public static int getPercentCompleteFromTasksAndReviews(Artifact artifact) throws OseeCoreException {
- if (artifact.isOfType(AtsArtifactTypes.Action)) {
+ if (IAtsAction.isOfType(artifact)) {
double percent = 0;
for (TeamWorkFlowArtifact team : ActionManager.getTeams(artifact)) {
if (!team.isCancelled()) {
@@ -87,7 +88,7 @@ public class PercentCompleteTasksReviewsColumn extends XViewerAtsColumn implemen
}
int spent = 0;
int size = 0;
- if (artifact instanceof TeamWorkFlowArtifact) {
+ if (IAtsTeamWorkflow.isOfType(artifact)) {
TeamWorkFlowArtifact TeamWorkFlowArtifact = (TeamWorkFlowArtifact) artifact;
Collection<TaskArtifact> taskArts = TeamWorkFlowArtifact.getTaskArtifacts();
for (TaskArtifact taskArt : taskArts) {
@@ -95,7 +96,7 @@ public class PercentCompleteTasksReviewsColumn extends XViewerAtsColumn implemen
}
size = taskArts.size();
}
- if (artifact instanceof TeamWorkFlowArtifact) {
+ if (IAtsTeamWorkflow.isOfType(artifact)) {
TeamWorkFlowArtifact teamWf = (TeamWorkFlowArtifact) artifact;
Collection<IAtsAbstractReview> reviewArts = AtsClientService.get().getReviewService().getReviews(teamWf);
for (IAtsAbstractReview reviewArt : reviewArts) {

Back to the top