diff options
author | megumi.telles | 2017-08-16 16:30:05 +0000 |
---|---|---|
committer | megumi.telles | 2017-10-03 18:03:54 +0000 |
commit | dc7027c8ba5e49c5ad6dfa5f76505504430e9ff2 (patch) | |
tree | cd01c8da2d58f265f557bf799a7e3c1af577f30c | |
parent | 76d040e56602dcbb192d629abae28bffd79a9b33 (diff) | |
download | org.eclipse.osee-dc7027c8ba5e49c5ad6dfa5f76505504430e9ff2.tar.gz org.eclipse.osee-dc7027c8ba5e49c5ad6dfa5f76505504430e9ff2.tar.xz org.eclipse.osee-dc7027c8ba5e49c5ad6dfa5f76505504430e9ff2.zip |
feature[ats_TW1650]: Update traceability blams for Applicability
17 files changed, 601 insertions, 77 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DetailedTestStatusOld.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DetailedTestStatusOld.java index c39b20d6de5..708aaff2313 100644 --- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DetailedTestStatusOld.java +++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/operation/DetailedTestStatusOld.java @@ -73,7 +73,9 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam; import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; +import org.eclipse.osee.framework.ui.skynet.branch.ViewApplicabilityUtil; import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget; +import org.eclipse.osee.framework.ui.skynet.widgets.XCombo; import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener; import org.eclipse.osee.framework.ui.skynet.widgets.XWidget; import org.eclipse.osee.framework.ui.skynet.widgets.util.SwtXWidgetRenderer; @@ -86,6 +88,8 @@ import org.eclipse.ui.forms.widgets.FormToolkit; * @author Ryan D. Brooks */ public class DetailedTestStatusOld extends AbstractBlam { + private static final String REQUIREMENTS_BRANCH = "Requirements Branch"; + private static final String PROGRAM = "Program"; private static final Pattern taskNamePattern = Pattern.compile("(?:\"([^\"]+)\")? for \"([^\"]+)\""); private static final SimpleDateFormat dateFormatter = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy"); private final Matcher taskNameMatcher = taskNamePattern.matcher(""); @@ -113,6 +117,8 @@ public class DetailedTestStatusOld extends AbstractBlam { private static final String TRACE_HANDLER_CHECKBOX = "<XWidget xwidgetType=\"XCheckBox\" displayName=\"%s\" labelAfter=\"true\" horizontalLabel=\"true\"/>"; private Collection<String> availableTraceHandlers; + private XCombo branchViewWidget; + private XBranchSelectWidget branchWidget; private BranchId selectedBranch; private IAtsProgram selectedProgram; @@ -224,10 +230,13 @@ public class DetailedTestStatusOld extends AbstractBlam { return; } - BranchId requirementsBranch = variableMap.getBranch("Requirements Branch"); + BranchId requirementsBranch = variableMap.getBranch(REQUIREMENTS_BRANCH); BranchId scriptsBranch = variableMap.getBranch("Test Results Branch"); BranchId procedureBranch = variableMap.getBranch("Test Procedure Branch"); + Object view = variableMap.getValue(BRANCH_VIEW); + setViewId(view); + File scriptDir = new File(variableMap.getString("Script Root Directory")); versions = new ArrayList<>(); for (IAtsVersion version : variableMap.getCollection(IAtsVersion.class, "Versions")) { @@ -247,8 +256,8 @@ public class DetailedTestStatusOld extends AbstractBlam { // Load Requirements Data TraceabilityProviderOperation provider = - new ScriptTraceabilityOperation(scriptDir, requirementsBranch, false, traceHandlers, false); - RequirementTraceabilityData traceabilityData = new RequirementTraceabilityData(procedureBranch, provider); + new ScriptTraceabilityOperation(scriptDir, requirementsBranch, false, traceHandlers, false, viewId); + RequirementTraceabilityData traceabilityData = new RequirementTraceabilityData(procedureBranch, provider, viewId); IStatus status = traceabilityData.initialize(monitor); switch (status.getSeverity()) { @@ -517,7 +526,7 @@ public class DetailedTestStatusOld extends AbstractBlam { if (widgetLabel.equals("Versions")) { versionsListViewer = (XVersionList) xWidget; - } else if (widgetLabel.equals("Requirements Branch")) { + } else if (widgetLabel.equals(REQUIREMENTS_BRANCH)) { requirementsBranchWidget = (XBranchSelectWidget) xWidget; } else if (widgetLabel.equals("Test Procedure Branch")) { testProcedureBranchWidget = (XBranchSelectWidget) xWidget; @@ -527,10 +536,30 @@ public class DetailedTestStatusOld extends AbstractBlam { @Override public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, SwtXWidgetRenderer dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) { String widgetName = xWidget.getLabel(); - if (widgetName.equals("Program")) { + if (widgetName.equals(PROGRAM)) { XAtsProgramComboWidget programWidget = (XAtsProgramComboWidget) xWidget; programWidget.getComboViewer().addSelectionChangedListener(new ProgramSelectionListener()); + } else if (xWidget.getLabel().equals(REQUIREMENTS_BRANCH)) { + branchWidget = (XBranchSelectWidget) xWidget; + branchWidget.addXModifiedListener(new XModifiedListener() { + + @Override + public void widgetModified(XWidget widget) { + if (branchViewWidget != null) { + branchViewWidget.setEditable(true); + BranchId branch = branchWidget.getSelection(); + if (branch != null && branch.isInvalid()) { + branchViews = ViewApplicabilityUtil.getBranchViews(ViewApplicabilityUtil.getParentBranch(branch)); + branchViewWidget.setDataStrings(branchViews.values()); + } + } + } + }); + } else if (xWidget.getLabel().equals(BRANCH_VIEW)) { + branchViewWidget = (XCombo) xWidget; + branchViewWidget.setEditable(false); } + } private void loadTasksFromWorkflow(TeamWorkFlowArtifact workflow) throws OseeCoreException { @@ -595,6 +624,7 @@ public class DetailedTestStatusOld extends AbstractBlam { "<XWidget xwidgetType=\"XBranchSelectWidget\" displayName=\"Test Results Branch\" toolTip=\"Select a scripts results branch.\" />"); sb.append( "<XWidget xwidgetType=\"XBranchSelectWidget\" displayName=\"Test Procedure Branch\" toolTip=\"Select a test procedures branch.\" />"); + sb.append(BRANCH_VIEW_WIDGET); sb.append("</xWidgets>"); return sb.toString(); } diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishSubsystemToDesignTraceability.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishSubsystemToDesignTraceability.java index 65ae9846c08..1e15eed35ac 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishSubsystemToDesignTraceability.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishSubsystemToDesignTraceability.java @@ -14,8 +14,10 @@ import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.List; +import java.util.Set; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; @@ -29,17 +31,29 @@ import org.eclipse.osee.framework.plugin.core.util.AIFile; import org.eclipse.osee.framework.plugin.core.util.OseeData; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; +import org.eclipse.osee.framework.skynet.core.utility.ViewIdUtility; import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam; import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; +import org.eclipse.osee.framework.ui.skynet.branch.ViewApplicabilityUtil; +import org.eclipse.osee.framework.ui.skynet.widgets.XCombo; +import org.eclipse.osee.framework.ui.skynet.widgets.XListDropViewer; +import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener; +import org.eclipse.osee.framework.ui.skynet.widgets.XWidget; +import org.eclipse.osee.framework.ui.skynet.widgets.util.SwtXWidgetRenderer; import org.eclipse.swt.program.Program; +import org.eclipse.ui.forms.widgets.FormToolkit; /** * @author Ryan D. Brooks */ public class PublishSubsystemToDesignTraceability extends AbstractBlam { + private static final String SUBSYSTEM_ROOT_ARTIFACTS = "Subsystem Root Artifacts"; private CharBackedInputStream charBak; private ISheetWriter excelWriter; + private XCombo branchViewWidget; + private XListDropViewer viewerWidget; + @Override public String getName() { return "Publish Subsystem To Design Traceability"; @@ -54,10 +68,17 @@ public class PublishSubsystemToDesignTraceability extends AbstractBlam { public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { monitor.beginTask(getDescriptionUsage(), 100); - List<Artifact> subsystems = variableMap.getArtifacts("Subsystem Root Artifacts"); + List<Artifact> subsystems = variableMap.getArtifacts(SUBSYSTEM_ROOT_ARTIFACTS); BranchId branch = subsystems.get(0).getBranch(); + Object view = variableMap.getValue(BRANCH_VIEW); + setViewId(view); + init(); + Set<ArtifactId> findExcludedArtifactsByView = ViewIdUtility.findExcludedArtifactsByView(viewId, branch); + if (subsystems != null) { + ViewIdUtility.removeExcludedArtifacts(subsystems.iterator(), findExcludedArtifactsByView); + } monitor.subTask("Aquiring Design Artifacts"); // bulk load for performance reasons ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.SubsystemDesign, branch); @@ -90,14 +111,22 @@ public class PublishSubsystemToDesignTraceability extends AbstractBlam { excelWriter.writeRow(CoreAttributeTypes.ParagraphNumber.getName(), "Paragraph Title", CoreAttributeTypes.ParagraphNumber.getName(), "Paragraph Title"); - for (Artifact subsystemRequirement : subsystem.getDescendants()) { + List<Artifact> descendants = subsystem.getDescendants(); + if (descendants != null) { + ViewIdUtility.removeExcludedArtifacts(descendants.iterator(), excludedArtifactIdMap); + } + for (Artifact subsystemRequirement : descendants) { excelWriter.writeCell(subsystemRequirement.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, "")); excelWriter.writeCell(subsystemRequirement.getName()); if (subsystemRequirement.isOfType(CoreArtifactTypes.SubsystemRequirementMSWord)) { boolean loopNeverRan = true; - for (Artifact subsystemDesign : subsystemRequirement.getRelatedArtifacts( - CoreRelationTypes.Design__Design)) { + List<Artifact> relatedArtifacts = + subsystemRequirement.getRelatedArtifacts(CoreRelationTypes.Design__Design); + if (relatedArtifacts != null) { + ViewIdUtility.removeExcludedArtifacts(relatedArtifacts.iterator(), excludedArtifactIdMap); + } + for (Artifact subsystemDesign : relatedArtifacts) { if (subsystemDesign.isOfType(CoreArtifactTypes.SubsystemDesign)) { loopNeverRan = false; excelWriter.writeCell(subsystemDesign.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, ""), @@ -125,7 +154,41 @@ public class PublishSubsystemToDesignTraceability extends AbstractBlam { @Override public String getXWidgetsXml() { - return "<xWidgets><XWidget xwidgetType=\"XListDropViewer\" displayName=\"Subsystem Root Artifacts\" /></xWidgets>"; + StringBuilder builder = new StringBuilder(); + builder.append("<xWidgets>"); + builder.append("<XWidget xwidgetType=\"XListDropViewer\" displayName=\"Subsystem Root Artifacts\" />"); + builder.append(BRANCH_VIEW_WIDGET); + builder.append("</xWidgets>"); + return builder.toString(); + } + + @Override + public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, SwtXWidgetRenderer dynamicXWidgetLayout, XModifiedListener xModListener, boolean isEditable) { + super.widgetCreated(xWidget, toolkit, art, dynamicXWidgetLayout, xModListener, isEditable); + if (xWidget.getLabel().equals(SUBSYSTEM_ROOT_ARTIFACTS)) { + viewerWidget = (XListDropViewer) xWidget; + viewerWidget.addXModifiedListener(new XModifiedListener() { + + @Override + public void widgetModified(XWidget widget) { + if (branchViewWidget != null) { + branchViewWidget.setEditable(true); + List<Artifact> arts = viewerWidget.getArtifacts(); + if (arts != null && !arts.isEmpty()) { + BranchId branch = arts.iterator().next().getBranch(); + if (branch != null && branch.isValid()) { + branchViews = + ViewApplicabilityUtil.getBranchViews(ViewApplicabilityUtil.getParentBranch(branch)); + branchViewWidget.setDataStrings(branchViews.values()); + } + } + } + } + }); + } else if (xWidget.getLabel().equals(BRANCH_VIEW)) { + branchViewWidget = (XCombo) xWidget; + branchViewWidget.setEditable(false); + } } @Override diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishSystemLevelSSDD.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishSystemLevelSSDD.java index 5137c61b298..f17b3b52a24 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishSystemLevelSSDD.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/PublishSystemLevelSSDD.java @@ -36,20 +36,32 @@ import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.utility.Requirements; +import org.eclipse.osee.framework.skynet.core.utility.ViewIdUtility; import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam; import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; +import org.eclipse.osee.framework.ui.skynet.branch.ViewApplicabilityUtil; +import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget; +import org.eclipse.osee.framework.ui.skynet.widgets.XCombo; +import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener; +import org.eclipse.osee.framework.ui.skynet.widgets.XWidget; +import org.eclipse.osee.framework.ui.skynet.widgets.util.SwtXWidgetRenderer; import org.eclipse.swt.program.Program; +import org.eclipse.ui.forms.widgets.FormToolkit; /** * @author Ryan D. Brooks */ public class PublishSystemLevelSSDD extends AbstractBlam { + private static final String BRANCH = "Branch"; private CharBackedInputStream charBak; private ISheetWriter excelWriter; private List<Artifact> sysReqs; private Artifact[] allSubsystems; private final HashCollection<Artifact, Artifact> subsystemToRequirements; + private XCombo branchViewWidget; + private XBranchSelectWidget branchWidget; + @Override public String getName() { return "Publish System Level SSDD"; @@ -66,12 +78,25 @@ public class PublishSystemLevelSSDD extends AbstractBlam { } @Override + public String getXWidgetsXml() throws OseeCoreException { + StringBuilder builder = new StringBuilder(); + builder.append("<xWidgets>"); + builder.append(branchXWidgetXml); + builder.append(BRANCH_VIEW_WIDGET); + builder.append("</xWidgets>"); + return builder.toString(); + } + + @Override public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { monitor.beginTask("Generating System Level SSDD", 100); - BranchId branch = variableMap.getBranch("Branch"); + BranchId branch = variableMap.getBranch(BRANCH); + Object view = variableMap.getValue(BRANCH_VIEW); + setViewId(view); init(); + ViewIdUtility.findExcludedArtifactsByView(viewId, branch); monitor.subTask("Aquiring System Components"); // bulk load for performance reasons ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.Component, branch); @@ -82,6 +107,7 @@ public class PublishSystemLevelSSDD extends AbstractBlam { Artifact root = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(branch); sysReqs = root.getChild(Requirements.SYSTEM_REQUIREMENTS).getDescendants(); + excludeArtifacts(sysReqs.iterator()); getSubsystemList(); monitor.subTask("5.2 System Requirement Allocation To Subsystems"); @@ -98,7 +124,10 @@ public class PublishSystemLevelSSDD extends AbstractBlam { private void getSubsystemList() throws OseeCoreException { for (Artifact systemRequirement : sysReqs) { - for (Artifact subsystem : systemRequirement.getRelatedArtifacts(CoreRelationTypes.Allocation__Component)) { + List<Artifact> relatedArtifacts = + systemRequirement.getRelatedArtifacts(CoreRelationTypes.Allocation__Component); + excludeArtifacts(relatedArtifacts.iterator()); + for (Artifact subsystem : relatedArtifacts) { subsystemToRequirements.put(subsystem, systemRequirement); } } @@ -132,7 +161,12 @@ public class PublishSystemLevelSSDD extends AbstractBlam { CoreArtifactTypes.SystemRequirementMSWord.getName(), "Notes <rationale>"); for (Artifact systemRequirement : subsystemToRequirements.getValues(subsystem)) { - for (Artifact component : systemRequirement.getRelatedArtifacts(CoreRelationTypes.Allocation__Component)) { + List<Artifact> relatedArtifacts = + systemRequirement.getRelatedArtifacts(CoreRelationTypes.Allocation__Component); + + excludeArtifacts(relatedArtifacts.iterator()); + + for (Artifact component : relatedArtifacts) { if (component.equals(subsystem)) { String rationale = systemRequirement.getRelationRationale(component, CoreRelationTypes.Allocation__Component); @@ -152,8 +186,10 @@ public class PublishSystemLevelSSDD extends AbstractBlam { excelWriter.writeCell(systemRequirement.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, "")); excelWriter.writeCell(systemRequirement.getName()); - List<Artifact> allocatedSubsystems = - new ArrayList<Artifact>(systemRequirement.getRelatedArtifacts(CoreRelationTypes.Allocation__Component)); + List<Artifact> relatedArtifacts = systemRequirement.getRelatedArtifacts(CoreRelationTypes.Allocation__Component); + excludeArtifacts(relatedArtifacts.iterator()); + + List<Artifact> allocatedSubsystems = new ArrayList<Artifact>(relatedArtifacts); Collections.sort(allocatedSubsystems); for (Artifact allocatedSubsystem : allocatedSubsystems) { excelWriter.writeCell("X", Arrays.binarySearch(allSubsystems, allocatedSubsystem) + 2); @@ -162,6 +198,31 @@ public class PublishSystemLevelSSDD extends AbstractBlam { } @Override + public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, SwtXWidgetRenderer dynamicXWidgetLayout, XModifiedListener xModListener, boolean isEditable) { + super.widgetCreated(xWidget, toolkit, art, dynamicXWidgetLayout, xModListener, isEditable); + if (xWidget.getLabel().equals(BRANCH)) { + branchWidget = (XBranchSelectWidget) xWidget; + branchWidget.addXModifiedListener(new XModifiedListener() { + + @Override + public void widgetModified(XWidget widget) { + if (branchViewWidget != null) { + branchViewWidget.setEditable(true); + BranchId branch = branchWidget.getSelection(); + if (branch != null && branch.isValid()) { + branchViews = ViewApplicabilityUtil.getBranchViews(ViewApplicabilityUtil.getParentBranch(branch)); + branchViewWidget.setDataStrings(branchViews.values()); + } + } + } + }); + } else if (xWidget.getLabel().equals(BRANCH_VIEW)) { + branchViewWidget = (XCombo) xWidget; + branchViewWidget.setEditable(false); + } + } + + @Override public String getDescriptionUsage() { return "Generate Traceability tables for the System Level SSDD"; } diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/SubsystemFullTraceReport.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/SubsystemFullTraceReport.java index fc411feadc4..fdc919c71c8 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/SubsystemFullTraceReport.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/SubsystemFullTraceReport.java @@ -43,7 +43,10 @@ import org.eclipse.osee.framework.skynet.core.artifact.Attribute; import org.eclipse.osee.framework.skynet.core.utility.Artifacts; import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam; import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; +import org.eclipse.osee.framework.ui.skynet.branch.ViewApplicabilityUtil; import org.eclipse.osee.framework.ui.skynet.widgets.XCheckBox; +import org.eclipse.osee.framework.ui.skynet.widgets.XCombo; +import org.eclipse.osee.framework.ui.skynet.widgets.XListDropViewer; import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener; import org.eclipse.osee.framework.ui.skynet.widgets.XText; import org.eclipse.osee.framework.ui.skynet.widgets.XWidget; @@ -59,6 +62,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit; * @author Ryan D. Brooks */ public class SubsystemFullTraceReport extends AbstractBlam { + private static final String SUBSYSTEM_REQUIREMENTS = "Subsystem Requirements"; private CharBackedInputStream charBak; private ISheetWriter writer; private HashCollection<Artifact, String> requirementsToCodeUnits; @@ -74,7 +78,10 @@ public class SubsystemFullTraceReport extends AbstractBlam { private static final String TRACE_HANDLER_CHECKBOX = "<XWidget xwidgetType=\"XCheckBox\" displayName=\"%s\" labelAfter=\"true\" horizontalLabel=\"true\"/>"; + private Collection<String> availableTraceHandlers; + private XCombo branchViewWidget; + private XListDropViewer subSystem; @Override public String getName() { @@ -88,12 +95,15 @@ public class SubsystemFullTraceReport extends AbstractBlam { @Override public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { - List<Artifact> artifacts = variableMap.getArtifacts("Subsystem Requirements"); + List<Artifact> artifacts = variableMap.getArtifacts(SUBSYSTEM_REQUIREMENTS); if (artifacts.isEmpty()) { throw new OseeArgumentException("must specify a set of artifacts"); } BranchId branch = artifacts.get(0).getBranch(); + Object view = variableMap.getValue(BRANCH_VIEW); + setViewId(view); + init(); String scriptDir = variableMap.getString(SCRIPT_ROOT_DIR); Boolean checked = variableMap.getBoolean(USE_TRACE_IN_OSEE); @@ -110,8 +120,8 @@ public class SubsystemFullTraceReport extends AbstractBlam { if (!checked) { File dir = new File(scriptDir); if (dir.exists()) { - ScriptTraceabilityOperation traceOperation = - new ScriptTraceabilityOperation(dir.getParentFile(), branch, false, traceHandlers, isGitCodeStructure); + ScriptTraceabilityOperation traceOperation = new ScriptTraceabilityOperation(dir.getParentFile(), branch, + false, traceHandlers, isGitCodeStructure, viewId); Operations.executeWorkAndCheckStatus(traceOperation, monitor); requirementsToCodeUnits = traceOperation.getRequirementToCodeUnitsMap(); } @@ -234,6 +244,7 @@ public class SubsystemFullTraceReport extends AbstractBlam { availableTraceHandlers.add(handler); } sb.append("<XWidget xwidgetType=\"XListDropViewer\" displayName=\"Subsystem Requirements\" />"); + sb.append(BRANCH_VIEW_WIDGET); sb.append("</xWidgets>"); return sb.toString(); } @@ -279,5 +290,32 @@ public class SubsystemFullTraceReport extends AbstractBlam { } }); } + if (widget.getLabel().equals(SUBSYSTEM_REQUIREMENTS)) { + subSystem = (XListDropViewer) widget; + subSystem.addXModifiedListener(new XModifiedListener() { + + @Override + public void widgetModified(XWidget widget) { + if (branchViewWidget != null) { + branchViewWidget.setEditable(true); + List<Artifact> arts = subSystem.getArtifacts(); + if (arts != null && !arts.isEmpty()) { + BranchId branch = arts.iterator().next().getBranch(); + if (branch != null && branch.isValid()) { + branchViews = + ViewApplicabilityUtil.getBranchViews(ViewApplicabilityUtil.getParentBranch(branch)); + branchViewWidget.setDataStrings(branchViews.values()); + } + } + } + } + }); + } + + if (widget.getLabel().equals(BRANCH_VIEW)) { + branchViewWidget = (XCombo) widget; + branchViewWidget.setEditable(false); + } + } }
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/SubsystemToLowLevelReqTraceReport.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/SubsystemToLowLevelReqTraceReport.java index b219ce99302..46a3d8498da 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/SubsystemToLowLevelReqTraceReport.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/SubsystemToLowLevelReqTraceReport.java @@ -38,14 +38,23 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.relation.RelationManager; import org.eclipse.osee.framework.skynet.core.utility.Requirements; +import org.eclipse.osee.framework.skynet.core.utility.ViewIdUtility; import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam; import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; +import org.eclipse.osee.framework.ui.skynet.branch.ViewApplicabilityUtil; +import org.eclipse.osee.framework.ui.skynet.widgets.XCombo; +import org.eclipse.osee.framework.ui.skynet.widgets.XListDropViewer; +import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener; +import org.eclipse.osee.framework.ui.skynet.widgets.XWidget; +import org.eclipse.osee.framework.ui.skynet.widgets.util.SwtXWidgetRenderer; import org.eclipse.swt.program.Program; +import org.eclipse.ui.forms.widgets.FormToolkit; /** * @author Ryan D. Brooks */ public class SubsystemToLowLevelReqTraceReport extends AbstractBlam { + private static final String LOW_LEVEL_REQUIREMENTS = "Low Level Requirements"; private CharBackedInputStream charBak; private ISheetWriter excelWriter; private final HashMap<String, List<Artifact>> subsysToSubsysReqsMap; @@ -53,6 +62,9 @@ public class SubsystemToLowLevelReqTraceReport extends AbstractBlam { private final HashSet<Artifact> components; private Collection<ArtifactType> lowerLevelTypes; + private XCombo branchViewWidget; + private XListDropViewer lowerLevel; + @Override public String getName() { return "Subsystem To Low Level Req Trace Report"; @@ -84,6 +96,9 @@ public class SubsystemToLowLevelReqTraceReport extends AbstractBlam { BranchId branch = lowLevelReqs.get(0).getBranch(); + Object view = variableMap.getValue(BRANCH_VIEW); + setViewId(view); + monitor.subTask("Loading Higher Level Requirements"); // bulk load to improve performance monitor.worked(1); ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.SubsystemRequirementMSWord, branch); @@ -117,8 +132,12 @@ public class SubsystemToLowLevelReqTraceReport extends AbstractBlam { if (isLowerLevelRequirement(lowLevelReq)) { row[2] = lowLevelReq.getAttributesToStringSorted(CoreAttributeTypes.QualificationMethod); - for (Artifact subSysReq : lowLevelReq.getRelatedArtifacts( - CoreRelationTypes.Requirement_Trace__Higher_Level)) { + List<Artifact> relatedArtifacts = + lowLevelReq.getRelatedArtifacts(CoreRelationTypes.Requirement_Trace__Higher_Level); + if (relatedArtifacts != null) { + ViewIdUtility.removeExcludedArtifacts(relatedArtifacts.iterator(), excludedArtifactIdMap); + } + for (Artifact subSysReq : relatedArtifacts) { row[3] = getAssociatedSubSystem(subSysReq); row[4] = correct(subSysReq.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, "")); row[5] = subSysReq.getName(); @@ -173,9 +192,12 @@ public class SubsystemToLowLevelReqTraceReport extends AbstractBlam { if (isAllocated(higherLevelReq)) { row[0] = correct(higherLevelReq.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, "")); row[1] = higherLevelReq.getName(); - - for (Artifact lowerLevelReq : higherLevelReq.getRelatedArtifacts( - CoreRelationTypes.Requirement_Trace__Lower_Level)) { + List<Artifact> relatedArtifacts = + higherLevelReq.getRelatedArtifacts(CoreRelationTypes.Requirement_Trace__Lower_Level); + if (relatedArtifacts != null) { + ViewIdUtility.removeExcludedArtifacts(relatedArtifacts.iterator(), excludedArtifactIdMap); + } + for (Artifact lowerLevelReq : relatedArtifacts) { if (lowLevelReqs.contains(lowerLevelReq)) { row[2] = correct(lowerLevelReq.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, "")); row[3] = lowerLevelReq.getName(); @@ -215,6 +237,7 @@ public class SubsystemToLowLevelReqTraceReport extends AbstractBlam { } } } + ViewIdUtility.removeExcludedArtifacts(lowLevelReqs.iterator(), excludedArtifactIdMap); } private void initAllocationComponents(List<Artifact> artifacts) throws OseeCoreException { @@ -230,6 +253,7 @@ public class SubsystemToLowLevelReqTraceReport extends AbstractBlam { } } } + ViewIdUtility.removeExcludedArtifacts(components.iterator(), excludedArtifactIdMap); } private String correct(String value) { @@ -248,6 +272,10 @@ public class SubsystemToLowLevelReqTraceReport extends AbstractBlam { } private void orderSubsystemReqs(Artifact subsysTopFolder) throws OseeCoreException { + List<Artifact> children = subsysTopFolder.getChildren(); + if (children != null) { + ViewIdUtility.removeExcludedArtifacts(children.iterator(), excludedArtifactIdMap); + } for (Artifact subsysFolder : subsysTopFolder.getChildren()) { String subSysName = subsysFolder.getName(); List<Artifact> subsysReqs = subsysFolder.getDescendants(); @@ -259,7 +287,38 @@ public class SubsystemToLowLevelReqTraceReport extends AbstractBlam { public String getXWidgetsXml() { return "<xWidgets><XWidget xwidgetType=\"XListDropViewer\" displayName=\"Lower Level Requirements\" />" + // "<XWidget xwidgetType=\"XListDropViewer\" displayName=\"Allocation Components\" />" + // - "<XWidget xwidgetType=\"XArtifactTypeMultiChoiceSelect\" displayName=\"Low Level Requirement Type(s)\" multiSelect=\"true\" /></xWidgets>"; + "<XWidget xwidgetType=\"XArtifactTypeMultiChoiceSelect\" displayName=\"Low Level Requirement Type(s)\" multiSelect=\"true\" />" + // + "<XWidget xwidgetType=\"XCombo()\" displayName=\"Branch View\" horizontalLabel=\"true\"/>" + // + "</xWidgets>"; + } + + @Override + public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, SwtXWidgetRenderer dynamicXWidgetLayout, XModifiedListener xModListener, boolean isEditable) { + super.widgetCreated(xWidget, toolkit, art, dynamicXWidgetLayout, xModListener, isEditable); + if (xWidget.getLabel().equals(LOW_LEVEL_REQUIREMENTS)) { + lowerLevel = (XListDropViewer) xWidget; + lowerLevel.addXModifiedListener(new XModifiedListener() { + + @Override + public void widgetModified(XWidget widget) { + if (branchViewWidget != null) { + branchViewWidget.setEditable(true); + List<Artifact> arts = lowerLevel.getArtifacts(); + if (arts != null && !arts.isEmpty()) { + BranchId branch = arts.iterator().next().getBranch(); + if (branch != null && branch.isValid()) { + branchViews = + ViewApplicabilityUtil.getBranchViews(ViewApplicabilityUtil.getParentBranch(branch)); + branchViewWidget.setDataStrings(branchViews.values()); + } + } + } + } + }); + } else if (xWidget.getLabel().equals(BRANCH_VIEW)) { + branchViewWidget = (XCombo) xWidget; + branchViewWidget.setEditable(false); + } } @Override diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/SystemSubsystemReport.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/SystemSubsystemReport.java index 87ccc18526a..5bc000a8d49 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/SystemSubsystemReport.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/blam/operation/SystemSubsystemReport.java @@ -14,6 +14,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Map.Entry; @@ -21,6 +22,7 @@ import java.util.Set; import org.apache.commons.lang.WordUtils; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.AttributeId; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; @@ -41,9 +43,17 @@ import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; import org.eclipse.osee.framework.skynet.core.utility.Requirements; +import org.eclipse.osee.framework.skynet.core.utility.ViewIdUtility; import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam; import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; +import org.eclipse.osee.framework.ui.skynet.branch.ViewApplicabilityUtil; +import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget; +import org.eclipse.osee.framework.ui.skynet.widgets.XCombo; +import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener; +import org.eclipse.osee.framework.ui.skynet.widgets.XWidget; +import org.eclipse.osee.framework.ui.skynet.widgets.util.SwtXWidgetRenderer; import org.eclipse.swt.program.Program; +import org.eclipse.ui.forms.widgets.FormToolkit; /** * @author Ryan D. Brooks @@ -60,6 +70,10 @@ public class SystemSubsystemReport extends AbstractBlam { private final HashMap<String, Set<Artifact>> subsysToSysReqsMap; private final LinkedHashSet<Artifact> components; private List<Artifact> sysReqs; + Set<ArtifactId> findExcludedArtifactsByView; + + private XCombo branchViewWidget; + private XBranchSelectWidget viewerWidget; @Override public String getName() { @@ -80,6 +94,7 @@ public class SystemSubsystemReport extends AbstractBlam { subsysToSubsysReqsMap = new HashMap<>(); subsysToSysReqsMap = new HashMap<>(); components = new LinkedHashSet<>(250); + findExcludedArtifactsByView = new HashSet<>(); } private void init() throws IOException { @@ -91,6 +106,7 @@ public class SystemSubsystemReport extends AbstractBlam { subsysToSubsysReqsMap.clear(); subsysToSysReqsMap.clear(); components.clear(); + findExcludedArtifactsByView.clear(); charBak = new CharBackedInputStream(); excelWriter = new ExcelXmlWriter(charBak.getWriter()); } @@ -101,8 +117,13 @@ public class SystemSubsystemReport extends AbstractBlam { BranchId branch = variableMap.getBranch("Branch"); + Object view = variableMap.getValue(BRANCH_VIEW); + setViewId(view); + init(); + findExcludedArtifactsByView = ViewIdUtility.findExcludedArtifactsByView(viewId, branch); + monitor.subTask("Aquiring System Components"); // bulk load for performance reasons ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.Component, branch); @@ -117,6 +138,10 @@ public class SystemSubsystemReport extends AbstractBlam { sysReqs = root.getChild(Requirements.SYSTEM_REQUIREMENTS).getDescendants(); + if (sysReqs != null && !sysReqs.isEmpty()) { + ViewIdUtility.removeExcludedArtifacts(sysReqs.iterator(), findExcludedArtifactsByView); + } + monitor.subTask("Generating Metrics"); generateMetrics(getProductComponent(root), subsysTopFolder); @@ -157,14 +182,20 @@ public class SystemSubsystemReport extends AbstractBlam { CountingMap<Artifact> allocatedSysReqCounter = new CountingMap<>(sysReqs.size()); - for (Artifact subsysFolder : subsysTopFolder.getChildren()) { + List<Artifact> children = subsysTopFolder.getChildren(); + if (children != null && !children.isEmpty()) { + ViewIdUtility.removeExcludedArtifacts(children.iterator(), findExcludedArtifactsByView); + } + for (Artifact subsysFolder : children) { resetCounters(); String subSysName = subsysFolder.getName(); row[0] = subSysName; Artifact component = productComponent.getChild(subSysName); - List<Artifact> sysReqByComp = component.getRelatedArtifacts(CoreRelationTypes.Allocation__Requirement); + if (sysReqByComp != null && !sysReqByComp.isEmpty()) { + ViewIdUtility.removeExcludedArtifacts(sysReqByComp.iterator(), findExcludedArtifactsByView); + } storeInHierarchyOrderBySubsystem(subSysName, sysReqByComp); allocatedSysReqCounter.put(sysReqByComp); Set<String> missingAllocationGuids = new LinkedHashSet<>(); @@ -266,7 +297,12 @@ public class SystemSubsystemReport extends AbstractBlam { row[1] = artifact.getName(); if (artifact.isOfType(CoreArtifactTypes.SubsystemRequirementMSWord)) { - for (Artifact component : artifact.getRelatedArtifacts(CoreRelationTypes.Allocation__Component)) { + + List<Artifact> relatedArtifacts = artifact.getRelatedArtifacts(CoreRelationTypes.Allocation__Component); + if (relatedArtifacts != null && !relatedArtifacts.isEmpty()) { + ViewIdUtility.removeExcludedArtifacts(relatedArtifacts.iterator(), findExcludedArtifactsByView); + } + for (Artifact component : relatedArtifacts) { components.add(component); row[2] = component.getName(); excelWriter.writeRow(row); @@ -296,7 +332,12 @@ public class SystemSubsystemReport extends AbstractBlam { excelWriter.writeRow(); excelWriter.writeRow(subSysName + " Subsystem Requirements allocated to the " + component.getName()); excelWriter.writeRow("PIDS Paragraph #", "PIDS Paragraph Title", "Notes <rationale>"); - for (Artifact subsysReq : component.getRelatedArtifacts(CoreRelationTypes.Allocation__Requirement)) { + + List<Artifact> relatedArtifacts = component.getRelatedArtifacts(CoreRelationTypes.Allocation__Requirement); + if (relatedArtifacts != null && !relatedArtifacts.isEmpty()) { + ViewIdUtility.removeExcludedArtifacts(relatedArtifacts.iterator(), findExcludedArtifactsByView); + } + for (Artifact subsysReq : relatedArtifacts) { if (subsysReqs.contains(subsysReq)) { row[0] = subsysReq.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, ""); row[1] = subsysReq.getName(); @@ -326,7 +367,11 @@ public class SystemSubsystemReport extends AbstractBlam { } private void countDescendants(String subSysName, Set<Artifact> subsysReqs, Artifact artifact, Set<String> missingAllocationGuids) throws OseeCoreException { - for (Artifact child : artifact.getChildren()) { + List<Artifact> children = artifact.getChildren(); + if (children != null && !children.isEmpty()) { + ViewIdUtility.removeExcludedArtifacts(children.iterator(), findExcludedArtifactsByView); + } + for (Artifact child : children) { if (child.isOfType(CoreArtifactTypes.SubsystemRequirementMSWord)) { subsysDescendantCount++; String selectedSubSystem = child.getSoleAttributeValue(CoreAttributeTypes.Subsystem, ""); @@ -373,7 +418,11 @@ public class SystemSubsystemReport extends AbstractBlam { row[0] = sysReq.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, ""); row[1] = sysReq.getName(); - for (Artifact subSysReq : sysReq.getRelatedArtifacts(CoreRelationTypes.Requirement_Trace__Lower_Level)) { + List<Artifact> relatedArtifacts = sysReq.getRelatedArtifacts(CoreRelationTypes.Requirement_Trace__Lower_Level); + if (relatedArtifacts != null && !relatedArtifacts.isEmpty()) { + ViewIdUtility.removeExcludedArtifacts(relatedArtifacts.iterator(), findExcludedArtifactsByView); + } + for (Artifact subSysReq : relatedArtifacts) { if (subsysReqs.contains(subSysReq)) { row[2] = subSysReq.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, ""); row[3] = subSysReq.getName(); @@ -417,7 +466,12 @@ public class SystemSubsystemReport extends AbstractBlam { row[2] = "N/A: " + subsysReq.getArtifactTypeName(); } - for (Artifact subSysReq : subsysReq.getRelatedArtifacts(CoreRelationTypes.Requirement_Trace__Higher_Level)) { + List<Artifact> relatedArtifacts = + subsysReq.getRelatedArtifacts(CoreRelationTypes.Requirement_Trace__Higher_Level); + if (relatedArtifacts != null && !relatedArtifacts.isEmpty()) { + ViewIdUtility.removeExcludedArtifacts(relatedArtifacts.iterator(), findExcludedArtifactsByView); + } + for (Artifact subSysReq : relatedArtifacts) { row[3] = subSysReq.getSoleAttributeValue(CoreAttributeTypes.ParagraphNumber, ""); row[4] = subSysReq.getName(); excelWriter.writeRow(row); @@ -448,6 +502,31 @@ public class SystemSubsystemReport extends AbstractBlam { } @Override + public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, SwtXWidgetRenderer dynamicXWidgetLayout, XModifiedListener xModListener, boolean isEditable) { + super.widgetCreated(xWidget, toolkit, art, dynamicXWidgetLayout, xModListener, isEditable); + if (xWidget.getLabel().equals("Branch")) { + viewerWidget = (XBranchSelectWidget) xWidget; + viewerWidget.addXModifiedListener(new XModifiedListener() { + + @Override + public void widgetModified(XWidget widget) { + if (branchViewWidget != null) { + branchViewWidget.setEditable(true); + BranchId branch = viewerWidget.getSelection(); + if (branch != null && branch.isValid()) { + branchViews = ViewApplicabilityUtil.getBranchViews(ViewApplicabilityUtil.getParentBranch(branch)); + branchViewWidget.setDataStrings(branchViews.values()); + } + } + } + }); + } else if (xWidget.getLabel().equals(BRANCH_VIEW)) { + branchViewWidget = (XCombo) xWidget; + branchViewWidget.setEditable(false); + } + } + + @Override public Collection<String> getCategories() { return Arrays.asList("Reports"); } diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/BranchTraceabilityOperation.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/BranchTraceabilityOperation.java index 4e50fad962d..70d2bb74f44 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/BranchTraceabilityOperation.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/BranchTraceabilityOperation.java @@ -21,6 +21,7 @@ import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.define.internal.Activator; import org.eclipse.osee.define.traceability.data.RequirementData; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.IOseeBranch; @@ -32,6 +33,7 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; +import org.eclipse.osee.framework.skynet.core.utility.ViewIdUtility; /** * @author John R. Misinco @@ -44,22 +46,24 @@ public class BranchTraceabilityOperation extends TraceabilityProviderOperation { private Map<String, Artifact> testUnits; private final Collection<? extends IArtifactType> types; private final boolean withInheritance; + private final ArtifactId viewId; - private BranchTraceabilityOperation(RequirementData requirementData, BranchId branch, Collection<? extends IArtifactType> types, boolean withInheritance) { + private BranchTraceabilityOperation(RequirementData requirementData, BranchId branch, Collection<? extends IArtifactType> types, boolean withInheritance, ArtifactId viewId) { super("Branch Traceability Provider", Activator.PLUGIN_ID); this.requirementData = requirementData; this.branch = branch; this.types = types; this.withInheritance = withInheritance; + this.viewId = viewId; } - public BranchTraceabilityOperation(IOseeBranch branch) { - this(new RequirementData(branch), branch, Collections.singleton(CoreArtifactTypes.AbstractSoftwareRequirement), - true); + public BranchTraceabilityOperation(IOseeBranch branch, ArtifactId viewId) { + this(new RequirementData(branch, viewId), branch, + Collections.singleton(CoreArtifactTypes.AbstractSoftwareRequirement), true, viewId); } - public BranchTraceabilityOperation(BranchId branch, Collection<? extends IArtifactType> types, boolean withInheritance) { - this(new RequirementData(branch, types, withInheritance), branch, types, withInheritance); + public BranchTraceabilityOperation(BranchId branch, Collection<? extends IArtifactType> types, boolean withInheritance, ArtifactId viewId) { + this(new RequirementData(branch, types, withInheritance, viewId), branch, types, withInheritance, viewId); } @Override @@ -90,7 +94,12 @@ public class BranchTraceabilityOperation extends TraceabilityProviderOperation { requirementData.initialize(monitor); requirementToTestUnitsMap = new HashCollection<>(); + Set<ArtifactId> excludedArtifactIdMap = ViewIdUtility.findExcludedArtifactsByView(viewId, branch); List<Artifact> unitsOnBranch = ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.TestCase, branch); + if (unitsOnBranch != null) { + ViewIdUtility.removeExcludedArtifacts(unitsOnBranch.iterator(), excludedArtifactIdMap); + } + testUnits = new HashMap<>(); for (Artifact unit : unitsOnBranch) { testUnits.put(convertToJavaFileName(unit.getName()), unit); @@ -105,9 +114,13 @@ public class BranchTraceabilityOperation extends TraceabilityProviderOperation { reqs.addAll(ArtifactQuery.getArtifactListFromType(type, branch)); } } + ViewIdUtility.removeExcludedArtifacts(reqs.iterator(), excludedArtifactIdMap); for (Artifact req : reqs) { List<Artifact> verifiers = req.getRelatedArtifacts(CoreRelationTypes.Verification__Verifier); + if (verifiers != null) { + ViewIdUtility.removeExcludedArtifacts(verifiers.iterator(), excludedArtifactIdMap); + } Collection<String> verifierNames = new HashSet<>(); String inspection = getInspectionQual(req); if (Strings.isValid(inspection)) { diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ImportTraceabilityWizard.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ImportTraceabilityWizard.java index 69d15c45fb8..131b78b647f 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ImportTraceabilityWizard.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ImportTraceabilityWizard.java @@ -17,6 +17,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; import org.eclipse.osee.define.internal.Activator; import org.eclipse.osee.define.traceability.TraceUnitExtensionManager.TraceHandler; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.operation.Operations; import org.eclipse.osee.framework.logging.OseeLevel; @@ -48,7 +49,7 @@ public class ImportTraceabilityWizard extends Wizard implements IImportWizard { handlers.add(TraceUnitExtensionManager.getInstance().getTraceUnitHandlerById(handlerId)); } Operations.executeWorkAndCheckStatus( - new ScriptTraceabilityOperation(file, branch, true, handlers, isGitBased)); + new ScriptTraceabilityOperation(file, branch, true, handlers, isGitBased, ArtifactId.SENTINEL)); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, "Traceability Import Error", ex); } diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/RequirementTraceabilityData.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/RequirementTraceabilityData.java index e7ed971c3b6..cea2cd73466 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/RequirementTraceabilityData.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/RequirementTraceabilityData.java @@ -18,6 +18,7 @@ import java.io.InputStreamReader; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -28,6 +29,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.osee.define.internal.Activator; import org.eclipse.osee.define.traceability.data.RequirementData; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreRelationTypes; @@ -37,6 +39,7 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; +import org.eclipse.osee.framework.skynet.core.utility.ViewIdUtility; /** * @author Roberto E. Escobar @@ -51,11 +54,14 @@ public class RequirementTraceabilityData { private final Set<String> codeUnits = new TreeSet<>(); private final Map<String, Artifact> testProcedures = new HashMap<>(); private File testProcedureFilter; + private final ArtifactId viewId; + private Set<ArtifactId> excludedArtifactIdMap = new HashSet<>(); - public RequirementTraceabilityData(BranchId testProcedureBranch, TraceabilityProviderOperation traceabilityProvider) { + public RequirementTraceabilityData(BranchId testProcedureBranch, TraceabilityProviderOperation traceabilityProvider, ArtifactId viewId) { this.testProcedureBranch = testProcedureBranch; this.traceabilityProvider = traceabilityProvider; this.testProcedureFilter = null; + this.viewId = viewId; reset(); } @@ -78,6 +84,8 @@ public class RequirementTraceabilityData { this.requirementsToCodeUnits = traceabilityProvider.getRequirementToCodeUnitsMap(); this.codeUnits.addAll(traceabilityProvider.getCodeUnits()); + excludedArtifactIdMap = ViewIdUtility.findExcludedArtifactsByView(viewId, testProcedureBranch); + if (monitor.isCanceled() != true) { if (status.getSeverity() == IStatus.OK) { getTestProcedureTraceability(testProcedureBranch); @@ -94,8 +102,12 @@ public class RequirementTraceabilityData { private void getTestProcedureTraceability(BranchId testProcedureBranch) throws OseeCoreException { // Map Software Requirements from TestProcedure IOseeBranch to Requirements IOseeBranch Map<String, Artifact> testProcedureBranchReqsToReqsBranchMap = new HashMap<>(); - for (Artifact tpRequirement : ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.SoftwareRequirement, - testProcedureBranch)) { + List<Artifact> artifacts = + ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.SoftwareRequirement, testProcedureBranch); + if (artifacts != null) { + ViewIdUtility.removeExcludedArtifacts(artifacts.iterator(), excludedArtifactIdMap); + } + for (Artifact tpRequirement : artifacts) { testProcedureBranchReqsToReqsBranchMap.put(tpRequirement.getName(), tpRequirement); } @@ -104,6 +116,9 @@ public class RequirementTraceabilityData { Artifact requirement = entry.getValue(); Set<Artifact> foundProcedures = new HashSet<Artifact>(requirement.getRelatedArtifacts(CoreRelationTypes.Validation__Validator)); + if (foundProcedures != null) { + ViewIdUtility.removeExcludedArtifacts(foundProcedures.iterator(), excludedArtifactIdMap); + } Set<Artifact> toAdd = new HashSet<>(); if (testProceduresFilter.isEmpty() != true) { for (Artifact artifact : foundProcedures) { @@ -132,7 +147,7 @@ public class RequirementTraceabilityData { /** * Get Requirement Artifact based on traceMark mark if it fails, check if trace mark is a structured requirement and * try again - * + * * @return requirement artifact */ public Artifact getRequirementFromTraceMark(String traceMark) { @@ -163,7 +178,7 @@ public class RequirementTraceabilityData { /** * TODO need to use persisted test script NOTE: These artifact should not be persisted since they are temporary items * artifacts - * + * * @param artifact requirement to find * @return the test scripts associated with this requirement * @throws OseeCoreException diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ScriptTraceabilityOperation.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ScriptTraceabilityOperation.java index 62712f92b82..06c20bd476b 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ScriptTraceabilityOperation.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/ScriptTraceabilityOperation.java @@ -28,6 +28,7 @@ import org.eclipse.osee.define.internal.Activator; import org.eclipse.osee.define.traceability.TraceUnitExtensionManager.TraceHandler; import org.eclipse.osee.define.traceability.data.RequirementData; import org.eclipse.osee.define.traceability.data.TraceMark; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; @@ -89,12 +90,13 @@ public class ScriptTraceabilityOperation extends TraceabilityProviderOperation { excelWriter = new ExcelXmlWriter(charBak.getWriter()); } - public ScriptTraceabilityOperation(File file, BranchId branch, boolean writeOutResults, Collection<TraceHandler> traceHandlers, boolean isGitBased) throws IOException { - this(new RequirementData(branch), file, writeOutResults, traceHandlers, isGitBased); + public ScriptTraceabilityOperation(File file, BranchId branch, boolean writeOutResults, Collection<TraceHandler> traceHandlers, boolean isGitBased, ArtifactId viewId) throws IOException { + this(new RequirementData(branch, viewId), file, writeOutResults, traceHandlers, isGitBased); } - public ScriptTraceabilityOperation(File file, BranchId branch, boolean writeOutResults, Collection<? extends IArtifactType> types, boolean withInheritance, Collection<TraceHandler> traceHandlers, boolean isGitBased) throws IOException { - this(new RequirementData(branch, types, withInheritance), file, writeOutResults, traceHandlers, isGitBased); + public ScriptTraceabilityOperation(File file, BranchId branch, boolean writeOutResults, Collection<? extends IArtifactType> types, boolean withInheritance, Collection<TraceHandler> traceHandlers, boolean isGitBased, ArtifactId viewId) throws IOException { + this(new RequirementData(branch, types, withInheritance, viewId), file, writeOutResults, traceHandlers, + isGitBased); } @Override diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/blam/TraceReportBlam.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/blam/TraceReportBlam.java index 05466280876..b9d1fe6009e 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/blam/TraceReportBlam.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/blam/TraceReportBlam.java @@ -51,8 +51,10 @@ import org.eclipse.osee.framework.plugin.core.util.AIFile; import org.eclipse.osee.framework.plugin.core.util.IExceptionableRunnable; import org.eclipse.osee.framework.plugin.core.util.Jobs; import org.eclipse.osee.framework.plugin.core.util.OseeData; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam; import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; +import org.eclipse.osee.framework.ui.skynet.branch.ViewApplicabilityUtil; import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorProvider; import org.eclipse.osee.framework.ui.skynet.results.IResultsEditorTab; import org.eclipse.osee.framework.ui.skynet.results.ResultsEditor; @@ -60,13 +62,22 @@ import org.eclipse.osee.framework.ui.skynet.results.html.ResultsEditorHtmlTab; import org.eclipse.osee.framework.ui.skynet.results.table.IResultsXViewerRow; import org.eclipse.osee.framework.ui.skynet.results.table.ResultsEditorTableTab; import org.eclipse.osee.framework.ui.skynet.results.table.ResultsXViewerRow; +import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget; +import org.eclipse.osee.framework.ui.skynet.widgets.XCombo; +import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener; +import org.eclipse.osee.framework.ui.skynet.widgets.XWidget; +import org.eclipse.osee.framework.ui.skynet.widgets.util.SwtXWidgetRenderer; import org.eclipse.swt.program.Program; +import org.eclipse.ui.forms.widgets.FormToolkit; /** * @author Roberto E. Escobar */ public class TraceReportBlam extends AbstractBlam { + private static final String BRANCH = "Branch"; private final List<IResultsEditorTab> resultsTabs; + private XCombo branchViewWidget; + private XBranchSelectWidget branchWidget; public TraceReportBlam() { this.resultsTabs = new ArrayList<>(); @@ -101,6 +112,7 @@ public class TraceReportBlam extends AbstractBlam { builder.append("<xWidgets>"); // builder.append("<XWidget xwidgetType=\"XFileSelectionDialog\" displayName=\"Select UI List File\" />"); builder.append("<XWidget xwidgetType=\"XBranchSelectWidget\" displayName=\"Requirements Branch\" />"); + builder.append(BRANCH_VIEW_WIDGET); builder.append("<XWidget xwidgetType=\"XLabel\" displayName=\"Select Trace Types:\"/>"); for (TraceTypeEnum traceType : TraceTypeEnum.values()) { builder.append(getOperationsCheckBoxes(traceType.asLabel())); @@ -114,25 +126,6 @@ public class TraceReportBlam extends AbstractBlam { return builder.toString(); } - // private String getUIsFilterFromFile(IProgressMonitor monitor, String filePath) throws Exception { - // String input; - // File file = new File(filePath); - // if (file == null || !file.exists()) { - // throw new OseeArgumentException("UI list file not accessible"); - // } - // IFileStore fileStore = EFS.getStore(file.toURI()); - // InputStream inputStream = null; - // try { - // inputStream = new BufferedInputStream(fileStore.openInputStream(EFS.NONE, monitor)); - // input = Lib.inputStreamToString(inputStream); - // } finally { - // if (inputStream != null) { - // inputStream.close(); - // } - // } - // return input; - // } - private List<TraceTypeEnum> getCheckedTraceItems(VariableMap variableMap) throws OseeArgumentException { List<TraceTypeEnum> toReturn = new ArrayList<>(); for (TraceTypeEnum traceType : TraceTypeEnum.values()) { @@ -151,6 +144,9 @@ public class TraceReportBlam extends AbstractBlam { if (branch == null) { throw new OseeArgumentException("Branch cannot be null"); } + Object view = variableMap.getValue(BRANCH_VIEW); + setViewId(view); + List<TraceTypeEnum> traceTypes = getCheckedTraceItems(variableMap); if (traceTypes.isEmpty()) { throw new OseeArgumentException("Please select a trace type"); @@ -165,7 +161,7 @@ public class TraceReportBlam extends AbstractBlam { CharBackedInputStream excelInputStream = null; Map<String, AbstractArtifactRelationReport> reports = new LinkedHashMap<>(); List<BaseTraceDataCache> traceCache = new ArrayList<>(); - RequirementData reqData = new RequirementData(branch); + RequirementData reqData = new RequirementData(branch, viewId); CodeUnitData codeUnit = null; TestUnitData testUnit = null; try { @@ -229,6 +225,31 @@ public class TraceReportBlam extends AbstractBlam { } } + @Override + public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, SwtXWidgetRenderer dynamicXWidgetLayout, XModifiedListener xModListener, boolean isEditable) { + super.widgetCreated(xWidget, toolkit, art, dynamicXWidgetLayout, xModListener, isEditable); + if (xWidget.getLabel().equals(BRANCH)) { + branchWidget = (XBranchSelectWidget) xWidget; + branchWidget.addXModifiedListener(new XModifiedListener() { + + @Override + public void widgetModified(XWidget widget) { + if (branchViewWidget != null) { + branchViewWidget.setEditable(true); + BranchId branch = branchWidget.getSelection(); + if (branch != null && branch.isValid()) { + branchViews = ViewApplicabilityUtil.getBranchViews(ViewApplicabilityUtil.getParentBranch(branch)); + branchViewWidget.setDataStrings(branchViews.values()); + } + } + } + }); + } else if (xWidget.getLabel().equals(BRANCH_VIEW)) { + branchViewWidget = (XCombo) xWidget; + branchViewWidget.setEditable(false); + } + } + private void executeReports(IProgressMonitor monitor, Map<String, AbstractArtifactRelationReport> reports) throws OseeCoreException { try { monitor.beginTask("Create Reports", reports.size()); diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/data/RequirementData.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/data/RequirementData.java index a0eccb0b8e9..37dcea10102 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/data/RequirementData.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/data/RequirementData.java @@ -16,15 +16,19 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.osee.define.traceability.TraceabilityExtractor; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.jdk.core.type.Pair; import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; +import org.eclipse.osee.framework.skynet.core.utility.ViewIdUtility; /** * @author Roberto E. Escobar @@ -37,17 +41,20 @@ public class RequirementData extends BaseTraceDataCache { private final TraceabilityExtractor extractor = TraceabilityExtractor.getInstance(); private final Collection<? extends IArtifactType> types; private final boolean withInheritance; + private final ArtifactId viewId; - public RequirementData(BranchId branch, Collection<? extends IArtifactType> types, boolean withInheritance) { + public RequirementData(BranchId branch, Collection<? extends IArtifactType> types, boolean withInheritance, ArtifactId viewId) { super("Software Requirements Data", branch); this.types = types; this.withInheritance = withInheritance; + this.viewId = viewId; } - public RequirementData(BranchId branch) { + public RequirementData(BranchId branch, ArtifactId viewId) { super("Software Requirements Data", branch); types = Collections.singleton(CoreArtifactTypes.AbstractSoftwareRequirement); withInheritance = true; + this.viewId = viewId; } @Override @@ -59,6 +66,9 @@ public class RequirementData extends BaseTraceDataCache { @Override protected void doBulkLoad(IProgressMonitor monitor) throws Exception { + Set<ArtifactId> excludedArtifactIdMap = new HashSet<>(); + excludedArtifactIdMap = ViewIdUtility.findExcludedArtifactsByView(viewId, getBranch()); + List<Artifact> allSwRequirements = new ArrayList<>(); for (IArtifactType type : types) { if (withInheritance) { @@ -68,6 +78,7 @@ public class RequirementData extends BaseTraceDataCache { allSwRequirements.addAll(ArtifactQuery.getArtifactListFromType(type, getBranch(), EXCLUDE_DELETED)); } } + ViewIdUtility.removeExcludedArtifacts(allSwRequirements.iterator(), excludedArtifactIdMap); populateTraceMap(monitor, allSwRequirements, allRequirementsMap); for (Artifact requirement : getAllRequirements()) { @@ -93,7 +104,7 @@ public class RequirementData extends BaseTraceDataCache { /** * Get Requirement Artifact based on traceMark mark - * + * * @return requirement artifact */ public Artifact getRequirementFromTraceMark(String traceMark) { @@ -103,7 +114,7 @@ public class RequirementData extends BaseTraceDataCache { /** * Get Requirement Artifact based on traceMark mark if it fails, check if trace mark is a structured requirement and * try again - * + * * @return requirement artifact */ public Artifact getRequirementFromTraceMarkIncludeStructuredRequirements(String traceMark) { diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/operations/TraceUnitToArtifactProcessor.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/operations/TraceUnitToArtifactProcessor.java index 1b9ce9c7703..1cefde6b93a 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/operations/TraceUnitToArtifactProcessor.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/operations/TraceUnitToArtifactProcessor.java @@ -34,6 +34,7 @@ import org.eclipse.osee.define.traceability.data.RequirementData; import org.eclipse.osee.define.traceability.data.TestUnitData; import org.eclipse.osee.define.traceability.data.TraceMark; import org.eclipse.osee.define.traceability.data.TraceUnit; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.IArtifactType; import org.eclipse.osee.framework.core.data.BranchId; import org.eclipse.osee.framework.core.data.RelationTypeSide; @@ -107,7 +108,7 @@ public class TraceUnitToArtifactProcessor implements ITraceUnitProcessor { public void initialize(IProgressMonitor monitor) { transaction = null; handler = null; - requirementData = new RequirementData(importIntoBranch); + requirementData = new RequirementData(importIntoBranch, ArtifactId.SENTINEL); if (!monitor.isCanceled()) { requirementData.initialize(monitor); } diff --git a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/report/PublishStdStpTraceability.java b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/report/PublishStdStpTraceability.java index 56efb9d3c32..3e34faf2bbb 100644 --- a/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/report/PublishStdStpTraceability.java +++ b/plugins/org.eclipse.osee.define/src/org/eclipse/osee/define/traceability/report/PublishStdStpTraceability.java @@ -37,15 +37,24 @@ import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.Lib; import org.eclipse.osee.framework.plugin.core.util.AIFile; import org.eclipse.osee.framework.plugin.core.util.OseeData; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam; import org.eclipse.osee.framework.ui.skynet.blam.VariableMap; +import org.eclipse.osee.framework.ui.skynet.branch.ViewApplicabilityUtil; +import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget; +import org.eclipse.osee.framework.ui.skynet.widgets.XCombo; +import org.eclipse.osee.framework.ui.skynet.widgets.XModifiedListener; +import org.eclipse.osee.framework.ui.skynet.widgets.XWidget; +import org.eclipse.osee.framework.ui.skynet.widgets.util.SwtXWidgetRenderer; import org.eclipse.swt.program.Program; +import org.eclipse.ui.forms.widgets.FormToolkit; /** * @author Roberto E. Escobar */ public class PublishStdStpTraceability extends AbstractBlam { + private static final String PROGRAM_BRANCH = "Program Branch"; private static final String scriptDirectory = "<XWidget xwidgetType=\"XText\" displayName=\"Script Root Directory\" defaultValue=\"C:/UserData/workspaceScripts\"/>"; private static final String requirementsBranch = @@ -58,7 +67,10 @@ public class PublishStdStpTraceability extends AbstractBlam { "<XWidget xwidgetType=\"XCheckBox\" displayName=\"Search Git Code Structure\" labelAfter=\"true\" horizontalLabel=\"true\" defaultValue=\"false\" />"; private static final String TRACE_HANDLER_CHECKBOX = "<XWidget xwidgetType=\"XCheckBox\" displayName=\"%s\" labelAfter=\"true\" horizontalLabel=\"true\"/>"; + private Collection<String> availableTraceHandlers; + private XCombo branchViewWidget; + private XBranchSelectWidget branchWidget; @Override public String getName() { @@ -87,6 +99,7 @@ public class PublishStdStpTraceability extends AbstractBlam { } builder.append(requirementsBranch); + builder.append(BRANCH_VIEW_WIDGET); builder.append(artifactTypeChooser); builder.append(searchInheritedTypes); @@ -119,7 +132,9 @@ public class PublishStdStpTraceability extends AbstractBlam { @Override public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { - BranchId requirementsBranch = variableMap.getBranch("Program Branch"); + BranchId requirementsBranch = variableMap.getBranch(PROGRAM_BRANCH); + Object view = variableMap.getValue(BRANCH_VIEW); + setViewId(view); Collection<? extends IArtifactType> types = variableMap.getCollection(ArtifactType.class, "Artifact Type(s) to Trace"); boolean searchInherited = variableMap.getBoolean("Search Inherited Types"); @@ -142,13 +157,14 @@ public class PublishStdStpTraceability extends AbstractBlam { // Load Requirements Data TraceabilityProviderOperation provider; if (traceHandlers.isEmpty()) { - provider = new BranchTraceabilityOperation(requirementsBranch, types, searchInherited); + provider = new BranchTraceabilityOperation(requirementsBranch, types, searchInherited, viewId); } else { boolean isGitBased = variableMap.getBoolean("Search Git Code Structure"); provider = new ScriptTraceabilityOperation(scriptDir, requirementsBranch, false, types, searchInherited, - traceHandlers, isGitBased); + traceHandlers, isGitBased, viewId); } - RequirementTraceabilityData traceabilityData = new RequirementTraceabilityData(requirementsBranch, provider); + RequirementTraceabilityData traceabilityData = + new RequirementTraceabilityData(requirementsBranch, provider, viewId); IStatus status = traceabilityData.initialize(monitor); if (status.getSeverity() == IStatus.CANCEL) { monitor.setCanceled(true); @@ -187,6 +203,31 @@ public class PublishStdStpTraceability extends AbstractBlam { } @Override + public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, SwtXWidgetRenderer dynamicXWidgetLayout, XModifiedListener xModListener, boolean isEditable) { + super.widgetCreated(xWidget, toolkit, art, dynamicXWidgetLayout, xModListener, isEditable); + if (xWidget.getLabel().equals(PROGRAM_BRANCH)) { + branchWidget = (XBranchSelectWidget) xWidget; + branchWidget.addXModifiedListener(new XModifiedListener() { + + @Override + public void widgetModified(XWidget widget) { + if (branchViewWidget != null) { + branchViewWidget.setEditable(true); + BranchId branch = branchWidget.getSelection(); + if (branch != null && branch.isInvalid()) { + branchViews = ViewApplicabilityUtil.getBranchViews(ViewApplicabilityUtil.getParentBranch(branch)); + branchViewWidget.setDataStrings(branchViews.values()); + } + } + } + }); + } else if (xWidget.getLabel().equals(BRANCH_VIEW)) { + branchViewWidget = (XCombo) xWidget; + branchViewWidget.setEditable(false); + } + } + + @Override public Collection<String> getCategories() { return Arrays.asList("Define.Publish"); } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java index bc00adfcdaf..d391da30a9c 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/sql/OseeSql.java @@ -56,6 +56,8 @@ public enum OseeSql { LOAD_REVISION_HISTORY_TRANSACTION_ATTR("SELECT %s txs.transaction_id from osee_attribute arv, osee_txs txs where arv.art_id = ? and arv.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.transaction_id <=?", Strings.HintsOrdered), LOAD_REVISION_HISTORY_TRANSACTION_REL("SELECT %s txs.transaction_id from osee_relation_link rel, osee_txs txs where (rel.a_art_id = ? or rel.b_art_id = ?) and rel.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.transaction_id <=?", Strings.HintsOrdered), + LOAD_EXCLUDED_ARTIFACT_IDS("select art_id from osee_artifact art, osee_txs txs where art.gamma_id = txs.gamma_id and txs.branch_id = ? and txs.tx_current = 1 and not exists (select null from osee_tuple2 t2, osee_txs txsP where tuple_type = 2 and e1 = ? and t2.gamma_id = txsP.gamma_id and txsP.branch_id = ? and txsP.tx_current = 1 and e2 = txs.app_id)"), + CHANGE_BRANCH_ATTRIBUTE_WAS("SELECT%s attxs1.attr_id, attxs1.value as was_value, txs1.mod_type FROM osee_join_id4 ja1, osee_attribute attxs1, osee_txs txs1, WHERE txs1.branch_id = ? AND txs1.tx_type = 1 AND attxs1.gamma_id = txs1.gamma_id AND attxs1.art_id = ja1.id2 AND txs1.branch_id = ja1.id1 AND ja1.query_id = ?", Strings.HintsOrdered), CHANGE_TX_ATTRIBUTE_WAS("SELECT%s att1.attr_id, att1.value as was_value, txs1.mod_type FROM osee_join_id4 al1, osee_attribute att1, osee_txs txs1 WHERE al1.id2 = att1.art_id AND att1.gamma_id = txs1.gamma_id AND txs1.transaction_id < ? AND al1.query_id = ? AND txs1.branch_id = al1.id1 order by txs1.branch_id, att1.art_id, att1.attr_id, txs1.transaction_id desc", Strings.HintsOrdered), CHANGE_BRANCH_ATTRIBUTE_IS("SELECT%s art1.art_type_id, attr1.art_id, attr1.attr_id, attr1.gamma_id, attr1.attr_type_id, attr1.value as is_value, txs1.mod_type FROM osee_txs txs1, osee_attribute attr1, osee_artifact art1 WHERE txs1.branch_id = ? AND txs1.transaction_id <> = ? AND txs1.tx_current in (" + TxChange.DELETED.getValue() + ", " + TxChange.CURRENT.getValue() + ", " + TxChange.ARTIFACT_DELETED.getValue() + ") AND art1.art_id = attr1.art_id AND attr1.gamma_id = txs1.gamma_id", Strings.HintsOrdered), diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ViewIdUtility.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ViewIdUtility.java new file mode 100644 index 00000000000..ea5e3d472cf --- /dev/null +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ViewIdUtility.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2017 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.framework.skynet.core.utility; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import org.eclipse.osee.framework.core.data.ArtifactId; +import org.eclipse.osee.framework.core.data.BranchId; +import org.eclipse.osee.framework.core.sql.OseeSql; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.framework.skynet.core.artifact.ArtifactLoader; + +/** + * @author Megumi Telles + */ +public class ViewIdUtility { + + public static Set<ArtifactId> findExcludedArtifactsByView(ArtifactId viewId, BranchId branch) { + Set<ArtifactId> excludedArtifactIdMap = new HashSet<>(); + if (!viewId.equals(ArtifactId.SENTINEL)) { + Object[] objs = {branch, viewId, branch}; + List<ArtifactId> excludedArtifacts = + ArtifactLoader.selectArtifactIds(OseeSql.LOAD_EXCLUDED_ARTIFACT_IDS.getSql(), objs, 300); + for (ArtifactId artId : excludedArtifacts) { + excludedArtifactIdMap.add(artId); + } + } + return excludedArtifactIdMap; + } + + public static void removeExcludedArtifacts(Iterator<Artifact> iterator, Set<ArtifactId> excludedArtifactIdMap) { + while (iterator.hasNext()) { + Artifact artifact = iterator.next(); + if (excludedArtifactIdMap.contains(ArtifactId.valueOf(artifact.getId()))) { + iterator.remove(); + } + } + } + +} diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java index ea5e8d6e397..95d4488cb9e 100644 --- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java +++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/AbstractBlam.java @@ -14,7 +14,12 @@ package org.eclipse.osee.framework.ui.skynet.blam; import java.io.IOException; import java.io.InputStream; import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.xml.parsers.ParserConfigurationException; @@ -24,6 +29,7 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.jobs.IJobChangeListener; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.operation.IOperation; import org.eclipse.osee.framework.core.operation.OperationLogger; import org.eclipse.osee.framework.core.operation.Operations; @@ -59,13 +65,20 @@ public abstract class AbstractBlam implements IDynamicWidgetLayoutListener { private final static String titleEnd = " BLAM"; private final Pattern capitalLetter = Pattern.compile("[A-Z]+[a-z]*"); + protected Set<ArtifactId> excludedArtifactIdMap = new HashSet<>(); + protected Map<Long, String> branchViews; + protected ArtifactId viewId = ArtifactId.SENTINEL; + public enum BlamUiSource { DEFAULT, FILE } + public static final String BRANCH_VIEW = "Branch View"; public static final String branchXWidgetXml = "<xWidgets><XWidget xwidgetType=\"XBranchSelectWidget\" displayName=\"Branch\" /></xWidgets>"; + public static final String BRANCH_VIEW_WIDGET = + "<XWidget xwidgetType=\"XCombo()\" displayName=\"Branch View\" horizontalLabel=\"true\"/>"; public static final String emptyXWidgetsXml = "<xWidgets/>"; private OperationLogger logger; @@ -115,7 +128,12 @@ public abstract class AbstractBlam implements IDynamicWidgetLayoutListener { return getXWidgetsXmlFromUiFile(getClass().getSimpleName(), Activator.PLUGIN_ID); case DEFAULT: default: - return AbstractBlam.branchXWidgetXml; + StringBuilder sb = new StringBuilder(); + sb.append("<xWidgets>"); + sb.append(branchXWidgetXml); + sb.append(BRANCH_VIEW_WIDGET); + sb.append("</xWidgets>"); + return sb.toString(); } } @@ -219,4 +237,23 @@ public abstract class AbstractBlam implements IDynamicWidgetLayoutListener { return "BLAM Workflow"; } + public void excludeArtifacts(Iterator<Artifact> iter) { + while (iter.hasNext()) { + Artifact artifact = iter.next(); + if (excludedArtifactIdMap.contains(ArtifactId.valueOf(artifact.getId()))) { + iter.remove(); + } + } + } + + public void setViewId(Object view) { + if (branchViews != null) { + for (Entry<Long, String> entry : branchViews.entrySet()) { + if (entry.getValue().equals(view)) { + viewId = ArtifactId.valueOf(entry.getKey()); + } + } + } + } + }
\ No newline at end of file |