コード例 #1
0
        /// <summary>
        /// Creates new Scrum team with specified team name and Scrum master name.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="scrumMasterName">Name of the Scrum master.</param>
        /// <param name="deck">Selected deck of estimation cards to use in the team.</param>
        /// <returns>
        /// Created Scrum team.
        /// </returns>
        public TeamResult CreateTeam(string teamName, string scrumMasterName, Deck deck)
        {
            _logger.LogInformation("{action}(\"{teamName}\", \"{scrumMasterName}\", {deck})", nameof(CreateTeam), teamName, scrumMasterName, deck);
            ValidateTeamName(teamName);
            ValidateMemberName(scrumMasterName, nameof(scrumMasterName));

            try
            {
                var domainDeck = ServiceEntityMapper.Map(deck);
                using (var teamLock = PlanningPoker.CreateScrumTeam(teamName, scrumMasterName, domainDeck))
                {
                    teamLock.Lock();
                    var resultTeam = ServiceEntityMapper.Map <D.ScrumTeam, ScrumTeam>(teamLock.Team);
                    return(new TeamResult
                    {
                        ScrumTeam = resultTeam,
                        SessionId = teamLock.Team.ScrumMaster.SessionId
                    });
                }
            }
            catch (ArgumentException ex)
            {
                throw new HubException(ex.Message);
            }
        }
コード例 #2
0
        /// <summary>
        /// Connects member or observer with specified name to the Scrum team with specified name.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="memberName">Name of the member or observer.</param>
        /// <param name="asObserver">If set to <c>true</c> then connects as observer; otherwise as member.</param>
        /// <returns>
        /// The Scrum team the member or observer joined to.
        /// </returns>
        public TeamResult JoinTeam(string teamName, string memberName, bool asObserver)
        {
            _logger.LogInformation("{action}(\"{teamName}\", \"{memberName}\", {asObserver})", nameof(JoinTeam), teamName, memberName, asObserver);
            ValidateTeamName(teamName);
            ValidateMemberName(memberName, nameof(memberName));

            try
            {
                using (var teamLock = PlanningPoker.GetScrumTeam(teamName))
                {
                    teamLock.Lock();
                    var team   = teamLock.Team;
                    var member = team.Join(memberName, asObserver);

                    var resultTeam = ServiceEntityMapper.Map <D.ScrumTeam, ScrumTeam>(teamLock.Team);
                    return(new TeamResult
                    {
                        ScrumTeam = resultTeam,
                        SessionId = member.SessionId
                    });
                }
            }
            catch (ArgumentException ex)
            {
                throw new HubException(ex.Message);
            }
        }
コード例 #3
0
        public ActionResult <TeamResult> JoinTeam(string teamName, string memberName, bool asObserver)
        {
            ValidateTeamName(teamName);
            ValidateMemberName(memberName, nameof(memberName));

            try
            {
                using (var teamLock = PlanningPoker.GetScrumTeam(teamName))
                {
                    teamLock.Lock();
                    var team   = teamLock.Team;
                    var member = team.Join(memberName, asObserver);

                    var resultTeam = ServiceEntityMapper.Map <D.ScrumTeam, ScrumTeam>(teamLock.Team);
                    return(new TeamResult
                    {
                        ScrumTeam = resultTeam,
                        SessionId = member.SessionId
                    });
                }
            }
            catch (ArgumentException ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #4
0
        /// <summary>
        /// Reconnects member with specified name to the Scrum team with specified name.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="memberName">Name of the member.</param>
        /// <returns>
        /// The Scrum team the member or observer reconnected to.
        /// </returns>
        /// <remarks>
        /// This operation is used to resynchronize client and server. Current status of ScrumTeam is returned and message queue for the member is cleared.
        /// </remarks>
        public ReconnectTeamResult ReconnectTeam(string teamName, string memberName)
        {
            _logger.LogInformation("{action}(\"{teamName}\", \"{memberName}\")", nameof(ReconnectTeam), teamName, memberName);
            ValidateTeamName(teamName);
            ValidateMemberName(memberName, nameof(memberName));

            try
            {
                using (var teamLock = PlanningPoker.GetScrumTeam(teamName))
                {
                    teamLock.Lock();
                    var team     = teamLock.Team;
                    var observer = team.FindMemberOrObserver(memberName);
                    if (observer == null)
                    {
                        throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.Error_MemberNotFound, memberName), nameof(memberName));
                    }

                    Estimation selectedEstimation = null;
                    if (team.State == D.TeamState.EstimationInProgress)
                    {
                        var member = observer as D.Member;
                        if (member != null)
                        {
                            selectedEstimation = ServiceEntityMapper.Map <D.Estimation, Estimation>(member.Estimation);
                        }
                    }

                    var lastMessageId = observer.ClearMessages();
                    observer.UpdateActivity();

                    var teamResult = ServiceEntityMapper.Map <D.ScrumTeam, ScrumTeam>(teamLock.Team);
                    return(new ReconnectTeamResult()
                    {
                        ScrumTeam = teamResult,
                        LastMessageId = lastMessageId,
                        SelectedEstimation = selectedEstimation
                    });
                }
            }
            catch (ArgumentException ex)
            {
                throw new HubException(ex.Message);
            }
        }
コード例 #5
0
        /// <summary>
        /// Creates new Scrum team with specified team name and Scrum master name.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="scrumMasterName">Name of the Scrum master.</param>
        /// <returns>
        /// Created Scrum team.
        /// </returns>
        public ScrumTeam CreateTeam(string teamName, string scrumMasterName)
        {
            ValidateTeamName(teamName);
            ValidateMemberName(scrumMasterName, "scrumMasterName");

            try
            {
                using (var teamLock = this.PlanningPoker.CreateScrumTeam(teamName, scrumMasterName))
                {
                    teamLock.Lock();
                    return(ServiceEntityMapper.Map <D.ScrumTeam, ScrumTeam>(teamLock.Team));
                }
            }
            catch (ArgumentException ex)
            {
                throw new FaultException(ex.Message);
            }
        }
