class FeideeUtils::Category
Constants
- FieldMappings
- IgnoredFields
- ProjectRootTypeCode
Public Class Methods
validate_global_integrity()
click to toggle source
# File lib/feidee_utils/category.rb, line 22 def self.validate_global_integrity if TypeEnum[ProjectRootTypeCode] != :project_root raise "The type code of project root has been changed," + " please update the code." end rows = self.database.execute <<-SQL SELECT #{id_field_name}, #{FieldMappings[:name]} FROM #{table_name} WHERE #{FieldMappings[:raw_type]}=#{ProjectRootTypeCode}; SQL if rows.length > 1 poids = rows.map do |row| row[0] end raise "More than one category have type project_root." + " IDs are #{poids.inspect}." elsif rows.length == 1 category_name = rows[0][1] if category_name != "projectRoot" and category_name != "root" raise "Category #{category_name} has type project_root." + " ID: #{rows[0][0]}." end end end
Public Instance Methods
to_s()
click to toggle source
# File lib/feidee_utils/category.rb, line 70 def to_s "#{name} (Category/#{poid})" end
validate_integrity()
click to toggle source
# File lib/feidee_utils/category.rb, line 10 def validate_integrity validate_depth_integrity validate_one_level_path_integrity unless column("usedCount") == 0 raise "Category usedCount should always be 0, " + "but it's #{column("usedCount")}.\n" + inspect end end