Class: Etna::Clients::Magma::RenameAttributeActionValidator

Inherits:
AttributeActionValidatorBase show all
Defined in:
lib/etna/clients/magma/workflows/json_validators.rb

Instance Attribute Summary

Attributes inherited from AttributeActionValidatorBase

#action, #project_models

Attributes inherited from ValidatorBase

#errors

Instance Method Summary collapse

Methods inherited from AttributeActionValidatorBase

#action_to_attribute, #check_already_exists_in_model, #check_does_not_exist_in_model, #exists_in_magma_model?, #initialize, #validate_model_exists

Methods inherited from ValidatorBase

#check_in_set, #check_key, #check_key_empty, #check_valid_name_with_numbers, #format_errors, #initialize, #model_exists_in_project?, #name_regex_no_numbers, #name_regex_with_numbers, #nil_or_empty?, #valid?, #validate!

Constructor Details

This class inherits a constructor from Etna::Clients::Magma::AttributeActionValidatorBase

Instance Method Details

#validateObject



380
381
382
383
384
# File 'lib/etna/clients/magma/workflows/json_validators.rb', line 380

def validate
  validate_action
  validate_model_exists(action.model_name)
  validate_proposed_name
end

#validate_actionObject



386
387
388
389
390
# File 'lib/etna/clients/magma/workflows/json_validators.rb', line 386

def validate_action
  check_key("action #{action}", action, :model_name)
  check_key("action #{action}", action, :attribute_name)
  check_key("action #{action}", action, :new_attribute_name)
end

#validate_proposed_nameObject



392
393
394
395
396
# File 'lib/etna/clients/magma/workflows/json_validators.rb', line 392

def validate_proposed_name
  check_does_not_exist_in_model(action.model_name, action.attribute_name)
  check_valid_name_with_numbers('New attribute', action.new_attribute_name)
  check_already_exists_in_model(action.model_name, action.new_attribute_name)
end