Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2011-01-24 01:09:43 +0000
committerRyan D. Brooks2011-01-24 01:09:43 +0000
commite847982e21edf58404ba4f4cc8061c699ef4509d (patch)
treefda8175c43ef99ae5e7032cd317d8d35fc238cd2
parent8494908d6f41df7679454c3332540eafde0df345 (diff)
downloadorg.eclipse.osee-e847982e21edf58404ba4f4cc8061c699ef4509d.tar.gz
org.eclipse.osee-e847982e21edf58404ba4f4cc8061c699ef4509d.tar.xz
org.eclipse.osee-e847982e21edf58404ba4f4cc8061c699ef4509d.zip
feature: Fix work definition loading to ensure that fallback to old can occur
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AbstractWorkflowArtifact.java19
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditorOutlinePage.java14
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java1
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/ClearAtsWorkDefinitionCache.java35
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java4
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionProviders.java4
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionSheetProviders.java13
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/WorkDefinitionFactory.java77
-rw-r--r--plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee1
9 files changed, 114 insertions, 54 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AbstractWorkflowArtifact.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AbstractWorkflowArtifact.java
index 303e2eaf3e6..119093926f2 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AbstractWorkflowArtifact.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/artifact/AbstractWorkflowArtifact.java
@@ -87,7 +87,6 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
private final Set<IRelationEnumeration> atsWorldRelations = new HashSet<IRelationEnumeration>();
private Collection<User> transitionAssignees;
- protected WorkDefinitionMatch workDefinitionMatch;
protected AbstractWorkflowArtifact parentSma;
protected TeamWorkFlowArtifact parentTeamArt;
protected ActionArtifact parentAction;
@@ -233,7 +232,6 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
}
public void clearCaches() {
- workDefinitionMatch = null;
implementersStr = null;
stateToWeight = null;
}
@@ -243,15 +241,12 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
}
public WorkDefinitionMatch getWorkDefinitionMatch() {
- if (AtsUtil.isForceReloadWorkDefinitions() || workDefinitionMatch == null) {
- try {
- workDefinitionMatch = WorkDefinitionFactory.getWorkDefinition(this);
- } catch (Exception ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- }
+ try {
+ return WorkDefinitionFactory.getWorkDefinition(this);
+ } catch (Exception ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
}
- return workDefinitionMatch;
-
+ return null;
}
@Override
@@ -807,9 +802,9 @@ public abstract class AbstractWorkflowArtifact extends AbstractAtsArtifact imple
workRules.addAll(((TeamWorkFlowArtifact) this).getTeamDefinition().getRulesStartsWith(ruleName));
}
// Get work rules from workflow
- if (workDefinitionMatch != null) {
+ if (getWorkDefinition() != null) {
// Get rules from workflow definitions
- workRules.addAll(workDefinitionMatch.getWorkDefinition().getRulesStartsWith(ruleName));
+ workRules.addAll(getWorkDefinition().getRulesStartsWith(ruleName));
}
// Add work rules from page
workRules.addAll(getStateDefinition().getRulesStartsWith(ruleName));
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditorOutlinePage.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditorOutlinePage.java
index dfcda050672..f52a5857ff8 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditorOutlinePage.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/editor/SMAEditorOutlinePage.java
@@ -16,11 +16,8 @@ import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -85,17 +82,6 @@ public class SMAEditorOutlinePage extends ContentOutlinePage {
getSite().getActionBars().getToolBarManager().update(true);
}
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection sSelection = (IStructuredSelection) selection;
- if (!sSelection.isEmpty()) {
- System.out.println("SMA Selection");
- }
- }
- }
-
public void setInput(Object input) {
if (input instanceof SMAEditor) {
this.editor = (SMAEditor) input;
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java
index fcaf9dd971a..095b4205302 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/AtsNavigateViewItems.java
@@ -238,6 +238,7 @@ public final class AtsNavigateViewItems implements XNavigateViewItems {
new GenerateGuid(utilItems);
new XNavigateItemOperation(utilItems, FrameworkImage.GEAR, MassEditDirtyArtifactOperation.NAME,
new MassEditDirtyArtifactOperation());
+ new ClearAtsWorkDefinitionCache(utilItems);
items.add(utilItems);
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/ClearAtsWorkDefinitionCache.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/ClearAtsWorkDefinitionCache.java
new file mode 100644
index 00000000000..ffbf8f0b0bb
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/navigate/ClearAtsWorkDefinitionCache.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.ats.navigate;
+
+import org.eclipse.osee.ats.workdef.WorkDefinitionFactory;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItemAction;
+import org.eclipse.osee.framework.ui.skynet.FrameworkImage;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class ClearAtsWorkDefinitionCache extends XNavigateItemAction {
+
+ public ClearAtsWorkDefinitionCache(XNavigateItem parent) {
+ super(parent, "Clear ATS WorkDefinition Cache", FrameworkImage.GEAR);
+ }
+
+ @Override
+ public void run(TableLoadOption... tableLoadOptions) {
+ WorkDefinitionFactory.clearCaches();
+ AWorkbench.popup("Completed");
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java
index 85a36eba2e0..56981b4e70e 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/AtsUtil.java
@@ -499,10 +499,6 @@ public final class AtsUtil {
return StateManager.getAssigned(userId, clazz);
}
- public static boolean isForceReloadWorkDefinitions() {
- return Boolean.valueOf(System.getProperty("ats.forceReloadWorkDefinitions"));
- }
-
public static Boolean useNewWorkDefintions = null;
public synchronized static boolean isUseNewWorkDefinitions() {
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionProviders.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionProviders.java
index b6db036c7bc..42aadc5cb92 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionProviders.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionProviders.java
@@ -121,7 +121,9 @@ public final class AtsWorkDefinitionProviders {
}
}
}
- OseeLog.log(AtsPlugin.class, Level.INFO, "No AtsWorkDefinitionProvider Loaded");
+ if (provider == null) {
+ OseeLog.log(AtsPlugin.class, Level.INFO, "No AtsWorkDefinitionProvider Loaded");
+ }
return provider;
}
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionSheetProviders.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionSheetProviders.java
index 8eb39c64fa1..1cbc77b64b1 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionSheetProviders.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/AtsWorkDefinitionSheetProviders.java
@@ -44,15 +44,24 @@ public final class AtsWorkDefinitionSheetProviders {
// private constructor
}
- public static String getOverrideId(String id) {
+ public static String getOverrideId(String legacyId) {
for (WorkDefinitionSheet sheet : getWorkDefinitionSheets()) {
- if (sheet.getLegacyOverrideId().equals(id)) {
+ if (sheet.getLegacyOverrideId().equals(legacyId)) {
return sheet.getName();
}
}
return null;
}
+ public static String getReverseOverrideId(String sheetName) {
+ for (WorkDefinitionSheet sheet : getWorkDefinitionSheets()) {
+ if (sheet.getName().equals(sheetName)) {
+ return sheet.getLegacyOverrideId();
+ }
+ }
+ return null;
+ }
+
public static void initializeDatabase() throws OseeCoreException {
SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Import ATS Work Definitions");
Artifact folder = AtsFolderUtil.getFolder(AtsFolder.WorkDefinitions);
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/WorkDefinitionFactory.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/WorkDefinitionFactory.java
index 42c89bbc144..4228f27e495 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/WorkDefinitionFactory.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workdef/WorkDefinitionFactory.java
@@ -5,11 +5,10 @@
*/
package org.eclipse.osee.ats.workdef;
+import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Set;
import java.util.logging.Level;
import org.eclipse.osee.ats.actions.wizard.IAtsTeamWorkflow;
import org.eclipse.osee.ats.artifact.AbstractWorkflowArtifact;
@@ -18,6 +17,7 @@ import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
import org.eclipse.osee.ats.artifact.GoalArtifact;
import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.artifact.TeamWorkflowExtensions;
import org.eclipse.osee.ats.internal.AtsPlugin;
@@ -49,7 +49,8 @@ import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinitio
public class WorkDefinitionFactory {
private static final Map<String, RuleDefinition> idToRule = new HashMap<String, RuleDefinition>();
- private static final Set<WorkDefinitionMatch> workDefinitions = new HashSet<WorkDefinitionMatch>();
+ private static final Map<Artifact, WorkDefinitionMatch> artToWorkDefinitions =
+ new HashMap<Artifact, WorkDefinitionMatch>();
private static final Map<String, WorkDefinitionMatch> idToWorkDefintion = new HashMap<String, WorkDefinitionMatch>();
public static RuleDefinition getRuleById(String id) {
@@ -81,22 +82,30 @@ public class WorkDefinitionFactory {
}
}
+ public static void clearCaches() {
+ artToWorkDefinitions.clear();
+ idToRule.clear();
+ idToWorkDefintion.clear();
+ }
+
public static WorkDefinitionMatch getWorkDefinition(Artifact artifact) throws OseeCoreException {
- WorkDefinitionMatch match = getWorkDefinitionNew(artifact);
- if (!match.isMatched()) {
- WorkFlowDefinitionMatch flowMatch = WorkFlowDefinitionFactory.getWorkFlowDefinition(artifact);
- if (flowMatch.isMatched()) {
- WorkDefinition workDef = translateToWorkDefinition(flowMatch.getWorkFlowDefinition());
- match = new WorkDefinitionMatch(workDef, null);
- match.getTrace().addAll(flowMatch.getTrace());
+ if (!artToWorkDefinitions.containsKey(artifact)) {
+ WorkDefinitionMatch match = getWorkDefinitionNew(artifact);
+ if (!match.isMatched()) {
+ WorkFlowDefinitionMatch flowMatch = WorkFlowDefinitionFactory.getWorkFlowDefinition(artifact);
+ if (flowMatch.isMatched()) {
+ WorkDefinition workDef = translateToWorkDefinition(flowMatch.getWorkFlowDefinition());
+ match = new WorkDefinitionMatch(workDef, null);
+ match.getTrace().addAll(flowMatch.getTrace());
+ }
}
+ artToWorkDefinitions.put(artifact, match);
}
- workDefinitions.add(match);
- return match;
+ return artToWorkDefinitions.get(artifact);
}
public static WorkDefinitionMatch getWorkDefinition(String id) throws OseeCoreException {
- if (!idToWorkDefintion.containsKey(id) || AtsUtil.isForceReloadWorkDefinitions()) {
+ if (!idToWorkDefintion.containsKey(id)) {
WorkDefinitionMatch match = new WorkDefinitionMatch();
String translatedId = WorkDefinitionFactory.getOverrideWorkDefId(id);
// Try to get from new DSL provider if configured to use it
@@ -110,12 +119,34 @@ public class WorkDefinitionFactory {
}
// Otherwise, just translate legacy WorkFlowDefinition from artifact
if (!match.isMatched()) {
- WorkDefinition workDef =
- translateToWorkDefinition((WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(id));
- match.setWorkDefinition(workDef);
- match.getTrace().add(String.format("from legacy WorkFlowDefinition [%s] translated for id [%s]", id, id));
+ WorkFlowDefinition workFlowDef = (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(id);
+ if (workFlowDef != null) {
+ WorkDefinition workDef = translateToWorkDefinition(workFlowDef);
+ if (workDef != null) {
+ match.setWorkDefinition(workDef);
+ match.getTrace().add(
+ String.format("from legacy WorkFlowDefinition [%s] translated for id [%s]", id, id));
+ }
+ }
}
- workDefinitions.add(match);
+ // If still no match, configuration may have new workdef id but not set to use them
+ // Attempt to get back to original id and load through WorkFlowDefinition translate
+ if (!match.isMatched()) {
+ String reverseId = AtsWorkDefinitionSheetProviders.getReverseOverrideId(id);
+ WorkFlowDefinition workFlowDef =
+ (WorkFlowDefinition) WorkItemDefinitionFactory.getWorkItemDefinition(reverseId);
+ if (workFlowDef != null) {
+ WorkDefinition workDef = translateToWorkDefinition(workFlowDef);
+ if (workDef != null) {
+ match.setWorkDefinition(workDef);
+ match.getTrace().add(
+ String.format(
+ "from legacy WorkFlowDefinition [%s] translated for id [%s] falling back to reverse id [%s]",
+ id, id, reverseId));
+ }
+ }
+ }
+ System.out.println("Loaded " + match);
idToWorkDefintion.put(id, match);
}
return idToWorkDefintion.get(id);
@@ -366,7 +397,11 @@ public class WorkDefinitionFactory {
// Otherwise, use workflow defined by attribute of WorkflowDefinition
// Note: This is new. Old TeamDefs got workflow off relation
if (artifact instanceof TeamWorkFlowArtifact) {
- match = ((TeamWorkFlowArtifact) artifact).getTeamDefinition().getWorkDefinition();
+ TeamDefinitionArtifact teamDef = ((TeamWorkFlowArtifact) artifact).getTeamDefinition();
+ match = getWorkDefinitionFromArtifactsAttributeValue(teamDef);
+ if (!match.isMatched()) {
+ match = ((TeamWorkFlowArtifact) artifact).getTeamDefinition().getWorkDefinition();
+ }
} else if (artifact instanceof GoalArtifact) {
match = getWorkDefinition(getOverrideWorkDefId(GoalWorkflowDefinition.ID));
match.getTrace().add(String.format("Override translated from id [%s]", GoalWorkflowDefinition.ID));
@@ -384,8 +419,8 @@ public class WorkDefinitionFactory {
return match;
}
- public static Set<WorkDefinitionMatch> getWorkDefinitions() {
- return workDefinitions;
+ public static Collection<WorkDefinitionMatch> getWorkDefinitions() {
+ return idToWorkDefintion.values();
}
public static String getOverrideWorkDefId(String id) {
diff --git a/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee b/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee
index 05b5056e46e..444298a7363 100644
--- a/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee
+++ b/plugins/org.eclipse.osee.ats/support/OseeTypes_ATS.osee
@@ -63,6 +63,7 @@ artifactType "Team Definition" extends "ats.Ats Artifact", "Abstract Access Cont
attribute "ats.Allow Create Branch"
attribute "ats.Allow Commit Branch"
attribute "ats.Related Task Workflow Definition"
+ attribute "ats.Workflow Definition"
}
artifactType "Actionable Item" extends "ats.Ats Artifact", "Abstract Access Controlled" {

Back to the top