Skip to content

Commit d3818c1

Browse files
committed
Changes to Web
1 parent 6cf15a9 commit d3818c1

File tree

43 files changed

+5351
-3438
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+5351
-3438
lines changed

config/HC20_SR_final.json

Lines changed: 2685 additions & 3429 deletions
Large diffs are not rendered by default.

data/web/js/aaselements.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,33 @@ function getCollectionData(_uuid){
9999
if (_elem ["modelType"] == "SubmodelElementCollection"){
100100
collectionElem.value[i] = getCollectionData(collectionElem.value[i]);
101101
}
102+
else if (_elem ["modelType"] == "AnnotatedRelationshipElement"){
103+
console.log(_elem);
104+
collectionElem.value[i] = getANR(collectionElem.value[i]);
105+
}
102106
else {
103107
collectionElem.value[i] =_elem
104108
}
105109
}
106110
return collectionElem.serialize();
107111
}
112+
function getANR(_uuid){
113+
let collectionElem = linearData1[_uuid]
114+
for (var i = 0; i < collectionElem.annotations.length; i++ ) {
115+
let _elem = (linearData1[collectionElem.annotations[i]]).serialize();
116+
if (_elem ["modelType"] == "SubmodelElementCollection"){
117+
collectionElem.annotations[i] = getCollectionData(collectionElem.annotations[i]);
118+
}
119+
else if (_elem ["modelType"] == "AnnotatedRelationshipElement"){
120+
collectionElem.annotations[i] = getANR(collectionElem.annotations[i]);
121+
}
122+
else {
123+
collectionElem.annotations[i] =_elem
124+
}
125+
}
126+
return collectionElem.serialize();
127+
}
128+
108129
function saveSubmodel(event,submodelIdentifier,aasIdentifier){
109130
event.stopPropagation();
110131
event.preventDefault();
@@ -116,11 +137,15 @@ function saveSubmodel(event,submodelIdentifier,aasIdentifier){
116137
if (_elem["modelType"] == "SubmodelElementCollection"){
117138
_submodel_New["submodelElements"][i] = getCollectionData(_submodel_New["submodelElements"][i]);
118139
}
140+
else if (_elem["modelType"] == "AnnotatedRelationshipElement"){
141+
_submodel_New["submodelElements"][i] = getANR(_submodel_New["submodelElements"][i]);
142+
}
119143
else {
120144
_submodel_New["submodelElements"][i] = _elem;
121145
}
122146
}
123147
_submodel_New["id"] = submodelIdentifier;
148+
console.log(_submodel_New);
124149
var httpGetRequest = new XMLHttpRequest();
125150
httpGetRequest.open('PUT',"/submodels/"+btoa(submodelIdentifier));
126151
httpGetRequest.onload = () => {

data/web/js/typedefinitions.js

Lines changed: 116 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,101 @@ class DataElement extends SubmodelElement{
10131013

10141014
}
10151015
}
1016+
class RelationshipElement extends SubmodelElement{
1017+
constructor(extensions,category,idShort,displayName,description,
1018+
checksum,kind,semanticId,supplementalSemanticIds,
1019+
qualifiers,embeddedDataSpecifications){
1020+
super(extensions,category,idShort,displayName,description,
1021+
checksum,kind,semanticId,supplementalSemanticIds,
1022+
qualifiers,embeddedDataSpecifications);
1023+
this.first = new ComplexObject("first","Reference");
1024+
this.second = new ComplexObject("second","Reference");
1025+
this.modelType = "RelationshipElement";
1026+
}
1027+
serialize(){
1028+
let jsonData = super.serialize();
1029+
if (this.first._object != null) {
1030+
jsonData["first"] = this.first.serialize();
1031+
}
1032+
if (this.second._object != null) {
1033+
jsonData["second"] = this.second.serialize();
1034+
}
1035+
jsonData["modelType"] = "RelationshipElement";
1036+
return jsonData;
1037+
}
1038+
deserialize(data,parentId,exdomain){
1039+
super.deserialize(data,parentId,exdomain);
1040+
if (data.hasOwnProperty("first")){
1041+
this.first.deserialize(data["first"],parentId,exdomain);
1042+
}
1043+
if (data.hasOwnProperty("second")){
1044+
this.second.deserialize(data["second"],parentId,exdomain);
1045+
}
1046+
}
1047+
createDom(parentId,exdomain){
1048+
this.uuid = crypto.randomUUID();
1049+
this.exdomain = exdomain;
1050+
document.getElementById(parentId).insertAdjacentHTML(
1051+
'afterbegin',
1052+
`<div class="temp" id = "`+this.uuid+`">
1053+
</div>`);
1054+
this.first.createDom(this.uuid,exdomain);
1055+
this.second.createDom(this.uuid,exdomain);
1056+
super.createDom(this.uuid,exdomain);
1057+
}
1058+
}
1059+
class AnnotatedRelationshipElement extends SubmodelElement{
1060+
constructor(extensions,category,idShort,displayName,description,
1061+
checksum,kind,semanticId,supplementalSemanticIds,
1062+
qualifiers,embeddedDataSpecifications){
1063+
super(extensions,category,idShort,displayName,description,
1064+
checksum,kind,semanticId,supplementalSemanticIds,
1065+
qualifiers,embeddedDataSpecifications);
1066+
this.first = new ComplexObject("first","Reference");
1067+
this.second = new ComplexObject("second","Reference");
1068+
this.modelType = "AnnotatedRelationshipElement";
1069+
this.annotations = new Array();
1070+
}
1071+
serialize(){
1072+
let jsonData = super.serialize();
1073+
if (this.first._object != null) {
1074+
jsonData["first"] = this.first.serialize();
1075+
}
1076+
if (this.second._object != null) {
1077+
jsonData["second"] = this.second.serialize();
1078+
}
1079+
if (this.annotations != null){
1080+
if (this.annotations.length > 0 ){
1081+
jsonData["annotations"] = new Array();
1082+
for (var elemId of this.annotations){
1083+
jsonData["annotations"].push(elemId);
1084+
}
1085+
}
1086+
}
1087+
jsonData["modelType"] = "AnnotatedRelationshipElement";
1088+
return jsonData;
1089+
}
1090+
deserialize(data,parentId,exdomain){
1091+
super.deserialize(data,parentId,exdomain);
1092+
if (data.hasOwnProperty("first")){
1093+
this.first.deserialize(data["first"],parentId,exdomain);
1094+
}
1095+
if (data.hasOwnProperty("second")){
1096+
this.second.deserialize(data["second"],parentId,exdomain);
1097+
}
1098+
}
1099+
createDom(parentId,exdomain){
1100+
this.uuid = crypto.randomUUID();
1101+
this.exdomain = exdomain;
1102+
document.getElementById(parentId).insertAdjacentHTML(
1103+
'afterbegin',
1104+
`<div class="temp" id = "`+this.uuid+`">
1105+
</div>`);
1106+
this.first.createDom(this.uuid,exdomain);
1107+
this.second.createDom(this.uuid,exdomain);
1108+
super.createDom(this.uuid,exdomain);
1109+
}
1110+
}
10161111
class Property extends DataElement{
10171112
constructor(extensions,category,idShort,displayName,description,
10181113
checksum,kind,semanticId,supplementalSemanticIds,
@@ -1185,8 +1280,8 @@ class ReferenceElement extends DataElement{
11851280
this.value.createDom(parentId,exdomain);
11861281
super.createDom(parentId,exdomain);
11871282
}
1188-
11891283
}
1284+
11901285
class Blob extends DataElement{
11911286
constructor(extensions,category,idShort,displayName,description,
11921287
checksum,kind,semanticId,supplementalSemanticIds,
@@ -1197,7 +1292,7 @@ class Blob extends DataElement{
11971292
checksum,kind,semanticId,supplementalSemanticIds,
11981293
qualifiers,embeddedDataSpecifications);
11991294
this.value = value;
1200-
this.contentType = contentType;
1295+
this.contentType = new StringObject("contentType");
12011296
}
12021297
serialize(){
12031298
let jsonData = super.serialize();
@@ -1216,7 +1311,7 @@ class IFile extends DataElement{
12161311
super(extensions,category,idShort,displayName,description,
12171312
checksum,kind,semanticId,supplementalSemanticIds,
12181313
qualifiers,embeddedDataSpecifications);
1219-
this.contentType = contentType;
1314+
this.contentType = new StringObject("contentType");
12201315
this.modelType = "File";
12211316
this.idShortPath = "";
12221317
this.submodelIdentifier = ""
@@ -1225,7 +1320,7 @@ class IFile extends DataElement{
12251320
serialize(){
12261321
let jsonData = super.serialize();
12271322
jsonData["value"] = this.value.text;
1228-
//jsonData["contentType"] = this.contentType.getSelectedItem();
1323+
jsonData["contentType"] = this.contentType.text;
12291324
jsonData["modelType"] = "File";
12301325
return jsonData;
12311326
}
@@ -1234,6 +1329,9 @@ class IFile extends DataElement{
12341329
if (data.hasOwnProperty("value")){
12351330
this.value.text = data["value"];
12361331
}
1332+
if (data.hasOwnProperty("contentType")){
1333+
this.contentType.text = data["contentType"];
1334+
}
12371335
}
12381336
createDom(parentId,exdomain){
12391337
this.value.createDom(parentId,exdomain);
@@ -1258,7 +1356,6 @@ class SubmodelElementCollection extends SubmodelElement{
12581356
for (var elemId of this.value){
12591357
jsonData["value"].push(elemId);
12601358
}
1261-
12621359
}
12631360
}
12641361
jsonData["modelType"] = this.modelType;
@@ -1279,12 +1376,25 @@ class Capability extends SubmodelElement{
12791376
super(extensions,category,idShort,displayName,description,
12801377
checksum,kind,semanticId,supplementalSemanticIds,
12811378
qualifiers,embeddedDataSpecifications);
1379+
this.modelType = "Capability";
12821380
}
12831381
serialize(){
12841382
let jsonData = super.serialize();
12851383
jsonData["modelType"] = "Capability";
12861384
return jsonData;
1287-
}
1385+
}
1386+
deserialize(data,parentId,exdomain){
1387+
super.deserialize(data,parentId,exdomain);
1388+
}
1389+
createDom(parentId,exdomain){
1390+
this.uuid = crypto.randomUUID();
1391+
this.exdomain = exdomain;
1392+
document.getElementById(parentId).insertAdjacentHTML(
1393+
'afterbegin',
1394+
`<div class="temp" id = "`+this.uuid+`">
1395+
</div>`);
1396+
super.createDom(parentId,exdomain);
1397+
}
12881398
}
12891399
class EventElement extends SubmodelElement{
12901400
constructor(extensions,category,idShort,displayName,description,
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)