-
Notifications
You must be signed in to change notification settings - Fork 4
REST API
Sebi1006 edited this page Jun 25, 2021
·
50 revisions
- GET: /rest/v1/meta-models/:metaModelId/style
- GET: /rest/v1/meta-models/:metaModelId/shape
- GET: /rest/v1/meta-models/:metaModelId/diagram
Schema of the REST API response for the parsed Style DSL.
Definition:
{
"styles": [
{
"background": {
"color": "String",
"gradient": {
"horizontal": "Boolean",
"area": [
{
"offset": "Integer",
"color": "String",
}
],
}
},
"font": {
"bold": "Boolean",
"color": "String",
"gradient": {
"horizontal": "Boolean",
"area": [
{
"offset": "Integer",
"color": "String",
}
],
},
"italic": "Boolean",
"name": "String",
"size": "Integer"
},
"line": {
"color": "String",
"style": "String",
"width": "Integer"
},
"name": "String"
}
]
}
Example:
{
"styles": [
{
"background": {
"color": "rgba(255, 255, 255, 1)"
},
"font": {
"size":20
},
"line": {
"color": "rgba(0, 0, 0, 1)",
"style": "DASH",
"width": 1
},
"name": "Y"
}
]
}
Color strings are represented as RGBA:
color: "rgba(255, 255, 255, 0.5)"
Schema of the REST API response for the parsed Shape DSL.
Definition:
{
"shapes": {
"nodes": [
{
"name": "String",
"conceptElement": "String",
"edges": [
"String",
"String"
],
"size": {
"width": "Integer",
"height": "Integer",
"widthMax": "Integer",
"widthMin": "Integer",
"heightMax": "Integer",
"heightMin": "Integer"
},
// svg --> Not implemented
"svg": "String",
"style": "Style",
"resizing": {
"horizontal": "Boolean",
"vertical": "Boolean",
"proportional": "Boolean"
},
"geoElements": [
//Geo-Elements (rectangle)
{
"curve": {
"width": "Integer",
"height": "Integer"
},
"endPoint": {
"x": "Integer",
"y": "Integer"
},
"identifier": "String",
"points": [
{
"x": "Integer",
"y": "Integer"
}
],
"position": {
"x": "Integer",
"y": "Integer"
},
"size": {
"width": "Integer",
"height": "Integer"
},
"startPoint": {
"x": "Integer",
"y": "Integer"
},
"text": "StaticString",
"multiline": "Boolean",
"align": {
"horizontal": "String",
"vertical": "String"
},
"editable": "Boolean",
"for": {
"each": "String",
"as": "String"
},
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"style": "Style",
"type": "String",
"id": "UniqueID"
}
]
}
],
"edges": [
{
"name": "String",
"style": "Style",
"conceptElement": "String",
"target": "String",
"placings": [
{
"style": "String",
"position": {
"distance": "Integer",
"offset": "Double"
},
"geoElement": {
//Geo-Element (polygon)
"curve": {
"width": "Integer",
"height": "Integer"
},
"endPoint": {
"x": "Integer",
"y": "Integer"
},
"identifier": "String",
"points": [
{
"x": "Integer",
"y": "Integer"
}
],
"position": {
"x": "Integer",
"y": "Integer"
},
"size": {
"width": "Integer",
"height": "Integer"
},
"startPoint": {
"x": "Integer",
"y": "Integer"
},
"text": "StaticString",
"multiline": "Boolean",
"align": {
"horizontal": "String",
"vertical": "String"
},
"editable": "Boolean",
"for": {
"each": "String",
"as": "String"
},
"style": "Style",
"type": "String",
"id": "UniqueID"
}
}
]
}
]
}
}
Example:
{
"shapes": {
"nodes": [
{
"name": "KnotenNode",
"conceptElement": "Knoten",
"edges": [
"hatKindEdge"
],
"size": {
"width": 10,
"height": 15,
"widthMax": 20,
"widthMin": 10,
"heightMax": 25,
"heightMin": 15
},
"svg": "SVG",
"style": "Style",
"resizing": {
"horizontal": false,
"vertical": false,
"proportional": true
},
"geoElements": [
{
"size": {
"width": 10,
"height": 15
},
"position": {
"x": 3,
"y": 4
},
"childGeoElements": [
{
"identifier": "überschrift",
"size": {
"width": 10,
"height": 15
},
"position": {
"x": 3,
"y": 4
},
"multiline": false,
"align": {
"horizontal": "middle",
"vertical": "middle"
},
"style": "Style",
"type": "textfield",
"id": "UniqueID"
},
{
"identifier": "compartment",
"size": {
"width": 10,
"height": 15
},
"position": {
"x": 3,
"y": 4
},
"childGeoElements": [
{
"text": "kennNummer = ",
"size": {
"width": 10,
"height": 15
},
"position": {
"x": 3,
"y": 4
},
"style": "Style",
"type": "statictext",
"id": "UniqueID"
},
{
"identifier": "kennNummerWert",
"size": {
"width": 10,
"height": 15
},
"position": {
"x": 3,
"y": 4
},
"multiline": false,
"align": {
"horizontal": "middle",
"vertical": "middle"
},
"style": "Style",
"type": "textField",
"id": "UniqueID"
}
],
"style": "Style",
"type": "compartement",
"id": "UniqueID"
}
],
"style": "BlackWhiteStyle",
"type": "ellipse",
"id": "UniqueID"
},
{
"size": {
"width": 10,
"height": 15
},
"position": {
"x": 3,
"y": 4
},
"editable": true,
"for": {
"each": "hatAttribut",
"as": "attribut"
},
"childGeoElements": [
{
// textfield...
}
],
"style": "Style",
"type": "repeating",
"id": "UniqueID"
}
]
},
{
"name": "MatroschkaNode",
"conceptElement": "Knoten",
"edges": [],
"size": {
"width": 10,
"height": 15,
"widthMax": 20,
"widthMin": 10,
"heightMax": 25,
"heightMin": 15
},
"svg": "SVG",
"style": "Style",
"resizing": {
"horizontal": false,
"vertical": false,
"proportional": true
},
"geoElements": [
// rectangle...
// repeating...
]
}
],
"edges": [
{
"name": "hatKindEdge",
"conceptElement": "Knoten.hatKind",
"target": "Knoten",
"placings": [
{
"style": "PfeilStyle",
"position": {
"distance": 1,
"offset": 1.0
},
"geoElement": {
"geoElement": {
"points": [
{
"x": 0,
"y": 0
},
{
"x": 20,
"y": 10
},
{
"x": 40,
"y": 0
},
{
"x": 20,
"y": -10
}
],
"type": "polygon",
"id": "UniqueID"
}
}
]
}
]
}
}
Definition for single geo elements in REST API. Each element contains a unique ID.
Line:
{
"startPoint": {
"x": "Integer",
"y": "Integer"
},
"endPoint": {
"x": "Integer",
"y": "Integer"
},
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"style": "Style",
"type": "line",
"id": "UniqueID"
}
Polyline:
{
"points": [
{
"x": "Integer",
"y": "Integer"
}
],
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"style": "Style",
"type": "polyline",
"id": "UniqueID"
}
Polygon:
{
"points": [
{
"x": "Integer",
"y": "Integer"
}
],
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"style": "Style",
"type": "polygon",
"id": "UniqueID"
}
Rectangle:
{
"size": {
"width": "Integer",
"height": "Integer"
},
"position": {
"x": "Integer",
"y": "Integer"
},
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"style": "Style",
"type": "rectangle",
"id": "UniqueID"
}
RoundedRectangle:
{
"size": {
"width": "Integer",
"height": "Integer"
},
"curve": {
"width": "Integer",
"height": "Integer"
},
"position": {
"x": "Integer",
"y": "Integer"
},
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"style": "Style",
"type": "roundedRectangle",
"id": "UniqueID"
}
Ellipse:
{
"size": {
"width": "Integer",
"height": "Integer"
},
"position": {
"x": "Integer",
"y": "Integer"
},
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"style": "Style",
"type": "ellipse",
"id": "UniqueID"
}
Statictext:
{
"text": "StaticString",
"size": {
"width": "Integer",
"height": "Integer"
},
"position": {
"x": "Integer",
"y": "Integer"
},
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"style": "Style",
"type": "statictext",
"id": "UniqueID"
}
Textfield:
{
"identifier": "String",
"size": {
"width": "Integer",
"height": "Integer"
},
"position": {
"x": "Integer",
"y": "Integer"
},
// editable --> false = display textfield as label
"editable": "Boolean",
"multiline": "Boolean",
"align": {
"horizontal": "String",
"vertical": "String"
},
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"style": "Style",
"type": "textfield",
"id": "UniqueID"
}
Compartement:
// Not implemented
{
"size": {
"width": "Integer",
"height": "Integer"
},
"position": {
"x": "Integer",
"y": "Integer"
},
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"style": "Style",
"type": "compartement",
"id": "UniqueID"
}
RepeatingBox:
{
"editable": "Boolean",
"for": {
"each": "String",
"as": "String"
},
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"type": "repeatingBox",
"id": "UniqueID"
}
HorizontalLayout:
{
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"style": "Style",
"type": "horizontalLayout",
"id": "UniqueID"
}
VerticalLayout:
{
"childGeoElements": [
{
//example: rectangle --> textfield
}
],
"style": "Style",
"type": "verticalLayout",
"id": "UniqueID"
}
Schema of the REST API response for the parsed Diagram DSL.
Definition:
{
"diagrams": [
{
"name": "String",
"palettes": [
{
"name": "String",
"nodes": [
"String",
"String"
]
}
]
},
{
"name": "String",
"palettes": [
{
"name": "String",
"nodes": [
"String",
"String"
]
}
]
}
]
}
Example:
{
"diagrams": [
{
"name": "BaumDiagramm",
"palettes": [
{
"name": "BaumElemente",
"nodes": [
"KnotenNode"
]
}
]
},
{
"name": "MatroschkaDiagramm",
"palettes": [
{
"name": "MatroschkaElemente",
"nodes": [
"MatroschkaNode"
]
}
]
}
]
}
Structure
- Editor
- all JointJS (editor) specific JS-Files
- Style
- StyleGenerator.js
- StyleGenerator.test.js
- Diagram
- DiagramGenerator.js
- DiagramGenerator.test.js
- Shape
- ShapeGenerator.js
- ShapeGenerator.test.js
- NodeGenerator.js
- NodeGenerator.test.js
- EdgeGenerator.js
- EdgeGenerator.test.js
- GeoModelGenerator.js
- GeoModelGenerator.test.js
Note: Move the tests in a separate directory after a new implementation.