コード例 #1
0
 public IWorkflowBuilder <TIssue> Condition(JiraTransition transition, Func <TIssue, bool> condition)
 {
     if (conditions.ContainsKey(transition.Id))
     {
         throw new InvalidOperationException(
                   $"condition is already define, transition [{transition.Name}], id: [{transition.Id}]");
     }
     conditions.Add(transition.Id, i => condition((TIssue)i));
     return(this);
 }
コード例 #2
0
ファイル: Workflow.cs プロジェクト: ivan816/simple-jira
 public Func <JiraIssue, bool> GetCondition(JiraTransition transition)
 {
     return(conditions.TryGetValue(transition.Id, out var condition)
         ? condition
         : WorkflowCache.defaultCondition);
 }
コード例 #3
0
ファイル: Jira.cs プロジェクト: Celdorfpwn/ASAP
        /// <summary>
        /// Set the next status
        /// </summary>
        /// <param name="issue">The issue to change the status for</param>
        /// <param name="newStatus">The new status (transition)</param>
        /// <param name="message">Message to add</param>
        public void SetStatus(Issue issue, JiraTransition newStatus, string message, ItVersion fixVersion = null)
        {
            string query = String.Format("issue/{0}", issue.Key);
            string data = "{\"transition\" : {\"id\" : \"" + (int)newStatus + "\"}}";
            if (!String.IsNullOrWhiteSpace(message))
            {
                data = "{\"update\" : {\"comment\" : [{\"add\" : {\"body\" : \"" + message + "\"}}]}, \"transition\": {\"id\": \"" + (int)newStatus + "\"}}";
            }

            // Set the new status and comment
            string response = RunQuery(query, data, "POST");

            if (!String.IsNullOrEmpty(response))
            {
                throw new InvalidDataException("Set status return not expected data");
            }

            // Set the fix Version
            if (fixVersion != null)
            {
                data = "{\"update\" : {\"fixVersions\" : [{\"set\" : [{\"name\" : \"" + fixVersion.Name + "\"}]}]} }";

                response = RunQuery(query, data, "POST");

                if (!String.IsNullOrEmpty(response))
                {
                    throw new InvalidDataException("Set fix version return not expected data");
                }
            }
            string logMsg = String.Format("{0} changed into {1}", issue.Key, newStatus);
            LoggerService.Log.Instance.AddLog(new LoggerService.LogEntry(LoggerService.LogType.Info, logMsg));
        }