public List <JiraField> getFieldsForAction(JiraIssue issue, int id) { #if PLVS_133_WORKAROUND object[] fields = service.getFieldsForAction(Token, issue.Key, id.ToString()); if (fields == null) { return(new List <JiraField>()); } return((from field in fields where field != null let fieldId = field.GetType().GetProperty("id") let name = field.GetType().GetProperty("name") select new JiraField((string)fieldId.GetValue(field, null), (string)name.GetValue(field, null))) .ToList()); #else RemoteField[] fields = service.getFieldsForAction(Token, issue.Key, id.ToString()); if (fields == null) { return(new List <JiraField>()); } return((from field in fields where field != null select new JiraField(field.id, field.name)).ToList()); #endif }
private static void putIssueInDbIfNotPresent(NpgsqlConnection connection, JiraIssue issue, int projectId) { NpgsqlCommand command = new NpgsqlCommand( string.Format("select id from issues where key like '{0}' and project={1}", issue.Key, projectId), connection); NpgsqlDataReader reader = command.ExecuteReader(); bool issueExists = false; while (reader.Read()) { issueExists = true; } reader.Close(); if (issueExists) { return; } string summary = issue.Summary ?? ""; string description = issue.Description ?? ""; command = new NpgsqlCommand( string.Format("insert into issues (key, project, summary, description) values ('{0}', {1}, '{2}', '{3}')", issue.Key, projectId, to64(summary), to64(description)), connection); command.ExecuteNonQuery(); }
public bool Equals(JiraIssue other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } bool eq = true; eq &= other.Server.GUID.Equals(Server.GUID); eq &= other.IssueType.Equals(IssueType); eq &= other.IssueTypeId.Equals(IssueTypeId); eq &= other.IssueTypeIconUrl.Equals(IssueTypeIconUrl); eq &= string.Equals(other.Description, Description); eq &= other.Id == Id; eq &= other.Key.Equals(Key); eq &= string.Equals(other.Summary, Summary); eq &= other.Status.Equals(Status); eq &= other.StatusIconUrl.Equals(StatusIconUrl); eq &= Equals(other.Priority, Priority); eq &= string.Equals(other.Resolution, Resolution); eq &= other.Reporter.Equals(Reporter); eq &= string.Equals(other.Assignee, Assignee); eq &= other.CreationDate.Equals(CreationDate); eq &= other.UpdateDate.Equals(UpdateDate); eq &= other.ProjectKey.Equals(ProjectKey); eq &= string.Equals(other.Environment, Environment); eq &= string.Equals(other.OriginalEstimate, OriginalEstimate); eq &= string.Equals(other.RemainingEstimate, RemainingEstimate); eq &= string.Equals(other.TimeSpent, TimeSpent); eq &= string.Equals(other.ParentKey, ParentKey); eq &= Equals(other.PriorityIconUrl, PriorityIconUrl); eq &= other.StatusId == StatusId; eq &= other.PriorityId == PriorityId; eq &= PlvsUtils.compareLists(other.comments, comments); eq &= PlvsUtils.compareLists(other.versions, versions); eq &= PlvsUtils.compareLists(other.fixVersions, fixVersions); eq &= PlvsUtils.compareLists(other.components, components); eq &= PlvsUtils.compareLists(other.SubtaskKeys, SubtaskKeys); eq &= PlvsUtils.compareLists(other.Attachments, Attachments); eq &= PlvsUtils.compareLists(other.IssueLinks, IssueLinks); return(eq); }
public List <JiraNamedEntity> getActionsForIssue(JiraIssue issue) { #if PLVS_133_WORKAROUND object[] results = service.getAvailableActions(Token, issue.Key); return(createEntityList(results)); #else RemoteNamedObject[] actions = service.getAvailableActions(Token, issue.Key); if (actions == null) { return(new List <JiraNamedEntity>()); } return((from action in actions where action != null select new JiraNamedEntity(int.Parse(action.id), action.name, null)).ToList()); #endif }
public void addComment(JiraIssue issue, string comment) { #if PLVS_133_WORKAROUND object[] comments = service.getComments(Token, issue.Key); if (comments == null) { throw new Exception("Unable to retrieve information about the RemoteComment type"); } Type type = comments.GetType(); Type commentType = type.GetElementType(); ConstructorInfo constructor = commentType.GetConstructor(new Type[] {}); object commentObject = constructor.Invoke(new object[] {}); setObjectProperty(commentObject, "body", comment); service.addComment(Token, issue.Key, commentObject); #else service.addComment(Token, issue.Key, new RemoteComment { body = comment }); #endif }
public void runIssueActionWithParams(JiraIssue issue, int id, ICollection <JiraField> fields, string comment) { #if PLVS_133_WORKAROUND List <object> fieldValues = new List <object>(); foreach (var field in fields) { if (field.Values == null) { continue; } object rfv = createRemoteFieldValueObject(field.Id); setObjectProperty(rfv, "values", field.Values.ToArray()); fieldValues.Add(rfv); } service.progressWorkflowAction(Token, issue.Key, id.ToString(), fieldValues.ToArray()); if (comment != null) { addComment(issue, comment); } #else if (fields == null || fields.Count == 0) { throw new Exception("Field values must not be empty"); } service.progressWorkflowAction(Token, issue.Key, id.ToString(), (from field in fields where field.Values != null select new RemoteFieldValue { id = field.Id, values = field.Values.ToArray() }).ToArray()); if (!string.IsNullOrEmpty(comment)) { service.addComment(Token, issue.Key, new RemoteComment { body = comment }); } #endif }
public void runIssueActionWithParams(JiraIssue issue, JiraNamedEntity action, ICollection <JiraField> fields, string comment) { using (SoapSession s = createSoapSession(issue.Server)) { wrapExceptionsVoid(issue.Server, s, () => s.runIssueActionWithParams(issue, action.Id, fields, comment)); } }
public void runIssueActionWithoutParams(JiraIssue issue, int id) { service.progressWorkflowAction(Token, issue.Key, id.ToString(), null); }
public void uploadAttachment(JiraIssue issue, string name, byte[] attachment) { using (SoapSession s = createSoapSession(issue.Server)) { wrapExceptionsVoid(issue.Server, s, () => s.uploadAttachment(issue.Key, name, attachment)); } }
public void updateIssue(JiraIssue issue, ICollection <JiraField> fields) { using (SoapSession s = createSoapSession(issue.Server)) { wrapExceptionsVoid(issue.Server, s, () => s.updateIssue(issue.Key, fields)); } }
public void logWorkAndUpdateRemainingManually(JiraIssue issue, string timeSpent, DateTime startDate, string remainingEstimate, string comment) { using (SoapSession s = createSoapSession(issue.Server)) { wrapExceptionsVoid(issue.Server, s, () => s.logWorkAndUpdateRemainingManually(issue.Key, timeSpent, startDate, remainingEstimate, comment)); } }
public void logWorkAndLeaveRemainingUnchanged(JiraIssue issue, string timeSpent, DateTime startDate, string comment) { using (SoapSession s = createSoapSession(issue.Server)) { wrapExceptionsVoid(issue.Server, s, () => s.logWorkAndLeaveRemainingUnchanged(issue.Key, timeSpent, startDate, comment)); } }
public JiraNamedEntity getSecurityLevel(JiraIssue issue) { using (SoapSession s = createSoapSession(issue.Server)) { return(wrapExceptions(issue.Server, s, () => s.getSecurityLevel(issue.Key))); } }
public object getIssueSoapObject(JiraIssue issue) { using (SoapSession s = createSoapSession(issue.Server)) { return(wrapExceptions(issue.Server, s, () => s.getIssueSoapObject(issue.Key))); } }
public string createIssue(JiraServer server, JiraIssue issue) { using (SoapSession s = createSoapSession(server)) { return(wrapExceptions(server, s, () => s.createIssue(issue))); } }
public void runIssueActionWithoutParams(JiraIssue issue, JiraNamedEntity action) { using (SoapSession s = createSoapSession(issue.Server)) { wrapExceptionsVoid(issue.Server, s, () => s.runIssueActionWithoutParams(issue, action.Id)); } }
public List <JiraField> getFieldsForAction(JiraIssue issue, int actionId) { using (SoapSession s = createSoapSession(issue.Server)) { return(wrapExceptions(issue.Server, s, () => s.getFieldsForAction(issue, actionId))); } }
public List <JiraNamedEntity> getActionsForIssue(JiraIssue issue) { using (SoapSession s = createSoapSession(issue.Server)) { return(wrapExceptions(issue.Server, s, () => s.getActionsForIssue(issue))); } }
public void addComment(JiraIssue issue, string comment) { using (SoapSession s = createSoapSession(issue.Server)) { wrapExceptionsVoid(issue.Server, s, () => s.addComment(issue, comment)); } }
public string createIssue(JiraIssue issue) { #if PLVS_133_WORKAROUND object[] issuesTable = service.getIssuesFromTextSearch(Token, "<<<<<<<<<<<<<IHOPETHEREISNOSUCHTEXT>>>>>>>>>>>>>>"); Type issueObjectType = issuesTable.GetType().GetElementType(); object ri = issueObjectType.GetConstructor(new Type[] {}).Invoke(new object[] {}); setObjectProperty(ri, "project", issue.ProjectKey); setObjectProperty(ri, "type", issue.IssueTypeId.ToString()); setObjectProperty(ri, "priority", issue.PriorityId.ToString()); setObjectProperty(ri, "summary", issue.Summary); setObjectProperty(ri, "description", issue.Description); if (issue.Assignee != null) { setObjectProperty(ri, "assignee", issue.Assignee); } if (issue.Components != null && issue.Components.Count > 0) { object[] components = service.getComponents(Token, issue.ProjectKey); setObjectTablePropertyFromObjectList(ri, "components", issue.Components, components); } object[] versions = service.getVersions(Token, issue.ProjectKey); if (issue.Versions != null && issue.Versions.Count > 0) { setObjectTablePropertyFromObjectList(ri, "affectsVersions", issue.Versions, versions); } if (issue.FixVersions != null && issue.FixVersions.Count > 0) { setObjectTablePropertyFromObjectList(ri, "fixVersions", issue.FixVersions, versions); } object createdIssue = service.createIssue(Token, ri); return((string)createdIssue.GetType().GetProperty("key").GetValue(createdIssue, null)); #else RemoteIssue ri = new RemoteIssue { project = issue.ProjectKey, type = issue.IssueTypeId.ToString(), priority = issue.PriorityId.ToString(), summary = issue.Summary, description = issue.Description, }; if (issue.Assignee != null) { ri.assignee = issue.Assignee; } if (issue.Components != null && issue.Components.Count > 0) { IEnumerable <JiraNamedEntity> components = getComponents(issue.ProjectKey); // RemoteComponent[] objects = service.getComponents(Token, issue.ProjectKey); List <RemoteComponent> comps = new List <RemoteComponent>(); foreach (string t in issue.Components) { // fixme: a bit problematic part. What if two objects have the same name? // I suppose JiraIssue class has to be fixed, but that would require more problematic // construction of it during server query string tCopy = t; foreach (JiraNamedEntity component in components.Where(component => component.Name.Equals(tCopy))) { comps.Add(new RemoteComponent { id = component.Id.ToString(), name = component.Name }); break; } } ri.components = comps.ToArray(); } List <JiraNamedEntity> versions = getVersions(issue.ProjectKey); // RemoteVersion[] versions = service.getVersions(Token, issue.ProjectKey); if (issue.Versions != null && issue.Versions.Count > 0) { List <RemoteVersion> vers = new List <RemoteVersion>(); foreach (string t in issue.Versions) { // fixme: a bit problematic part. same as for objects string tCopy = t; foreach (JiraNamedEntity version in versions.Where(version => version.Name.Equals(tCopy))) { vers.Add(new RemoteVersion { id = version.Id.ToString(), name = version.Name }); break; } } ri.affectsVersions = vers.ToArray(); } if (issue.FixVersions != null && issue.FixVersions.Count > 0) { List <RemoteVersion> vers = new List <RemoteVersion>(); foreach (string t in issue.FixVersions) { // fixme: a bit problematic part. same as for objects string tCopy = t; foreach (JiraNamedEntity version in versions.Where(version => version.Name.Equals(tCopy))) { vers.Add(new RemoteVersion { id = version.Id.ToString(), name = version.Name }); break; } } ri.fixVersions = vers.ToArray(); } RemoteIssue createdIssue = service.createIssue(Token, ri); return(createdIssue.key); #endif }