summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2012-05-07 18:10:40 (EDT)
committerRoberto E. Escobar2012-05-07 18:10:40 (EDT)
commiteabe6dd34379884cc68b690f79ecbc523fbd8c49 (patch)
tree2227d057aab45cb8a3cc1c8c635c3a2ea9517ccf
parent07a9f6e7d60f0391a947fd4cd41958450b79d92f (diff)
downloadorg.eclipse.osee-eabe6dd34379884cc68b690f79ecbc523fbd8c49.zip
org.eclipse.osee-eabe6dd34379884cc68b690f79ecbc523fbd8c49.tar.gz
org.eclipse.osee-eabe6dd34379884cc68b690f79ecbc523fbd8c49.tar.bz2
feature: More storage changes
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/FilterVersionOperation.java50
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfiguration.java12
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationAddOperation.java21
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationDeleteOperation.java21
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationQueryOperation.java (renamed from plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationQuery.java)4
5 files changed, 89 insertions, 19 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/FilterVersionOperation.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/FilterVersionOperation.java
index 7ff35a3..095c02e 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/FilterVersionOperation.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/FilterVersionOperation.java
@@ -10,39 +10,60 @@
*******************************************************************************/
package org.eclipse.osee.ats.config;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.nebula.widgets.xviewer.Activator;
-import org.eclipse.osee.ats.core.client.config.TeamDefinitionArtifact;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+/**
+ * <p>
+ * From a set of all artifacts A, operation removes any found artifacts B, A - B, found in traversal of following
+ * relationship. <br>
+ * Given a Team Definition artifact, operation get its related < {@code CoreRelationTypes.Universal_Grouping__Group}
+ * artifacts (usually its Task Configuration artifacts) and
+ * </p>
+ *
+ * <pre>
+ *
+ *
+ *
+ * </pre>
+ */
public class FilterVersionOperation extends AbstractOperation {
private final Artifact teamDefinition;
- private final Artifact[] additional;
+ private final Artifact[] additionalToFilter;
+ private final Set<Artifact> allVersions;
+ private final Set<Artifact> result;
- public FilterVersionOperation(String operationName, Set<Artifact> result, Artifact teamDefinition, Artifact... additionalToBeRemoved) {
- super(operationName, Activator.PLUGIN_ID);
+ public FilterVersionOperation(String operationName, Set<Artifact> allVersions, Set<Artifact> result, Artifact teamDefinition, Artifact... additionalToBeRemoved) {
+ super(operationName, FilterVersionOperation.class.getName());
+ this.allVersions = allVersions;
+ this.result = result;
this.teamDefinition = teamDefinition;
- this.additional = additionalToBeRemoved;
+ this.additionalToFilter = additionalToBeRemoved;
}
@Override
protected void doWork(IProgressMonitor monitor) throws Exception {
- final Set<Artifact> filteredVersions = new HashSet<Artifact>(getVersions(TaskConfiguration.this.program));
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+
+ result.addAll(this.allVersions);
+
try {
- this.teamDefinition = (TeamDefinitionArtifact) iter.next();
- for (Artifact taskConf : this.teamDefinition.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Group)) {
+ for (Artifact taskConf : teamDefinition.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Group)) {
List<Artifact> keys = taskConf.getRelatedArtifacts(CoreRelationTypes.Universal_Grouping__Members);
for (int i = 0; i < keys.size(); i++) {
- if (keys.get(i).equals(this.teamDefinition)) {
- filteredVersions.remove(keys.get(keys.size() - 1 - i));
+ if (keys.get(i).equals(teamDefinition)) {
+ result.remove(keys.get(keys.size() - 1 - i));
break;
}
}
@@ -51,7 +72,12 @@ public class FilterVersionOperation extends AbstractOperation {
OseeLog.log(Activator.class, Level.SEVERE,
FilterVersionOperation.class.getSimpleName() + " unable to update versions. Ex: " + ex);
}
- filteredVersions.remove(version);
+
+ for (Artifact version : additionalToFilter) {
+ result.remove(version);
+ }
+
+ monitor.done();
}
}
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 1ddcadf..e0eec1b 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
@@ -235,7 +235,7 @@ public class TaskConfiguration extends AbstractBlam {
version = (VersionArtifact) iter.next();
final Map<String, Artifact> stringTotaskCreationMap = new HashMap<String, Artifact>();
- Operations.executeAsJob(new TaskConfigurationQuery("Search for task configuration setup...",
+ Operations.executeAsJob(new TaskConfigurationQueryOperation("Search for task configuration setup...",
NullOperationLogger.getSingleton(), version, stringTotaskCreationMap), true);
final ISelectionChangedListener taskCreationListener = new ISelectionChangedListener() {
@@ -281,14 +281,16 @@ public class TaskConfiguration extends AbstractBlam {
IStructuredSelection selection = (IStructuredSelection) event.getSelectionProvider().getSelection();
final Iterator<?> iter = selection.iterator();
if (iter.hasNext()) {
- final Set<Artifact> result = new HashSet<Artifact>();
new Thread(new Runnable() {
@Override
public void run() {
+
+ final Set<Artifact> result = new HashSet<Artifact>();
+
selectedTeamDefinition = (TeamDefinitionArtifact) iter.next();
- Operations.executeAsJob(new FilterVersionOperation("Filtering Version Artifacts", result,
- selectedTeamDefinition, version), true);
+ Operations.executeAsJob(new FilterVersionOperation("Filtering Version Artifacts",
+ getVersions(TaskConfiguration.this.program), result, selectedTeamDefinition, version), true);
Displays.ensureInDisplayThread(new Runnable() {
@Override
@@ -298,7 +300,7 @@ public class TaskConfiguration extends AbstractBlam {
}
});
}
- });
+ }).start();
}
}
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationAddOperation.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationAddOperation.java
new file mode 100644
index 0000000..79130ff
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationAddOperation.java
@@ -0,0 +1,21 @@
+/*
+ * Created on May 16, 2012
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.ats.config;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.operation.AbstractOperation;
+
+public class TaskConfigurationAddOperation extends AbstractOperation {
+
+ public TaskConfigurationAddOperation(String operationName, String pluginId) {
+ super(operationName, pluginId);
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationDeleteOperation.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationDeleteOperation.java
new file mode 100644
index 0000000..8136d2d
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationDeleteOperation.java
@@ -0,0 +1,21 @@
+/*
+ * Created on May 16, 2012
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.ats.config;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.operation.AbstractOperation;
+
+public class TaskConfigurationDeleteOperation extends AbstractOperation {
+
+ public TaskConfigurationDeleteOperation(String operationName, String pluginId) {
+ super(operationName, pluginId);
+ }
+
+ @Override
+ protected void doWork(IProgressMonitor monitor) throws Exception {
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationQuery.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationQueryOperation.java
index 46ffc8b..817899b 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationQuery.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/TaskConfigurationQueryOperation.java
@@ -30,14 +30,14 @@ import org.eclipse.osee.framework.core.operation.OperationLogger;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-public class TaskConfigurationQuery extends AbstractOperation {
+public class TaskConfigurationQueryOperation extends AbstractOperation {
private final Class<?>[] KEYS = {VersionArtifact.class, TeamDefinitionArtifact.class};
private final Set<Class<?>> keyTypes;
private final Artifact version;
private final Map<String, Artifact> taskConfigurationStorage;
- public TaskConfigurationQuery(String operationName, OperationLogger logger, Artifact versionArtifact, Map<String, Artifact> storage) {
+ public TaskConfigurationQueryOperation(String operationName, OperationLogger logger, Artifact versionArtifact, Map<String, Artifact> storage) {
super(operationName, "org.eclipse.osee.ats.config.TaskConfigurationQuery", logger);
this.version = versionArtifact;
this.keyTypes = new HashSet<Class<?>>(Arrays.asList(KEYS));