예제 #1
0
            public override void Execute(IOperation operation, IOperationLogger logger)
            {
                logger.Debug($"[Operation: {operation.ComplexOperationId}, note: {NoteId}] Sending notifications for users").Wait();

                var note = noteFolderStore.GetNoteById(operation, NoteId).Result;

                var(_, users) = userDataStore.GetUsers(operation, new UserPagingRequest
                {
                    PageNo   = 0,
                    PageSize = UserIds.Count(),
                    Filter   = new UserPagingFilter
                    {
                        Ids = UserIds
                    }
                }).Result;

                foreach (var user in users)
                {
                    var message = $"[Operation: {operation.ComplexOperationId}, note: {NoteId}] Note \"{note.FolderName}\" -> \"{note.Title}\":";
                    message += $"\n- The following user: {user.FirstName}{(!string.IsNullOrWhiteSpace(user.LastName) ? $" {user.LastName}" : "")} <{user.Email}>";
                    message += $"\n- The text:\n{note.Text}";
                    logger.Info(message).Wait();
                }

                logger.Debug($"[Operation: {operation.ComplexOperationId}, note: {NoteId}] Sent notifications for users").Wait();
            }
        private async Task DeleteDeployment(IOperation operation, IOperationLogger logger, DeploymentListItem deployment)
        {
            var response = await new Deployment.DeleteRequest(deployment.Id)
            {
                Cascade = true
            }.SendRequest(operation, camundaClient);

            if (response.IsWithoutErrors())
            {
                await logger.Info($"Camunda deployment was deleted:\n{JsonConvert.SerializeObject(deployment, Formatting.Indented)}");
            }
            else
            {
                await logger.Error($"Camunda deployments wasn't deleted:\n{JsonConvert.SerializeObject(response.Errors, Formatting.Indented)}");

                throw CommonExceptions.FailedToDeleteCamundaDeployment(operation);
            }
        }
        private async Task <List <DeploymentListItem> > GetDeployments(IOperation operation, IOperationLogger logger, CamundaDeploymentSettings settings)
        {
            var response = await new Deployment.GetListRequest
            {
                Source    = settings.ProjectName,
                SortBy    = "deploymentTime",
                SortOrder = "desc"
            }.SendRequest(operation, camundaClient);

            if (response.IsWithoutErrors())
            {
                await logger.Info($"Camunda deployments were got successfully:\n{JsonConvert.SerializeObject(response.Response, Formatting.Indented)}");

                return(response.Response);
            }

            await logger.Error($"Camunda deployments weren't got:\n{JsonConvert.SerializeObject(response.Errors, Formatting.Indented)}");

            throw CommonExceptions.FailedToGetListOfCamundaDeployments(operation);
        }