<commit_before># == Schema Information
#
# Table name: dev_mode_property_sets
#
#  id                :integer          not null, primary key
#  name              :string(255)      not null
#  description       :text
#  shared            :boolean          default(FALSE), not null
#  scalable          :boolean          default(FALSE), not null
#  preference_cpu    :float
#  preference_memory :integer
#  preference_disk   :integer
#  appliance_id      :integer          not null
#  security_proxy_id :integer
#  created_at        :datetime
#  updated_at        :datetime
#

class DevModePropertySet < ActiveRecord::Base
  validates_presence_of :name

  validates :shared, inclusion: [true, false]
  validates :scalable, inclusion: [true, false]

  validates :preference_memory, numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true }
  validates :preference_disk, numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true }
  validates :preference_cpu, numericality: { greater_than_or_equal_to: 0.0, allow_nil: true }

  belongs_to :security_proxy

  belongs_to :appliance
  validates_presence_of :appliance

  has_many :port_mapping_templates, dependent: :destroy, autosave: true

  def self.create_from(appliance_type)
    dev_mode_property_set = DevModePropertySet.new(
      name: appliance_type.name,
      description: appliance_type.description,
      shared: appliance_type.shared,
      scalable: appliance_type.scalable,
      preference_cpu: appliance_type.preference_cpu,
      preference_memory: appliance_type.preference_memory,
      preference_disk: appliance_type.preference_disk,
      security_proxy: appliance_type.security_proxy,
    )

    dev_mode_property_set.port_mapping_templates = PmtCopier.copy appliance_type
    dev_mode_property_set
  end
end<commit_msg>Ref #2476: dev mode prop set set into copied pmt<commit_after># == Schema Information
#
# Table name: dev_mode_property_sets
#
#  id                :integer          not null, primary key
#  name              :string(255)      not null
#  description       :text
#  shared            :boolean          default(FALSE), not null
#  scalable          :boolean          default(FALSE), not null
#  preference_cpu    :float
#  preference_memory :integer
#  preference_disk   :integer
#  appliance_id      :integer          not null
#  security_proxy_id :integer
#  created_at        :datetime
#  updated_at        :datetime
#

class DevModePropertySet < ActiveRecord::Base
  validates_presence_of :name

  validates :shared, inclusion: [true, false]
  validates :scalable, inclusion: [true, false]

  validates :preference_memory, numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true }
  validates :preference_disk, numericality: { only_integer: true, greater_than_or_equal_to: 0, allow_nil: true }
  validates :preference_cpu, numericality: { greater_than_or_equal_to: 0.0, allow_nil: true }

  belongs_to :security_proxy

  belongs_to :appliance
  validates_presence_of :appliance

  has_many :port_mapping_templates, dependent: :destroy, autosave: true

  def self.create_from(appliance_type)
    dev_mode_property_set = DevModePropertySet.new(
      name: appliance_type.name,
      description: appliance_type.description,
      shared: appliance_type.shared,
      scalable: appliance_type.scalable,
      preference_cpu: appliance_type.preference_cpu,
      preference_memory: appliance_type.preference_memory,
      preference_disk: appliance_type.preference_disk,
      security_proxy: appliance_type.security_proxy,
    )

    dev_mode_property_set.port_mapping_templates = PmtCopier.copy(appliance_type).each {|pmt| pmt.dev_mode_property_set = dev_mode_property_set}
    dev_mode_property_set
  end
end
{'fraction_non_alphanumeric': 0.0728862973760933, 'fraction_numerical': 0.004770739464617015, 'mean_word_length': 3.771175726927939, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7372633', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1149, 'n_words': 254}