Пример #1
0
 public JiraIssue(JiraConnection conn, RemoteIssue issue)
     : base(issue, issue.id, issue.summary)
 {
     _connection = conn;
     _assignee   = _connection.GetUser(Object.assignee);
     _reporter   = _connection.GetUser(Object.reporter);
 }
Пример #2
0
        public void ProcessAction(string comment, IIssueAction action, IIssueUser assignTo)
        {
            if (!String.IsNullOrEmpty(comment))
            {
                AddComment(comment);
            }

            _connection.ProcessAction(this, action, assignTo);
        }
Пример #3
0
        internal void ProcessAction(JiraIssue issue, IIssueAction action, IIssueUser assignTo)
        {
            List <RemoteFieldValue> actionParams = new List <RemoteFieldValue>();

            RemoteField[] fields = _service.getFieldsForAction(_token, issue.DisplayId, action.Id);
            foreach (RemoteField field in fields)
            {
                RemoteFieldValue param     = new RemoteFieldValue();
                string           paramName = param.id = field.id;

                if (StringComparer.OrdinalIgnoreCase.Equals("Resolution", field.name))
                {
                    param.values = new string[] { FindFixResolution() }
                }
                ;
                else if (StringComparer.OrdinalIgnoreCase.Equals("Assignee", field.name))
                {
                    param.values = new string[] { assignTo.Id }
                }
                ;
                else if (StringComparer.OrdinalIgnoreCase.Equals("Worklog", paramName)) // JIRA 4.1 - worklogs are required!
                {
                    continue;
                }
                else
                {
                    param.values = issue.GetFieldValue(paramName);
                    if (param.values == null || param.values.Length == 0 || (param.values.Length == 1 && param.values[0] == null))
                    {
                        string setting = _settings(String.Format("{0}:{1}", action.Name, field.name));
                        if (setting != null)
                        {
                            param.values = new string[] { setting }
                        }
                        ;
                    }
                }

                actionParams.Add(param);
            }

            RemoteIssue newIssue = _service.progressWorkflowAction(_token, issue.DisplayId, action.Id, actionParams.ToArray());
        }
Пример #4
0
 public void ProcessAction(string comment, IIssueAction action, IIssueUser assignTo)
 {
 }
Пример #5
0
        internal void ProcessAction(JiraIssue issue, IIssueAction action, IIssueUser assignTo)
        {
            List<RemoteFieldValue> actionParams = new List<RemoteFieldValue>();

            RemoteField[] fields = _service.getFieldsForAction(_token, issue.DisplayId, action.Id);
            foreach (RemoteField field in fields)
            {
                RemoteFieldValue param = new RemoteFieldValue();
                string paramName = param.id = field.id;

                if (StringComparer.OrdinalIgnoreCase.Equals("Resolution", field.name))
                    param.values = new string[] { FindFixResolution() };
                else if (StringComparer.OrdinalIgnoreCase.Equals("Assignee", field.name))
                    param.values = new string[] { assignTo.Id };
                else if (StringComparer.OrdinalIgnoreCase.Equals("Worklog", paramName))	// JIRA 4.1 - worklogs are required!
                    continue;
                else
                {
                    param.values = issue.GetFieldValue(paramName);
                    if (param.values == null || param.values.Length == 0 || (param.values.Length == 1 && param.values[0] == null))
                    {
                        string setting = _settings(String.Format("{0}:{1}", action.Name, field.name));
                        if(setting != null)
                            param.values = new string[] { setting };
                    }
                }

                actionParams.Add(param);
            }

            RemoteIssue newIssue = _service.progressWorkflowAction(_token, issue.DisplayId, action.Id, actionParams.ToArray());
        }
Пример #6
0
        public IEnumerable <Exception> CommitChanges(int revision, string[] files)
        {
            _serializer.Serialize(_storage);

            List <Exception> errors         = new List <Exception>();
            IList <IIssue>   selectedIssues = this.SelectedIssues;

            _selected.Clear();             //don't want to do this twice...
            StringBuilder comments = new StringBuilder(Comments);

            if (revision > 0)
            {
                if (comments.Length > 0)
                {
                    comments.AppendLine(Environment.NewLine);
                }
                comments.AppendFormat("revision: {0}", revision);
            }
            if (files != null && files.Length > 0)
            {
                if (comments.Length > 0)
                {
                    comments.AppendLine();
                }
                foreach (string file in files)
                {
                    comments.AppendLine(file);
                }
            }

            string actionName = null;

            if (PerformAction && _actions.SelectedItem != null)
            {
                actionName = _actions.SelectedItem.Name;
            }

            IIssueUser assignee = null;

            if (AssignTo && _assignees.SelectedItem != null)
            {
                assignee = _assignees.SelectedItem;
            }

            foreach (IIssue issue in selectedIssues)
            {
                try
                {
                    if (AddWorklog && TimeSpent.Length > 0)
                    {
                        issue.ProcessWorklog(_timeSpent, _timeEstimateRecalcualationMethod, _newTimeEstimate);
                    }
                }
                catch (Exception e)
                {
                    Log.Error(e, "Failed to commit issue {0} - {1}", issue.DisplayId, issue.Name);
                    errors.Add(e);
                }

                try
                {
                    if (actionName != null)
                    {
                        IIssueUser finalAssignee = assignee;
                        if (finalAssignee == ReportedByUser.Instance)
                        {
                            finalAssignee = issue.ReportedBy;
                        }
                        if (finalAssignee == null)
                        {
                            finalAssignee = issue.AssignedTo;
                        }

                        IIssueAction finalAction = null;
                        foreach (IIssueAction action in issue.GetActions())
                        {
                            if (action.Name == actionName)
                            {
                                finalAction = action; break;
                            }
                        }

                        if (finalAction == null)
                        {
                            throw new ApplicationException(String.Format("Action {0} not found.", actionName));
                        }
                        if (finalAssignee == null)
                        {
                            throw new ApplicationException("Invalid assignee.");
                        }

                        issue.ProcessAction(comments.ToString(), finalAction, finalAssignee);
                    }
                    else
                    {
                        issue.AddComment(comments.ToString());
                    }
                }
                catch (Exception e)
                {
                    Log.Error(e, "Failed to commit issue {0} - {1}", issue.DisplayId, issue.Name);
                    errors.Add(e);
                }
            }
            return(errors);
        }
Пример #7
0
		public void ProcessAction(string comment, IIssueAction action, IIssueUser assignTo)
		{
			Issue.ProcessAction(comment, action, assignTo);
		}
Пример #8
0
 public void ProcessAction(string comment, IIssueAction action, IIssueUser assignTo)
 {
     _issue.ProcessAction(comment, action, assignTo);
 }