Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2010-10-05 17:59:34 -0400
committerRyan D. Brooks2010-10-05 17:59:34 -0400
commit710024f31226a9ccdd414514d66c939f5d3a9940 (patch)
tree2837e7b4170d40038667886aebe22df261dec464 /plugins/org.eclipse.osee.coverage
parent503ab3dbf5a967df13167bc181f6c31892b3d7ed (diff)
downloadorg.eclipse.osee-710024f31226a9ccdd414514d66c939f5d3a9940.tar.gz
org.eclipse.osee-710024f31226a9ccdd414514d66c939f5d3a9940.tar.xz
org.eclipse.osee-710024f31226a9ccdd414514d66c939f5d3a9940.zip
bug: Enable coverage package to cross branch link to ATS for work products
Diffstat (limited to 'plugins/org.eclipse.osee.coverage')
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/CreateWorkProductTaskAction.java2
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/OpenWorkProductTaskAction.java4
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/RemoveWorkProductTaskAction.java4
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorInput.java3
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorWorkProductTab.java13
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java12
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java16
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/IWorkProductRelatable.java4
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/IWorkProductTaskProvider.java3
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/SimpleWorkProductTaskProvider.java5
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/WorkProductAction.java5
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/CoverageAttributeTypes.java3
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/DbWorkProductTaskProvider.java60
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoveragePackageStore.java4
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoverageUnitStore.java6
-rw-r--r--plugins/org.eclipse.osee.coverage/support/OseeTypes_Coverage.osee12
16 files changed, 107 insertions, 49 deletions
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/CreateWorkProductTaskAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/CreateWorkProductTaskAction.java
index f57a1cd096..3cc8cad60b 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/CreateWorkProductTaskAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/CreateWorkProductTaskAction.java
@@ -116,7 +116,7 @@ public class CreateWorkProductTaskAction extends Action {
for (ICoverage coverage : relateableCoverageItems) {
if (coverage instanceof IWorkProductRelatable) {
- ((IWorkProductRelatable) coverage).setWorkProductGuid(newTaskArt.getGuid());
+ ((IWorkProductRelatable) coverage).setWorkProductTaskGuid(newTaskArt.getGuid());
}
}
newTaskArt.persist(getText());
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/OpenWorkProductTaskAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/OpenWorkProductTaskAction.java
index 97318bf897..b15be94af6 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/OpenWorkProductTaskAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/OpenWorkProductTaskAction.java
@@ -68,8 +68,8 @@ public class OpenWorkProductTaskAction extends Action {
final List<String> workProductGuids = new ArrayList<String>();
for (ICoverage coverage : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (coverage instanceof IWorkProductRelatable && Strings.isValid(((IWorkProductRelatable) coverage).getWorkProductGuid())) {
- workProductGuids.add(((IWorkProductRelatable) coverage).getWorkProductGuid());
+ if (coverage instanceof IWorkProductRelatable && Strings.isValid(((IWorkProductRelatable) coverage).getWorkProductTaskGuid())) {
+ workProductGuids.add(((IWorkProductRelatable) coverage).getWorkProductTaskGuid());
}
}
if (workProductGuids.isEmpty()) {
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/RemoveWorkProductTaskAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/RemoveWorkProductTaskAction.java
index c8fb82a9b0..192dae9c1c 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/RemoveWorkProductTaskAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/action/RemoveWorkProductTaskAction.java
@@ -64,7 +64,7 @@ public class RemoveWorkProductTaskAction extends Action {
List<ICoverage> relatedCoverageItems = new ArrayList<ICoverage>();
for (ICoverage coverage : selectedCoverageEditorItem.getSelectedCoverageEditorItems()) {
- if (coverage instanceof IWorkProductRelatable && Strings.isValid(((IWorkProductRelatable) coverage).getWorkProductGuid())) {
+ if (coverage instanceof IWorkProductRelatable && Strings.isValid(((IWorkProductRelatable) coverage).getWorkProductTaskGuid())) {
relatedCoverageItems.add(coverage);
}
}
@@ -78,7 +78,7 @@ public class RemoveWorkProductTaskAction extends Action {
try {
for (ICoverage coverage : relatedCoverageItems) {
if (coverage instanceof IWorkProductRelatable) {
- ((IWorkProductRelatable) coverage).setWorkProductGuid("");
+ ((IWorkProductRelatable) coverage).setWorkProductTaskGuid("");
}
}
saveable.save(relatedCoverageItems);
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorInput.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorInput.java
index 7a51eba078..b1b89ec08a 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorInput.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorInput.java
@@ -119,6 +119,9 @@ public class CoverageEditorInput implements IEditorInput {
} else if (!coveragePackageArtifact.equals(other.coveragePackageArtifact)) {
return false;
}
+ if (coveragePackageArtifact.equals(other.getCoveragePackageArtifact())) {
+ return true;
+ }
if (coveragePackageBase == null) {
if (other.coveragePackageBase != null) {
return false;
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorWorkProductTab.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorWorkProductTab.java
index 3fbac46d4e..a47c6e96d5 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorWorkProductTab.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/editor/CoverageEditorWorkProductTab.java
@@ -11,6 +11,8 @@ package org.eclipse.osee.coverage.editor;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.osee.coverage.action.OpenMultipleWorkProductsAction;
@@ -24,7 +26,6 @@ import org.eclipse.osee.coverage.store.OseeCoveragePackageStore;
import org.eclipse.osee.coverage.util.CoverageUtil;
import org.eclipse.osee.coverage.util.ISaveable;
import org.eclipse.osee.coverage.util.WorkProductActionLabelProvider;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.jdk.core.util.DateUtil;
@@ -116,23 +117,21 @@ public class CoverageEditorWorkProductTab extends FormPage implements ISaveable
@Override
public void performArtifactDrop(Artifact[] dropArtifacts) {
super.performArtifactDrop(dropArtifacts);
+ Set<WorkProductAction> workProductActions = new HashSet<WorkProductAction>();
for (Artifact artifact : dropArtifacts) {
if (!artifact.isOfType(SkynetGuiPlugin.getInstance().getOseeCmService().getPcrArtifactType())) {
AWorkbench.popup("Related artifact must be a Team Workflow");
return;
}
+ // set completed to false; will be reloaded on save anyway
+ workProductActions.add(new WorkProductAction(artifact, false));
}
try {
if (coverageEditor.getBranch() == null) {
AWorkbench.popup("Coverage Package must have imports before work package applied");
return;
}
- OseeCoveragePackageStore store =
- OseeCoveragePackageStore.get(coveragePackage, coverageEditor.getBranch());
- for (Artifact artifact : dropArtifacts) {
- store.getArtifact(false).addRelation(CoreRelationTypes.SupportingInfo_SupportingInfo, artifact);
- }
- store.getArtifact(false).persist("Relate Coverage work product Actions");
+ coveragePackage.getWorkProductTaskProvider().addWorkProductAction(workProductActions);
refresh();
} catch (OseeCoreException ex) {
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java
index 2ad36aa894..abc94f1efe 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageItem.java
@@ -88,7 +88,7 @@ public class CoverageItem extends NamedIdentity implements ICoverage, IWorkProdu
toItem.setOrderNumber(fromItem.getOrderNumber());
toItem.setRationale(fromItem.getRationale());
toItem.setTestUnitProvider(fromItem.getTestUnitProvider());
- toItem.setWorkProductGuid(fromItem.getWorkProductGuid());
+ toItem.setWorkProductTaskGuid(fromItem.getWorkProductTaskGuid());
toItem.setWorkProductTask(fromItem.getWorkProductTask());
}
@@ -265,8 +265,8 @@ public class CoverageItem extends NamedIdentity implements ICoverage, IWorkProdu
if (Strings.isValid(store.get("rationale"))) {
setRationale(store.get("rationale"));
}
- if (Strings.isValid(store.get("workProductGuid"))) {
- setWorkProductGuid(store.get("workProductGuid"));
+ if (Strings.isValid(store.get("workProductTaskGuid"))) {
+ setWorkProductTaskGuid(store.get("workProductTaskGuid"));
}
if (testUnitProvider == null) {
testUnitProvider = new SimpleTestUnitProvider();
@@ -291,7 +291,7 @@ public class CoverageItem extends NamedIdentity implements ICoverage, IWorkProdu
store.put("order", orderNumber);
}
if (Strings.isValid(workProductGuid)) {
- store.put("workProductGuid", workProductGuid);
+ store.put("workProductTaskGuid", workProductGuid);
}
store.put("methodType", coverageMethod.getName());
if (testUnitProvider != null) {
@@ -327,12 +327,12 @@ public class CoverageItem extends NamedIdentity implements ICoverage, IWorkProdu
}
@Override
- public String getWorkProductGuid() {
+ public String getWorkProductTaskGuid() {
return workProductGuid;
}
@Override
- public void setWorkProductGuid(String workProductGuid) {
+ public void setWorkProductTaskGuid(String workProductGuid) {
this.workProductGuid = workProductGuid;
}
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java
index 44f20926a3..d1c0f0b0f8 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/CoverageUnit.java
@@ -39,7 +39,7 @@ public class CoverageUnit extends NamedIdentity implements IWorkProductRelatable
final List<CoverageItem> coverageItems = new ArrayList<CoverageItem>();
String location;
String orderNumber = "";
- String workProductGuid;
+ String workProductTaskGuid;
WorkProductTask workProductTask;
final List<CoverageUnit> coverageUnits = new ArrayList<CoverageUnit>();
ICoverage parent;
@@ -293,7 +293,7 @@ public class CoverageUnit extends NamedIdentity implements IWorkProductRelatable
coverageUnit.setOrderNumber(orderNumber);
coverageUnit.setFolder(folder);
coverageUnit.setAssignees(assignees);
- coverageUnit.setWorkProductGuid(workProductGuid);
+ coverageUnit.setWorkProductTaskGuid(workProductTaskGuid);
coverageUnit.setLocation(location);
if (includeItems) {
for (CoverageItem coverageItem : coverageItems) {
@@ -362,20 +362,20 @@ public class CoverageUnit extends NamedIdentity implements IWorkProductRelatable
if (getWorkProductTask() != null) {
return getWorkProductTask().toString();
}
- if (Strings.isValid(workProductGuid)) {
- return "Task Not Found: " + workProductGuid;
+ if (Strings.isValid(workProductTaskGuid)) {
+ return "Task Not Found: " + workProductTaskGuid;
}
return "";
}
@Override
- public String getWorkProductGuid() {
- return workProductGuid;
+ public String getWorkProductTaskGuid() {
+ return workProductTaskGuid;
}
@Override
- public void setWorkProductGuid(String workProductGuid) {
- this.workProductGuid = workProductGuid;
+ public void setWorkProductTaskGuid(String workProductTaskGuid) {
+ this.workProductTaskGuid = workProductTaskGuid;
}
@Override
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/IWorkProductRelatable.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/IWorkProductRelatable.java
index a006bf6728..6137f942ae 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/IWorkProductRelatable.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/IWorkProductRelatable.java
@@ -7,9 +7,9 @@ package org.eclipse.osee.coverage.model;
public interface IWorkProductRelatable {
- public String getWorkProductGuid();
+ public String getWorkProductTaskGuid();
- public void setWorkProductGuid(String workProductGuid);
+ public void setWorkProductTaskGuid(String workProductGuid);
public WorkProductTask getWorkProductTask();
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/IWorkProductTaskProvider.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/IWorkProductTaskProvider.java
index 3f462b8a90..27031f6145 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/IWorkProductTaskProvider.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/IWorkProductTaskProvider.java
@@ -5,6 +5,7 @@
*/
package org.eclipse.osee.coverage.model;
+import java.util.Collection;
import java.util.List;
public interface IWorkProductTaskProvider {
@@ -13,7 +14,7 @@ public interface IWorkProductTaskProvider {
public void removeWorkProductAction(WorkProductAction action);
- public void addWorkProductAction(WorkProductAction action);
+ public void addWorkProductAction(Collection<WorkProductAction> actions);
public List<WorkProductTask> getWorkProductTasks();
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/SimpleWorkProductTaskProvider.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/SimpleWorkProductTaskProvider.java
index 27f451699f..4794ee67dd 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/SimpleWorkProductTaskProvider.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/SimpleWorkProductTaskProvider.java
@@ -6,6 +6,7 @@
package org.eclipse.osee.coverage.model;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
public class SimpleWorkProductTaskProvider implements IWorkProductTaskProvider {
@@ -24,8 +25,8 @@ public class SimpleWorkProductTaskProvider implements IWorkProductTaskProvider {
}
@Override
- public void addWorkProductAction(WorkProductAction action) {
- actions.add(action);
+ public void addWorkProductAction(Collection<WorkProductAction> actions) {
+ actions.addAll(actions);
}
@Override
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/WorkProductAction.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/WorkProductAction.java
index 51713b6c18..caa316ea5e 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/WorkProductAction.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/model/WorkProductAction.java
@@ -7,6 +7,7 @@ package org.eclipse.osee.coverage.model;
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
public class WorkProductAction {
@@ -15,6 +16,10 @@ public class WorkProductAction {
boolean completed;
Set<WorkProductTask> tasks = new HashSet<WorkProductTask>();
+ public WorkProductAction(Artifact artifact, boolean completed) {
+ this(artifact.getGuid(), artifact.getName(), completed);
+ }
+
public WorkProductAction(String guid, String name, boolean completed) {
super();
this.guid = guid;
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/CoverageAttributeTypes.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/CoverageAttributeTypes.java
index 1ffe7d3cdf..5069f66e5b 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/CoverageAttributeTypes.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/CoverageAttributeTypes.java
@@ -24,7 +24,8 @@ public class CoverageAttributeTypes extends NamedIdentity implements IAttributeT
public static final IAttributeType FileContents = new CoverageAttributeTypes("AARDJK8YAT3SDnghjQgA", "coverage.File Contents");
public static final IAttributeType Location = new CoverageAttributeTypes("AARA2XwhNRddgQrd0iwA", "coverage.Location");
public static final IAttributeType Namespace = new CoverageAttributeTypes("AAQ_v6uUrh0j39+4D5gA", "coverage.Namespace");
- public static final IAttributeType WorkProductGuid = new CoverageAttributeTypes("A+m7Y2sV2z83QUlkzIAA", "coverage.WorkProductGuid");
+ public static final IAttributeType WorkProductTaskGuid = new CoverageAttributeTypes("A+m7Y2sV2z83QUlkzIAA", "coverage.WorkProductTaskGuid");
+ public static final IAttributeType WorkProductPcrGuid = new CoverageAttributeTypes("AWuQmRuq1gwrejEWRgAA", "coverage.WorkProductPcrGuid");
public static final IAttributeType Notes = new CoverageAttributeTypes("AARERmIjazD1udUwfLgA", "coverage.Notes");
public static final IAttributeType Order = new CoverageAttributeTypes("AD72opMBR1pFxB0hVpQA", "coverage.Order");
// @formatter:on
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/DbWorkProductTaskProvider.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/DbWorkProductTaskProvider.java
index 5bd8fe3fe1..b514dc48f0 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/DbWorkProductTaskProvider.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/DbWorkProductTaskProvider.java
@@ -6,6 +6,7 @@
package org.eclipse.osee.coverage.store;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -15,12 +16,13 @@ import org.eclipse.osee.coverage.model.CoveragePackage;
import org.eclipse.osee.coverage.model.IWorkProductTaskProvider;
import org.eclipse.osee.coverage.model.WorkProductAction;
import org.eclipse.osee.coverage.model.WorkProductTask;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
import org.eclipse.osee.framework.ui.skynet.cm.IOseeCmService;
@@ -49,10 +51,14 @@ public class DbWorkProductTaskProvider implements IWorkProductTaskProvider {
IOseeCmService cm = SkynetGuiPlugin.getInstance().getOseeCmService();
Artifact packageArt = store.getArtifact(false);
if (packageArt != null) {
- for (Artifact pcrArt : packageArt.getRelatedArtifacts(CoreRelationTypes.SupportingInfo_SupportingInfo)) {
+ List<String> relatedActionGuids =
+ packageArt.getAttributesToStringList(CoverageAttributeTypes.WorkProductPcrGuid);
+ List<Artifact> relatedArtifacts =
+ ArtifactQuery.getArtifactListFromIds(relatedActionGuids, BranchManager.getCommonBranch());
+ checkForErrorCase(relatedActionGuids, relatedArtifacts, store.getBranch());
+ for (Artifact pcrArt : relatedArtifacts) {
if (cm.isPcrArtifact(pcrArt)) {
- WorkProductAction action =
- new WorkProductAction(pcrArt.getGuid(), pcrArt.getName(), cm.isCompleted(pcrArt));
+ WorkProductAction action = new WorkProductAction(pcrArt, cm.isCompleted(pcrArt));
actions.add(action);
for (Artifact taskArt : cm.getTaskArtifacts(pcrArt)) {
action.getTasks().add(
@@ -66,15 +72,32 @@ public class DbWorkProductTaskProvider implements IWorkProductTaskProvider {
}
}
+ private void checkForErrorCase(List<String> relatedActionGuids, List<Artifact> relatedArtifacts, Branch branch) {
+ boolean found = false;
+ for (String guid : relatedActionGuids) {
+ for (Artifact art : relatedArtifacts) {
+ if (art.getGuid().equals(guid)) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ OseeLog.format(Activator.class, Level.SEVERE,
+ "Invalid related WorkProductPcrGuid [%s] for Coverage Package [%s] on branch [%s]; ignoring.", guid,
+ coveragePackage.getName(), branch.getName());
+ }
+ }
+ }
+
@Override
public void removeWorkProductAction(WorkProductAction action) {
try {
OseeCoveragePackageStore store = OseeCoveragePackageStore.get(coveragePackage, branch);
- for (Artifact artifact : store.getArtifact(false).getRelatedArtifacts(
- CoreRelationTypes.SupportingInfo_SupportingInfo)) {
- if (artifact.getGuid().equals(action.getGuid())) {
- store.getArtifact(false).deleteRelation(CoreRelationTypes.SupportingInfo_SupportingInfo, artifact);
- }
+ Artifact artifact = store.getArtifact(false);
+ List<String> relatedActionGuids =
+ artifact.getAttributesToStringList(CoverageAttributeTypes.WorkProductPcrGuid);
+ if (relatedActionGuids.contains(action.getGuid())) {
+ store.getArtifact(false).deleteAttribute(CoverageAttributeTypes.WorkProductPcrGuid, action.getGuid());
}
store.getArtifact(false).persist("Un-Relate Coverage work product Actions");
reload();
@@ -84,8 +107,23 @@ public class DbWorkProductTaskProvider implements IWorkProductTaskProvider {
}
@Override
- public void addWorkProductAction(WorkProductAction action) {
- reload();
+ public void addWorkProductAction(Collection<WorkProductAction> actions) {
+ try {
+ OseeCoveragePackageStore store = OseeCoveragePackageStore.get(coveragePackage, branch);
+ Artifact artifact = store.getArtifact(false);
+ List<String> relatedActionGuids =
+ artifact.getAttributesToStringList(CoverageAttributeTypes.WorkProductPcrGuid);
+ for (WorkProductAction action : actions) {
+ if (!relatedActionGuids.contains(action.getGuid())) {
+ artifact.addAttribute(CoverageAttributeTypes.WorkProductPcrGuid, action.getGuid());
+ relatedActionGuids.add(action.getGuid());
+ }
+ }
+ artifact.persist("Relate Coverage work product Actions");
+ reload();
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
+ }
}
@Override
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoveragePackageStore.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoveragePackageStore.java
index 48b44cfeb2..5ff3e13e64 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoveragePackageStore.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoveragePackageStore.java
@@ -100,9 +100,9 @@ public class OseeCoveragePackageStore extends OseeCoverageStore implements ISave
this.coveragePackage.getWorkProductTaskProvider().reload();
for (ICoverage coverage : coverages) {
if (coverage instanceof IWorkProductRelatable) {
- if (Strings.isValid(((IWorkProductRelatable) coverage).getWorkProductGuid())) {
+ if (Strings.isValid(((IWorkProductRelatable) coverage).getWorkProductTaskGuid())) {
((IWorkProductRelatable) coverage).setWorkProductTask(this.coveragePackage.getWorkProductTaskProvider().getWorkProductTask(
- ((IWorkProductRelatable) coverage).getWorkProductGuid()));
+ ((IWorkProductRelatable) coverage).getWorkProductTaskGuid()));
}
}
if (coverage instanceof ICoverageUnitProvider) {
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoverageUnitStore.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoverageUnitStore.java
index c1da9445fc..10295e3c27 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoverageUnitStore.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/OseeCoverageUnitStore.java
@@ -100,7 +100,7 @@ public class OseeCoverageUnitStore extends OseeCoverageStore {
coverageUnit.setNotes(artifact.getSoleAttributeValueAsString(CoverageAttributeTypes.Notes, ""));
coverageUnit.setFolder(artifact.isOfType(CoverageArtifactTypes.CoverageFolder));
coverageUnit.setAssignees(artifact.getSoleAttributeValueAsString(CoverageAttributeTypes.Assignees, ""));
- coverageUnit.setWorkProductGuid(artifact.getSoleAttributeValueAsString(CoverageAttributeTypes.WorkProductGuid,
+ coverageUnit.setWorkProductTaskGuid(artifact.getSoleAttributeValueAsString(CoverageAttributeTypes.WorkProductTaskGuid,
""));
coverageUnit.setNamespace(artifact.getSoleAttributeValueAsString(CoverageAttributeTypes.Namespace, ""));
coverageUnit.setOrderNumber(artifact.getSoleAttributeValueAsString(CoverageAttributeTypes.Order, ""));
@@ -177,8 +177,8 @@ public class OseeCoverageUnitStore extends OseeCoverageStore {
if (Strings.isValid(coverageUnit.getNamespace())) {
artifact.setSoleAttributeFromString(CoverageAttributeTypes.Namespace, coverageUnit.getNamespace());
}
- if (Strings.isValid(coverageUnit.getWorkProductGuid())) {
- artifact.setSoleAttributeFromString(CoverageAttributeTypes.WorkProductGuid, coverageUnit.getWorkProductGuid());
+ if (Strings.isValid(coverageUnit.getWorkProductTaskGuid())) {
+ artifact.setSoleAttributeFromString(CoverageAttributeTypes.WorkProductTaskGuid, coverageUnit.getWorkProductTaskGuid());
}
if (coverageUnit.getFileContentsProvider() != null && coverageUnit.getFileContentsProvider() != OseeCoverageUnitFileContentsProvider.getInstance(branch)) {
String fileContents = coverageUnit.getFileContents();
diff --git a/plugins/org.eclipse.osee.coverage/support/OseeTypes_Coverage.osee b/plugins/org.eclipse.osee.coverage/support/OseeTypes_Coverage.osee
index 2f2a1327e0..faa330a6d3 100644
--- a/plugins/org.eclipse.osee.coverage/support/OseeTypes_Coverage.osee
+++ b/plugins/org.eclipse.osee.coverage/support/OseeTypes_Coverage.osee
@@ -21,6 +21,7 @@ artifactType "Coverage Package" extends "General Data" {
guid "AARFcyA9zyD3uEK8akgA"
attribute "Active"
attribute "coverage.Coverage Options"
+ attribute "coverage.WorkProductPcrGuid"
}
attributeType "coverage.File Contents" extends StringAttribute {
@@ -31,7 +32,7 @@ attributeType "coverage.File Contents" extends StringAttribute {
fileExtension "txt"
}
-attributeType "coverage.WorkProductGuid" extends StringAttribute {
+attributeType "coverage.WorkProductTaskGuid" extends StringAttribute {
guid "A+m7Y2sV2z83QUlkzIAA"
dataProvider DefaultAttributeDataProvider
min 0
@@ -39,6 +40,14 @@ attributeType "coverage.WorkProductGuid" extends StringAttribute {
fileExtension "txt"
}
+attributeType "coverage.WorkProductPcrGuid" extends StringAttribute {
+ guid "AWuQmRuq1gwrejEWRgAA"
+ dataProvider DefaultAttributeDataProvider
+ min 0
+ max unlimited
+ fileExtension "txt"
+}
+
attributeType "coverage.Assignees" extends StringAttribute {
guid "AARCA+XjSyKjnh3sweQA"
dataProvider DefaultAttributeDataProvider
@@ -96,4 +105,5 @@ artifactType "Coverage Folder" extends "Abstract Coverage Unit" {
artifactType "Coverage Unit" extends "Abstract Coverage Unit" {
guid "ALZS3MQdCCIUvEYlZeAA"
+ attribute "coverage.WorkProductTaskGuid"
}

Back to the top