Пример #1
0
        private void ValidateSessionCode(string sessionCode)
        {
            ValidationResult sessionCodeValidator = new SessionCodeValidator(sessionCode).Validate();

            if (!sessionCodeValidator.IsValid)
            {
                _messageBuilder.AppendLine(sessionCodeValidator.Message);
            }
        }
Пример #2
0
        private string ValidateCurrentUsageAndLimitationsForCurrentUserModel(GetCurrentUsageAndLimitationsForCurrentUserModel validationObj)
        {
            ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate();

            if (!validationResult.IsValid)
            {
                _messageBuilder.AppendLine(validationResult.Message);
            }
            return(_messageBuilder.ToString());
        }
Пример #3
0
        private string ValidateRemoveCommandTemplateModel(RemoveCommandTemplateModel model)
        {
            ValidateId(model.CommandTemplateId, nameof(model.CommandTemplateId));
            ValidationResult sessionCodeValidation = new SessionCodeValidator(model.SessionCode).Validate();

            if (!sessionCodeValidation.IsValid)
            {
                _messageBuilder.AppendLine(sessionCodeValidation.Message);
            }
            return(_messageBuilder.ToString());
        }
Пример #4
0
        private string ValidateCreateJobModel(CreateJobModel validationObj)
        {
            _ = ValidateJobSpecificationExt(validationObj.JobSpecification);
            ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate();

            if (!validationResult.IsValid)
            {
                _messageBuilder.AppendLine(validationResult.Message);
            }
            return(_messageBuilder.ToString());
        }
        private string ValidateListAdaptorUserGroupsModel(ListAdaptorUserGroupsModel validationObj)
        {
            ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate();

            if (!validationResult.IsValid)
            {
                _messageBuilder.AppendLine(validationResult.Message);
            }

            return(_messageBuilder.ToString());
        }
Пример #6
0
        private string ValidateGetCurrentInfoForJobModel(GetCurrentInfoForJobModel validationObj)
        {
            ValidateId(validationObj.SubmittedJobInfoId, nameof(validationObj.SubmittedJobInfoId));

            ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate();

            if (!validationResult.IsValid)
            {
                _messageBuilder.AppendLine(validationResult.Message);
            }
            return(_messageBuilder.ToString());
        }
Пример #7
0
        private string ValidateGetAllocatedNodesIPsModel(GetAllocatedNodesIPsModel validationObj)
        {
            ValidateId(validationObj.SubmittedTaskInfoId, nameof(validationObj.SubmittedTaskInfoId));

            ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate();

            if (!validationResult.IsValid)
            {
                _messageBuilder.AppendLine(validationResult.Message);
            }
            return(_messageBuilder.ToString());
        }
        private string ValidateEndDataTransferModel(EndDataTransferModel validationObj)
        {
            ValidateDataTransferMethodExt(validationObj.UsedTransferMethod);

            ValidationResult sessionCodeValidation = new SessionCodeValidator(validationObj.SessionCode).Validate();

            if (!sessionCodeValidation.IsValid)
            {
                _messageBuilder.AppendLine(sessionCodeValidation.Message);
            }

            return(_messageBuilder.ToString());
        }
        private string ValidateGetResourceUsageReportForJobModel(GetResourceUsageReportForJobModel validationObj)
        {
            ValidateId(validationObj.JobId, nameof(validationObj.JobId));

            ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate();

            if (!validationResult.IsValid)
            {
                _messageBuilder.AppendLine(validationResult.Message);
            }

            return(_messageBuilder.ToString());
        }
Пример #10
0
        private string ValidateCurrentClusterNodeUsageModel(CurrentClusterNodeUsageModel model)
        {
            if (model.ClusterNodeId <= 0)
            {
                _messageBuilder.AppendLine(MustBeGreaterThanZeroMessage("ClusterNodeId"));
            }
            ValidationResult sessionCodeValidation = new SessionCodeValidator(model.SessionCode).Validate();

            if (!sessionCodeValidation.IsValid)
            {
                _messageBuilder.AppendLine(sessionCodeValidation.Message);
            }
            return(_messageBuilder.ToString());
        }
Пример #11
0
        private string ValidateCreateCommandTemplateModel(CreateCommandTemplateModel model)
        {
            ValidateId(model.GenericCommandTemplateId, nameof(model.GenericCommandTemplateId));
            ValidationResult sessionCodeValidation = new SessionCodeValidator(model.SessionCode).Validate();

            if (!sessionCodeValidation.IsValid)
            {
                _messageBuilder.AppendLine(sessionCodeValidation.Message);
            }

            if (ContainsIllegalCharactersForPath(model.ExecutableFile))
            {
                _messageBuilder.AppendLine("ExecutableFile contains illegal characters.");
            }

            return(_messageBuilder.ToString());
        }
