private static void runAction(Control owner, JiraNamedEntity action, JiraIssueListModel model, JiraIssue issue, List <JiraField> fields, StatusLabel status, Action onFinish) { JiraIssue issueWithTime = SmartJiraServerFacade.Instance.getIssue(issue.Server, issue.Key); issueWithTime.SecurityLevel = SmartJiraServerFacade.Instance.getSecurityLevel(issue); object rawIssueObject = SmartJiraServerFacade.Instance.getRawIssueObject(issue); List <JiraField> fieldsWithValues = JiraActionFieldType.fillFieldValues(issue, rawIssueObject, fields); // PLVS-133 - this should never happen but does? if (model == null) { owner.Invoke(new MethodInvoker(() => PlvsUtils.showError("Issue List Model was null, please report this as a bug", new Exception("IssueActionRunner.runAction()")))); model = JiraIssueListModelImpl.Instance; } if (fieldsWithValues == null || fieldsWithValues.Count == 0) { runActionWithoutFields(owner, action, model, issue, status, onFinish); } else { owner.Invoke(new MethodInvoker(() => new IssueWorkflowAction(issue, action, model, fieldsWithValues, status, onFinish).initAndShowDialog())); } }
private void runAction(JiraNamedEntity action) { Thread runner = new Thread(new ThreadStart(delegate { try { status.setInfo("Retrieveing fields for action \"" + action.Name + "\"..."); var fields = JiraServerFacade.Instance.getFieldsForAction(issue, action.Id); if (fields == null || fields.Count == 0) { runActionLocally(action); } else { status.setInfo("Action \"" + action.Name + "\" requires input fields, opening action screen in the browser..."); Process.Start(issue.Server.Url + "/secure/WorkflowUIDispatcher.jspa?id=" + issue.Id + "&action=" + action.Id); } } catch (Exception e) { status.setError("Failed to run action " + action.Name + " on issue " + issue.Key, e); } })); runner.Start(); }
protected override AbstractIssueGroupNode findGroupNode(JiraIssue issue) { JiraNamedEntity prio = UNKNOWN_PRIORITY; if (!groupNodes.ContainsKey(issue.PriorityId)) { List <JiraNamedEntity> priorities = JiraServerCache.Instance.getPriorities(issue.Server); foreach (JiraNamedEntity priority in priorities) { if (priority.Id != issue.PriorityId) { continue; } prio = priority; break; } ByPriorityIssueGroupNode groupNode = prio.Id == UNKNOWN_PRIORITY.Id ? unknownPriorityNode : new ByPriorityIssueGroupNode(issue.Server, prio); groupNodes[prio.Id] = groupNode; if (prio.Id == UNKNOWN_PRIORITY.Id) { issuesWithUnknownPriority.Add(issue); } return(groupNode); } // all issues with unknown priority must be put in one bucket, once it is created foreach (var i in issuesWithUnknownPriority) { if (i.Id == issue.Id && i.Server.GUID.Equals(issue.Server.GUID)) { return(groupNodes[UNKNOWN_PRIORITY.Id]); } } return(groupNodes[issue.PriorityId]); }
public IssueWorkflowAction( JiraIssue issue, JiraNamedEntity action, JiraIssueListModel model, List <JiraField> fields, StatusLabel status, Action onFinish) { this.issue = issue; this.action = action; this.model = model; this.fields = JiraActionFieldType.sortFieldList(fields); this.status = status; this.onFinish = onFinish; InitializeComponent(); Text = issue.Key + ": " + action.Name; ClientSize = new Size(INITIAL_WIDTH, INITIAL_HEIGHT + buttonOk.Height + 3 * MARGIN); buttonOk.Enabled = false; StartPosition = FormStartPosition.CenterParent; panelThrobber.Visible = true; panelContent.Visible = false; }
private void runActionLocally(JiraNamedEntity action) { status.setInfo("Running action \"" + action.Name + "\" on issue " + issue.Key + "..."); JiraServerFacade.Instance.runIssueActionWithoutParams(issue, action); status.setInfo("Action \"" + action.Name + "\" successfully run on issue " + issue.Key); var newIssue = JiraServerFacade.Instance.getIssue(issue.Server, issue.Key); Invoke(new MethodInvoker(() => model.updateIssue(newIssue))); }
public void addPriority(JiraServer server, JiraNamedEntity priority) { lock (priorityCache) { if (!priorityCache.ContainsKey(server.GUID)) { priorityCache[server.GUID] = new SortedDictionary <int, JiraNamedEntity>(); } priorityCache[server.GUID][priority.Id] = priority; } }
public void addIssueType(JiraServer server, JiraNamedEntity issueType) { lock (issueTypeCache) { if (!issueTypeCache.ContainsKey(server.GUID)) { issueTypeCache[server.GUID] = new SortedDictionary <int, JiraNamedEntity>(); } issueTypeCache[server.GUID][issueType.Id] = issueType; } }
private void runDeactivateIssueAction() { JiraNamedEntity action = cbActions.SelectedItem as JiraNamedEntity; if (action == null) { return; } store.storeParameter(DEACTIVATE_ISSUE_LAST_ACTION, action.Id); IssueActionRunner.runAction(this, action, model, issue, status, () => { Close(); onFinished(); }); }
public void addStatus(JiraServer server, JiraNamedEntity status) { lock (statusCache) { if (!statusCache.ContainsKey(server.GUID)) { statusCache[server.GUID] = new SortedDictionary <int, JiraNamedEntity>(); } statusCache[server.GUID][status.Id] = status; } }
private static void loadResolutions(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_RESOLUTIONS_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_RESOLUTIONS_ID + i), 0); string name = store.loadParameter(getParamKey(key, FILTER_RESOLUTIONS_NAME + i), null); JiraNamedEntity resolution = new JiraNamedEntity(id, name, null); f.Resolutions.Add(resolution); } }
private static void loadComponents(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_COMPONENTS_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_COMPONENTS_ID + i), 0); string name = store.loadParameter(getParamKey(key, FILTER_COMPONENTS_NAME + i), null); JiraNamedEntity comp = new JiraNamedEntity(id, name, null); f.Components.Add(comp); } }
private static void loadFixVersions(Globals globals, string solutionKey, Guid key, JiraCustomFilter f) { int count = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_FIXFORVERSIONS_COUNT), 0); for (int i = 0; i < count; ++i) { int id = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_FIXFORVERSIONS_ID + i), 0); string name = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_FIXFORVERSIONS_NAME + i), null); JiraNamedEntity fixVersion = new JiraNamedEntity(id, name, null); f.FixForVersions.Add(fixVersion); } }
private static void loadIssueTypes(Globals globals, string solutionKey, Guid key, JiraCustomFilter f) { int count = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_ISSUE_TYPE_COUNT), 0); for (int i = 0; i < count; ++i) { int id = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_ISSUE_TYPE_ID + i), 0); string name = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_ISSUE_TYPE_NAME + i), null); JiraNamedEntity issueType = new JiraNamedEntity(id, name, null); f.IssueTypes.Add(issueType); } }
private static void loadFixVersions(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_FIXFORVERSIONS_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_FIXFORVERSIONS_ID + i), 0); string name = store.loadParameter(getParamKey(key, FILTER_FIXFORVERSIONS_NAME + i), null); JiraNamedEntity fixVersion = new JiraNamedEntity(id, name, null); f.FixForVersions.Add(fixVersion); } }
private static void loadIssueTypes(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_ISSUE_TYPE_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_ISSUE_TYPE_ID + i), 0); string name = store.loadParameter(getParamKey(key, FILTER_ISSUE_TYPE_NAME + i), null); JiraNamedEntity issueType = new JiraNamedEntity(id, name, null); f.IssueTypes.Add(issueType); } }
private static void loadPriorities(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_PRIORITIES_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_PRIORITIES_ID + i), 0); string name = store.loadParameter(getParamKey(key, FILTER_PRIORITIES_NAME + i), null); JiraNamedEntity priority = new JiraNamedEntity(id, name, null); f.Priorities.Add(priority); } }
private static void loadStatuses(ParameterStore store, Guid key, JiraCustomFilter f) { int count = store.loadParameter(getParamKey(key, FILTER_STATUSES_COUNT), 0); for (int i = 0; i < count; ++i) { int id = store.loadParameter(getParamKey(key, FILTER_STATUSES_ID + i), 0); string name = store.loadParameter(getParamKey(key, FILTER_STATUSES_NAME + i), null); JiraNamedEntity status = new JiraNamedEntity(id, name, null); f.Statuses.Add(status); } }
private static void loadComponents(Globals globals, string solutionKey, Guid key, JiraCustomFilter f) { int count = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_COMPONENTS_COUNT), 0); for (int i = 0; i < count; ++i) { int id = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_COMPONENTS_ID + i), 0); string name = ParameterSerializer.loadParameter(globals, getParamKey(solutionKey, key, FILTER_COMPONENTS_NAME + i), null); JiraNamedEntity comp = new JiraNamedEntity(id, name, null); f.Components.Add(comp); } }
protected override AbstractIssueGroupNode findGroupNode(JiraIssue issue) { if (!groupNodes.ContainsKey(issue.StatusId)) { SortedDictionary <int, JiraNamedEntity> statuses = JiraServerCache.Instance.getStatues(issue.Server); if (!statuses.ContainsKey(issue.StatusId)) { return(null); } JiraNamedEntity status = statuses[issue.StatusId]; groupNodes[issue.StatusId] = new ByStatusIssueGroupNode(issue.Server, status); } return(groupNodes[issue.StatusId]); }
public static void runAction(Control owner, JiraNamedEntity action, JiraIssueListModel model, JiraIssue issue, StatusLabel status, Action onFinish) { Thread runner = PlvsUtils.createThread(delegate { try { status.setInfo("Retrieving fields for action \"" + action.Name + "\"..."); List <JiraField> fields = SmartJiraServerFacade.Instance.getFieldsForAction(issue, action.Id); runAction(owner, action, model, issue, fields, status, onFinish); } catch (Exception e) { status.setError("Failed to run action " + action.Name + " on issue " + issue.Key, e); } }); runner.Start(); }
protected override AbstractIssueGroupNode findGroupNode(JiraIssue issue) { if (!groupNodes.ContainsKey(issue.IssueTypeId)) { SortedDictionary <int, JiraNamedEntity> issueTypes = JiraServerCache.Instance.getIssueTypes(issue.Server); if (!issueTypes.ContainsKey(issue.IssueTypeId)) { return(null); } JiraNamedEntity issueType = issueTypes[issue.IssueTypeId]; groupNodes[issue.IssueTypeId] = new ByTypeIssueGroupNode(issue.Server, issueType); } return(groupNodes[issue.IssueTypeId]); }
private static void runActionWithoutFields( Control owner, JiraNamedEntity action, JiraIssueListModel model, JiraIssue issue, StatusLabel status, Action onFinish) { status.setInfo("Running action \"" + action.Name + "\" on issue " + issue.Key + "..."); SmartJiraServerFacade.Instance.runIssueActionWithoutParams(issue, action); status.setInfo("Action \"" + action.Name + "\" successfully run on issue " + issue.Key); var newIssue = SmartJiraServerFacade.Instance.getIssue(issue.Server, issue.Key); UsageCollector.Instance.bumpJiraIssuesOpen(); owner.Invoke(new MethodInvoker(() => { model.updateIssue(newIssue); if (onFinish != null) { onFinish(); } })); }
public ComponentNode(JiraIssueListModel model, AbstractJiraServerFacade facade, JiraServer server, JiraProject project, JiraNamedEntity comp) : base(model, facade, server, comp.Name, 0) { this.project = project; this.comp = comp; ContextMenuStrip = new ContextMenuStrip(); menuItems.Add(new ToolStripMenuItem("Open \"Set Component to " + comp.Name + "\" Drop Zone", null, createDropZone)); ContextMenuStrip.Items.Add("dummy"); ContextMenuStrip.Items.AddRange(MenuItems.ToArray()); ContextMenuStrip.Opening += contextMenuStripOpening; ContextMenuStrip.Opened += contextMenuStripOpened; }
private void buttonOk_Click(object sender, EventArgs e) { clearFilterValues(); foreach (var item in listBoxProjects.SelectedItems) { JiraProject proj = item as JiraProject; if (proj != null) { filter.Projects.Add(proj); } } foreach (var item in listViewIssueTypes.SelectedItems) { IssueTypeListViewItem itlvi = item as IssueTypeListViewItem; if (itlvi != null) { filter.IssueTypes.Add(itlvi.IssueType); } } foreach (var item in listBoxFixForVersions.SelectedItems) { JiraNamedEntity version = item as JiraNamedEntity; if (version != null) { filter.FixForVersions.Add(version); } } foreach (var item in listBoxAffectsVersions.SelectedItems) { JiraNamedEntity version = item as JiraNamedEntity; if (version != null) { filter.AffectsVersions.Add(version); } } foreach (var item in listBoxComponents.SelectedItems) { JiraNamedEntity comp = item as JiraNamedEntity; if (comp != null) { filter.Components.Add(comp); } } Changed = true; Close(); }
public PriorityNode(JiraIssueListModel model, AbstractJiraServerFacade facade, JiraServer server, JiraNamedEntity priority) : base(model, facade, server, priority.Name, 0) { this.priority = priority; ContextMenuStrip = new ContextMenuStrip(); menuItems.Add(new ToolStripMenuItem( "Open \"Set Priority to " + priority.Name + "\" Drop Zone", ImageCache.Instance.getImage(server, priority.IconUrl).Img, createDropZone)); ContextMenuStrip.Items.Add("dummy"); ContextMenuStrip.Items.AddRange(MenuItems.ToArray()); ContextMenuStrip.Opening += contextMenuStripOpening; ContextMenuStrip.Opened += contextMenuStripOpened; }
public VersionNode(JiraIssueListModel model, AbstractJiraServerFacade facade, JiraServer server, JiraProject project, JiraNamedEntity version) : base(model, facade, server, version.Name, 0) { this.project = project; this.version = version; ContextMenuStrip = new ContextMenuStrip(); menuItems.Add(new ToolStripMenuItem("Open \"Set Fix For " + version.Name + "\" Drop Zone", null, createFixForDropZone)); menuItems.Add(new ToolStripMenuItem("Open \"Set Affects " + version.Name + "\" Drop Zone", null, createAffectsDropZone)); ContextMenuStrip.Items.Add("dummy"); ContextMenuStrip.Items.AddRange(MenuItems.ToArray()); ContextMenuStrip.Opening += contextMenuStripOpening; ContextMenuStrip.Opened += contextMenuStripOpened; }
public abstract void runIssueActionWithParams(JiraIssue issue, JiraNamedEntity action, ICollection <JiraField> fields, string comment);
public ByStatusIssueGroupNode(JiraServer server, JiraNamedEntity status) : base(server, status) { }
public abstract void runIssueActionWithoutParams(JiraIssue issue, JiraNamedEntity action);
public ByPriorityIssueGroupNode(JiraServer server, JiraNamedEntity priority) : base(server, priority) { }