archimate 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +1 -1
  3. data/Gemfile +1 -0
  4. data/README.md +10 -55
  5. data/Rakefile +19 -1
  6. data/archimate.gemspec +16 -14
  7. data/bin/archimate +12 -0
  8. data/lib/archimate/cli/archi.rb +38 -19
  9. data/lib/archimate/cli/cleanup.rb +41 -25
  10. data/lib/archimate/cli/duper.rb +0 -1
  11. data/lib/archimate/cli/mapper.rb +53 -40
  12. data/lib/archimate/cli/svger.rb +33 -4
  13. data/lib/archimate/core_refinements.rb +41 -0
  14. data/lib/archimate/data_model/bounds.rb +14 -4
  15. data/lib/archimate/data_model/comparison.rb +3 -27
  16. data/lib/archimate/data_model/connection.rb +26 -11
  17. data/lib/archimate/data_model/diagram.rb +17 -10
  18. data/lib/archimate/data_model/element.rb +21 -9
  19. data/lib/archimate/data_model/elements.rb +24 -18
  20. data/lib/archimate/data_model/lang_string.rb +34 -10
  21. data/lib/archimate/data_model/layer.rb +6 -0
  22. data/lib/archimate/data_model/location.rb +10 -13
  23. data/lib/archimate/data_model/model.rb +55 -43
  24. data/lib/archimate/data_model/organization.rb +21 -5
  25. data/lib/archimate/data_model/property.rb +0 -6
  26. data/lib/archimate/data_model/referenceable.rb +29 -3
  27. data/lib/archimate/data_model/referenceable_list.rb +34 -14
  28. data/lib/archimate/data_model/relationship.rb +29 -8
  29. data/lib/archimate/data_model/relationship_references.rb +115 -6
  30. data/lib/archimate/data_model/relationships.rb +15 -0
  31. data/lib/archimate/data_model/view_node.rb +20 -13
  32. data/lib/archimate/data_model/viewpoint.rb +13 -1
  33. data/lib/archimate/data_model/viewpoints.rb +416 -0
  34. data/lib/archimate/data_model.rb +7 -1
  35. data/lib/archimate/derived_relations.rb +2 -11
  36. data/lib/archimate/export/cypher.rb +6 -5
  37. data/lib/archimate/file_format.rb +1 -0
  38. data/lib/archimate/file_formats/archi_file_reader.rb +11 -1
  39. data/lib/archimate/file_formats/archi_file_writer.rb +15 -46
  40. data/lib/archimate/file_formats/archi_file_writer_4.rb +14 -0
  41. data/lib/archimate/file_formats/model_exchange_file_reader.rb +2 -1
  42. data/lib/archimate/file_formats/model_exchange_file_writer_21.rb +1 -0
  43. data/lib/archimate/file_formats/sax/archi/diagram.rb +53 -13
  44. data/lib/archimate/file_formats/sax/archi/location.rb +1 -3
  45. data/lib/archimate/file_formats/sax/model_exchange_file/diagram.rb +13 -2
  46. data/lib/archimate/file_formats/sax.rb +1 -0
  47. data/lib/archimate/file_formats/serializer/archi/archi_file_writer.rb +63 -0
  48. data/lib/archimate/file_formats/serializer/archi/archi_file_writer_3.rb +18 -0
  49. data/lib/archimate/file_formats/serializer/archi/archi_file_writer_4.rb +18 -0
  50. data/lib/archimate/file_formats/serializer/archi/bounds.rb +2 -2
  51. data/lib/archimate/file_formats/serializer/archi/connection.rb +24 -13
  52. data/lib/archimate/file_formats/serializer/archi/diagram.rb +3 -3
  53. data/lib/archimate/file_formats/serializer/archi/element.rb +2 -2
  54. data/lib/archimate/file_formats/serializer/archi/organization.rb +1 -1
  55. data/lib/archimate/file_formats/serializer/archi/property.rb +1 -1
  56. data/lib/archimate/file_formats/serializer/archi/relationship.rb +2 -2
  57. data/lib/archimate/file_formats/serializer/archi/view_node.rb +20 -22
  58. data/lib/archimate/file_formats/serializer/archi/viewpoint3.rb +43 -0
  59. data/lib/archimate/file_formats/serializer/archi/viewpoint4.rb +41 -0
  60. data/lib/archimate/file_formats/serializer/model_exchange_file/style.rb +3 -7
  61. data/lib/archimate/file_formats/serializer/model_exchange_file/v21/diagram.rb +3 -3
  62. data/lib/archimate/file_formats/serializer/model_exchange_file/v21/model.rb +9 -2
  63. data/lib/archimate/file_formats/serializer/model_exchange_file/v21/view_node.rb +1 -1
  64. data/lib/archimate/file_formats/serializer/model_exchange_file/v21/viewpoint.rb +23 -0
  65. data/lib/archimate/file_formats/serializer/model_exchange_file/v30/diagram.rb +3 -3
  66. data/lib/archimate/file_formats/serializer/model_exchange_file/v30/model.rb +5 -7
  67. data/lib/archimate/file_formats/serializer/model_exchange_file/v30/view_node.rb +3 -3
  68. data/lib/archimate/file_formats/serializer/writer.rb +0 -5
  69. data/lib/archimate/file_formats/serializer.rb +6 -2
  70. data/lib/archimate/lint/duplicate_entities.rb +5 -5
  71. data/lib/archimate/lint/linter.rb +4 -4
  72. data/lib/archimate/maybe_io.rb +3 -2
  73. data/lib/archimate/svg/archimate.css +19 -21
  74. data/lib/archimate/svg/connection.rb +1 -1
  75. data/lib/archimate/svg/diagram.rb +1 -6
  76. data/lib/archimate/svg/entity/application_component.rb +9 -3
  77. data/lib/archimate/svg/entity/constraint.rb +0 -1
  78. data/lib/archimate/svg/entity/contract.rb +9 -0
  79. data/lib/archimate/svg/entity/data_entity.rb +1 -1
  80. data/lib/archimate/svg/entity/device.rb +1 -1
  81. data/lib/archimate/svg/entity/event_entity.rb +24 -7
  82. data/lib/archimate/svg/entity/group.rb +23 -4
  83. data/lib/archimate/svg/entity/grouping.rb +37 -0
  84. data/lib/archimate/svg/entity/interface_entity.rb +1 -1
  85. data/lib/archimate/svg/entity/node.rb +1 -1
  86. data/lib/archimate/svg/entity/outcome.rb +0 -1
  87. data/lib/archimate/svg/entity/principle.rb +0 -1
  88. data/lib/archimate/svg/entity/process_entity.rb +1 -1
  89. data/lib/archimate/svg/entity/requirement.rb +0 -1
  90. data/lib/archimate/svg/entity/service_entity.rb +6 -13
  91. data/lib/archimate/svg/entity.rb +1 -0
  92. data/lib/archimate/svg/entity_factory.rb +9 -5
  93. data/lib/archimate/svg/path.rb +57 -46
  94. data/lib/archimate/svg/point.rb +4 -0
  95. data/lib/archimate/svg/segment.rb +30 -0
  96. data/lib/archimate/svg/svg_template.svg.erb +11 -3
  97. data/lib/archimate/svg/view_node.rb +22 -0
  98. data/lib/archimate/version.rb +1 -1
  99. data/lib/archimate.rb +3 -2
  100. metadata +54 -54
  101. data/exe/archidiff +0 -7
  102. data/exe/archidiff-summary +0 -7
  103. data/exe/archimerge +0 -7
  104. data/exe/fmtxml +0 -7
  105. data/lib/archimate/data_model/viewpoint_type.rb +0 -389
  106. data/lib/archimate/file_formats/serializer/archi/location.rb +0 -26
  107. data/lib/archimate/file_formats/serializer/archi/viewpoint_type.rb +0 -45
  108. data/lib/archimate/svg/child.rb +0 -29