Пример #12
0
        private string ValidateGetUserGroupResourceUsageReportModel(GetUserGroupResourceUsageReportModel model)
        {
            ValidateId(model.GroupId, nameof(model.GroupId));
            if (model.StartTime > model.EndTime)
            {
                _messageBuilder.AppendLine("StartTime must be before EndTime");
            }

            ValidationResult validationResult = new SessionCodeValidator(model.SessionCode).Validate();

            if (!validationResult.IsValid)
            {
                _messageBuilder.AppendLine(validationResult.Message);
            }

            return(_messageBuilder.ToString());
        }
Пример #13
0
        private string ValidateCopyJobDataToTempModel(CopyJobDataToTempModel validationObj)
        {
            ValidateId(validationObj.SubmittedJobInfoId, nameof(validationObj.SubmittedJobInfoId));

            ValidationResult validationResult = new SessionCodeValidator(validationObj.SessionCode).Validate();

            if (!validationResult.IsValid)
            {
                _messageBuilder.AppendLine(validationResult.Message);
            }

            validationResult = new PathValidator(validationObj.Path).Validate();
            if (!validationResult.IsValid)
            {
                _messageBuilder.AppendLine(validationResult.Message);
            }

            return(_messageBuilder.ToString());
        }
Пример #14
0
        private string ValidateGetCommandTemplateParametersNameModele(GetCommandTemplateParametersNameModel model)
        {
            if (model.CommandTemplateId <= 0)
            {
                _messageBuilder.AppendLine(MustBeGreaterThanZeroMessage("CommandTemplateId"));
            }

            if (ContainsIllegalCharactersForPath(model.UserScriptPath))
            {
                _messageBuilder.AppendLine("UserScriptPath contains illegal characters.");
            }

            ValidationResult sessionCodeValidation = new SessionCodeValidator(model.SessionCode).Validate();

            if (!sessionCodeValidation.IsValid)
            {
                _messageBuilder.AppendLine(sessionCodeValidation.Message);
            }
            return(_messageBuilder.ToString());
        }
Пример #15
0
        private string ValidateHttpGetToJobNodeModel(HttpGetToJobNodeModel validationObj)
        {
            if (string.IsNullOrEmpty(validationObj.NodeIPAddress))
            {
                _messageBuilder.AppendLine("IpAddress must be set");
            }
            else if (!IsIpAddress(validationObj.NodeIPAddress))
            {
                _messageBuilder.AppendLine("Ip address has unknown format. If using ipv6, please try to specify 'full address' without shortening.");
            }

            if (string.IsNullOrEmpty(validationObj.HttpRequest))
            {
                _messageBuilder.AppendLine("HttpRequest must be set");
            }

            if (!validationObj.HttpHeaders.Any())
            {
                _messageBuilder.AppendLine("HttpHeader must be set");
            }


            if (validationObj.HttpHeaders.Any(httpHeader => string.IsNullOrEmpty(httpHeader.Name) || string.IsNullOrEmpty(httpHeader.Value)))
            {
                _messageBuilder.AppendLine("HttpHeader must be set");
            }


            ValidatePort(validationObj.NodePort);
            ValidateId(validationObj.SubmittedJobInfoId, nameof(validationObj.SubmittedJobInfoId));

            ValidationResult sessionCodeValidation = new SessionCodeValidator(validationObj.SessionCode).Validate();

            if (!sessionCodeValidation.IsValid)
            {
                _messageBuilder.AppendLine(sessionCodeValidation.Message);
            }

            return(_messageBuilder.ToString());
        }
Пример #16
0
        private string ValidateGetDataTransferMethodModel(GetDataTransferMethodModel validationObj)
        {
            if (string.IsNullOrEmpty(validationObj.IpAddress))
            {
                _messageBuilder.AppendLine("IpAddress must be set");
            }
            else if (!IsIpAddress(validationObj.IpAddress))
            {
                _messageBuilder.AppendLine("Ip address has unknown format. If using ipv6, please try to specify 'full address' without shortening.");
            }

            ValidatePort(validationObj.Port);

            ValidateId(validationObj.SubmittedJobInfoId, nameof(validationObj.SubmittedJobInfoId));

            ValidationResult sessionCodeValidation = new SessionCodeValidator(validationObj.SessionCode).Validate();

            if (!sessionCodeValidation.IsValid)
            {
                _messageBuilder.AppendLine(sessionCodeValidation.Message);
            }

            return(_messageBuilder.ToString());
        }