コード例 #6
0
        public ActionResult <ScrumTeam> CreateTeam(string teamName, string scrumMasterName)
        {
            ValidateTeamName(teamName);
            ValidateMemberName(scrumMasterName, nameof(scrumMasterName));

            try
            {
                using (var teamLock = PlanningPoker.CreateScrumTeam(teamName, scrumMasterName))
                {
                    teamLock.Lock();
                    return(ServiceEntityMapper.Map <D.ScrumTeam, ScrumTeam>(teamLock.Team));
                }
            }
            catch (ArgumentException ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #7
0
        /// <summary>
        /// Creates new Scrum team with specified team name and Scrum master name.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="scrumMasterName">Name of the Scrum master.</param>
        /// <returns>
        /// Created Scrum team.
        /// </returns>
        public ScrumTeam CreateTeam(string teamName, string scrumMasterName)
        {
            _logger.LogInformation("{action}(\"{teamName}\", \"{scrumMasterName}\")", nameof(CreateTeam), teamName, scrumMasterName);
            ValidateTeamName(teamName);
            ValidateMemberName(scrumMasterName, nameof(scrumMasterName));

            try
            {
                using (var teamLock = PlanningPoker.CreateScrumTeam(teamName, scrumMasterName))
                {
                    teamLock.Lock();
                    return(ServiceEntityMapper.Map <D.ScrumTeam, ScrumTeam>(teamLock.Team));
                }
            }
            catch (ArgumentException ex)
            {
                throw new HubException(ex.Message);
            }
        }
コード例 #8
0
        /// <summary>
        /// Connects member or observer with specified name to the Scrum team with specified name.
        /// </summary>
        /// <param name="teamName">Name of the Scrum team.</param>
        /// <param name="memberName">Name of the member or observer.</param>
        /// <param name="asObserver">If set to <c>true</c> then connects as observer; otherwise as member.</param>
        /// <returns>
        /// The Scrum team the member or observer joined to.
        /// </returns>
        public ScrumTeam JoinTeam(string teamName, string memberName, bool asObserver)
        {
            ValidateTeamName(teamName);
            ValidateMemberName(memberName, "memberName");

            try
            {
                using (var teamLock = this.PlanningPoker.GetScrumTeam(teamName))
                {
                    teamLock.Lock();
                    var team = teamLock.Team;
                    team.Join(memberName, asObserver);
                    return(ServiceEntityMapper.Map <D.ScrumTeam, ScrumTeam>(teamLock.Team));
                }
            }
            catch (ArgumentException ex)
            {
                throw new FaultException(ex.Message);
            }
        }
コード例 #9
0
        public ActionResult <ReconnectTeamResult> ReconnectTeam(string teamName, string memberName)
        {
            ValidateTeamName(teamName);
            ValidateMemberName(memberName, nameof(memberName));

            try
            {
                using (var teamLock = PlanningPoker.GetScrumTeam(teamName))
                {
                    teamLock.Lock();
                    var team     = teamLock.Team;
                    var observer = team.CreateSession(memberName);
                    if (observer == null)
                    {
                        throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.Error_MemberNotFound, memberName), nameof(memberName));
                    }

                    Estimation selectedEstimation = null;
                    if (team.State == D.TeamState.EstimationInProgress && observer is D.Member member)
                    {
                        selectedEstimation = ServiceEntityMapper.Map <D.Estimation, Estimation>(member.Estimation);
                    }

                    var lastMessageId = observer.ClearMessages();
                    observer.UpdateActivity();

                    var resultTeam = ServiceEntityMapper.Map <D.ScrumTeam, ScrumTeam>(teamLock.Team);
                    return(new ReconnectTeamResult()
                    {
                        ScrumTeam = resultTeam,
                        SessionId = observer.SessionId,
                        LastMessageId = lastMessageId,
                        SelectedEstimation = selectedEstimation
                    });
                }
            }
            catch (ArgumentException ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #10
0
            private void ProcessMessages(bool hasMessages, D.Observer member)
            {
                try
                {
                    List <Message> result;
                    if (hasMessages)
                    {
                        result = member.Messages.Select(m => ServiceEntityMapper.Map <D.Message, Message>(m)).ToList();
                    }
                    else
                    {
                        result = new List <Message>();
                    }

                    this.ReturnResult(result);
                }
                catch (Exception ex)
                {
                    this.ThrowException(ex);
                }
            }
コード例 #11
0
        public ActionResult <TeamResult> CreateTeam(string teamName, string scrumMasterName, Deck deck)
        {
            ValidateTeamName(teamName);
            ValidateMemberName(scrumMasterName, nameof(scrumMasterName));

            try
            {
                var domainDeck = ServiceEntityMapper.Map(deck);
                using (var teamLock = PlanningPoker.CreateScrumTeam(teamName, scrumMasterName, domainDeck))
                {
                    teamLock.Lock();
                    var resultTeam = ServiceEntityMapper.Map <D.ScrumTeam, ScrumTeam>(teamLock.Team);
                    return(new TeamResult
                    {
                        ScrumTeam = resultTeam,
                        SessionId = teamLock.Team.ScrumMaster.SessionId
                    });
                }
            }
            catch (ArgumentException ex)
            {
                return(BadRequest(ex.Message));
            }
        }