@@ -0,0 +1,416 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ruby-enum"
4
+
5
+ module Archimate
6
+ module DataModel
7
+ # This module contains an enumeration of built-in ArchiMate viewpoint
8
+ # types. These viewpoints are a summary of the viewpoint types defined
9
+ # in ArchiMate versions 2 and 3.
10
+ class Viewpoints
11
+ include Ruby::Enum
12
+
13
+ # Basic Viewpoints
14
+ define :Introductory, Viewpoint.new(
15
+ id: "VIEWPOINT-INTRODUCTORY",
16
+ name: "Introductory",
17
+ allowed_element_types: Elements.core_elements,
18
+ allowed_relationship_types: Relationships.classes
19
+ )
20
+
21
+ # Category:Composition Viewpoints that defines internal compositions and aggregations of elements.
22
+ define :Organization, Viewpoint.new(
23
+ id: "VIEWPOINT-ORGANIZATION",
24
+ name: "Organization",
25
+ allowed_element_types: ConnectorType.values + [
26
+ Elements::BusinessActor, Elements::BusinessCollaboration,
27
+ Elements::BusinessInterface, Elements::BusinessRole,
28
+ Elements::Location
29
+ ],
30
+ allowed_relationship_types: Relationships.default - [Relationships::Access, Relationships::Realization]
31
+ )
32
+
33
+ define :Application_platform, Viewpoint.new(
34
+ id: "VIEWPOINT-APPLICATION_PLATFORM",
35
+ name: "Application Platform",
36
+ allowed_element_types: Elements.core_elements,
37
+ allowed_relationship_types: Relationships.classes
38
+ )
39
+
40
+ define :Information_structure, Viewpoint.new(
41
+ id: "VIEWPOINT-INFORMATION_STRUCTURE",
42
+ name: "Information Structure",
43
+ allowed_element_types: ConnectorType.values + [
44
+ Elements::Artifact, Elements::BusinessObject, Elements::DataObject,
45
+ Elements::Meaning, Elements::Representation
46
+ ],
47
+ allowed_relationship_types: Relationships.default - [Relationships::Assignment, Relationships::Serving]
48
+ )
49
+
50
+ define :Technology, Viewpoint.new(
51
+ id: "VIEWPOINT-TECHNOLOGY",
52
+ name: "Technology",
53
+ allowed_element_types: Elements.core_elements,
54
+ allowed_relationship_types: Relationships.classes
55
+ )
56
+
57
+ define :Layered, Viewpoint.new(
58
+ id: "VIEWPOINT-LAYERED",
59
+ name: "Layered",
60
+ allowed_element_types: Elements.classes + ConnectorType.values,
61
+ allowed_relationship_types: Relationships.classes
62
+ )
63
+
64
+ define :Physical, Viewpoint.new(
65
+ id: "VIEWPOINT-PHYSICAL",
66
+ name: "Physical",
67
+ allowed_element_types: Elements.core_elements,
68
+ allowed_relationship_types: Relationships.classes
69
+ )
70
+
71
+ # Category:Support Viewpoints where you are looking at elements that are
72
+ # supported by other elements. Typically from one layer and upwards to an
73
+ # above layer.
74
+ define :Product, Viewpoint.new(
75
+ id: "VIEWPOINT-PRODUCT",
76
+ name: "Product",
77
+ allowed_element_types: ConnectorType.values + [
78
+ Elements::ApplicationComponent, Elements::ApplicationInterface,
79
+ Elements::ApplicationService, Elements::BusinessActor,
80
+ Elements::BusinessEvent, Elements::BusinessFunction,
81
+ Elements::BusinessInteraction, Elements::BusinessInterface,
82
+ Elements::BusinessProcess, Elements::BusinessRole,
83
+ Elements::BusinessService, Elements::Contract,
84
+ Elements::Product, Elements::Value
85
+ ],
86
+ allowed_relationship_types: Relationships.default
87
+ )
88
+
89
+ define :Application_usage, Viewpoint.new(
90
+ id: "VIEWPOINT-APPLICATION_USAGE",
91
+ name: "Application Usage",
92
+ allowed_element_types: ConnectorType.values + [
93
+ Elements::ApplicationCollaboration, Elements::ApplicationComponent,
94
+ Elements::ApplicationInterface, Elements::ApplicationService,
95
+ Elements::BusinessEvent, Elements::BusinessFunction,
96
+ Elements::BusinessInteraction, Elements::BusinessObject,
97
+ Elements::BusinessProcess, Elements::BusinessRole,
98
+ Elements::DataObject
99
+ ],
100
+ allowed_relationship_types: Relationships.default
101
+ )
102
+
103
+ define :Technology_usage, Viewpoint.new(
104
+ id: "VIEWPOINT-TECHNOLOGY_USAGE",
105
+ name: "Technology Usage",
106
+ allowed_element_types: Elements.core_elements,
107
+ allowed_relationship_types: Relationships.classes
108
+ )
109
+
110
+ # Category:Cooperation Towards peer elements which cooperate with each
111
+ # other. Typically across aspects.
112
+ define :Business_process_cooperation, Viewpoint.new(
113
+ id: "VIEWPOINT-BUSINESS_PROCESS_COOPERATION",
114
+ name: "Business Process Cooperation",
115
+ allowed_element_types: ConnectorType.values + [
116
+ Elements::ApplicationService, Elements::BusinessActor,
117
+ Elements::BusinessCollaboration, Elements::BusinessEvent,
118
+ Elements::BusinessFunction, Elements::BusinessInteraction,
119
+ Elements::BusinessObject, Elements::BusinessProcess,
120
+ Elements::BusinessRole, Elements::BusinessService,
121
+ Elements::Location, Elements::Representation
122
+ ],
123
+ allowed_relationship_types: Relationships.default
124
+ )
125
+
126
+ define :Application_cooperation, Viewpoint.new(
127
+ id: "VIEWPOINT-APPLICATION_COOPERATION",
128
+ name: "Application Cooperation",
129
+ allowed_element_types: ConnectorType.values + [
130
+ Elements::ApplicationCollaboration, Elements::ApplicationComponent,
131
+ Elements::ApplicationFunction, Elements::ApplicationInteraction,
132
+ Elements::ApplicationInterface, Elements::ApplicationService,
133
+ Elements::DataObject, Elements::Location
134
+ ],
135
+ allowed_relationship_types: Relationships.default
136
+ )
137
+
138
+ # Category:Realization Viewpoints where you are looking at elements that
139
+ # realize other elements. Typically from one layer and downwards to a
140
+ # below layer.
141
+ define :Service_realization, Viewpoint.new(
142
+ id: "VIEWPOINT-SERVICE_REALIZATION",
143
+ name: "Service Realization",
144
+ allowed_element_types: ConnectorType.values + [
145
+ Elements::ApplicationCollaboration, Elements::ApplicationComponent,
146
+ Elements::ApplicationService, Elements::BusinessActor,
147
+ Elements::BusinessCollaboration, Elements::BusinessEvent,
148
+ Elements::BusinessFunction, Elements::BusinessInteraction,
149
+ Elements::BusinessObject, Elements::BusinessProcess,
150
+ Elements::BusinessRole, Elements::BusinessService,
151
+ Elements::DataObject
152
+ ],
153
+ allowed_relationship_types: Relationships.default
154
+ )
155
+
156
+ define :Implementation_and_deployment, Viewpoint.new(
157
+ id: "VIEWPOINT-IMPLEMENTATION_AND_DEPLOYMENT",
158
+ name: "Implementation and Deployment",
159
+ allowed_element_types: ConnectorType.values + [
160
+ Elements::ApplicationCollaboration, Elements::ApplicationComponent,
161
+ Elements::Artifact, Elements::CommunicationPath,
162
+ Elements::DataObject, Elements::Device,
163
+ Elements::InfrastructureService, Elements::Network, Elements::Node,
164
+ Elements::SystemSoftware
165
+ ],
166
+ allowed_relationship_types: Relationships.default
167
+ )
168
+
169
+ define :Goal_realization, Viewpoint.new(
170
+ id: "VIEWPOINT-GOAL_REALIZATION",
171
+ name: "Goal Realization",
172
+ allowed_element_types: [
173
+ Elements::Constraint, Elements::Goal, Elements::Principle,
174
+ Elements::Requirement
175
+ ],
176
+ allowed_relationship_types: [
177
+ Relationships::Aggregation, Relationships::Association,
178
+ Relationships::Composition, Relationships::Influence,
179
+ Relationships::Realization, Relationships::Specialization
180
+ ]
181
+ )
182
+
183
+ define :Goal_contribution, Viewpoint.new(
184
+ id: "VIEWPOINT-GOAL_CONTRIBUTION",
185
+ name: "Goal Contribution",
186
+ allowed_element_types: [
187
+ Elements::Constraint, Elements::Goal, Elements::Principle,
188
+ Elements::Requirement
189
+ ],
190
+ allowed_relationship_types: [
191
+ Relationships::Aggregation, Relationships::Association,
192
+ Relationships::Composition, Relationships::Influence,
193
+ Relationships::Realization, Relationships::Specialization
194
+ ]
195
+ )
196
+
197
+ define :Principles, Viewpoint.new(
198
+ id: "VIEWPOINT-PRINCIPLES",
199
+ name: "Principles",
200
+ allowed_element_types: [Elements::Goal, Elements::Principle],
201
+ allowed_relationship_types: [
202
+ Relationships::Aggregation, Relationships::Association,
203
+ Relationships::Composition, Relationships::Influence,
204
+ Relationships::Realization, Relationships::Specialization
205
+ ]
206
+ )
207
+
208
+ define :Requirements_realization, Viewpoint.new(
209
+ id: "VIEWPOINT-REQUIREMENTS_REALIZATION",
210
+ name: "Requirements Realization",
211
+ allowed_element_types: Elements.core_elements + ConnectorType.values + [
212
+ Elements::Constraint, Elements::Goal, Elements::Requirement
213
+ ],
214
+ allowed_relationship_types: Relationships.default
215
+ )
216
+
217
+ define :Motivation, Viewpoint.new(
218
+ id: "VIEWPOINT-MOTIVATION",
219
+ name: "Motivation",
220
+ allowed_element_types: [
221
+ Elements::Assessment, Elements::Constraint, Elements::Driver,
222
+ Elements::Goal, Elements::Principle, Elements::Requirement,
223
+ Elements::Stakeholder
224
+ ],
225
+ allowed_relationship_types: [
226
+ Relationships::Aggregation, Relationships::Association,
227
+ Relationships::Composition, Relationships::Flow,
228
+ Relationships::Influence, Relationships::Realization,
229
+ Relationships::Specialization
230
+ ]
231
+ )
232
+
233
+ # Strategy Viewpoints
234
+ define :Strategy, Viewpoint.new(
235
+ id: "VIEWPOINT-STRATEGY",
236
+ name: "Strategy",
237
+ allowed_element_types: Elements.core_elements,
238
+ allowed_relationship_types: Relationships.classes
239
+ )
240
+
241
+ define :Capability_map, Viewpoint.new(
242
+ id: "VIEWPOINT-CAPABILITY_MAP",
243
+ name: "Capability Map",
244
+ allowed_element_types: Elements.core_elements,
245
+ allowed_relationship_types: Relationships.classes
246
+ )
247
+
248
+ define :Outcome_realization, Viewpoint.new(
249
+ id: "VIEWPOINT-OUTCOME_REALIZATION",
250
+ name: "Outcome Realization",
251
+ allowed_element_types: Elements.core_elements,
252
+ allowed_relationship_types: Relationships.classes
253
+ )
254
+
255
+ define :Resource_map, Viewpoint.new(
256
+ id: "VIEWPOINT-RESOURCE_MAP",
257
+ name: "Resource Map",
258
+ allowed_element_types: Elements.core_elements,
259
+ allowed_relationship_types: Relationships.classes
260
+ )
261
+
262
+ # Implementation and Migration Viewpoints
263
+ define :Project, Viewpoint.new(
264
+ id: "VIEWPOINT-PROJECT",
265
+ name: "Project",
266
+ allowed_element_types: ConnectorType.values + [
267
+ Elements::BusinessActor, Elements::BusinessRole,
268
+ Elements::Deliverable, Elements::Goal, Elements::WorkPackage
269
+ ],
270
+ allowed_relationship_types: Relationships.default - [Relationships::Access]
271
+ )
272
+
273
+ define :Migration, Viewpoint.new(
274
+ id: "VIEWPOINT-MIGRATION",
275
+ name: "Migration",
276
+ allowed_element_types: ConnectorType.values + [Elements::Gap, Elements::Plateau],
277
+ allowed_relationship_types: [
278
+ Relationships::AndJunction, Relationships::Association,
279
+ Relationships::Composition, Relationships::Flow,
280
+ Relationships::Junction, Relationships::OrJunction,
281
+ Relationships::Triggering
282
+ ]
283
+ )
284
+
285
+ define :Implementation_and_migration, Viewpoint.new(
286
+ id: "VIEWPOINT-IMPLEMENTATION_AND_MIGRATION",
287
+ name: "Implementation and Migration",
288
+ allowed_element_types: Elements.core_elements + ConnectorType.values + [
289
+ Elements::Location, Elements::Requirement, Elements::Constraint,
290
+ Elements::Goal, Elements::BusinessRole, Elements::WorkPackage,
291
+ Elements::Deliverable, Elements::BusinessActor, Elements::Plateau,
292
+ Elements::Gap
293
+ ],
294
+ allowed_relationship_types: Relationships.default
295
+ )
296
+
297
+ # Other Viewpoints
298
+ define :Stakeholder, Viewpoint.new(
299
+ id: "VIEWPOINT-STAKEHOLDER",
300
+ name: "Stakeholder",
301
+ allowed_element_types: [
302
+ Elements::Assessment, Elements::Driver, Elements::Goal,
303
+ Elements::Stakeholder
304
+ ],
305
+ allowed_relationship_types: [
306
+ Relationships::Aggregation, Relationships::Association,
307
+ Relationships::Composition, Relationships::Influence,
308
+ Relationships::Specialization
309
+ ]
310
+ )
311
+
312
+ # Other older viewpoints
313
+ define :Actor_cooperation, Viewpoint.new(
314
+ id: "VIEWPOINT-ACTOR_COOPERATION",
315
+ name: "Actor Co-operation",
316
+ allowed_element_types: ConnectorType.values + [
317
+ Elements::ApplicationComponent, Elements::ApplicationInterface,
318
+ Elements::ApplicationService, Elements::BusinessActor,
319
+ Elements::BusinessCollaboration, Elements::BusinessInterface,
320
+ Elements::BusinessRole, Elements::BusinessService
321
+ ],
322
+ allowed_relationship_types: Relationships.default - [Relationships::Access]
323
+ )
324
+
325
+ define :Business_function, Viewpoint.new(
326
+ id: "VIEWPOINT-BUSINESS_FUNCTION",
327
+ name: "Business Function",
328
+ allowed_element_types: ConnectorType.values + [
329
+ Elements::BusinessActor, Elements::BusinessFunction,
330
+ Elements::BusinessRole
331
+ ],
332
+ allowed_relationship_types: Relationships.default - [Relationships::Access, Relationships::Realization]
333
+ )
334
+
335
+ define :Business_process, Viewpoint.new(
336
+ id: "VIEWPOINT-BUSINESS_PROCESS",
337
+ name: "Business Process",
338
+ allowed_element_types: ConnectorType.values + [
339
+ Elements::ApplicationService, Elements::BusinessActor,
340
+ Elements::BusinessCollaboration, Elements::BusinessEvent,
341
+ Elements::BusinessFunction, Elements::BusinessInteraction,
342
+ Elements::BusinessObject, Elements::BusinessProcess,
343
+ Elements::BusinessRole, Elements::BusinessService,
344
+ Elements::Location, Elements::Representation
345
+ ],
346
+ allowed_relationship_types: Relationships.default
347
+ )
348
+
349
+ define :Application_behavior, Viewpoint.new(
350
+ id: "VIEWPOINT-APPLICATION_BEHAVIOR",
351
+ name: "Application Behavior",
352
+ allowed_element_types: ConnectorType.values + [
353
+ Elements::ApplicationCollaboration, Elements::ApplicationComponent,
354
+ Elements::ApplicationFunction, Elements::ApplicationInteraction,
355
+ Elements::ApplicationInterface, Elements::ApplicationService,
356
+ Elements::DataObject
357
+ ],
358
+ allowed_relationship_types: Relationships.default
359
+ )
360
+
361
+ define :Application_structure, Viewpoint.new(
362
+ id: "VIEWPOINT-APPLICATION_STRUCTURE",
363
+ name: "Application Structure",
364
+ allowed_element_types: ConnectorType.values + [
365
+ Elements::ApplicationCollaboration, Elements::ApplicationComponent,
366
+ Elements::ApplicationInterface, Elements::DataObject
367
+ ],
368
+ allowed_relationship_types: Relationships.default - [Relationships::Realization]
369
+ )
370
+
371
+ define :Infrastructure, Viewpoint.new(
372
+ id: "VIEWPOINT-INFRASTRUCTURE",
373
+ name: "Infrastructure",
374
+ allowed_element_types: ConnectorType.values + [
375
+ Elements::Artifact, Elements::CommunicationPath, Elements::Device,
376
+ Elements::InfrastructureFunction, Elements::InfrastructureInterface,
377
+ Elements::InfrastructureService, Elements::Location,
378
+ Elements::Network, Elements::Node, Elements::SystemSoftware
379
+ ],
380
+ allowed_relationship_types: Relationships.default
381
+ )
382
+
383
+ define :Infrastructure_usage, Viewpoint.new(
384
+ id: "VIEWPOINT-INFRASTRUCTURE_USAGE",
385
+ name: "Infrastructure Usage",
386
+ allowed_element_types: ConnectorType.values + [
387
+ Elements::ApplicationComponent, Elements::ApplicationFunction,
388
+ Elements::CommunicationPath, Elements::Device,
389
+ Elements::InfrastructureFunction, Elements::InfrastructureInterface,
390
+ Elements::InfrastructureService, Elements::Network, Elements::Node,
391
+ Elements::SystemSoftware
392
+ ],
393
+ allowed_relationship_types: Relationships.default
394
+ )
395
+
396
+ define :Landscape_map, Viewpoint.new(
397
+ id: "VIEWPOINT-LANDSCAPE_MAP",
398
+ name: "Landscape Map",
399
+ allowed_element_types: Elements.classes + ConnectorType.values,
400
+ allowed_relationship_types: Relationships.classes
401
+ )
402
+
403
+ def self.[](idx)
404
+ values[idx]
405
+ end
406
+
407
+ def self.with_name(name)
408
+ values.find { |vp| vp.name == name }
409
+ end
410
+
411
+ VIEWPOINT_CONTENT_ENUM = %w[Details Coherence Overview].freeze
412
+
413
+ VIEWPOINT_PURPOSE_ENUM = %w[Designing Deciding Informing].freeze
414
+ end
415
+ end
416
+ end
@@ -30,13 +30,19 @@ module Archimate
30
30
  require 'archimate/data_model/relationship_references'
