Class: Ea::Qea::Models::EaObject

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/ea/qea/models/ea_object.rb

Constant Summary collapse

COLUMN_MAP =
{
  "Object_ID" => :ea_object_id,
  "Object_Type" => :object_type,
  "Diagram_ID" => :diagram_id,
  "Name" => :name,
  "Alias" => :alias,
  "Author" => :author,
  "Version" => :version,
  "Note" => :note,
  "Package_ID" => :package_id,
  "Stereotype" => :stereotype,
  "NType" => :ntype,
  "Complexity" => :complexity,
  "Effort" => :effort,
  "Style" => :style,
  "BackColor" => :backcolor,
  "BorderStyle" => :borderstyle,
  "BorderWidth" => :borderwidth,
  "Fontcolor" => :fontcolor,
  "Bordercolor" => :bordercolor,
  "CreatedDate" => :createddate,
  "ModifiedDate" => :modifieddate,
  "Status" => :status,
  "Abstract" => :abstract,
  "Tagged" => :tagged,
  "PDATA1" => :pdata1,
  "PDATA2" => :pdata2,
  "PDATA3" => :pdata3,
  "PDATA4" => :pdata4,
  "PDATA5" => :pdata5,
  "Concurrency" => :concurrency,
  "Visibility" => :visibility,
  "Persistence" => :persistence,
  "Cardinality" => :cardinality,
  "GenType" => :gentype,
  "GenFile" => :genfile,
  "Header1" => :header1,
  "Header2" => :header2,
  "Phase" => :phase,
  "Scope" => :scope,
  "GenOption" => :genoption,
  "GenLinks" => :genlinks,
  "Classifier" => :classifier,
  "ea_guid" => :ea_guid,
  "ParentID" => :parentid,
  "RunState" => :runstate,
  "Classifier_guid" => :classifier_guid,
  "TPos" => :tpos,
  "IsRoot" => :isroot,
  "IsLeaf" => :isleaf,
  "IsSpec" => :isspec,
  "IsActive" => :isactive,
  "StateFlags" => :stateflags,
  "PackageFlags" => :packageflags,
  "Multiplicity" => :multiplicity,
  "StyleEx" => :styleex,
  "ActionFlags" => :actionflags,
  "EventFlags" => :eventflags,
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

from_db_row, #primary_key

Class Method Details

.column_mapObject



125
126
127
# File 'lib/ea/qea/models/ea_object.rb', line 125

def self.column_map
  COLUMN_MAP
end

.primary_key_columnObject



129
130
131
# File 'lib/ea/qea/models/ea_object.rb', line 129

def self.primary_key_column
  :ea_object_id
end

.table_nameObject



133
134
135
# File 'lib/ea/qea/models/ea_object.rb', line 133

def self.table_name
  "t_object"
end

Instance Method Details

#abstract?Boolean

Returns:

  • (Boolean)


137
138
139
# File 'lib/ea/qea/models/ea_object.rb', line 137

def abstract?
  abstract == "1"
end

#component?Boolean

Returns:

  • (Boolean)


149
150
151
# File 'lib/ea/qea/models/ea_object.rb', line 149

def component?
  object_type == "Component"
end

#data_type?Boolean

Returns:

  • (Boolean)


161
162
163
# File 'lib/ea/qea/models/ea_object.rb', line 161

def data_type?
  object_type == "DataType"
end

#enumeration?Boolean

Returns:

  • (Boolean)


157
158
159
# File 'lib/ea/qea/models/ea_object.rb', line 157

def enumeration?
  object_type == "Enumeration"
end

#instance?Boolean

Returns:

  • (Boolean)


165
166
167
# File 'lib/ea/qea/models/ea_object.rb', line 165

def instance?
  object_type == "Object"
end

#interface?Boolean

Returns:

  • (Boolean)


145
146
147
# File 'lib/ea/qea/models/ea_object.rb', line 145

def interface?
  object_type == "Interface"
end

#leaf?Boolean

Returns:

  • (Boolean)


173
174
175
# File 'lib/ea/qea/models/ea_object.rb', line 173

def leaf?
  isleaf == 1
end

#package?Boolean

Returns:

  • (Boolean)


153
154
155
# File 'lib/ea/qea/models/ea_object.rb', line 153

def package?
  object_type == "Package"
end

#root?Boolean

Returns:

  • (Boolean)


169
170
171
# File 'lib/ea/qea/models/ea_object.rb', line 169

def root?
  isroot == 1
end

#sort_positionInteger

Returns tpos for tree-position ordering.

Returns:

  • (Integer)

    tpos for tree-position ordering



217
218
219
# File 'lib/ea/qea/models/ea_object.rb', line 217

def sort_position
  tpos || 0
end

#stereotype_is?(expected) ⇒ Boolean

Returns:

  • (Boolean)


210
211
212
213
214
# File 'lib/ea/qea/models/ea_object.rb', line 210

def stereotype_is?(expected)
  return false unless stereotype

  stereotype.downcase == expected
end

#transformer_typeSymbol?

Resolve the transformer registry key for this object's type. Considers both object_type and stereotype (e.g., a Class with stereotype "enumeration" transforms as an enum).

EA object types that have no UML model equivalent return nil and are skipped during transformation:

Text           — diagram text annotation box. A rendering hint,
               not a model element. Currently dropped; its
               content is not preserved in the UML document.
               (Faithful mapping to UML Comment is pending a
               `comments` collection on Package.)

ProxyConnector — EA-internal stub representing a connector that
               crosses package boundaries. Structural plumbing
               with no UML equivalent. Dropped.

Note           — diagram note. Same situation as Text: rendering
               hint, not a model element. Dropped.

Returns:

  • (Symbol, nil)

    Registry key or nil if not a UML model element



198
199
200
201
202
203
204
205
206
207
208
# File 'lib/ea/qea/models/ea_object.rb', line 198

def transformer_type
  if enumeration? || stereotype_is?("enumeration")
    :enumeration
  elsif data_type?
    :data_type
  elsif uml_class? || interface?
    :class
  elsif instance?
    :instance
  end
end

#uml_class?Boolean

Returns:

  • (Boolean)


141
142
143
# File 'lib/ea/qea/models/ea_object.rb', line 141

def uml_class?
  object_type == "Class"
end