Skip to content

Commit

Permalink
Fixed JobStep.name validation
Browse files Browse the repository at this point in the history
Signed-off-by: coduz <alberto.codutti@eurotech.com>
  • Loading branch information
Coduz committed Dec 17, 2019
1 parent 83c3ef5 commit e255ded
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.eclipse.kapua.app.console.module.api.client.util.DialogUtils;
import org.eclipse.kapua.app.console.module.api.client.util.FailureHandler;
import org.eclipse.kapua.app.console.module.api.client.util.KapuaSafeHtmlUtils;
import org.eclipse.kapua.app.console.module.api.client.util.validator.TextFieldValidator;
import org.eclipse.kapua.app.console.module.api.shared.model.session.GwtSession;
import org.eclipse.kapua.app.console.module.job.client.messages.ConsoleJobMessages;
import org.eclipse.kapua.app.console.module.job.shared.model.GwtJobStep;
Expand Down Expand Up @@ -98,7 +99,10 @@ public JobStepAddDialog(GwtSession currentSession, String jobId) {
this.jobId = jobId;

jobStepName = new KapuaTextField<String>();
jobStepName.setMinLength(3);
jobStepName.setMaxLength(255);
jobStepName.setValidator(new TextFieldValidator(jobStepName, TextFieldValidator.FieldType.NAME_SPACE));

jobStepDescription = new KapuaTextField<String>();
jobStepDefinitionCombo = new ComboBox<GwtJobStepDefinition>();
jobStepPropertiesFieldSet = new FieldSet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
import org.eclipse.kapua.KapuaEntityUniquenessException;
import org.eclipse.kapua.KapuaException;
import org.eclipse.kapua.commons.configuration.AbstractKapuaConfigurableResourceLimitedService;
import org.eclipse.kapua.model.query.SortOrder;
import org.eclipse.kapua.commons.util.ArgumentValidator;
import org.eclipse.kapua.locator.KapuaLocator;
import org.eclipse.kapua.locator.KapuaProvider;
import org.eclipse.kapua.model.domain.Actions;
import org.eclipse.kapua.model.id.KapuaId;
import org.eclipse.kapua.model.query.KapuaQuery;
import org.eclipse.kapua.model.query.SortOrder;
import org.eclipse.kapua.model.query.predicate.AttributePredicate.Operator;
import org.eclipse.kapua.service.authorization.AuthorizationService;
import org.eclipse.kapua.service.authorization.permission.PermissionFactory;
Expand Down Expand Up @@ -71,8 +71,7 @@ public JobStep create(JobStepCreator jobStepCreator) throws KapuaException {
// Argument validation
ArgumentValidator.notNull(jobStepCreator, "jobStepCreator");
ArgumentValidator.notNull(jobStepCreator.getScopeId(), "jobStepCreator.scopeId");
ArgumentValidator.notEmptyOrNull(jobStepCreator.getName(), "jobStepCreator.name");
ArgumentValidator.numRange(jobStepCreator.getName().length(), 1, 255, "jobStepCreator.name");
ArgumentValidator.validateEntityName(jobStepCreator.getName(), "jobStepCreator.name");
ArgumentValidator.notNull(jobStepCreator.getJobStepDefinitionId(), "jobStepCreator.stepDefinitionId");

if (jobStepCreator.getDescription() != null) {
Expand Down Expand Up @@ -152,7 +151,7 @@ public JobStep update(JobStep jobStep) throws KapuaException {
// Argument validation
ArgumentValidator.notNull(jobStep, "jobStep");
ArgumentValidator.notNull(jobStep.getScopeId(), "jobStep.scopeId");
ArgumentValidator.notNull(jobStep.getName(), "jobStep.name");
ArgumentValidator.validateEntityName(jobStep.getName(), "jobStep.name");
ArgumentValidator.notNull(jobStep.getJobStepDefinitionId(), "jobStep.stepDefinitionId");
if (jobStep.getDescription() != null) {
ArgumentValidator.numRange(jobStep.getDescription().length(), 0, 8192, "jobStep.description");
Expand Down

0 comments on commit e255ded

Please sign in to comment.