eventmodeler 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -108,52 +108,9 @@ function findActorForScreen(model, screen) {
|
|
|
108
108
|
}
|
|
109
109
|
return null;
|
|
110
110
|
}
|
|
111
|
-
// Check if two rectangles overlap
|
|
112
|
-
function rectanglesOverlap(r1, r2) {
|
|
113
|
-
return (r1.x < r2.x + r2.width &&
|
|
114
|
-
r1.x + r1.width > r2.x &&
|
|
115
|
-
r1.y < r2.y + r2.height &&
|
|
116
|
-
r1.y + r1.height > r2.y);
|
|
117
|
-
}
|
|
118
|
-
function getAggregatesForSlice(model, slice) {
|
|
119
|
-
const sliceRect = {
|
|
120
|
-
x: slice.position.x,
|
|
121
|
-
y: slice.position.y,
|
|
122
|
-
width: slice.size.width,
|
|
123
|
-
height: slice.size.height,
|
|
124
|
-
};
|
|
125
|
-
return [...model.aggregates.values()].filter(aggregate => {
|
|
126
|
-
const aggRect = {
|
|
127
|
-
x: aggregate.position.x,
|
|
128
|
-
y: aggregate.position.y,
|
|
129
|
-
width: aggregate.size.width,
|
|
130
|
-
height: aggregate.size.height,
|
|
131
|
-
};
|
|
132
|
-
return rectanglesOverlap(sliceRect, aggRect);
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function getActorsForSlice(model, slice) {
|
|
136
|
-
const sliceRect = {
|
|
137
|
-
x: slice.position.x,
|
|
138
|
-
y: slice.position.y,
|
|
139
|
-
width: slice.size.width,
|
|
140
|
-
height: slice.size.height,
|
|
141
|
-
};
|
|
142
|
-
return [...model.actors.values()].filter(actor => {
|
|
143
|
-
const actorRect = {
|
|
144
|
-
x: actor.position.x,
|
|
145
|
-
y: actor.position.y,
|
|
146
|
-
width: actor.size.width,
|
|
147
|
-
height: actor.size.height,
|
|
148
|
-
};
|
|
149
|
-
return rectanglesOverlap(sliceRect, actorRect);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
111
|
function formatSliceXml(model, slice) {
|
|
153
112
|
const components = getSliceComponents(model, slice);
|
|
154
113
|
const scenarios = [...model.scenarios.values()].filter(s => s.sliceId === slice.id);
|
|
155
|
-
const aggregates = getAggregatesForSlice(model, slice);
|
|
156
|
-
const actors = getActorsForSlice(model, slice);
|
|
157
114
|
const componentIds = new Set();
|
|
158
115
|
components.commands.forEach(c => componentIds.add(c.id));
|
|
159
116
|
components.events.forEach(e => componentIds.add(e.id));
|
|
@@ -280,21 +237,6 @@ function formatSliceXml(model, slice) {
|
|
|
280
237
|
xml += ' </processor>\n';
|
|
281
238
|
}
|
|
282
239
|
xml += ' </components>\n';
|
|
283
|
-
if (aggregates.length > 0) {
|
|
284
|
-
xml += ' <aggregates>\n';
|
|
285
|
-
for (const agg of aggregates) {
|
|
286
|
-
const idField = agg.aggregateIdFieldName ? ` id-field="${escapeXml(agg.aggregateIdFieldName)}"` : '';
|
|
287
|
-
xml += ` <aggregate name="${escapeXml(agg.name)}"${idField}/>\n`;
|
|
288
|
-
}
|
|
289
|
-
xml += ' </aggregates>\n';
|
|
290
|
-
}
|
|
291
|
-
if (actors.length > 0) {
|
|
292
|
-
xml += ' <actors>\n';
|
|
293
|
-
for (const actor of actors) {
|
|
294
|
-
xml += ` <actor name="${escapeXml(actor.name)}"/>\n`;
|
|
295
|
-
}
|
|
296
|
-
xml += ' </actors>\n';
|
|
297
|
-
}
|
|
298
240
|
if (internalFlows.length > 0) {
|
|
299
241
|
xml += ' <information-flow>\n';
|
|
300
242
|
for (const flow of internalFlows) {
|