Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JNG-5862 transform navigations #258

Merged
merged 6 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@cached
operation JSL!ActorLinkDeclaration getFqName(): String {
if (self.eContainer.isTypeOf(JSL!ActorGroupDeclaration) or self.eContainer.isTypeOf(JSL!ActorDeclaration)) {
return self.eContainer.getFqName() + "::" + self.name;
if (self.getTransferContainer().isDefined()) {
return self.getTransferContainer().getFqName() + "::" + self.name;
}
return self.name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ operation JSL!TransferDeclaration collectExposedRelations(collected: Set): Set {
@cached
operation JSL!TransferDeclaration getAllRelations(): Set {
var relations = new Set();
relations.addAll(self.members.select(m | m.isKindOf(JSL!TransferRelationDeclaration)));
var ownRelations = self.members.select(m | m.isKindOf(JSL!TransferRelationDeclaration));
relations.addAll(ownRelations);

if (self.isKindOf(JSL!ActorDeclaration)) {
var linkRelations = self.getAllMenuDeclarations();
Expand All @@ -69,6 +70,28 @@ operation JSL!TransferDeclaration getAllRelations(): Set {
relations.addAll(member.getAllRelations());
}

// also add relations of relations to complete the trees
for (member in ownRelations) {
relations.addAll(member.referenceType.getAllRelations());
}

return relations;
}

@cached
operation JSL!TransferDeclaration getDirectRelations(): Set {
var relations = new Set();
relations.addAll(self.members.select(m | m.isKindOf(JSL!TransferRelationDeclaration)));

if (self.isKindOf(JSL!ActorDeclaration)) {
var linkRelations = self.getAllMenuDeclarations();
relations.addAll(linkRelations);
}

for (member in self.members.select(m | m.isKindOf(JSL!ViewPanelDeclaration))) {
relations.addAll(member.getAllRelations());
}

return relations;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import "rowLinkDeclaration.eol";
import "viewDeclaration.eol";
import "viewFieldDeclaration.eol";
import "viewGroupDeclaration.eol";
import "viewLinkDeclaration.eol";
import "viewPanelDeclaration.eol";
import "viewTableDeclaration.eol";
import "viewTabsDeclaration.eol";
import "visibleDeclaration.eol";
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@cached
operation JSL!RowLinkDeclaration getId(): String {
return (self.eContainer.getId() + "/" + self.name);
}

@cached
operation JSL!RowLinkDeclaration getFqName(): String {
if (self.getTransferContainer().isDefined()) {
return self.getTransferContainer().getFqName() + "::" + self.name;
}
return self.name;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@cached
operation JSL!ViewLinkDeclaration getId(): String {
return (self.eContainer.getId() + "/" + self.name);
}

@cached
operation JSL!ViewLinkDeclaration getFqName(): String {
if (self.getTransferContainer().isDefined()) {
return self.getTransferContainer().getFqName() + "::" + self.name;
}
return self.name;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ operation JSL!ViewPanelDeclaration getAllRelations(): Set {
var relations = new Set();

if (self.isTypeOf(JSL!ViewGroupDeclaration)) {
relations.addAll(self.members.select(m | m.isKindOf(JSL!TransferRelationDeclaration)));
var ownRelations = self.members.select(m | m.isKindOf(JSL!TransferRelationDeclaration));
relations.addAll(ownRelations);
for (group in self.members.select(m | m.isKindOf(JSL!ViewGroupDeclaration))) {
relations.addAll(group.getAllRelations());
}
for (tabs in self.members.select(m | m.isKindOf(JSL!ViewTabsDeclaration))) {
relations.addAll(tabs.getAllRelations());
}

// also add relations of relations to complete the trees
for (member in ownRelations) {
relations.addAll(member.referenceType.getAllRelations());
}
} else if (self.isTypeOf(JSL!ViewTabsDeclaration)) {
for (group in self.groups) {
relations.addAll(group.getAllRelations());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@cached
operation JSL!ViewTableDeclaration getId(): String {
return (self.eContainer.getId() + "/" + self.name);
}

@cached
operation JSL!ViewTableDeclaration getFqName(): String {
if (self.getTransferContainer().isDefined()) {
return self.getTransferContainer().getFqName() + "::" + self.name;
}
return self.name;
}

@cached
operation JSL!ViewTableDeclaration getAllLinks(): Set {
return self.referenceType.members.select(m | m.isTypeOf(JSL!RowLinkDeclaration));
}

@cached
operation JSL!ViewTableDeclaration getDetailLink(): JSL!RowLinkDeclaration {
return self.getAllLinks().selectOne(l | l.getDetail().isDefined());
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "modules/structure/transferRelationDeclaration.etl";
import "modules/type/type.etl";

import "modules/view/enumLiteral.etl";
import "modules/view/rowLinkDeclaration.etl";
import "modules/view/viewFieldDeclaration.etl";
import "modules/view/viewGroupDeclaration.etl";
import "modules/view/viewLinkDeclaration.etl";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,27 @@ rule AccessPageDefinition

t.dataElement = s.equivalent("RelationType");

var relations = s.referenceType.getDirectRelations();

/*
log.info("===================");
log.info(t.name + ":");
log.info(relations.collect(r | r.name).concat(", "));
log.info("===================");
*/

for (link in relations.select(r | r.isKindOf(JSL!ViewLinkDeclaration))) {
t.actions.add(link.equivalent("ViewLinkDeclarationOpenPageAction"));
}

for (table in relations.select(r | r.isKindOf(JSL!ViewTableDeclaration))) {
var detailLink = table.getDetailLink();

if (detailLink.isDefined()) {
log.info(" - detail: true");
t.actions.add(table.equivalent("ViewTableDeclarationOpenPageAction"));
}
}

log.debug("Create AccessPageDefinition: " + t.name);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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();

Expand All @@ -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];
Expand All @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
rule RowLinkPageDefinition
transform s: JSL!RowLinkDeclaration
to t: UI!ui::PageDefinition {
guard: actorDeclaration.getAllRelations().contains(s)

t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/RowLinkPageDefinition");

t.name = s.getFqName() + "::PageDefinition";
t.container = s.referenceType.equivalent("TransferDeclarationPageContainer");

actorDeclaration.equivalent("Application").pages.add(t);

t.dataElement = s.equivalent("RelationType");

var relations = s.referenceType.getDirectRelations();

/*
log.info("===================");
log.info(t.name + ":");
log.info(relations.collect(r | r.name).concat(", "));
log.info("===================");
*/

for (link in relations.select(r | r.isKindOf(JSL!ViewLinkDeclaration))) {
t.actions.add(link.equivalent("ViewLinkDeclarationOpenPageAction"));
}

for (table in relations.select(r | r.isKindOf(JSL!ViewTableDeclaration))) {
var detailLink = table.getDetailLink();

if (detailLink.isDefined()) {
t.actions.add(table.equivalent("ViewTableDeclarationOpenPageAction"));
}
}

log.debug("Create RowLinkPageDefinition: " + t.name);
}
Loading
Loading