summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn F. Cook2011-08-02 16:05:30 (EDT)
committerRyan D. Brooks2011-08-02 16:05:30 (EDT)
commit79e69c9c937d627f25e69cd63c3c10fe23a6a890 (patch)
tree36eddef9229a634913ecf2418763150c210b7bdb
parentb4d61cdee2e9e18f7aa4137d953a7c8f74b53159 (diff)
downloadorg.eclipse.osee-79e69c9c937d627f25e69cd63c3c10fe23a6a890.zip
org.eclipse.osee-79e69c9c937d627f25e69cd63c3c10fe23a6a890.tar.gz
org.eclipse.osee-79e69c9c937d627f25e69cd63c3c10fe23a6a890.tar.bz2
refinement[bgz_350331]: Delete SetRequirementCategory BLAM during migration to server side
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/SetRequirementCategory.java139
2 files changed, 0 insertions, 147 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
index 9722873..2591f52 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/plugin.xml
@@ -1129,14 +1129,6 @@
</Operation>
</extension>
<extension
- id="SetRequirementCategory"
- name="SetRequirementCategory"
- point="org.eclipse.osee.framework.ui.skynet.BlamOperation">
- <Operation
- className="org.eclipse.osee.framework.ui.skynet.blam.operation.SetRequirementCategory">
- </Operation>
- </extension>
- <extension
id="ExportArtifacts"
name="ExportArtifacts"
point="org.eclipse.osee.framework.ui.skynet.BlamOperation">
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/SetRequirementCategory.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/SetRequirementCategory.java
deleted file mode 100644
index 8c58e1e..0000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/blam/operation/SetRequirementCategory.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.ui.skynet.blam.operation;
-
-import static org.eclipse.osee.framework.core.enums.DeletionFlag.EXCLUDE_DELETED;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
-import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-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.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
-import org.eclipse.osee.framework.ui.skynet.blam.AbstractBlam;
-import org.eclipse.osee.framework.ui.skynet.blam.VariableMap;
-
-/**
- * @author Ryan D. Brooks
- */
-public class SetRequirementCategory extends AbstractBlam {
- private final HashMap<String, Artifact> reqs = new HashMap<String, Artifact>();
- private HashMap<String, String> reqPriorities;
- private boolean bulkLoad;
- private Branch branch;
-
- @Override
- public String getName() {
- return "Set Requirement Category";
- }
-
- @Override
- public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception {
- monitor.beginTask("Set Categories", 100);
-
- branch = variableMap.getBranch("Branch");
- String excelMlPath = variableMap.getString("ExcelML Priority File");
- bulkLoad = variableMap.getBoolean("Bulk Load");
-
- ExtractReqPriority extractor = new ExtractReqPriority(excelMlPath);
- reqPriorities = extractor.getReqPriorities();
-
- if (bulkLoad) {
- for (Artifact req : ArtifactQuery.getArtifactListFromTypeWithInheritence(
- CoreArtifactTypes.AbstractSoftwareRequirement, branch, EXCLUDE_DELETED)) {
- reqs.put(req.getName().trim(), req);
- }
- }
-
- SkynetTransaction transaction = new SkynetTransaction(branch, "set requirement categories");
- for (String requirementName : reqPriorities.keySet()) {
- updateCategory(transaction, requirementName);
- }
- transaction.execute();
-
- reqs.clear();
- }
-
- private void updateCategory(SkynetTransaction transaction, String requirementName) {
- try {
- String canonicalRequirementName = requirementName.trim();
- Artifact requirement = getRequirement(requirementName, canonicalRequirementName);
- requirement.setSoleAttributeValue(CoreAttributeTypes.Category, reqPriorities.get(canonicalRequirementName));
- requirement.persist(transaction);
- } catch (OseeCoreException ex) {
- OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
- }
- }
-
- private Artifact getSoleRequirement(String requirementName, String canonicalRequirementName) throws OseeCoreException {
- Artifact requirement;
- if (bulkLoad) {
- requirement = reqs.get(canonicalRequirementName);
- if (requirement == null) {
- throw new ArtifactDoesNotExist("No requirement with name [%s] found.", canonicalRequirementName);
- }
- } else {
- try {
- requirement = ArtifactQuery.getArtifactFromAttribute(CoreAttributeTypes.Name, requirementName, branch);
- } catch (ArtifactDoesNotExist ex) {
- requirement =
- ArtifactQuery.getArtifactFromAttribute(CoreAttributeTypes.Name, canonicalRequirementName, branch);
- }
- }
- return requirement;
- }
-
- private Artifact getRequirement(String requirementName, String canonicalRequirementName) throws OseeCoreException {
- try {
- Artifact requirement = getSoleRequirement(requirementName, canonicalRequirementName);
-
- if (requirement.isOrphan()) {
- throw new MultipleArtifactsExist(requirement.getName());
- }
- return requirement;
- } catch (MultipleArtifactsExist ex) {
- List<Artifact> artiafcts =
- ArtifactQuery.getArtifactListFromTypeAndName(CoreArtifactTypes.SoftwareRequirement,
- canonicalRequirementName, branch);
- for (Artifact requirement : artiafcts) {
- if (requirement.isOrphan()) {
- OseeLog.log(SkynetGuiPlugin.class, Level.INFO, requirement + " is an orphan");
- }
- }
- throw ex;
- }
- }
-
- @Override
- public String getXWidgetsXml() {
- return "<xWidgets><XWidget xwidgetType=\"XCheckBox\" horizontalLabel=\"true\" labelAfter=\"true\" displayName=\"Bulk Load\" /><XWidget xwidgetType=\"XText\" displayName=\"ExcelML Priority File\" defaultValue=\"C:/UserData/RequirementCategories.xml\" /><XWidget xwidgetType=\"XBranchSelectWidget\" displayName=\"Branch\" /></xWidgets>";
- }
-
- @Override
- public String getDescriptionUsage() {
- return "Sets the Category attribute on software requirements.";
- }
-
- @Override
- public Collection<String> getCategories() {
- return Arrays.asList("Define");
- }
-} \ No newline at end of file