31
31
  require 'archimate/data_model/element'
32
32
  require 'archimate/data_model/elements'
33
- require 'archimate/data_model/viewpoint_type'
34
33
  require 'archimate/data_model/concern'
35
34
  require 'archimate/data_model/viewpoint'
35
+ require 'archimate/data_model/viewpoints'
36
36
  require 'archimate/data_model/location'
37
37
  require 'archimate/data_model/connection'
38
38
  require 'archimate/data_model/view_node'
39
39
  require 'archimate/data_model/diagram'
40
40
  require 'archimate/data_model/model'
41
+
42
+ # Returns a lambda that matches entities with the given name
43
+ def by_name(name)
44
+ ->(entity) { entity.name == name }
45
+ end
46
+ module_function :by_name
41
47
  end
42
48
  end
@@ -117,20 +117,11 @@ module Archimate
117
117
  end
118
118
  end
119
119
 
120
- def element_by_name(name)
121
- @model.elements.find { |el| el.name.to_s == name.to_s }
122
- end
123
-
124
- def element_relationships(el)
125
- @model
126
- .relationships
127
- .select { |rel| rel.source.id == el.id }
128
- end
129
-
130
120
  private
131
121
 
132
122
  def concrete_relationships(el, relation_filter, from_path)
133
- element_relationships(el)
123
+ el
124
+ .source_relationships
134
125
  .select(&relation_filter)
