Skip to content

Commit

Permalink
Include NOTES into the values of the tagValue is equal to NOTE (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofVDB1 authored Sep 17, 2024
1 parent 8d5774e commit 883a2be
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
3 changes: 3 additions & 0 deletions packages/oslo-converter-uml-ea/lib/enums/TagValues.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export enum TagValues {
NOTE = 'NOTE',
}
4 changes: 2 additions & 2 deletions packages/oslo-converter-uml-ea/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oslo-flanders/ea-converter",
"version": "0.0.21-alpha.0",
"version": "0.0.22-alpha.0",
"description": "Transform an Enterprise Architect UML diagram to RDF",
"author": "Digitaal Vlaanderen <https://data.vlaanderen.be/id/organisatie/OVO002949>",
"homepage": "https://github.com/informatievlaanderen/OSLO-UML-Transformer/tree/main/packages/oslo-converter-uml-ea#readme",
Expand Down Expand Up @@ -42,7 +42,7 @@
},
"dependencies": {
"@oslo-flanders/core": "^0.0.15-alpha.0",
"@oslo-flanders/ea-uml-extractor": "^0.0.20-alpha.0",
"@oslo-flanders/ea-uml-extractor": "^0.0.21-alpha.0",
"@oslo-flanders/output-handlers": "^0.0.4-alpha.0",
"inversify": "^6.0.1",
"n3": "^1.16.2",
Expand Down
26 changes: 18 additions & 8 deletions packages/oslo-extractor-uml-ea/lib/utils/assignTags.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { TagValues } from '../../../oslo-converter-uml-ea/lib/enums/TagValues';
import type { EaConnector } from '../types/EaConnector';
import type { EaObject } from '../types/EaObject';
import type { EaTag } from '../types/EaTag';
Expand All @@ -15,16 +16,21 @@ export function addEaTagsToElements(
objectIdPropertyName: string,
tagValueName: string,
): void {
tags.forEach(tag => {
const element = elements.find(x => x.id === tag[objectIdPropertyName]);
tags.forEach((tag) => {
const element = elements.find((x) => x.id === tag[objectIdPropertyName]);

if (!element) {
// TODO: log message
} else {
const eaTag: EaTag = {
id: <number>tag.PropertyID,
tagName: <string>tag.Property,
tagValue: <string>tag[tagValueName],
// https://vlaamseoverheid.atlassian.net/jira/software/projects/SDTT/issues/SDTT-335
// If there are NOTES, then the tag value is a note, otherwise it is the tag value.
tagValue:
<string>tag[tagValueName] === TagValues.NOTE
? <string>tag.Notes
: <string>tag[tagValueName],
};

element.tags = element.tags ? [...element.tags, eaTag] : [eaTag];
Expand All @@ -41,26 +47,30 @@ export function addRoleTagsToElements(
tags: any[],
eaConnectors: EaConnector[],
): void {
eaConnectors.forEach(con => {
const connectorRoleTags = tags.filter(x => x.ElementID === con.eaGuid);
eaConnectors.forEach((con) => {
const connectorRoleTags = tags.filter((x) => x.ElementID === con.eaGuid);

if (connectorRoleTags.length === 0) {
return;
}

connectorRoleTags.forEach(roleTag => {
connectorRoleTags.forEach((roleTag) => {
const eaRoleTag: EaTag = {
id: <string>roleTag.PropertyID,
tagName: <string>roleTag.TagValue,
tagValue: <string>roleTag.Notes,
};

if (roleTag.BaseClass === 'ASSOCIATION_SOURCE') {
con.sourceRoleTags = con.sourceRoleTags ? [...con.sourceRoleTags, eaRoleTag] : [eaRoleTag];
con.sourceRoleTags = con.sourceRoleTags
? [...con.sourceRoleTags, eaRoleTag]
: [eaRoleTag];
}

if (roleTag.BaseClass === 'ASSOCIATION_TARGET') {
con.destinationRoleTags = con.destinationRoleTags ? [...con.destinationRoleTags, eaRoleTag] : [eaRoleTag];
con.destinationRoleTags = con.destinationRoleTags
? [...con.destinationRoleTags, eaRoleTag]
: [eaRoleTag];
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/oslo-extractor-uml-ea/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oslo-flanders/ea-uml-extractor",
"version": "0.0.20-alpha.0",
"version": "0.0.21-alpha.0",
"description": "Reads all the information from an Enterprise Architect UML diagram",
"author": "Digitaal Vlaanderen <https://data.vlaanderen.be/id/organisatie/OVO002949>",
"homepage": "https://github.com/informatievlaanderen/OSLO-UML-Transformer/tree/main/packages/oslo-extract-uml-ea#readme",
Expand Down

0 comments on commit 883a2be

Please sign in to comment.