diff options
author | ddunne | 2010-10-06 17:54:18 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2010-10-06 17:54:18 +0000 |
commit | ad0fcfa58a8e22bc351e889a019d139bfaf31c83 (patch) | |
tree | a8359f6048f08e35eeccfc0b32f7d46c1d88cde2 /plugins/org.eclipse.osee.coverage | |
parent | d3023d85db18e429e881c5180daba0043dd02973 (diff) | |
download | org.eclipse.osee-ad0fcfa58a8e22bc351e889a019d139bfaf31c83.tar.gz org.eclipse.osee-ad0fcfa58a8e22bc351e889a019d139bfaf31c83.tar.xz org.eclipse.osee-ad0fcfa58a8e22bc351e889a019d139bfaf31c83.zip |
feature: Add support for cross branch links to show in Workflow Editor
Diffstat (limited to 'plugins/org.eclipse.osee.coverage')
-rw-r--r-- | plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/store/DbWorkProductTaskProvider.java | 26 |
1 files changed, 23 insertions, 3 deletions
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 b514dc48f04..be32af3d64c 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 @@ -16,6 +16,7 @@ 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; @@ -23,6 +24,8 @@ 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.skynet.core.relation.crossbranch.CrossBranchLinkManager; +import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction; import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin; import org.eclipse.osee.framework.ui.skynet.cm.IOseeCmService; @@ -94,12 +97,20 @@ public class DbWorkProductTaskProvider implements IWorkProductTaskProvider { try { OseeCoveragePackageStore store = OseeCoveragePackageStore.get(coveragePackage, branch); Artifact artifact = store.getArtifact(false); + SkynetTransaction transaction = new SkynetTransaction(branch, "Un-Relate Coverage work product Actions"); List<String> relatedActionGuids = artifact.getAttributesToStringList(CoverageAttributeTypes.WorkProductPcrGuid); if (relatedActionGuids.contains(action.getGuid())) { - store.getArtifact(false).deleteAttribute(CoverageAttributeTypes.WorkProductPcrGuid, action.getGuid()); + artifact.deleteAttribute(CoverageAttributeTypes.WorkProductPcrGuid, action.getGuid()); + + // remove links from Action to coverage package + Artifact actionArt = ArtifactQuery.getArtifactFromId(action.getGuid(), BranchManager.getCommonBranch()); + CrossBranchLinkManager.deleteRelation(actionArt, CoreRelationTypes.SupportingInfo_SupportingInfo, artifact); + actionArt.persist(transaction); + } - store.getArtifact(false).persist("Un-Relate Coverage work product Actions"); + artifact.persist(transaction); + transaction.execute(); reload(); } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); @@ -110,16 +121,25 @@ public class DbWorkProductTaskProvider implements IWorkProductTaskProvider { public void addWorkProductAction(Collection<WorkProductAction> actions) { try { OseeCoveragePackageStore store = OseeCoveragePackageStore.get(coveragePackage, branch); + SkynetTransaction transaction = new SkynetTransaction(branch, "Relate Coverage work product Actions"); Artifact artifact = store.getArtifact(false); + // create links from coverage package to Actions 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()); + + // create links from Action to coverage package + Artifact actionArt = ArtifactQuery.getArtifactFromId(action.getGuid(), BranchManager.getCommonBranch()); + CrossBranchLinkManager.addRelation(actionArt, CoreRelationTypes.SupportingInfo_SupportingInfo, artifact); + actionArt.persist(transaction); } } - artifact.persist("Relate Coverage work product Actions"); + + artifact.persist(transaction); + transaction.execute(); reload(); } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); |