summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2012-05-07 18:10:40 (EDT)
committerRoberto E. Escobar2012-05-07 18:10:40 (EDT)
commit272c2bbc93dfd52b2153e7308445203a4a8fc93e (patch)
tree28eaae75e74c1c8d773cb39d4edb3ce84707fa7f
parenteb2bf6e7b4162a17d79b760cdd9230612ec56cdc (diff)
downloadorg.eclipse.osee-272c2bbc93dfd52b2153e7308445203a4a8fc93e.zip
org.eclipse.osee-272c2bbc93dfd52b2153e7308445203a4a8fc93e.tar.gz
org.eclipse.osee-272c2bbc93dfd52b2153e7308445203a4a8fc93e.tar.bz2
feature: More storage changes
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfiguration.java175
-rw-r--r--plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/FrameworkCore_Demo_Suite.java5
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/ReplaceAttributeWithTest.java47
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/ui/TaskConfigurationUi.xml1
5 files changed, 140 insertions, 93 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfiguration.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfiguration.java
index 00723ff..a1a52d9 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfiguration.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfiguration.java
@@ -10,10 +10,17 @@
*******************************************************************************/
package org.eclipse.osee.ats.config;
+import java.rmi.activation.Activator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+import java.util.logging.Level;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -22,35 +29,38 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.osee.ats.core.client.config.IAtsProgram;
import org.eclipse.osee.ats.core.client.config.TeamDefinitionArtifact;
import org.eclipse.osee.ats.core.client.version.VersionArtifact;
-import org.eclipse.osee.ats.util.widgets.XTeamDefinitionCombo;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
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.widgets.XComboViewer;
-import org.eclipse.osee.framework.ui.skynet.widgets.XListDropViewer;
+import org.eclipse.osee.framework.ui.skynet.widgets.XListViewer;
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.DynamicXWidgetLayout;
-import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.ui.forms.widgets.FormToolkit;
public class TaskConfiguration extends AbstractBlam {
+ private static final String TASK_CONFIGURATION = TaskConfiguration.class.getSimpleName();
+ private static final String TASK_CONFIGURATION_ARTIFACTS = "Task Configuration Artifacts";
private static final String PROGRAM = "Program";
private static final String VERSION_ARTIFACTS = "Version Artifacts";
- private XListDropViewer versionsWidget;
- private XTeamDefinitionCombo xTeamDefinitionCombo;
-
+ private XListViewer taskConfigurationArtifacts;
+ private XListViewer versionsWidget;
private IAtsProgram program;
private VersionArtifact version;
public TaskConfiguration() {
- super(null,
- "Creates new TaskCreation artifact on selected Version artifacts, associates via Parent-Child relationship.",
- BlamUiSource.FILE);
+ super(null, String.format(
+ "Creates new %s artifact on selected Version artifacts, associates via Parent-Child relationship.",
+ TASK_CONFIGURATION), BlamUiSource.FILE);
}
@Override
@@ -59,25 +69,41 @@ public class TaskConfiguration extends AbstractBlam {
monitor = new NullProgressMonitor();
}
- String workStatement = String.format("Created \"Task Creation\" artifact on Version Artifact:[%s]", version);
- monitor.beginTask(workStatement, 2);
- Artifact artifact =
- ArtifactTypeManager.addArtifact(CoreArtifactTypes.TaskCreation, version.getBranch(), "Task Creation");
- monitor.worked(1);
- version.addChild(artifact);
- monitor.worked(1);
- version.persist(String.format("[%s] added Task configuration to [%s]", getClass().getSimpleName(), version));
+ Artifact taskConfiguration = null;
+
+ if (version != null) {
+ String workStatement =
+ String.format("Created \"%s\" artifact on Version Artifact:[%s]", TASK_CONFIGURATION, version);
+ monitor.beginTask(workStatement, 2);
+ taskConfiguration =
+ ArtifactTypeManager.addArtifact(CoreArtifactTypes.UniversalGroup, version.getBranch(), TASK_CONFIGURATION);
+ monitor.worked(1);
+ version.addChild(taskConfiguration);
+ monitor.worked(1);
+ taskConfiguration.addAttribute(CoreAttributeTypes.Description, String.format(
+ "%s artifact relates 2 key artifacts to determine automatic task creation for a particular Branch",
+ TASK_CONFIGURATION));
+
+ version.persist(String.format("[%s] added Task configuration to [%s]", getClass().getSimpleName(), version));
+ } else {
+ throw new OseeStateException("Version artifact not selected");
+ }
+
monitor.done();
}
@Override
public void widgetCreated(XWidget xWidget, FormToolkit toolkit, Artifact art, DynamicXWidgetLayout dynamicXWidgetLayout, XModifiedListener modListener, boolean isEditable) {
- if (xWidget instanceof XComboViewer && PROGRAM.equals(xWidget.getLabel())) {
+ String label = xWidget.getLabel();
+ if (PROGRAM.equalsIgnoreCase(label)) {
XComboViewer viewer = (XComboViewer) xWidget;
- viewer.addSelectionChangedListener(new ProgramSelectionListener());
- } else if (xWidget instanceof XListDropViewer && VERSION_ARTIFACTS.equals(xWidget.getLabel())) {
- versionsWidget = (XListDropViewer) xWidget;
- versionsWidget.addSelectionChangedListener(new VersionSelectionListener());
+ viewer.addSelectionChangedListener(new ProgramChangedListener());
+ } else if (VERSION_ARTIFACTS.equalsIgnoreCase(label)) {
+ versionsWidget = (XListViewer) xWidget;
+ versionsWidget.addSelectionChangedListener(new VersionChangedListener());
+ } else if (TASK_CONFIGURATION_ARTIFACTS.equalsIgnoreCase(label)) {
+ taskConfigurationArtifacts = (XListViewer) xWidget;
+ taskConfigurationArtifacts.addSelectionChangedListener(new TaskConfigurationChangedListener());
}
}
@@ -86,42 +112,117 @@ public class TaskConfiguration extends AbstractBlam {
return Arrays.asList("Define");
}
- private class VersionSelectionListener implements ISelectionChangedListener {
+ private class ProgramChangedListener implements ISelectionChangedListener {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelectionProvider().getSelection();
Iterator<?> iter = selection.iterator();
if (iter.hasNext()) {
- version = (VersionArtifact) iter.next();
+ program = (IAtsProgram) iter.next();
+ try {
+ TeamDefinitionArtifact teamDefinitionArtifact = program.getTeamDefHoldingVersions();
+ final Collection<VersionArtifact> versionArtifacts = new ArrayList<VersionArtifact>();
+ if (teamDefinitionArtifact != null) {
+ versionArtifacts.addAll(teamDefinitionArtifact.getVersionsArtifacts());
+ }
+ versionsWidget.setInput(versionArtifacts);
+ version = null;
+ taskConfigurationArtifacts.setInput(null);
+ } catch (OseeCoreException ex) {
+ System.out.println("Error while processing. Exception:" + ex);
+ }
}
}
};
- private class ProgramSelectionListener implements ISelectionChangedListener {
+ private class VersionChangedListener implements ISelectionChangedListener {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelectionProvider().getSelection();
Iterator<?> iter = selection.iterator();
if (iter.hasNext()) {
- program = (IAtsProgram) iter.next();
+ version = (VersionArtifact) iter.next();
+
+ Map<String, Artifact> nameTotaskCreation = new HashMap<String, Artifact>();
try {
- TeamDefinitionArtifact teamDefinitionArtifact = program.getTeamDefHoldingVersions();
- final Collection<VersionArtifact> versionArtifacts = new ArrayList<VersionArtifact>();
- if (teamDefinitionArtifact != null) {
- versionArtifacts.addAll(teamDefinitionArtifact.getVersionsArtifacts());
- }
- Displays.ensureInDisplayThread(new Runnable() {
- @Override
- public void run() {
- versionsWidget.setInput(versionArtifacts);
+ for (Artifact taskCreationNode : version.getChildren()) {
+ if (taskCreationNode.isOfType(CoreArtifactTypes.UniversalGroup)) {
+ List<Artifact> artifactKeys = getKeysFromTaskCreationNode(taskCreationNode);
+ if (artifactKeys.size() == 2) {
+ Artifact key1 = artifactKeys.get(0);
+ Artifact key2 = artifactKeys.get(1);
+
+ String guiName =
+ String.format("[%s]:[%s] -- [%s]:[%s]", key1.getArtifactTypeName(), key1.getName(),
+ key2.getArtifactTypeName(), key2.getName());
+
+ nameTotaskCreation.put(guiName, taskCreationNode);
+ }
}
- });
+ }
} catch (OseeCoreException ex) {
- System.out.println("Error while processing. Exception:" + ex);
+ OseeLog.log(Activator.class, Level.INFO,
+ String.format("Unable to retrieve %s artifacts", TASK_CONFIGURATION));
}
+
+ taskConfigurationArtifacts.setInput(nameTotaskCreation.keySet());
}
}
};
+
+ /**
+ * Pulls first found keys from child and returns it as a list
+ *
+ * <pre>
+ * (Key 1) Version Artifact
+ * /
+ * (Task Creation) child --`.
+ * \ \
+ * | (Key 2) Team Definition
+ * |
+ * \
+ * (Key n) Artifact
+ * </pre>
+ *
+ * @throws OseeCoreException
+ */
+ private List<Artifact> getKeysFromTaskCreationNode(Artifact child) throws OseeCoreException {
+ List<Artifact> result = new ArrayList<Artifact>();
+
+ Set<Class<?>> typeSet = new CopyOnWriteArraySet<Class<?>>();
+ typeSet.add(VersionArtifact.class);
+ typeSet.add(TeamDefinitionArtifact.class);
+
+ List<Artifact> keys = child.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members);
+ for (Artifact key : keys) {
+ for (Class<?> type : typeSet) {
+ if (type.equals(key.getClass())) {
+ result.add(key);
+ typeSet.remove(type);
+ }
+ }
+ }
+ return result;
+ }
+
+ private class TaskConfigurationChangedListener implements ISelectionChangedListener {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelectionProvider().getSelection();
+
+ // Iterator<?> iter = selection.iterator();
+ // if (iter.hasNext()) {
+ // Artifact selectedVersion = (Artifact) iter.next();
+ // try {
+ // for (Artifact artifact : selectedVersion.getChildren()) {
+ // System.out.println("artifact : " + artifact);
+ // }
+ // } catch (OseeCoreException ex) {
+ // //
+ // }
+ // }
+ }
+ };
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee b/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee
index 92004d2..5366a8b 100644
--- a/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee
+++ b/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee
@@ -19,11 +19,6 @@ abstract artifactType "ats.Ats Artifact" extends "Artifact" {
attribute "ats.Goal Order Vote"
}
-artifactType "TaskCreation" extends "Artifact" {
- guid "ABR52KH7FwMFi9CFsLgA"
- uuid 0x1000000000000198
-}
-
artifactType "ats.Review" extends "ats.State Machine" {
guid "ABMa6P4TwzXA1b8K3RAA"
uuid 0x0000000000000040
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/FrameworkCore_Demo_Suite.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/FrameworkCore_Demo_Suite.java
index 6653e44..6af245e 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/FrameworkCore_Demo_Suite.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/FrameworkCore_Demo_Suite.java
@@ -28,8 +28,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifactsTest;
import org.eclipse.osee.framework.skynet.core.artifact.PurgeTransactionTest;
import org.eclipse.osee.framework.skynet.core.artifact.RelationDeletionTest;
import org.eclipse.osee.framework.skynet.core.artifact.RelationOrderingTest;
-import org.eclipse.osee.framework.skynet.core.artifact.ReplaceAttributeWithTest;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactLoaderTest;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQueryTestDemo;
import org.eclipse.osee.framework.skynet.core.branch.BranchSuite;
import org.eclipse.osee.framework.skynet.core.event.filter.ArtifactEventFiltersTest;
@@ -64,7 +62,6 @@ import org.junit.runners.Suite;
FrameworkEventToRemoteEventListenerTest.class,
BranchSuite.class,
UserManagerTest.class,
- ReplaceAttributeWithTest.class,
AttributePurgeTest.class,
CrossBranchLinkTest.class,
UpdateBookmarkIdTest.class,
@@ -72,7 +69,7 @@ import org.junit.runners.Suite;
BranchEventFiltersTest.class,
BranchEventTest.class,
BranchEventLoopbackTest.class,
- ArtifactLoaderTest.class,
+ //ArtifactLoaderTest.class,
ArtifactEventTest.class,
ArtifactEventLoopbackTest.class,
TransactionEventLocalTest.class,
diff --git a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/ReplaceAttributeWithTest.java b/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/ReplaceAttributeWithTest.java
deleted file mode 100644
index 3a77a65..0000000
--- a/plugins/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/artifact/ReplaceAttributeWithTest.java
+++ /dev/null
@@ -1,47 +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.skynet.core.artifact;
-
-import static org.junit.Assert.assertTrue;
-import java.util.Collections;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.support.test.util.DemoSawBuilds;
-
-/**
- * @author Jeff C. Phillips
- */
-public class ReplaceAttributeWithTest {
-
- @org.junit.Test
- public void testReplaceAttributeVersion() throws Exception {
- Artifact artifact =
- ArtifactTypeManager.addArtifact(CoreArtifactTypes.GeneralDocument, DemoSawBuilds.SAW_Bld_1,
- getClass().getSimpleName());
- artifact.setAttributeValues(CoreAttributeTypes.Name, Collections.singletonList("Name"));
- artifact.persist("Replace attribute test");
-
- Attribute<?> nameAttribute = artifact.getAttributes(CoreAttributeTypes.Name).iterator().next();
- int previousGamma = nameAttribute.getGammaId();
- String previousName = nameAttribute.getDisplayableString();
-
- nameAttribute.setFromString("New Name");
- nameAttribute.getArtifact().persist("Replace attribute test");
-
- nameAttribute.replaceWithVersion(previousGamma);
- artifact.persist("Replace attribute test");
- artifact.reloadAttributesAndRelations();
-
- assertTrue(nameAttribute.getGammaId() == previousGamma);
- assertTrue(artifact.getAttributes(CoreAttributeTypes.Name).iterator().next().getValue().equals(previousName));
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/ui/TaskConfigurationUi.xml b/plugins/org.eclipse.osee.framework.ui.skynet/ui/TaskConfigurationUi.xml
index 8441616..1427a20 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/ui/TaskConfigurationUi.xml
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/ui/TaskConfigurationUi.xml
@@ -1,4 +1,5 @@
<xWidgets>
<XWidget xwidgetType="XAtsProgramComboWidget" displayName="Program" />
<XWidget xwidgetType="XListDropViewer" displayName="Version Artifacts" />
+ <XWidget xwidgetType="XListDropViewer" displayName="Task Configuration Artifacts" />
</xWidgets>