Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshawn.f.cook2012-06-05 19:53:06 +0000
committerRoberto E. Escobar2012-06-05 19:53:06 +0000
commit908fc9ac6865feee46755d793a8868d0e3e8c2a7 (patch)
tree0d4d044d5ef03ad2ccc13b544f5b908d082a0133 /plugins/org.eclipse.osee.ats.core.client/src
parent3d35f510c17f3a68fd53ce7b93ba4a1202eb4473 (diff)
downloadorg.eclipse.osee-908fc9ac6865feee46755d793a8868d0e3e8c2a7.tar.gz
org.eclipse.osee-908fc9ac6865feee46755d793a8868d0e3e8c2a7.tar.xz
org.eclipse.osee-908fc9ac6865feee46755d793a8868d0e3e8c2a7.zip
feature[ats_3J3F2]: Create CreateTasksOperation class
Diffstat (limited to 'plugins/org.eclipse.osee.ats.core.client/src')
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/CreateTasksOperation.java190
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/ExecuteTaskOpList.java35
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/GenerateTaskOpList.java99
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/ITaskOperation.java23
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/ITaskTitleProvider.java18
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskEnum.java19
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskMetadata.java44
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskOpCreate.java51
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskOpModify.java41
9 files changed, 520 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/CreateTasksOperation.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/CreateTasksOperation.java
new file mode 100644
index 00000000000..06e0cae7a91
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/CreateTasksOperation.java
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.client.task.createtasks;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.osee.ats.api.data.AtsRelationTypes;
+import org.eclipse.osee.ats.core.client.action.ActionManager;
+import org.eclipse.osee.ats.core.client.config.ActionableItemArtifact;
+import org.eclipse.osee.ats.core.client.config.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.core.client.config.TeamDefinitionManagerCore;
+import org.eclipse.osee.ats.core.client.internal.Activator;
+import org.eclipse.osee.ats.core.client.team.CreateTeamOption;
+import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.core.client.util.AtsUsersClient;
+import org.eclipse.osee.ats.core.client.util.AtsUtilCore;
+import org.eclipse.osee.ats.core.client.version.VersionArtifact;
+import org.eclipse.osee.ats.core.client.workflow.ActionableItemManagerCore;
+import org.eclipse.osee.ats.core.model.IAtsUser;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.operation.AbstractOperation;
+import org.eclipse.osee.framework.core.operation.OperationLogger;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.revision.ChangeData;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
+
+/**
+ * @author Shawn F. Cook
+ */
+public class CreateTasksOperation extends AbstractOperation {
+ //QUESTION: Do we need either of theses commit* objects?
+ // private final IAtsProgram commitProgram;
+ // private final VersionArtifact commitVersion;
+ private final VersionArtifact destVersion;
+ private final ActionableItemArtifact actionableItemArt;
+ private final ChangeData changeData;
+ private final TeamWorkFlowArtifact reqTeamWf;
+ private final boolean reportOnly;
+ private SkynetTransaction transaction;
+ private final ITaskTitleProvider taskTitleProvider;
+
+ public CreateTasksOperation(VersionArtifact destinationVersion, ActionableItemArtifact actionableItemArt, ChangeData changeData, TeamWorkFlowArtifact reqTeamWf, boolean reportOnly, SkynetTransaction transaction, OperationLogger logger, ITaskTitleProvider taskTitleProvider) {
+ super("Create Tasks Operation for [" + reqTeamWf.getName() + "]", Activator.PLUGIN_ID, logger);
+ this.destVersion = destinationVersion;
+ this.actionableItemArt = actionableItemArt;
+ this.changeData = changeData;
+ this.reqTeamWf = reqTeamWf;
+ this.reportOnly = reportOnly;
+ this.transaction = transaction;
+ this.taskTitleProvider = taskTitleProvider;
+ }
+
+ private Map<TaskEnum, ITaskOperation> createReportOnlyTaskOperationMap() {
+ Map<TaskEnum, ITaskOperation> toReturn = new HashMap<TaskEnum, ITaskOperation>();
+
+ toReturn.put(TaskEnum.CREATE, new TaskOpCreate(taskTitleProvider));
+ toReturn.put(TaskEnum.MODIFY, new TaskOpModify());
+
+ return toReturn;
+ }
+
+ private Map<TaskEnum, ITaskOperation> createTaskOperationMap() {
+ Map<TaskEnum, ITaskOperation> toReturn = new HashMap<TaskEnum, ITaskOperation>();
+
+ toReturn.put(TaskEnum.CREATE, new TaskOpCreate(taskTitleProvider));
+ toReturn.put(TaskEnum.MODIFY, new TaskOpModify());
+
+ return toReturn;
+ }
+
+ public static interface StatusCollector {
+
+ void onStatus(IStatus status, TaskMetadata metadata);
+
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+
+ //Initialize the TaskEnum->TaskOperation map
+ Map<TaskEnum, ITaskOperation> ops = null;
+ if (reportOnly) {
+ ops = createReportOnlyTaskOperationMap();
+ } else {
+ ops = createTaskOperationMap();
+ }
+
+ // Ensure the destination workflow exists. - destTeamWf is only necessary if NOT reportOnly
+ TeamWorkFlowArtifact destTeamWf =
+ ensureDestTeamWfExists(reqTeamWf, actionableItemArt, destVersion, transaction, reportOnly);
+ if (destTeamWf == null) {
+ String msg = "CreateTasksOperation: Failed to create new team workflow for [" + reqTeamWf.getName() + "]";
+ OseeLog.log(Activator.class, Level.SEVERE, msg);
+ }
+
+ // Generate list of metadatas
+ GenerateTaskOpList generateTaskOpList = new GenerateTaskOpList();
+ List<TaskMetadata> metadatas = generateTaskOpList.generate(changeData, destTeamWf);
+
+ // Execute taskOps
+ ExecuteTaskOpList executeTaskOpList = new ExecuteTaskOpList();
+ Map<TaskMetadata, IStatus> statusMap = executeTaskOpList.execute(metadatas, ops);
+
+ if (!reportOnly) {
+ if (transaction == null) {
+ transaction =
+ TransactionManager.createTransaction(AtsUtilCore.getAtsBranch(), "Auto-create tasks for " + reqTeamWf);
+ }
+ transaction.execute();
+ }
+
+ //TODO: Need to provide a status report (somehow) back to calling code
+ }
+
+ private TeamWorkFlowArtifact findDestTeamWf(TeamWorkFlowArtifact reqTeamWf, ActionableItemArtifact actionableItemArt, VersionArtifact destVersion) throws OseeCoreException {
+ TeamWorkFlowArtifact destTeamWf = null;
+ TeamDefinitionArtifact teamDef =
+ TeamDefinitionManagerCore.getImpactedTeamDefs(Collections.singleton(actionableItemArt)).iterator().next();
+ List<Artifact> deriveToArts = reqTeamWf.getRelatedArtifacts(AtsRelationTypes.Derive_To);
+ for (Artifact derivedArt : deriveToArts) {
+ TeamWorkFlowArtifact derivedTeamWfArt = null;
+ if (derivedArt instanceof TeamWorkFlowArtifact) {
+ //TODO: WRONG! - Need to make use of destVersion
+ derivedTeamWfArt = (TeamWorkFlowArtifact) derivedArt;
+ TeamDefinitionArtifact teamDefFromArt = derivedTeamWfArt.getTeamDefinition();
+ ActionableItemManagerCore actionableItemsDamFromArt = derivedTeamWfArt.getActionableItemsDam();
+ boolean isTeamDef = teamDefFromArt.equals(teamDef);
+ boolean isAia = actionableItemsDamFromArt.getActionableItems().contains(actionableItemArt);
+ if (isTeamDef && isAia) {
+ destTeamWf = derivedTeamWfArt;
+ break;
+ }
+ } else {
+ OseeLog.log(
+ Activator.class,
+ Level.WARNING,
+ "GenerateTaskOperationMetaData.findDestTeamWf(): Artifact in Derive_To relationship found that is not of type TeamWorkFlowArtifact. Derive_From:" + reqTeamWf.getArtId() + " Derive_To:" + derivedArt.getArtId());
+ }
+ }
+
+ return destTeamWf;
+ }
+
+ /**
+ * Get the team workflow related to the teamWf parameter via the 'derived from' relationship that is also targeted
+ * for the version parameter. If such a workflow does not exist then return null.
+ *
+ * @throws OseeCoreException
+ */
+ private TeamWorkFlowArtifact ensureDestTeamWfExists(TeamWorkFlowArtifact reqTeamWf, ActionableItemArtifact actionableItemArt, VersionArtifact destVersion, SkynetTransaction transaction, boolean reportOnly) throws OseeCoreException {
+ Date createdDate = new Date();
+ IAtsUser createdBy = AtsUsersClient.getUser();
+
+ TeamWorkFlowArtifact destTeamWf = findDestTeamWf(reqTeamWf, actionableItemArt, destVersion);
+
+ if (destTeamWf == null && !reportOnly) {
+ Artifact actionArt = reqTeamWf.getParentActionArtifact();
+ TeamDefinitionArtifact teamDef =
+ TeamDefinitionManagerCore.getImpactedTeamDefs(Collections.singleton(actionableItemArt)).iterator().next();
+
+ destTeamWf =
+ ActionManager.createTeamWorkflow(actionArt, teamDef, Collections.singleton(actionableItemArt),
+ Arrays.asList(AtsUsersClient.getUser()), transaction, createdDate, createdBy, null,
+ CreateTeamOption.Duplicate_If_Exists);
+ if (destTeamWf != null) {
+ destTeamWf.setRelations(AtsRelationTypes.TeamWorkflowTargetedForVersion_Version,
+ Collections.singleton(destVersion));
+ }
+ }
+ return destTeamWf;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/ExecuteTaskOpList.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/ExecuteTaskOpList.java
new file mode 100644
index 00000000000..a819be2ba4d
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/ExecuteTaskOpList.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.client.task.createtasks;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Shawn F. Cook
+ */
+public class ExecuteTaskOpList {
+ public Map<TaskMetadata, IStatus> execute(List<TaskMetadata> metadatas, Map<TaskEnum, ITaskOperation> ops) throws OseeCoreException {
+ Map<TaskMetadata, IStatus> statusMap = new HashMap<TaskMetadata, IStatus>();
+
+ for (TaskMetadata metadata : metadatas) {
+ ITaskOperation operation = ops.get(metadata.getTaskEnum());
+ IStatus status = operation.execute(metadata);
+ statusMap.put(metadata, status);
+ }
+
+ return statusMap;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/GenerateTaskOpList.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/GenerateTaskOpList.java
new file mode 100644
index 00000000000..dc006ade8c4
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/GenerateTaskOpList.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.client.task.createtasks;
+
+import java.rmi.activation.Activator;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.ats.core.client.task.TaskArtifact;
+import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.change.Change;
+import org.eclipse.osee.framework.skynet.core.revision.ChangeData;
+
+/**
+ * @author Shawn F. Cook
+ */
+public class GenerateTaskOpList {
+
+ /**
+ * Generate an ordered list of TaskMetadata objects which can be used to create or modify tasks based on the
+ * following criteria:
+ * <ul>
+ * <li>If task doesn't exist yet for a change then create it</li>
+ * <li>If task DOES exist but no change exists for the task, then modify the task note attribute to reflect this</li>
+ * </ul>
+ * If destTeamWf is NULL then all tasks will be CREATE.
+ */
+ public List<TaskMetadata> generate(ChangeData changeData, TeamWorkFlowArtifact destTeamWf) throws OseeCoreException {
+ List<TaskMetadata> metadatas = new ArrayList<TaskMetadata>();
+
+ // If task doesn't exist yet for a change then create it
+ for (Change change : changeData.getChanges()) {
+ TaskArtifact taskArt = findTaskArtifactFor(change, destTeamWf);
+ if (taskArt == null) {
+ metadatas.add(new TaskMetadata(destTeamWf, taskArt, TaskEnum.CREATE));
+ }
+ }
+
+ if (destTeamWf != null) {
+ // If task DOES exist but no change exists for the task, then modify the task note attribute to reflect this
+ for (TaskArtifact taskArt : destTeamWf.getTaskArtifacts()) {
+ Change change = findChangeFor(taskArt, changeData);
+ if (change == null) {
+ metadatas.add(new TaskMetadata(destTeamWf, taskArt, TaskEnum.MODIFY));
+ }
+ }
+ }
+
+ return metadatas;
+ }
+
+ private TaskArtifact findTaskArtifactFor(Change change, TeamWorkFlowArtifact destTeamWf) throws OseeCoreException {
+ if (destTeamWf == null) {
+ return null;
+ }
+ for (TaskArtifact taskArt : destTeamWf.getTaskArtifacts()) {
+ //TODO: Utilize the new TaskArt->Artifact unidirectional relationship to find a task artifact for the changed artifact
+ }
+ return null;
+ }
+
+ private Change findChangeFor(TaskArtifact taskArt, ChangeData changeData) throws OseeCoreException {
+ Change retChange = null;
+
+ if (taskArt == null) {
+ return null;
+ }
+ //TODO: Utilize the new TaskArt->Artifact unidirectional relationship to find a task artifact for the changed artifact
+ Artifact associatedArt = null;
+
+ if (associatedArt == null) {
+ OseeLog.log(
+ Activator.class,
+ Level.WARNING,
+ "GenerateTaskOpList.findChangeFor() - WARNING: Task's associated Artifact is NULL. Task:" + taskArt.getGuid());
+ } else {
+ for (Change change : changeData.getChanges()) {
+ Artifact changeArt = change.getChangeArtifact();
+ if (changeArt.equals(associatedArt)) {
+ retChange = change;
+ break;
+ }
+ }
+ }
+
+ return retChange;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/ITaskOperation.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/ITaskOperation.java
new file mode 100644
index 00000000000..802e9f032f9
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/ITaskOperation.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.client.task.createtasks;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Shawn F. Cook
+ */
+public interface ITaskOperation {
+ public final static String AUTO_GENERATED_STATIC_ID = "taskAutoGen";
+
+ IStatus execute(TaskMetadata metadata) throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/ITaskTitleProvider.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/ITaskTitleProvider.java
new file mode 100644
index 00000000000..83f44b6406b
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/ITaskTitleProvider.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.client.task.createtasks;
+
+/**
+ * @author Shawn F. Cook
+ */
+public interface ITaskTitleProvider {
+ public String getTaskTitle(TaskMetadata metadata);
+}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskEnum.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskEnum.java
new file mode 100644
index 00000000000..98100256093
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskEnum.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.client.task.createtasks;
+
+/**
+ * @author Shawn F. Cook
+ */
+public enum TaskEnum {
+ CREATE,
+ MODIFY;
+}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskMetadata.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskMetadata.java
new file mode 100644
index 00000000000..69976a81e5f
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskMetadata.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.client.task.createtasks;
+
+import org.eclipse.osee.ats.core.client.task.TaskArtifact;
+import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
+
+/**
+ * @author Shawn F. Cook
+ */
+public class TaskMetadata {
+
+ private final TeamWorkFlowArtifact parentTeamWf;
+ private final TaskArtifact taskArtifact;
+ private final TaskEnum taskEnum;
+
+ public TaskMetadata(TeamWorkFlowArtifact parentWorkflow, TaskArtifact taskArtifact, TaskEnum taskEnum) {
+ super();
+ this.parentTeamWf = parentWorkflow;
+ this.taskArtifact = taskArtifact;
+ this.taskEnum = taskEnum;
+ }
+
+ public TeamWorkFlowArtifact getParentTeamWf() {
+ return parentTeamWf;
+ }
+
+ public TaskArtifact getTaskArtifact() {
+ return taskArtifact;
+ }
+
+ public TaskEnum getTaskEnum() {
+ return taskEnum;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskOpCreate.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskOpCreate.java
new file mode 100644
index 00000000000..7a2323e993a
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskOpCreate.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.client.task.createtasks;
+
+import java.util.Arrays;
+import java.util.Date;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.core.client.task.TaskArtifact;
+import org.eclipse.osee.ats.core.client.team.TeamState;
+import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.core.users.AtsUsers;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Shawn F. Cook
+ */
+public class TaskOpCreate implements ITaskOperation {
+ private final ITaskTitleProvider taskTitleProvider;
+
+ public TaskOpCreate(ITaskTitleProvider taskTitleProvider) {
+ super();
+ this.taskTitleProvider = taskTitleProvider;
+ }
+
+ @Override
+ public IStatus execute(TaskMetadata metadata) throws OseeCoreException {
+ TeamWorkFlowArtifact parentTeamWf = metadata.getParentTeamWf();
+ String taskTitle = taskTitleProvider.getTaskTitle(metadata);
+ Date creationDate = new Date();
+ TaskArtifact taskArt =
+ parentTeamWf.createNewTask(Arrays.asList(AtsUsers.getUnAssigned()), taskTitle, creationDate,
+ AtsUsers.getSystemUser());
+
+ // create for Implement state regardless of which state workflow is in
+ taskArt.setSoleAttributeValue(AtsAttributeTypes.RelatedToState, TeamState.Implement.getPageName());
+ taskArt.setSingletonAttributeValue(CoreAttributeTypes.StaticId, AUTO_GENERATED_STATIC_ID);
+ return Status.OK_STATUS;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskOpModify.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskOpModify.java
new file mode 100644
index 00000000000..9d3ff321054
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/task/createtasks/TaskOpModify.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.core.client.task.createtasks;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.core.client.task.TaskArtifact;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+
+/**
+ * @author Shawn F. Cook
+ */
+public class TaskOpModify implements ITaskOperation {
+ private static final String NO_MATCHING_CHANGE_REPORT_ARTIFACT = "No Match to Change Report Artifact; ";
+
+ @Override
+ public IStatus execute(TaskMetadata metadata) throws OseeCoreException {
+ TaskArtifact taskArt = metadata.getTaskArtifact();
+ String currentNoteValue = taskArt.getSoleAttributeValueAsString(AtsAttributeTypes.SmaNote, "");
+ if (!currentNoteValue.contains(NO_MATCHING_CHANGE_REPORT_ARTIFACT)) {
+ // append the flag to the Notes Field
+ taskArt.setSoleAttributeFromString(AtsAttributeTypes.SmaNote,
+ NO_MATCHING_CHANGE_REPORT_ARTIFACT + currentNoteValue);
+ // need to remove the static Id and allow user to delete these
+ if (taskArt.getAttributesToStringList(CoreAttributeTypes.StaticId).contains(AUTO_GENERATED_STATIC_ID)) {
+ taskArt.deleteSingletonAttributeValue(CoreAttributeTypes.StaticId, AUTO_GENERATED_STATIC_ID);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+}

Back to the top