diff options
author | ddunne | 2009-01-05 19:06:37 +0000 |
---|---|---|
committer | ddunne | 2009-01-05 19:06:37 +0000 |
commit | 31dcba0ed0c6a9124472b69eee2a87db7a1aa5a4 (patch) | |
tree | e3e128245dbd42f893fe6c21f3aff001d9deb3e5 | |
parent | 34e5ba6cf39e9744ec06b7b901e240ff730bf266 (diff) | |
download | org.eclipse.osee-31dcba0ed0c6a9124472b69eee2a87db7a1aa5a4.tar.gz org.eclipse.osee-31dcba0ed0c6a9124472b69eee2a87db7a1aa5a4.tar.xz org.eclipse.osee-31dcba0ed0c6a9124472b69eee2a87db7a1aa5a4.zip |
5 files changed, 359 insertions, 45 deletions
diff --git a/org.eclipse.osee.ats/META-INF/MANIFEST.MF b/org.eclipse.osee.ats/META-INF/MANIFEST.MF index d3e4ffa3545..4caaebe0aea 100644 --- a/org.eclipse.osee.ats/META-INF/MANIFEST.MF +++ b/org.eclipse.osee.ats/META-INF/MANIFEST.MF @@ -29,6 +29,7 @@ Export-Package: org.eclipse.osee.ats, org.eclipse.osee.ats.actions.wizard,
org.eclipse.osee.ats.artifact,
org.eclipse.osee.ats.config,
+ org.eclipse.osee.ats.config.wizard,
org.eclipse.osee.ats.editor,
org.eclipse.osee.ats.editor.help,
org.eclipse.osee.ats.editor.service,
diff --git a/org.eclipse.osee.ats/plugin.xml b/org.eclipse.osee.ats/plugin.xml index 079c44b658e..70a0532c195 100644 --- a/org.eclipse.osee.ats/plugin.xml +++ b/org.eclipse.osee.ats/plugin.xml @@ -77,11 +77,23 @@ id="org.eclipse.osee.ats.NewAction.wizard"
name="Action">
</wizard>
- <wizard name="Workflow Configuration"
- icon="images/workflowConfig.gif"
- category="org.eclipse.osee.ats.category"
- class="org.eclipse.osee.ats.workflow.editor.wizard.AtsWorkflowConfigCreationWizard"
- id="org.eclipse.osee.ats.workflow.editor.wizard.AtsWorkflowConfigCreationWizard">
+ <wizard
+ canFinishEarly="false"
+ category="org.eclipse.osee.ats.category"
+ class="org.eclipse.osee.ats.config.wizard.AtsConfigWizard"
+ hasPages="true"
+ icon="images/workflowConfig.gif"
+ id="org.eclipse.osee.ats.config.wizard.AtsConfigWizard"
+ name="ATS Configuration">
+ </wizard>
+ <wizard
+ canFinishEarly="false"
+ category="org.eclipse.osee.ats.category"
+ class="org.eclipse.osee.ats.workflow.editor.wizard.AtsWorkflowConfigCreationWizard"
+ hasPages="true"
+ icon="images/workflowConfig.gif"
+ id="org.eclipse.osee.ats.workflow.editor.wizard.AtsWorkflowConfigCreationWizard"
+ name="Workflow Configuration">
</wizard>
</extension>
<extension point="org.eclipse.ui.perspectives">
diff --git a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/wizard/AtsConfigWizard.java b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/wizard/AtsConfigWizard.java new file mode 100644 index 00000000000..7785b97a6de --- /dev/null +++ b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/wizard/AtsConfigWizard.java @@ -0,0 +1,144 @@ +/*******************************************************************************
+ * Copyright (c) 2004, 2005 Donald G. Dunne and others.
+ * 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:
+ * Donald G. Dunne - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.config.wizard;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osee.ats.AtsPlugin;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.config.AtsConfig;
+import org.eclipse.osee.ats.util.AtsLib;
+import org.eclipse.osee.ats.util.AtsRelation;
+import org.eclipse.osee.ats.workflow.editor.AtsWorkflowConfigEditor;
+import org.eclipse.osee.ats.workflow.editor.wizard.AtsWorkflowConfigCreationWizard;
+import org.eclipse.osee.framework.db.connection.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.skynet.ats.AtsOpenOption;
+import org.eclipse.osee.framework.ui.skynet.util.OSEELog;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinitionFactory;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * Create new new .shape-file. Those files can be used with the ShapesEditor (see plugin.xml).
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsConfigWizard extends Wizard implements INewWizard {
+
+ private AtsConfigWizardPage1 page1;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ // add pages to this wizard
+ addPage(page1);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ // create pages for this wizard
+ page1 = new AtsConfigWizardPage1(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ final String namespace = page1.getNamespace();
+ try {
+ try {
+ if (WorkItemDefinitionFactory.getWorkItemDefinition(namespace) != null) {
+ AWorkbench.popup("ERROR", "Configuration Namespace already used, choose a unique namespace.");
+ return false;
+ }
+ } catch (OseeCoreException ex) {
+ // do nothing
+ }
+
+ SkynetTransaction transaction = new SkynetTransaction(AtsPlugin.getAtsBranch());
+
+ // Create team def
+ TeamDefinitionArtifact teamDef =
+ (TeamDefinitionArtifact) ArtifactTypeManager.addArtifact(TeamDefinitionArtifact.ARTIFACT_NAME,
+ AtsPlugin.getAtsBranch(), page1.getTeamDefName());
+ if (page1.getVersions().size() > 0) {
+ teamDef.setSoleAttributeValue(ATSAttributes.TEAM_USES_VERSIONS_ATTRIBUTE.getStoreName(), true);
+ }
+ teamDef.addRelation(AtsRelation.TeamLead_Lead, UserManager.getUser());
+ teamDef.addRelation(AtsRelation.TeamMember_Member, UserManager.getUser());
+ AtsConfig.getInstance().getOrCreateTeamsDefinitionArtifact(transaction).addChild(teamDef);
+
+ // Create actionable items
+ List<ActionableItemArtifact> aias = new ArrayList<ActionableItemArtifact>();
+ for (String name : page1.getActionableItems()) {
+ ActionableItemArtifact aia =
+ (ActionableItemArtifact) ArtifactTypeManager.addArtifact(ActionableItemArtifact.ARTIFACT_NAME,
+ AtsPlugin.getAtsBranch(), name);
+ aia.setSoleAttributeValue(ATSAttributes.ACTIONABLE_ATTRIBUTE.getStoreName(), true);
+ AtsConfig.getInstance().getOrCreateActionableItemsHeadingArtifact(transaction).addChild(aia);
+ teamDef.addRelation(AtsRelation.TeamActionableItem_ActionableItem, aia);
+ aias.add(aia);
+ }
+
+ // Create versions
+ List<VersionArtifact> versions = new ArrayList<VersionArtifact>();
+ for (String name : page1.getVersions()) {
+ VersionArtifact aia =
+ (VersionArtifact) ArtifactTypeManager.addArtifact(VersionArtifact.ARTIFACT_NAME,
+ AtsPlugin.getAtsBranch(), name);
+ teamDef.addRelation(AtsRelation.TeamDefinitionToVersion_Version, aia);
+ versions.add(aia);
+ }
+
+ // create workflow
+ WorkFlowDefinition workFlowDefinition =
+ AtsWorkflowConfigCreationWizard.generateWorkflow(namespace, transaction, teamDef);
+
+ // persist everything
+ teamDef.persistAttributesAndRelations(transaction);
+ for (Artifact artifact : aias) {
+ artifact.persistAttributesAndRelations(transaction);
+ }
+ for (Artifact artifact : versions) {
+ artifact.persistAttributesAndRelations(transaction);
+ }
+ transaction.execute();
+
+ // open everything in editors
+ AtsLib.openAtsAction(teamDef, AtsOpenOption.OpenAll);
+ for (ActionableItemArtifact aia : aias) {
+ AtsLib.openAtsAction(aia, AtsOpenOption.OpenAll);
+ }
+ AtsWorkflowConfigEditor.editWorkflow(workFlowDefinition);
+
+ } catch (Exception ex) {
+ OSEELog.logException(AtsPlugin.class, ex, true);
+ }
+ return true;
+
+ }
+}
diff --git a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/wizard/AtsConfigWizardPage1.java b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/wizard/AtsConfigWizardPage1.java new file mode 100644 index 00000000000..aa12befd739 --- /dev/null +++ b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/config/wizard/AtsConfigWizardPage1.java @@ -0,0 +1,149 @@ +/******************************************************************************* + * 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.config.wizard; + +import java.util.ArrayList; +import java.util.List; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.osee.ats.AtsPlugin; +import org.eclipse.osee.ats.util.AtsLib; +import org.eclipse.osee.ats.workflow.ATSXWidgetOptionResolver; +import org.eclipse.osee.framework.ui.skynet.util.OSEELog; +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; +import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * @author Donald G. Dunne + */ +public class AtsConfigWizardPage1 extends WizardPage { + private final AtsConfigWizard wizard; + private WorkPage page; + + /** + * @param actionWizard + */ + public AtsConfigWizardPage1(AtsConfigWizard actionWizard) { + super("Create New ATS Configuration", "Create ATS Configuration", null); + setMessage("Enter configuration information."); + this.wizard = actionWizard; + } + + private final XModifiedListener xModListener = new XModifiedListener() { + public void widgetModified(XWidget widget) { + getContainer().updateButtons(); + } + }; + + public String getNamespace() { + return (String) getXWidget(CONFIG_NAMESPACE).getData(); + } + + public String getTeamDefName() { + return (String) getXWidget(TEAMDEF_NAME).getData(); + } + + public List<String> getActionableItems() { + List<String> aias = new ArrayList<String>(); + for (String aia : ((String) getXWidget(ACTIONABLE_ITEMS).getData()).split(",")) { + aia.replaceAll("^ *", ""); + if (!aia.equals("")) { + aias.add(aia); + } + } + return aias; + } + + public List<String> getVersions() { + List<String> versions = new ArrayList<String>(); + for (String version : ((String) getXWidget(VERSIONS).getData()).split(",")) { + version.replaceAll("^ *", ""); + if (!version.equals("")) { + versions.add(version); + } + } + return versions; + } + + public String getWorkflowId() { + return (String) getXWidget(WORKFLOW_ID).getData(); + } + + private static String CONFIG_NAMESPACE = "Configuration Namespace"; + private static String TEAMDEF_NAME = "Team Definition Name"; + private static String ACTIONABLE_ITEMS = "Actionable Item(s) (comma delim)"; + private static String VERSIONS = "Versions (comma delim)"; + private static String WORKFLOW_ID = "Workflow Id (blank to create default)"; + + public void createControl(Composite parent) { + + try { + String xWidgetXml = "<WorkPage>" + + // + "<XWidget displayName=\"" + CONFIG_NAMESPACE + "\" required=\"true\" xwidgetType=\"XText\"/>" + + // + "<XWidget displayName=\"" + TEAMDEF_NAME + "\" required=\"true\" xwidgetType=\"XText\"/>" + + // + "<XWidget displayName=\"" + ACTIONABLE_ITEMS + "\" required=\"true\" xwidgetType=\"XText\"/>" + + // + "<XWidget displayName=\"" + VERSIONS + "\" required=\"false\" xwidgetType=\"XText\"/>" + + // + "<XWidget displayName=\"" + WORKFLOW_ID + "\" required=\"false\" xwidgetType=\"XText\"/>" + + // + "</WorkPage>"; + Composite comp = new Composite(parent, SWT.NONE); + comp.setLayout(new GridLayout(1, false)); + comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + page = new WorkPage(xWidgetXml, ATSXWidgetOptionResolver.getInstance()); + page.createBody(null, comp, null, xModListener, true); + + setControl(comp); + ((XText) getXWidget(CONFIG_NAMESPACE)).setFocus(); + + ((XText) getXWidget(CONFIG_NAMESPACE)).getLabelWidget().addListener(SWT.MouseUp, new Listener() { + public void handleEvent(Event event) { + if (event.button == 3) { + String namespace = "qwerty" + AtsLib.getAtsDeveloperIncrementingNum(); + ((XText) getXWidget(CONFIG_NAMESPACE)).set(namespace); + ((XText) getXWidget(TEAMDEF_NAME)).set(namespace + " Team"); + ((XText) getXWidget(ACTIONABLE_ITEMS)).set(namespace + " a, " + namespace + " b, " + namespace + " c"); + ((XText) getXWidget(VERSIONS)).set(namespace + " 1.0, " + namespace + " 2.0, " + namespace + " 3.0"); + } + } + }); + + } catch (Exception ex) { + OSEELog.logException(AtsPlugin.class, ex, true); + } + } + + public XWidget getXWidget(String attrName) { + if (page == null) throw new IllegalArgumentException("WorkPage == null"); + return page.getLayoutData(attrName).getXWidget(); + } + + @Override + public boolean isPageComplete() { + if (!page.isPageComplete().isTrue()) return false; + + return true; + } + +} diff --git a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/wizard/AtsWorkflowConfigCreationWizard.java b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/wizard/AtsWorkflowConfigCreationWizard.java index 59f833118fa..5473cfc83da 100644 --- a/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/wizard/AtsWorkflowConfigCreationWizard.java +++ b/org.eclipse.osee.ats/src/org/eclipse/osee/ats/workflow/editor/wizard/AtsWorkflowConfigCreationWizard.java @@ -16,6 +16,8 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard;
import org.eclipse.osee.ats.AtsPlugin;
import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.util.AtsRelation;
import org.eclipse.osee.ats.workflow.editor.AtsWorkflowConfigEditor;
import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions.RuleWorkItemId;
@@ -76,47 +78,8 @@ public class AtsWorkflowConfigCreationWizard extends Wizard implements INewWizar } catch (OseeCoreException ex) {
// do nothing
}
-
- WorkFlowDefinition workflow = new WorkFlowDefinition(namespace, namespace, null);
- WorkPageDefinition endorsePage =
- new WorkPageDefinition("Endorse", namespace + ".Endorse", AtsEndorseWorkPageDefinition.ID);
-
- workflow.setStartPageId(endorsePage.getPageName());
-
- WorkPageDefinition implementPage = new WorkPageDefinition("Implement", namespace + ".Implement", null);
- implementPage.addWorkItem(RuleWorkItemId.atsRequireStateHourSpentPrompt.name());
- implementPage.addWorkItem(ATSAttributes.WORK_PACKAGE_ATTRIBUTE.getStoreName());
- implementPage.addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
-
- WorkPageDefinition completedPage =
- new WorkPageDefinition("Completed", namespace + ".Completed", AtsCompletedWorkPageDefinition.ID);
-
- WorkPageDefinition cancelledPage =
- new WorkPageDefinition("Cancelled", namespace + ".Cancelled", AtsCancelledWorkPageDefinition.ID);
-
- workflow.addPageTransition(endorsePage.getPageName(), implementPage.getPageName(),
- TransitionType.ToPageAsDefault);
- workflow.addPageTransition(implementPage.getPageName(), endorsePage.getPageName(),
- TransitionType.ToPageAsReturn);
- workflow.addPageTransition(cancelledPage.getPageName(), endorsePage.getPageName(),
- TransitionType.ToPageAsReturn);
- workflow.addPageTransition(implementPage.getPageName(), completedPage.getPageName(),
- TransitionType.ToPageAsDefault);
- workflow.addPageTransition(endorsePage.getPageName(), cancelledPage.getPageName(), TransitionType.ToPage);
-
- List<Artifact> artifacts = new ArrayList<Artifact>();
- artifacts.add(endorsePage.toArtifact(WriteType.New));
- artifacts.add(implementPage.toArtifact(WriteType.New));
- artifacts.add(completedPage.toArtifact(WriteType.New));
- artifacts.add(cancelledPage.toArtifact(WriteType.New));
- artifacts.add(workflow.toArtifact(WriteType.New));
- workflow.loadPageData(true);
-
SkynetTransaction transaction = new SkynetTransaction(AtsPlugin.getAtsBranch());
- for (Artifact artifact : artifacts) {
- AtsWorkDefinitions.addUpdateWorkItemToDefaultHeirarchy(artifact, transaction);
- artifact.persistAttributesAndRelations(transaction);
- }
+ WorkFlowDefinition workflow = generateWorkflow(namespace, transaction, null);
transaction.execute();
AtsWorkflowConfigEditor.editWorkflow(workflow);
@@ -127,4 +90,49 @@ public class AtsWorkflowConfigCreationWizard extends Wizard implements INewWizar return true;
}
+
+ public static WorkFlowDefinition generateWorkflow(String namespace, SkynetTransaction transaction, TeamDefinitionArtifact teamDef) throws OseeCoreException {
+ WorkFlowDefinition workflow = new WorkFlowDefinition(namespace, namespace, null);
+ WorkPageDefinition endorsePage =
+ new WorkPageDefinition("Endorse", namespace + ".Endorse", AtsEndorseWorkPageDefinition.ID);
+
+ workflow.setStartPageId(endorsePage.getPageName());
+
+ WorkPageDefinition implementPage = new WorkPageDefinition("Implement", namespace + ".Implement", null);
+ implementPage.addWorkItem(RuleWorkItemId.atsRequireStateHourSpentPrompt.name());
+ implementPage.addWorkItem(ATSAttributes.WORK_PACKAGE_ATTRIBUTE.getStoreName());
+ implementPage.addWorkItem(ATSAttributes.RESOLUTION_ATTRIBUTE.getStoreName());
+
+ WorkPageDefinition completedPage =
+ new WorkPageDefinition("Completed", namespace + ".Completed", AtsCompletedWorkPageDefinition.ID);
+
+ WorkPageDefinition cancelledPage =
+ new WorkPageDefinition("Cancelled", namespace + ".Cancelled", AtsCancelledWorkPageDefinition.ID);
+
+ workflow.addPageTransition(endorsePage.getPageName(), implementPage.getPageName(), TransitionType.ToPageAsDefault);
+ workflow.addPageTransition(implementPage.getPageName(), endorsePage.getPageName(), TransitionType.ToPageAsReturn);
+ workflow.addPageTransition(cancelledPage.getPageName(), endorsePage.getPageName(), TransitionType.ToPageAsReturn);
+ workflow.addPageTransition(implementPage.getPageName(), completedPage.getPageName(),
+ TransitionType.ToPageAsDefault);
+ workflow.addPageTransition(endorsePage.getPageName(), cancelledPage.getPageName(), TransitionType.ToPage);
+
+ List<Artifact> artifacts = new ArrayList<Artifact>();
+ artifacts.add(endorsePage.toArtifact(WriteType.New));
+ artifacts.add(implementPage.toArtifact(WriteType.New));
+ artifacts.add(completedPage.toArtifact(WriteType.New));
+ artifacts.add(cancelledPage.toArtifact(WriteType.New));
+ Artifact workflowArt = workflow.toArtifact(WriteType.New);
+ if (teamDef != null) {
+ teamDef.addRelation(AtsRelation.WorkItem__Child, workflowArt);
+ artifacts.add(teamDef);
+ }
+ artifacts.add(workflowArt);
+ workflow.loadPageData(true);
+
+ for (Artifact artifact : artifacts) {
+ AtsWorkDefinitions.addUpdateWorkItemToDefaultHeirarchy(artifact, transaction);
+ artifact.persistAttributesAndRelations(transaction);
+ }
+ return workflow;
+ }
}
|