diff options
author | donald.g.dunne | 2017-10-24 02:08:36 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2017-10-24 02:08:36 +0000 |
commit | 0040fa40d36c58d626660008be0a947be4036fdc (patch) | |
tree | 2bcaa7cdc5cf3e3cef328b433ae994f85b233e25 /plugins/org.eclipse.osee.ats.core/src | |
parent | e0c183aa0df22461958db538b4bb2d4775d3939f (diff) | |
download | org.eclipse.osee-0040fa40d36c58d626660008be0a947be4036fdc.tar.gz org.eclipse.osee-0040fa40d36c58d626660008be0a947be4036fdc.tar.xz org.eclipse.osee-0040fa40d36c58d626660008be0a947be4036fdc.zip |
bug[ats_TW2916]: Agile - Fix points in backlog and sprint
Change-Id: Id55d12ecd3be1d5db9f21696e49209525b2972f9
Diffstat (limited to 'plugins/org.eclipse.osee.ats.core/src')
3 files changed, 78 insertions, 26 deletions
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/agile/AgileService.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/agile/AgileService.java index 4092ac23965..cd301306998 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/agile/AgileService.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/agile/AgileService.java @@ -34,7 +34,9 @@ import org.eclipse.osee.ats.api.agile.JaxNewAgileTeam; 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.team.IAtsTeamDefinition; import org.eclipse.osee.ats.api.util.IAtsChangeSet; +import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow; import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.ArtifactToken; import org.eclipse.osee.framework.core.data.AttributeTypeId; @@ -417,4 +419,77 @@ public class AgileService implements IAgileService { return sprints; } + @Override + public String getAgileTeamPointsStr(IAtsWorkItem workItem) { + String result = + services.getAttributeResolver().getSoleAttributeValueAsString(workItem, AtsAttributeTypes.Points, ""); + if (Strings.isInValid(result)) { + result = services.getAttributeResolver().getSoleAttributeValue(workItem, AtsAttributeTypes.PointsNumeric, + 0.0).toString(); + } + return result; + } + + @Override + public IAgileTeam getAgileTeam(IAtsWorkItem workItem) { + IAgileTeam agileTeam = null; + IAtsTeamWorkflow teamWf = workItem.getParentTeamWorkflow(); + if (teamWf != null) { + // attempt to get from team definitions relation to agile team + IAtsTeamDefinition teamDef = teamWf.getTeamDefinition(); + if (teamDef != null) { + ArtifactId agileTeamArt = + services.getRelationResolver().getRelatedOrNull(teamDef, AtsRelationTypes.AgileTeamToAtsTeam_AgileTeam); + if (agileTeamArt != null) { + agileTeam = services.getAgileService().getAgileTeam(agileTeamArt); + } + } + // attempt to get from workitem relation to sprint + if (agileTeam == null) { + ArtifactId sprintArt = + services.getRelationResolver().getRelatedOrNull(workItem, AtsRelationTypes.AgileSprintToItem_Sprint); + if (sprintArt != null) { + IAgileSprint sprint = getAgileSprint(sprintArt); + if (sprint != null) { + agileTeam = services.getAgileService().getAgileTeamFromSprint(sprint); + } + } + } + // attemp to get from workitem relation to backlog + if (agileTeam == null) { + ArtifactId backlogArt = + services.getRelationResolver().getRelatedOrNull(workItem, AtsRelationTypes.Goal_Goal); + if (backlogArt != null) { + IAgileBacklog backlog = getAgileBacklog(backlogArt); + if (backlog != null) { + agileTeam = services.getAgileService().getAgileTeamFromBacklog(backlog); + } + } + } + } + return agileTeam; + } + + @Override + public IAgileTeam getAgileTeamFromSprint(IAgileSprint sprint) { + IAgileTeam agileTeam = null; + ArtifactId agileTeamArt = + services.getRelationResolver().getRelatedOrNull(sprint, AtsRelationTypes.AgileTeamToSprint_AgileTeam); + if (agileTeamArt != null) { + agileTeam = services.getAgileService().getAgileTeam(agileTeamArt); + } + return agileTeam; + } + + @Override + public IAgileTeam getAgileTeamFromBacklog(IAgileBacklog backlog) { + IAgileTeam agileTeam = null; + ArtifactId agileBacklogArt = + services.getRelationResolver().getRelatedOrNull(backlog, AtsRelationTypes.AgileTeamToBacklog_AgileTeam); + if (agileBacklogArt != null) { + agileTeam = services.getAgileService().getAgileTeam(agileBacklogArt); + } + return agileTeam; + } + } diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/AgileTeamPointsColumn.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/AgileTeamPointsColumn.java index c63c444a52d..f4cd876f95a 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/AgileTeamPointsColumn.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/AgileTeamPointsColumn.java @@ -13,12 +13,6 @@ package org.eclipse.osee.ats.core.column; import org.eclipse.osee.ats.api.IAtsObject; import org.eclipse.osee.ats.api.IAtsServices; import org.eclipse.osee.ats.api.IAtsWorkItem; -import org.eclipse.osee.ats.api.data.AtsAttributeTypes; -import org.eclipse.osee.ats.api.data.AtsRelationTypes; -import org.eclipse.osee.framework.core.data.ArtifactToken; -import org.eclipse.osee.framework.core.data.AttributeTypeId; -import org.eclipse.osee.framework.jdk.core.util.Conditions; -import org.eclipse.osee.framework.jdk.core.util.Strings; /** * Display Points as either "ats.Points" or "ats.Points Numeric" as configured on Agile Team artifact @@ -35,24 +29,7 @@ public class AgileTeamPointsColumn extends AbstractServicesColumn { public String getText(IAtsObject atsObject) throws Exception { String result = ""; if (atsObject instanceof IAtsWorkItem) { - ArtifactToken sprintArt = - services.getRelationResolver().getRelatedOrNull(atsObject, AtsRelationTypes.AgileSprintToItem_Sprint); - Conditions.assertNotNull(sprintArt, "Sprint not found for item %s", atsObject.toStringWithId()); - if (sprintArt != null) { - ArtifactToken agileTeamArt = - services.getRelationResolver().getRelatedOrNull(sprintArt, AtsRelationTypes.AgileTeamToSprint_AgileTeam); - Conditions.assertNotNull(agileTeamArt, "Agile Team not found for Stpring %s", sprintArt.toStringWithId()); - AttributeTypeId pointsAttrType = AtsAttributeTypes.Points; - String pointsAttrTypeName = services.getAttributeResolver().getSoleAttributeValue(agileTeamArt, - AtsAttributeTypes.PointsAttributeType, ""); - if (Strings.isValid(pointsAttrTypeName)) { - AttributeTypeId type = services.getStoreService().getAttributeType(pointsAttrTypeName); - if (type.isValid()) { - pointsAttrType = type; - } - } - result = services.getAttributeResolver().getSoleAttributeValue(atsObject, pointsAttrType, ""); - } + result = services.getAgileService().getAgileTeamPointsStr((IAtsWorkItem) atsObject); } return result; } diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/AtsColumnToken.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/AtsColumnToken.java index 40c2c293bfc..690437e3860 100644 --- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/AtsColumnToken.java +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/column/AtsColumnToken.java @@ -60,8 +60,8 @@ public class AtsColumnToken { "Sprint order", 45, ColumnAlign.Left.name(), false, ColumnType.Integer, true, "Order of item within displayed sprint. Editing this field changes order.", false, false); public static AtsColumnIdValueColumn AgileTeamPointsColumn = new AtsColumnIdValueColumn(AtsColumnId.AgileTeamPoints, - "Points", 40, ColumnAlign.Left.name(), false, ColumnType.Integer, false, - "Points as defined by AgileTeam configuration. Either Points or Points Numeric", false, false); + "Agile Points", 40, ColumnAlign.Left.name(), false, ColumnType.Integer, true, + "Points as defined by AgileTeam configuration. Either ats.Points or ats.Points Numeric", false, false); public static AtsColumnIdValueColumn AgileFeatureGroupColumn = new AtsColumnIdValueColumn(AtsColumnId.AgileFeatureGroup, "Feature Group", 110, ColumnAlign.Left.name(), false, ColumnType.String, false, "Agile Feature Group for this Item", false, false); |