Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2010-09-23 23:11:44 -0400
committerRyan D. Brooks2010-09-23 23:11:44 -0400
commitba97ca6a15a004e7ab2edd98d3b5f0b6a4c68500 (patch)
tree5f69d80981fc26478a08a26661afb37a7a584dba /plugins
parent28266d0b838f24da11379cba2826715a7964154b (diff)
downloadorg.eclipse.osee-ba97ca6a15a004e7ab2edd98d3b5f0b6a4c68500.tar.gz
org.eclipse.osee-ba97ca6a15a004e7ab2edd98d3b5f0b6a4c68500.tar.xz
org.eclipse.osee-ba97ca6a15a004e7ab2edd98d3b5f0b6a4c68500.zip
feature[ats_5PN81]: Add hours spent without changing resolution
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/workflow/SMAPromptChangeStatusTest.java28
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeHoursSpent.java60
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java11
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewer.java25
4 files changed, 99 insertions, 25 deletions
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/workflow/SMAPromptChangeStatusTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/workflow/SMAPromptChangeStatusTest.java
index a8861933cc..131742addc 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/workflow/SMAPromptChangeStatusTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/workflow/SMAPromptChangeStatusTest.java
@@ -68,27 +68,26 @@ public class SMAPromptChangeStatusTest {
assertTrue(tasks.size() == 4);
- SMAPromptChangeStatus promptChangeStatus = new SMAPromptChangeStatus(tasks);
- assertTrue(promptChangeStatus.isValidToChangeStatus().isTrue());
+ assertTrue(SMAPromptChangeStatus.isValidToChangeStatus(tasks).isTrue());
// Change two to 100, 1 hr split
- promptChangeStatus.performChangeStatus(null, null, 1, 100, true, true);
+ SMAPromptChangeStatus.performChangeStatus(tasks, null, null, 1, 100, true, true);
SMATestUtil.validateSMAs(tasks, TaskStates.Completed.name(), 100, 0.25);
// Change two to 100, 1 hr split
// hours should be added to inwork state; make sure completed state isn't statused
- promptChangeStatus.performChangeStatus(null, null, 1, 100, true, true);
+ SMAPromptChangeStatus.performChangeStatus(tasks, null, null, 1, 100, true, true);
SMATestUtil.validateSMAs(tasks, TaskStates.Completed.name(), 100, 0.50);
// Change two to 99, 1 hr split
// transitions to InWork and adds hours
// make sure hours not added to completed state
- promptChangeStatus.performChangeStatus(null, null, 1, 99, true, true);
+ SMAPromptChangeStatus.performChangeStatus(tasks, null, null, 1, 99, true, true);
SMATestUtil.validateSMAs(tasks, TaskStates.InWork.name(), 99, 0.75);
// Change two to 55, 0
// no transition, no hours spent
- promptChangeStatus.performChangeStatus(null, null, 0, 55, true, true);
+ SMAPromptChangeStatus.performChangeStatus(tasks, null, null, 0, 55, true, true);
SMATestUtil.validateSMAs(tasks, TaskStates.InWork.name(), 55, 0.75);
}
@@ -103,31 +102,30 @@ public class SMAPromptChangeStatusTest {
assertTrue(tasks.size() == 4);
- SMAPromptChangeStatus promptChangeStatus = new SMAPromptChangeStatus(tasks);
- assertTrue(promptChangeStatus.isValidToChangeStatus().isTrue());
+ assertTrue(SMAPromptChangeStatus.isValidToChangeStatus(tasks).isTrue());
SimpleTaskResolutionOptionsRule optionsRule = new SimpleTaskResolutionOptionsRule();
// Change two to 100, 1 hr split
- promptChangeStatus.performChangeStatus(optionsRule.getOptions(),
+ SMAPromptChangeStatus.performChangeStatus(tasks, optionsRule.getOptions(),
SimpleTaskResolutionOptionsRule.States.Complete.name(), 1, 100, true, true);
SMATestUtil.validateSMAs(tasks, TaskStates.Completed.name(), 100, 0.25);
// Change two to 100, 1 hr split
// hours should be added to inwork state; make sure completed state isn't statused
- promptChangeStatus.performChangeStatus(optionsRule.getOptions(),
+ SMAPromptChangeStatus.performChangeStatus(tasks, optionsRule.getOptions(),
SimpleTaskResolutionOptionsRule.States.Complete.name(), 1, 100, true, true);
SMATestUtil.validateSMAs(tasks, TaskStates.Completed.name(), 100, 0.50);
// Change two to 99, 1 hr split
// transitions to InWork and adds hours
// make sure hours not added to completed state
- promptChangeStatus.performChangeStatus(optionsRule.getOptions(),
+ SMAPromptChangeStatus.performChangeStatus(tasks, optionsRule.getOptions(),
SimpleTaskResolutionOptionsRule.States.In_Work.name(), 1, 99, true, true);
SMATestUtil.validateSMAs(tasks, TaskStates.InWork.name(), 99, 0.75);
// Change two to 55, 0
// no transition, no hours spent
- promptChangeStatus.performChangeStatus(optionsRule.getOptions(),
+ SMAPromptChangeStatus.performChangeStatus(tasks, optionsRule.getOptions(),
SimpleTaskResolutionOptionsRule.States.In_Work.name(), 0, 55, true, true);
SMATestUtil.validateSMAs(tasks, TaskStates.InWork.name(), 55, 0.75);
}
@@ -146,8 +144,7 @@ public class SMAPromptChangeStatusTest {
transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Prompt Change Status Test");
cancelTask.transition(TaskStates.Cancelled.name(), (User) null, transaction, TransitionOption.Persist);
transaction.execute();
- SMAPromptChangeStatus promptChangeStatus = new SMAPromptChangeStatus(tasks);
- Result result = promptChangeStatus.isValidToChangeStatus();
+ Result result = SMAPromptChangeStatus.isValidToChangeStatus(tasks);
assertTrue(result.isFalse());
assertTrue(result.getText().contains("Can not status a cancelled"));
@@ -167,8 +164,7 @@ public class SMAPromptChangeStatusTest {
transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Prompt Change Status Test");
taskArt.setSoleAttributeValue(AtsAttributeTypes.RelatedToState, DefaultTeamState.Analyze.name());
transaction.execute();
- SMAPromptChangeStatus promptChangeStatus = new SMAPromptChangeStatus(tasks);
- Result result = promptChangeStatus.isValidToChangeStatus();
+ Result result = SMAPromptChangeStatus.isValidToChangeStatus(tasks);
assertTrue(result.isFalse());
assertTrue(result.getText().contains("Task work must be done in"));
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeHoursSpent.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeHoursSpent.java
new file mode 100644
index 0000000000..8ddbdac357
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeHoursSpent.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.editor;
+
+import java.util.Arrays;
+import java.util.Collection;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.util.widgets.dialog.TaskOptionStatusDialog;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class SMAPromptChangeHoursSpent {
+
+ private final Collection<? extends StateMachineArtifact> smas;
+
+ public SMAPromptChangeHoursSpent(StateMachineArtifact sma) {
+ this(Arrays.asList(sma));
+ }
+
+ public SMAPromptChangeHoursSpent(final Collection<? extends StateMachineArtifact> smas) {
+ this.smas = smas;
+ }
+
+ public static boolean promptChangeStatus(Collection<? extends StateMachineArtifact> smas, boolean persist) throws OseeCoreException {
+ SMAPromptChangeHoursSpent promptChangeStatus = new SMAPromptChangeHoursSpent(smas);
+ return promptChangeStatus.promptChangeStatus(persist).isTrue();
+ }
+
+ public Result promptChangeStatus(boolean persist) throws OseeCoreException {
+ Result result = SMAPromptChangeStatus.isValidToChangeStatus(smas);
+ if (result.isFalse()) {
+ result.popup();
+ return result;
+ }
+
+ TaskOptionStatusDialog tsd =
+ new TaskOptionStatusDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ "Enter State Hours Spend", "Enter number of hours you spent since last status.", false, null, smas);
+ if (tsd.open() == 0) {
+ SMAPromptChangeStatus.performChangeStatus(smas, null,
+ tsd.getSelectedOptionDef() != null ? tsd.getSelectedOptionDef().getName() : null,
+ tsd.getHours().getFloat(), tsd.getPercent().getInt(), tsd.isSplitHours(), persist);
+ return Result.TrueResult;
+ }
+ return Result.FalseResult;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java
index 68916d450e..72e33f298c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAPromptChangeStatus.java
@@ -46,8 +46,8 @@ public class SMAPromptChangeStatus {
return promptChangeStatus.promptChangeStatus(persist).isTrue();
}
- public Result isValidToChangeStatus() throws OseeCoreException {
- // Don't allow statusing for any cancelled tasks
+ public static Result isValidToChangeStatus(Collection<? extends StateMachineArtifact> smas) throws OseeCoreException {
+ // Don't allow statusing for any canceled tasks
for (StateMachineArtifact sma : smas) {
if (sma.isCancelled()) {
String error =
@@ -76,7 +76,7 @@ public class SMAPromptChangeStatus {
}
public Result promptChangeStatus(boolean persist) throws OseeCoreException {
- Result result = isValidToChangeStatus();
+ Result result = isValidToChangeStatus(smas);
if (result.isFalse()) {
result.popup();
return result;
@@ -95,14 +95,15 @@ public class SMAPromptChangeStatus {
"Select resolution, enter percent complete and number of hours you spent since last status.", true,
options, smas);
if (tsd.open() == 0) {
- performChangeStatus(options, tsd.getSelectedOptionDef() != null ? tsd.getSelectedOptionDef().getName() : null,
+ performChangeStatus(smas, options,
+ tsd.getSelectedOptionDef() != null ? tsd.getSelectedOptionDef().getName() : null,
tsd.getHours().getFloat(), tsd.getPercent().getInt(), tsd.isSplitHours(), persist);
return Result.TrueResult;
}
return Result.FalseResult;
}
- public void performChangeStatus(List<TaskResOptionDefinition> options, String selectedOption, double hours, int percent, boolean splitHours, boolean persist) throws OseeCoreException {
+ public static void performChangeStatus(Collection<? extends StateMachineArtifact> smas, List<TaskResOptionDefinition> options, String selectedOption, double hours, int percent, boolean splitHours, boolean persist) throws OseeCoreException {
if (splitHours) {
hours = hours / smas.size();
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewer.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewer.java
index e325e64115..47a70fef85 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewer.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/task/TaskXViewer.java
@@ -22,6 +22,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
import org.eclipse.osee.ats.artifact.AtsAttributeTypes;
import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.editor.SMAPromptChangeHoursSpent;
import org.eclipse.osee.ats.editor.SMAPromptChangeStatus;
import org.eclipse.osee.ats.internal.AtsPlugin;
import org.eclipse.osee.ats.util.PromptChangeUtil;
@@ -118,8 +119,8 @@ public class TaskXViewer extends WorldXViewer {
return false;
}
- Action editTaskTitleAction, editTaskAssigneesAction, editTaskStatusAction, editTaskResolutionAction,
- editTaskEstimateAction, editTaskRelatedStateAction, editTaskNotesAction;
+ Action editTaskTitleAction, editTaskAssigneesAction, editTaskStatusAction, editTaskHoursSpentAction,
+ editTaskResolutionAction, editTaskEstimateAction, editTaskRelatedStateAction, editTaskNotesAction;
Action addNewTaskAction, deleteTasksAction;
Action showRelatedAction;
@@ -172,6 +173,20 @@ public class TaskXViewer extends WorldXViewer {
}
};
+ editTaskHoursSpentAction = new Action("Edit Task Hours Spent", IAction.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ try {
+ if (SMAPromptChangeHoursSpent.promptChangeStatus(getSelectedTaskArtifacts(), false)) {
+ editor.onDirtied();
+ update(getSelectedTaskArtifacts().toArray(), null);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, OseeLevel.SEVERE_POPUP, ex);
+ }
+ }
+ };
+
editTaskResolutionAction = new Action("Edit Task Resolution", IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
@@ -274,6 +289,9 @@ public class TaskXViewer extends WorldXViewer {
mm.insertBefore(WorldXViewer.MENU_GROUP_ATS_WORLD_EDIT, editTaskStatusAction);
editTaskStatusAction.setEnabled(isTasksEditable() && getSelectedArtifacts().size() > 0);
+ mm.insertBefore(WorldXViewer.MENU_GROUP_ATS_WORLD_EDIT, editTaskHoursSpentAction);
+ editTaskHoursSpentAction.setEnabled(isTasksEditable() && getSelectedArtifacts().size() > 0);
+
if (!isUsingTaskResolutionOptions()) {
mm.insertBefore(WorldXViewer.MENU_GROUP_ATS_WORLD_EDIT, editTaskResolutionAction);
editTaskResolutionAction.setEnabled(isTasksEditable() && getSelectedArtifacts().size() > 0 && isSelectedTaskArtifactsAreInWork());
@@ -306,8 +324,7 @@ public class TaskXViewer extends WorldXViewer {
public boolean handleChangeResolution() throws OseeCoreException {
// Ensure tasks are related to current state of workflow
- SMAPromptChangeStatus promptChangeStatus = new SMAPromptChangeStatus(getSelectedTaskArtifacts());
- Result result = promptChangeStatus.isValidToChangeStatus();
+ Result result = SMAPromptChangeStatus.isValidToChangeStatus(getSelectedTaskArtifacts());
if (result.isFalse()) {
return false;
}

Back to the top