From 09e52c56cb1a711ee3e06bb84af3b48bf667e88e Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Thu, 25 Jul 2024 16:51:05 +0200 Subject: [PATCH 1/6] JNG-5862 transform navigations --- .../structure/transferFieldDeclaration.etl | 6 +- .../structure/transferRelationDeclaration.etl | 2 +- .../transformations/ui/modules/type/type.etl | 20 +-- .../ui/modules/view/viewLinkDeclaration.etl | 41 ++++- .../ui/modules/view/viewTableDeclaration.etl | 47 +++++- .../JslModel2UiNavigationTest.java | 142 ++++++++++++++++++ .../application/JslModel2UiWidgetsTest.java | 7 +- 7 files changed, 245 insertions(+), 20 deletions(-) create mode 100644 judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiNavigationTest.java diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferFieldDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferFieldDeclaration.etl index 51e2f897..7c375879 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferFieldDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferFieldDeclaration.etl @@ -19,7 +19,7 @@ rule CreateTransientTransferAttribute extends AbstractCreateTransferAttribute { guard: not s.maps() and not s.reads() - t.setId("(jsl/" + s.getId() + ")/CreateTransientTransferAttribute"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/CreateTransientTransferAttribute"); t.memberType = UI!ui::data::MemberType#TRANSIENT; t.isReadOnly = false; @@ -34,7 +34,7 @@ rule CreateDerivedTransferAttribute extends AbstractCreateTransferAttribute { guard: s.reads() - t.setId("(jsl/" + s.getId() + ")/CreateDerivedTransferAttribute"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/CreateDerivedTransferAttribute"); t.memberType = UI!ui::data::MemberType#DERIVED; t.isReadOnly = true; @@ -49,7 +49,7 @@ rule CreateMappedTransferAttribute extends AbstractCreateTransferAttribute { guard: s.maps() - t.setId("(jsl/" + s.getId() + ")/CreateMappedTransferAttribute"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/CreateMappedTransferAttribute"); t.memberType = UI!ui::data::MemberType#MAPPED; t.isReadOnly = false; diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferRelationDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferRelationDeclaration.etl index ae928a2d..ecdd19f6 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferRelationDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/structure/transferRelationDeclaration.etl @@ -102,7 +102,7 @@ rule RelationType transform s: JSL!TransferRelationDeclaration to t: UI!ui::data::RelationType extends AbstractRelationType { - t.setId("(jsl/" + s.getId() + ")/RelationType"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/RelationType"); var containerClassType = s.getContainerEquivalentClassType(); containerClassType.relations.add(t); log.debug("Created RelationType [" + t.name + "] into [" + containerClassType.name + "]"); diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/type/type.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/type/type.etl index ae2c4362..47fd4130 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/type/type.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/type/type.etl @@ -4,7 +4,7 @@ rule CreateNumericType to t: UI!ui::data::NumericType { guard: s.`primitive` == "numeric" and ((s.getActorDeclaration().isDefined() and s.getActorDeclaration() == actorDeclaration) or s.eContainer.name == "judo::types") - t.setId("(jsl/" + s.getId() + ")/CreateNumericType"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/CreateNumericType"); t.name = s.name; t.precision = s.getPrecision().value.intValue(); t.scale = s.getScale().value.intValue(); @@ -18,7 +18,7 @@ rule CreateDateType to t: UI!ui::data::DateType { guard: s.`primitive` == "date" and ((s.getActorDeclaration().isDefined() and s.getActorDeclaration() == actorDeclaration) or s.eContainer.name == "judo::types") - t.setId("(jsl/" + s.getId() + ")/CreateDateType"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/CreateDateType"); t.name = s.name; actorDeclaration.equivalent("Application").dataTypes.add(t); log.debug("Created DateType: " + t.name); @@ -30,7 +30,7 @@ rule CreateTimeType to t: UI!ui::data::TimeType { guard: s.`primitive` == "time" and ((s.getActorDeclaration().isDefined() and s.getActorDeclaration() == actorDeclaration) or s.eContainer.name == "judo::types") - t.setId("(jsl/" + s.getId() + ")/CreateTimeType"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/CreateTimeType"); t.name = s.name; actorDeclaration.equivalent("Application").dataTypes.add(t); log.debug("Created TimeType: " + t.name); @@ -42,7 +42,7 @@ rule CreateTimestampType to t: UI!ui::data::TimestampType { guard: s.`primitive` == "timestamp" and ((s.getActorDeclaration().isDefined() and s.getActorDeclaration() == actorDeclaration) or s.eContainer.name == "judo::types") - t.setId("(jsl/" + s.getId() + ")/CreateTimestampType"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/CreateTimestampType"); t.name = s.name; actorDeclaration.equivalent("Application").dataTypes.add(t); log.debug("Created TimestampType: " + t.name); @@ -54,7 +54,7 @@ rule CreateEnumerationType to t: UI!ui::data::EnumerationType { guard: (s.getActorDeclaration().isDefined() and s.getActorDeclaration() == actorDeclaration) or s.eContainer.name == "judo::types" - t.setId("(jsl/" + s.getId() + ")/CreateEnumerationType"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/CreateEnumerationType"); t.name = s.name; actorDeclaration.equivalent("Application").dataTypes.add(t); log.debug("Created EnumerationType: " + t.name); @@ -66,7 +66,7 @@ rule CreateEnumerationMember to t: UI!ui::data::EnumerationMember { guard: (s.getActorDeclaration().isDefined() and s.getActorDeclaration() == actorDeclaration) or s.eContainer.name == "judo::types" - t.setId("(jsl/" + s.getId() + ")/CreateEnumerationMember"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/CreateEnumerationMember"); t.name = s.name; t.ordinal = s.value.intValue(); s.eContainer.equivalent("CreateEnumerationType").members.add(t); @@ -79,7 +79,7 @@ rule CreateBooleanType to t : UI!ui::data::BooleanType { guard: s.`primitive` == "boolean" and ((s.getActorDeclaration().isDefined() and s.getActorDeclaration() == actorDeclaration) or s.eContainer.name == "judo::types") - t.setId("(jsl/" + s.getId() + ")/CreateBooleanType"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/CreateBooleanType"); t.name = s.name; actorDeclaration.equivalent("Application").dataTypes.add(t); log.debug("Created BooleanType: " + t.name); @@ -91,7 +91,7 @@ rule CreateStringType to t : UI!ui::data::StringType { guard: s.`primitive` == "string" and ((s.getActorDeclaration().isDefined() and s.getActorDeclaration() == actorDeclaration) or s.eContainer.name == "judo::types") - t.setId("(jsl/" + s.getId() + ")/CreateStringType"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/CreateStringType"); t.name = s.name; t.maxLength = s.getMaxSize().value.intValue(); @@ -107,7 +107,7 @@ rule CreateStringType rule MimeType transform s: String to t: UI!ui::data::MimeType { - t.setId("(jsl/" + s + ")/MimeType"); + t.setId(actorDeclaration.name + "/(jsl/" + s + ")/MimeType"); var split = s.split("/"); t.type = split[0]; t.subType = split[1]; @@ -122,7 +122,7 @@ rule CreateBinaryType to t : UI!ui::data::BinaryType { guard: s.`primitive` == "binary" and ((s.getActorDeclaration().isDefined() and s.getActorDeclaration() == actorDeclaration) or s.eContainer.name == "judo::types") - t.setId("(jsl/" + s.getId() + ")/CreateBinaryType"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/CreateBinaryType"); t.name = s.name; if (s.getMimeType().isDefined()) { diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl index 980fbf02..258cddfb 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewLinkDeclaration.etl @@ -77,7 +77,7 @@ rule InlineViewLink t.selectorRowsPerPage = 10; t.autoCompleteRows = 10; - t.actionButtonGroup = s.equivalent("TabularReferenceFieldLinkButtonGroup"); + t.actionButtonGroup = s.equivalent("InlineViewLinkButtonGroup"); /* t.autocompleteRangeActionDefinition = s.equivalent("TabularReferenceFieldLinkAutocompleteRangeActionDefinition"); @@ -101,6 +101,8 @@ rule InlineViewLinkButtonGroup // TODO add action buttons + t.buttons.add(s.equivalent("ViewLinkDeclarationOpenPageButton")); + log.debug("InlineViewLinkButtonGroup: " + t.name); } @@ -126,3 +128,40 @@ rule ViewLinkDeclarationRepresentationColumn log.debug("ViewLinkDeclarationRepresentationColumn: " + t.name); } + +@lazy +rule ViewLinkDeclarationOpenPageButton + transform s: JSL!ViewLinkDeclaration + to t: UI!ui::Button { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageButton"); + t.name = s.name + "::View"; + t.buttonStyle = "contained"; + t.label = "View"; + t.icon = s.equivalent("ViewLinkDeclarationOpenPageButtonIcon"); + t.actionDefinition = s.equivalent("ViewLinkDeclarationOpenPageActionDefinition"); + + log.debug("ViewLinkDeclarationOpenPageButton: " + t.name); +} + +@lazy +rule ViewLinkDeclarationOpenPageButtonIcon + transform s: JSL!ViewLinkDeclaration + to t: UI!ui::Icon { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageButtonIcon"); + t.iconName = "eye"; + t.name = s.name + "Icon"; + + log.debug("ViewLinkDeclarationOpenPageButtonIcon: " + t.name); +} + +@lazy +rule ViewLinkDeclarationOpenPageActionDefinition + transform s: JSL!ViewLinkDeclaration + to t: UI!ui::OpenPageActionDefinition { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewLinkDeclarationOpenPageActionDefinition"); + t.name = s.name + "::View"; + t.isContainedRelationAction = true; + t.targetType = s.referenceType.equivalent("ClassType"); + + log.debug("ViewLinkDeclarationOpenPageActionDefinition: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl index d2236f6b..6fb28651 100644 --- a/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl +++ b/judo-tatami-jsl-jsl2ui/src/main/epsilon/transformations/ui/modules/view/viewTableDeclaration.etl @@ -222,7 +222,7 @@ rule RowLinkDerivedColumnFilter rule RowLinkDerivedAttributeType transform s: JSL!RowLinkDeclaration to t: UI!ui::data::AttributeType { - t.setId("(jsl/" + s.getId() + ")/RowLinkDerivedAttributeType"); + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/RowLinkDerivedAttributeType"); t.memberType = UI!ui::data::MemberType#DERIVED; t.isReadOnly = true; t.name = "_text_" + s.name; @@ -258,6 +258,51 @@ rule InlineViewTableRowButtonGroup t.label = "Actions"; // TODO add buttons + var rowLinks = s.referenceType.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); + + if (rowLinks.selectOne(l | l.getDetail().isDefined()).isDefined()) { + t.buttons.add(s.equivalent("ViewTableDeclarationRowOpenPageButton")); + } log.debug("TabularReferenceTableRowButtonGroup: " + t.name); } + +@lazy +rule ViewTableDeclarationRowOpenPageButton + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Button { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowOpenPageButton"); + t.name = s.name + "::View"; + t.icon = s.equivalent("ViewTableDeclarationRowOpenPageButtonIcon"); + t.label = "View"; + t.buttonStyle = "contained"; + t.actionDefinition = s.equivalent("ViewTableDeclarationRowOpenPageActionDefinition"); + + log.debug("ViewTableDeclarationRowOpenPageButton: " + t.name); +} + +@lazy +rule ViewTableDeclarationRowOpenPageButtonIcon + transform s: JSL!ViewTableDeclaration + to t: UI!ui::Icon { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowOpenPageButtonIcon"); + t.name = s.name + "Icon"; + t.iconName = "visibility"; + + log.debug("ViewTableDeclarationRowOpenPageButtonIcon: " + t.name); +} + +@lazy +rule ViewTableDeclarationRowOpenPageActionDefinition + transform s: JSL!ViewTableDeclaration + to t: UI!ui::RowOpenPageActionDefinition { + t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/ViewTableDeclarationRowOpenPageActionDefinition"); + t.name = s.name + "::View"; + t.targetType = s.referenceType.equivalent("ClassType"); + + var rowLinks = s.referenceType.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration)); + + t.linkRelation = rowLinks.selectOne(l | l.getDetail().isDefined()).equivalent("RelationType"); + + log.debug("ViewTableDeclarationRowOpenPageActionDefinition: " + t.name); +} diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiNavigationTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiNavigationTest.java new file mode 100644 index 00000000..844e772e --- /dev/null +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiNavigationTest.java @@ -0,0 +1,142 @@ +package hu.blackbelt.judo.tatami.jsl.jsl2ui.application; + +import hu.blackbelt.judo.meta.jsl.runtime.JslParser; +import hu.blackbelt.judo.meta.ui.*; +import hu.blackbelt.judo.meta.ui.data.ClassType; +import hu.blackbelt.judo.meta.ui.data.RelationType; +import hu.blackbelt.judo.tatami.jsl.jsl2ui.AbstractTest; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@Slf4j +public class JslModel2UiNavigationTest extends AbstractTest { + private static final String TARGET_TEST_CLASSES = "target/test-classes/widgets"; + + @Override + protected String getTargetTestClasses() { + return TARGET_TEST_CLASSES; + } + + @Override + protected String getTest() { + return this.getClass().getSimpleName(); + } + + @Override + protected Logger createLog() { + return log; + } + + @BeforeAll + static void prepareTestFolders() throws IOException { + if (!Files.exists(Paths.get(TARGET_TEST_CLASSES))) { + Files.createDirectories(Paths.get(TARGET_TEST_CLASSES)); + } + } + + @Test + void testNavigation() throws Exception { + jslModel = JslParser.getModelFromStrings("NavigationTestModel", List.of(""" + model NavigationTestModel; + + import judo::types; + + entity User { + identifier String email required; + field Integer numeric; + + field Related related; + relation Related[] relatedCollection; + } + + entity Related { + field String first; + field Integer second; + } + + view UserView(User u) { + group level1 { + link RelatedView related <= u.related eager:true icon:"related" label:"Related" width:6; + table RelatedRow[] relatedCollection <= u.relatedCollection icon:"relatedCollection" label:"Related Collection"; + } + } + + row RelatedRow(Related r) { + field String first <= r.first label:"First"; + field Integer second <= r.second label:"Second"; + link RelatedView detail <= r detail:true; + } + + view RelatedView(Related r) { + field String first <= r.first label: "First"; + field Integer second <= r.second label: "Second"; + } + + actor NavigationActor human { + link UserView user <= User.any() label:"User" icon:"tools"; + } + """)); + + transform(); + + List apps = uiModelWrapper.getStreamOfUiApplication().toList(); + + assertEquals(1, apps.size()); + + Application application = apps.get(0); + + List classTypes = application.getClassTypes(); + List links = application.getLinks(); + List tables = application.getTables(); + + ClassType relatedRowClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::RelatedRow::ClassType")).findFirst().orElseThrow(); + ClassType relatedViewClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::RelatedView::ClassType")).findFirst().orElseThrow(); + + RelationType detailRelation = (RelationType) application.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("detail")).findFirst().orElseThrow(); + + // Tables + + Table relatedCollectionTable = tables.stream().filter(t -> t.getName().equals("relatedCollection")).findFirst().orElseThrow(); + + List
tables = application.getTables(); + List pages = application.getPages(); ClassType relatedRowClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::RelatedRow::ClassType")).findFirst().orElseThrow(); ClassType relatedViewClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::RelatedView::ClassType")).findFirst().orElseThrow(); @@ -138,5 +140,20 @@ view RelatedView(Related r) { assertEquals("eye", openButton.getIcon().getIconName()); assertEquals(relatedViewClassType, openPageActionDefinition.getTargetType()); + + // Actions + + PageDefinition userAccessPage = pages.stream().filter(p -> p.getName().equals("NavigationTestModel::NavigationActor::user::PageDefinition")).findFirst().orElseThrow(); + List userAccessPageActions = userAccessPage.getActions(); + + assertEquals(2, userAccessPageActions.size()); + + Action relatedOpenPageAction = userAccessPageActions.stream().filter(a -> a.getName().equals("related::ViewLinkDeclarationOpenPageAction")).findFirst().orElseThrow(); + assertTrue(relatedOpenPageAction.getIsOpenPageAction()); + assertEquals(pages.stream().filter(p -> p.getName().equals("NavigationTestModel::UserView::related::PageDefinition")).findFirst().orElse(null), relatedOpenPageAction.getTargetPageDefinition()); + + Action relatedCollectionOpenPageAction = userAccessPageActions.stream().filter(a -> a.getName().equals("relatedCollection::ViewTableDeclarationOpenPageAction")).findFirst().orElseThrow(); + assertTrue(relatedCollectionOpenPageAction.getIsRowOpenPageAction()); + assertEquals(pages.stream().filter(p -> p.getName().equals("NavigationTestModel::RelatedRow::detail::PageDefinition")).findFirst().orElse(null), relatedCollectionOpenPageAction.getTargetPageDefinition()); } } From 012b6c0ef2a9aba3a572e1fc419b6f48ea43133f Mon Sep 17 00:00:00 2001 From: Norbert Csaba Herczeg Date: Thu, 25 Jul 2024 20:15:33 +0200 Subject: [PATCH 5/6] add moar tests --- .../JslModel2UiNavigationTest.java | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiNavigationTest.java b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiNavigationTest.java index b03bb4ca..71d4c459 100644 --- a/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiNavigationTest.java +++ b/judo-tatami-jsl-jsl2ui/src/test/java/hu/blackbelt/judo/tatami/jsl/jsl2ui/application/JslModel2UiNavigationTest.java @@ -62,6 +62,12 @@ void testNavigation() throws Exception { entity Related { field String first; field Integer second; + field Jumper theJumper; + relation Jumper[] theJumpersCollection; + } + + entity Jumper { + field String first; } view UserView(User u) { @@ -80,6 +86,17 @@ row RelatedRow(Related r) { view RelatedView(Related r) { field String first <= r.first label: "First"; field Integer second <= r.second label: "Second"; + link JumperView myJumper <= r.theJumper eager:false icon:"jumping" label:"My Jumper" width:6; + table JumperRow[] myJumpers <= r.theJumpersCollection eager:false icon:"jumping-all" label:"My Jumpers" width:6; + } + + view JumperView(Jumper j) { + field String first <= j.first label: "First"; + } + + row JumperRow(Jumper j) { + field String first <= j.first label: "First"; + link JumperView jumperRowDetail <= j detail:true; } actor NavigationActor human { @@ -100,13 +117,23 @@ view RelatedView(Related r) { List
tables = application.getTables(); List pages = application.getPages(); + assertEquals(6, classTypes.size()); + assertEquals(2, links.size()); + assertEquals(2, tables.size()); + assertEquals(6, pages.size()); + ClassType relatedRowClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::RelatedRow::ClassType")).findFirst().orElseThrow(); ClassType relatedViewClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::RelatedView::ClassType")).findFirst().orElseThrow(); + ClassType jumperRowClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::JumperRow::ClassType")).findFirst().orElseThrow(); + ClassType jumperViewClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::JumperView::ClassType")).findFirst().orElseThrow(); RelationType detailRelation = (RelationType) application.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("detail")).findFirst().orElseThrow(); + RelationType jumperRowDetailRelation = (RelationType) application.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("jumperRowDetail")).findFirst().orElseThrow(); // Tables + // - relatedCollection + Table relatedCollectionTable = tables.stream().filter(t -> t.getName().equals("relatedCollection")).findFirst().orElseThrow(); List
tables = application.getTables(); List pages = application.getPages(); @@ -121,6 +124,7 @@ row JumperRow(Jumper j) { assertEquals(2, links.size()); assertEquals(2, tables.size()); assertEquals(6, pages.size()); + assertEquals(7, relationTypes.size()); ClassType relatedRowClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::RelatedRow::ClassType")).findFirst().orElseThrow(); ClassType relatedViewClassType = classTypes.stream().filter(c -> c.getName().equals("NavigationTestModel::RelatedView::ClassType")).findFirst().orElseThrow(); @@ -130,6 +134,18 @@ row JumperRow(Jumper j) { RelationType detailRelation = (RelationType) application.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("detail")).findFirst().orElseThrow(); RelationType jumperRowDetailRelation = (RelationType) application.getRelationTypes().stream().filter(r -> ((RelationType) r).getName().equals("jumperRowDetail")).findFirst().orElseThrow(); + // Relations + + assertEquals(Set.of( + "NavigationActor::Application::NavigationTestModel::JumperRow::ClassType::jumperRowDetail", + "NavigationActor::Application::NavigationTestModel::NavigationActor::ClassType::user", + "NavigationActor::Application::NavigationTestModel::RelatedRow::ClassType::detail", + "NavigationActor::Application::NavigationTestModel::RelatedView::ClassType::myJumper", + "NavigationActor::Application::NavigationTestModel::RelatedView::ClassType::myJumpers", + "NavigationActor::Application::NavigationTestModel::UserView::ClassType::related", + "NavigationActor::Application::NavigationTestModel::UserView::ClassType::relatedCollection" + ), relationTypes.stream().map(NamedElement::getFQName).collect(Collectors.toSet())); + // Tables // - relatedCollection