135
126
  .reject { |rel| from_path.include?(rel) }
136
127
  end
@@ -49,7 +49,7 @@ module Archimate
49
49
  elements.each do |element|
50
50
  props = add_docs(
51
51
  {
52
- layer: element.layer.delete(" "),
52
+ layer: element.layer.to_s,
53
53
  name: element.name.to_s,
54
54
  nodeId: element.id
55
55
  }.merge(
@@ -99,11 +99,12 @@ module Archimate
99
99
  end
100
100
 
101
101
  def source(rel)
102
- "(s #{props(nodeId: rel.source)})"
102
+ "(s #{props(nodeId: rel.source.id)})"
103
103
  end
104
104
 
105
- def add_docs(h, l)
106
- t = l.map(&:text).join("\n").strip
105
+ def add_docs(h, documentation)
106
+ return h unless documentation
107
+ t = documentation.to_s.strip
107
108
  return h if t.empty?
108
109
  h.merge(documentation: t)
109
110
  end
@@ -121,7 +122,7 @@ module Archimate
121
122
  end
122
123
 
123
124
  def target(rel)
124
- "(t #{props(nodeId: rel.target)})"
125
+ "(t #{props(nodeId: rel.target.id)})"
125
126
  end
126
127
 
127
128
  def write(str)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "nokogiri"
3
4
 
4
5
  module Archimate
@@ -13,7 +13,17 @@ module Archimate
13
13
  handler_factory = Sax::Archi::ArchiHandlerFactory.new
14
14
  parser = Nokogiri::XML::SAX::Parser.new(Sax::Document.new(handler_factory))
15
15
  parser.parse(@string_or_io)
16
- parser.document.model
16
+ model = parser.document.model
17
+ model
18
+ .diagrams
19
+ .flat_map(&:connections)
20
+ .each do |connection|
21
+ connection.bendpoints.each do |bendpoint|
22
+ bendpoint.x += connection.start_location.x.to_i
23
+ bendpoint.y += connection.start_location.y.to_i
24
+ end
25
+ end
26
+ model
17
27
  end
18
28
  end
19
29
  end
@@ -1,57 +1,26 @@
1
1
  # frozen_string_literal: true
2
- require "nokogiri"
2
+
3
+ require "forwardable"
3
4
 
4
5
  module Archimate
5
6
  module FileFormats
6
- class ArchiFileWriter < Serializer::Writer
7
- include Serializer::Archi::Bounds
8
- include Serializer::Archi::Connection
9
- include Serializer::Archi::Diagram
10
- include Serializer::Archi::Documentation
11
- include Serializer::Archi::Element
12
- include Serializer::Archi::Location
13
- include Serializer::Archi::Model
14
- include Serializer::Archi::Organization
15
- include Serializer::Archi::Property
16
- include Serializer::Archi::Relationship
17
- include Serializer::Archi::ViewNode
7
+ class ArchiFileWriter
8
+ extend Forwardable
18
9
 
19
- TEXT_SUBSTITUTIONS = [
20
- ['&#13;', '&#xD;'],
21
- ['"', '&quot;'],
22
- ['&gt;', '>'],
23
- ['&#38;', '&amp;']
24
- ].freeze
10
+ def_delegators :@writer, :write
25
11
 
26
- def initialize(model)
27
- super
28
- @version = "3.1.1"
12
+ def self.write(model, output_io)
13
+ writer = new(model)
14
+ writer.write(output_io)
29
15
  end
30
16
 
31
- def process_text(doc_str)
32
- %w(documentation content name).each do |tag|
33
- TEXT_SUBSTITUTIONS.each do |from, to|
34
- doc_str.gsub!(%r{<#{tag}>([^<]*#{from}[^<]*)</#{tag}>}) do |str|
35
- str.gsub(from, to)
36
- end
37
- end
38
- end
39
- doc_str.gsub(
40
- %r{<(/)?archimate:}, "<\\1"
41
- ).gsub(
42
- %r{<(/)?model}, "<\\1archimate:model"
43
- )
44
- end
45
-
46
- def write(archifile_io)
47
- builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
48
- serialize_model(xml, model)
49
- end
50
- archifile_io.write(
51
- process_text(
52
- builder.to_xml
53
- )
54
- )
17
+ def initialize(model)
18
+ @writer = case model.version
19
+ when /^3\./
20
+ Serializer::Archi::ArchiFileWriter3
21
+ else
22
+ Serializer::Archi::ArchiFileWriter4
23
+ end.new(model)
55
24
  end
56
25
  end
57
26
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Archimate
4
+ module FileFormats
5
+ class ArchiFileWriter4 < Serializer::Archi::ArchiFileWriter
6
+ include Serializer::Archi::Viewpoint4
7
+
8
+ def initialize(model)
9
+ super
10
+ @version = model.version || "4.0.0"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "nokogiri"
3
4
 
4
5
  module Archimate
@@ -8,7 +9,7 @@ module Archimate
8
9
  @string_or_io = doc
9
10
  end
10
11
 
11
- def parse()
12
+ def parse
12
13
  handler_factory = Sax::ModelExchangeFile::ModelExchangeHandlerFactory.new
13
14
  parser = Nokogiri::XML::SAX::Parser.new(Sax::Document.new(handler_factory))
14
15
  parser.parse(@string_or_io)
@@ -26,6 +26,7 @@ module Archimate
26
26
  include Serializer::ModelExchangeFile::Relationship
27
27
  include Serializer::ModelExchangeFile::Style
28
28
  include Serializer::ModelExchangeFile::V21::ViewNode
29
+ include Serializer::ModelExchangeFile::V21::Viewpoint
29
30
 
30
31
  def initialize(model)
31
32
  super