Example #1
0
        private void Initialize(RemoteIssue remoteIssue)
        {
            _originalIssue = remoteIssue;

            _project        = remoteIssue.project;
            _key            = remoteIssue.key;
            _createDate     = remoteIssue.created;
            _dueDate        = remoteIssue.duedate;
            _updateDate     = remoteIssue.updated;
            _resolutionDate = remoteIssue.resolutionDateReadOnly;

            Assignee    = remoteIssue.assignee;
            Description = remoteIssue.description;
            Environment = remoteIssue.environment;
            Reporter    = remoteIssue.reporter;
            Summary     = remoteIssue.summary;
            Votes       = remoteIssue.votes;

            if (!String.IsNullOrEmpty(remoteIssue.parentKey))
            {
                _parentIssueKey = remoteIssue.parentKey;
            }

            // named entities
            _status    = String.IsNullOrEmpty(remoteIssue.status) ? null : new IssueStatus(_jira, remoteIssue.status);
            Priority   = String.IsNullOrEmpty(remoteIssue.priority) ? null : new IssuePriority(_jira, remoteIssue.priority);
            Resolution = String.IsNullOrEmpty(remoteIssue.resolution) ? null : new IssueResolution(_jira, remoteIssue.resolution);
            Type       = String.IsNullOrEmpty(remoteIssue.type) ? null : new IssueType(_jira, remoteIssue.type);

            // collections
            _affectsVersions = _originalIssue.affectsVersions == null ? new ProjectVersionCollection("versions", _jira, Project)
                : new ProjectVersionCollection("versions", _jira, Project, _originalIssue.affectsVersions.Select(v => new ProjectVersion(v)).ToList());

            _fixVersions = _originalIssue.fixVersions == null ? new ProjectVersionCollection("fixVersions", _jira, Project)
                : new ProjectVersionCollection("fixVersions", _jira, Project, _originalIssue.fixVersions.Select(v => new ProjectVersion(v)).ToList());

            _components = _originalIssue.components == null ? new ProjectComponentCollection("components", _jira, Project)
                : new ProjectComponentCollection("components", _jira, Project, _originalIssue.components.Select(c => new ProjectComponent(c)).ToList());

            _customFields = _originalIssue.customFieldValues == null ? new CustomFieldValueCollection(this)
                : new CustomFieldValueCollection(this, _originalIssue.customFieldValues.Select(f => new CustomFieldValue(f.customfieldId, this)
            {
                Values = f.values
            }).ToList());
        }
Example #2
0
        private void Initialize(RemoteIssue remoteIssue)
        {
            _originalIssue = remoteIssue;

            _project        = remoteIssue.project;
            _key            = remoteIssue.key;
            _createDate     = remoteIssue.created;
            _dueDate        = remoteIssue.duedate;
            _updateDate     = remoteIssue.updated;
            _resolutionDate = remoteIssue.resolutionDateReadOnly;
            _securityLevel  = remoteIssue.securityLevelReadOnly;

            Assignee     = remoteIssue.assignee;
            Description  = remoteIssue.description;
            Environment  = remoteIssue.environment;
            Reporter     = remoteIssue.reporter;
            Summary      = remoteIssue.summary;
            Votes        = remoteIssue.votesData?.votes;
            HasUserVoted = remoteIssue.votesData != null ? remoteIssue.votesData.hasVoted : false;

            if (!String.IsNullOrEmpty(remoteIssue.parentKey))
            {
                _parentIssueKey = remoteIssue.parentKey;
            }

            // named entities
            _status    = remoteIssue.status == null ? null : new IssueStatus(remoteIssue.status);
            Priority   = remoteIssue.priority == null ? null : new IssuePriority(remoteIssue.priority);
            Resolution = remoteIssue.resolution == null ? null : new IssueResolution(remoteIssue.resolution);
            Type       = remoteIssue.type == null ? null : new IssueType(remoteIssue.type);

            // collections
            _customFields = _originalIssue.customFieldValues == null ? new CustomFieldValueCollection(this)
                : new CustomFieldValueCollection(this, _originalIssue.customFieldValues.Select(f => new CustomFieldValue(f.customfieldId, this)
            {
                Values = f.values
            }).ToList());

            var affectsVersions = _originalIssue.affectsVersions ?? Enumerable.Empty <RemoteVersion>();

            _affectsVersions = new ProjectVersionCollection("versions", _jira, Project, affectsVersions.Select(v =>
            {
                v.ProjectKey = _originalIssue.project;
                return(new ProjectVersion(_jira, v));
            }).ToList());

            var fixVersions = _originalIssue.fixVersions ?? Enumerable.Empty <RemoteVersion>();

            _fixVersions = new ProjectVersionCollection("fixVersions", _jira, Project, fixVersions.Select(v =>
            {
                v.ProjectKey = _originalIssue.project;
                return(new ProjectVersion(_jira, v));
            }).ToList());

            var labels = _originalIssue.labels ?? new string[0];

            _labels = new IssueLabelCollection(labels.ToList());

            var components = _originalIssue.components ?? Enumerable.Empty <RemoteComponent>();

            _components = new ProjectComponentCollection("components", _jira, Project, components.Select(c =>
            {
                c.ProjectKey = _originalIssue.project;
                return(new ProjectComponent(c));
            }).ToList());
        }