class Mingle::PropertyDefinition
This is a lightweight representation of a ProjectDefinition in Mingle
Constants
- AGGREGATE_TYPE
- ANY_NUMBER_TYPE
- ANY_TEXT_TYPE
- CARD_TYPE
- DATE_TYPE
- FORMULA_TYPE
- MANAGED_NUMBER_TYPE
- MANAGED_TEXT_TYPE
- TREE_RELATIONSHIP_TYPE
- USER_TYPE
Attributes
Public Class Methods
# File lib/mingle_macro_models/property_definition.rb, line 18 def initialize(full_property_definition) @full_property_definition = full_property_definition end
Public Instance Methods
returns: True if a property definition has only calculated values, such as ones of Formula & Aggregate types
# File lib/mingle_macro_models/property_definition.rb, line 89 def calculated? type_description == FORMULA_TYPE || type_description == AGGREGATE_TYPE end
returns: A list of CardTypes that this PropertyDefinition
is valid for
# File lib/mingle_macro_models/property_definition.rb, line 33 def card_types @card_types_property_definitions_loader.load.collect(&:card_type).sort_by(&:position) end
returns: True if a property definition has only numeric values, such as the Date type
# File lib/mingle_macro_models/property_definition.rb, line 94 def date? type_description == DATE_TYPE end
returns: The description of this PropertyDefinition
# File lib/mingle_macro_models/property_definition.rb, line 28 def description @full_property_definition.description end
returns: The name of this PropertyDefinition
# File lib/mingle_macro_models/property_definition.rb, line 23 def name @full_property_definition.name end
returns: True if a property definition has only numeric values, such as ones of Un/managed number types
# File lib/mingle_macro_models/property_definition.rb, line 84 def numeric? type_description == MANAGED_NUMBER_TYPE || type_description == ANY_NUMBER_TYPE end
returns: True if a property definition has only textual values, such as ones of Un/managed text types
# File lib/mingle_macro_models/property_definition.rb, line 79 def textual? type_description == MANAGED_TEXT_TYPE || type_description == ANY_TEXT_TYPE end
# File lib/mingle_macro_models/property_definition.rb, line 98 def to_s "PropertyDefinition[name=#{name},type=#{type}]" end
returns: A short description of the property definition. This will be one of the above values
# File lib/mingle_macro_models/property_definition.rb, line 49 def type_description @full_property_definition.type_description end
returns: A list of explicitly defined values that this PropertyDefinition
has This method should ONLY be called for property definitions that are of the following types
Attempting to call this method for the following types will throw an Exception
To get the values for the above types, you can use MQL, such as “SELECT property_name” to get a list of values
# File lib/mingle_macro_models/property_definition.rb, line 70 def values valid_property_types_to_call_value_on = [MANAGED_TEXT_TYPE, MANAGED_NUMBER_TYPE, USER_TYPE] unless valid_property_types_to_call_value_on.any? {|t| self.type_description == t} raise "Do not call this method for property definitions of types other than MANAGED_TEXT_TYPE, MANAGED_NUMBER_TYPE, USER_TYPE." end @values_loader.load end