diff options
| author | cedricnjanga | 2017-09-27 12:28:23 +0200 | 
|---|---|---|
| committer | cedricnjanga | 2017-09-27 16:15:13 +0200 | 
| commit | ea0cf8c5e11ddbd61eed8cd825ac923ad947cdf4 (patch) | |
| tree | 0da9a75100a96bb886003baaf31287786c2a8f17 | |
| parent | 86abe568ce4c04d14df882ece44576ff069c4a3c (diff) | |
| download | chouette-core-ea0cf8c5e11ddbd61eed8cd825ac923ad947cdf4.tar.bz2 | |
Refs #4616 put generic_attribute compliance control inside a folder
| -rw-r--r-- | app/models/generic_attribute_control/min_max.rb | 17 | ||||
| -rw-r--r-- | app/models/generic_attribute_control/pattern.rb | 13 | ||||
| -rw-r--r-- | app/models/generic_attribute_control/uniqueness.rb | 13 | ||||
| -rw-r--r-- | app/models/generic_attribute_min_max.rb | 23 | ||||
| -rw-r--r-- | app/models/generic_attribute_pattern.rb | 23 | ||||
| -rw-r--r-- | app/models/generic_attribute_uniqueness.rb | 23 | 
6 files changed, 43 insertions, 69 deletions
| diff --git a/app/models/generic_attribute_control/min_max.rb b/app/models/generic_attribute_control/min_max.rb new file mode 100644 index 000000000..6a2e1f284 --- /dev/null +++ b/app/models/generic_attribute_control/min_max.rb @@ -0,0 +1,17 @@ +module GenericAttributeControl +  class MinMax < ComplianceControl +    hstore_accessor :control_attributes, minimum: :integer, maximum: :integer + +    @@default_criticity = :warning +    @@default_code = "3-Generic-2" + +    validate :min_max_values +    def min_max_values +      true +    end + +    def self.dynamic_attributes +      self.hstore_metadata_for_control_attributes.keys +    end +  end +end diff --git a/app/models/generic_attribute_control/pattern.rb b/app/models/generic_attribute_control/pattern.rb new file mode 100644 index 000000000..5b27da54e --- /dev/null +++ b/app/models/generic_attribute_control/pattern.rb @@ -0,0 +1,13 @@ +module GenericAttributeControl +  class Pattern < ComplianceControl +    hstore_accessor :control_attributes, value: :string, pattern: :string + +    @@default_criticity = :warning +    @@default_code = "3-Generic-3" + +    validate :pattern_match +    def pattern_match +      true +    end +  end +end
\ No newline at end of file diff --git a/app/models/generic_attribute_control/uniqueness.rb b/app/models/generic_attribute_control/uniqueness.rb new file mode 100644 index 000000000..4f1a82083 --- /dev/null +++ b/app/models/generic_attribute_control/uniqueness.rb @@ -0,0 +1,13 @@ +module GenericAttributeControl +  class Uniqueness < ComplianceControl +    hstore_accessor :control_attributes, name: :string + +    @@default_criticity = :warning +    @@default_code = "3-Generic-3" + +    validate :unique_values +    def unique_values +      true +    end +  end +end
\ No newline at end of file diff --git a/app/models/generic_attribute_min_max.rb b/app/models/generic_attribute_min_max.rb deleted file mode 100644 index 91bf285f0..000000000 --- a/app/models/generic_attribute_min_max.rb +++ /dev/null @@ -1,23 +0,0 @@ -class GenericAttributeMinMax < ComplianceControl -  hstore_accessor :control_attributes, minimum: :integer, maximum: :integer - -  @@default_criticity = :warning -  @@default_code = "3-Generic-2" - -  validate :min_max_values - -  def min_max_values -    true -  end - -  def self.dynamic_attributes -    self.hstore_metadata_for_control_attributes.keys -  end - -  # after_initialize do -  #   self.name = 'GenericAttributeMinMax' -  #   self.code = @@default_code -  #   self.criticity = @@default_criticity -  # end - -end diff --git a/app/models/generic_attribute_pattern.rb b/app/models/generic_attribute_pattern.rb deleted file mode 100644 index 0043f1563..000000000 --- a/app/models/generic_attribute_pattern.rb +++ /dev/null @@ -1,23 +0,0 @@ -#module ComplianceControls - -  class GenericAttributePattern < ComplianceControl - -    hstore_accessor :control_attributes, value: :string, pattern: :string - -    @@default_criticity = :warning -    @@default_code = "3-Generic-3" - -    validate :pattern_match -    def pattern_match -      true -    end - -    after_initialize do -      self.name = 'GenericAttributeMinMax' -      self.code = @@default_code -      self.criticity = @@default_criticity -    end - -  end - -#end
\ No newline at end of file diff --git a/app/models/generic_attribute_uniqueness.rb b/app/models/generic_attribute_uniqueness.rb deleted file mode 100644 index dcf4a16c2..000000000 --- a/app/models/generic_attribute_uniqueness.rb +++ /dev/null @@ -1,23 +0,0 @@ -#module ComplianceControls - -  class GenericAttributeUniqueness < ComplianceControl - -    hstore_accessor :control_attributes, name: :string - -    @@default_criticity = :warning -    @@default_code = "3-Generic-3" - -    validate :unique_values -    def unique_values -      true -    end - -    after_initialize do -      self.name = 'GenericAttributeMinMax' -      self.code = @@default_code -      self.criticity = @@default_criticity -    end - -  end - -#end
\ No newline at end of file | 
