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-5859 CRUD actions #259

Merged
merged 26 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
Expand Up @@ -17,11 +17,25 @@ operation JSL!TransferDeclaration getExposedTransferObjects(): Set {

for (relation in relations) {
transfers.addAll(relation.referenceType.getExposedTransferObjects());
var targetCreateEvent = relation.referenceType.getCreateEventDeclaration();
if (targetCreateEvent.isDefined() and targetCreateEvent.parameterType.isKindOf(JSL!TransferDeclaration)) {
transfers.add(targetCreateEvent.parameterType);
}
}

return transfers;
}

@cached
operation JSL!TransferDeclaration getReferencingCreateEvent(): JSL!TransferCreateDeclaration {
return JSL!TransferCreateDeclaration.all.selectOne(s | s.parameterType == self);
}

@cached
operation JSL!TransferDeclaration isCreateEventParameter(): Boolean {
return self.getReferencingCreateEvent().isDefined();
}

@cached
operation JSL!TransferDeclaration getExposedRelations(): Set {
return self.collectExposedRelations(new Set());
Expand Down Expand Up @@ -89,7 +103,7 @@ operation JSL!TransferDeclaration getDirectRelations(): Set {
}

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

return relations;
Expand All @@ -110,23 +124,26 @@ operation JSL!TransferDeclaration getAllPrimitiveFields(): Set {
@cached
operation JSL!TransferDeclaration isDeleteSupported(): Boolean {
if (self.map.isDefined()) {
return self.members.exists(m | m.isKindOf(JSL!TransferDeleteDeclaration) and m.isEventInstead());
var event = self.getDeleteEventDeclaration();
return event.isDefined() and event.isEventInstead();
}
return false;
}

@cached
operation JSL!TransferDeclaration isCreateSupported(): Boolean {
if (self.map.isDefined()) {
return self.members.exists(m | m.isKindOf(JSL!TransferCreateDeclaration) and m.isEventInstead());
var event = self.getCreateEventDeclaration();
return event.isDefined() and event.isEventInstead();
}
return false;
}

@cached
operation JSL!TransferDeclaration isUpdateSupported(): Boolean {
if (self.map.isDefined()) {
return self.members.exists(m | m.isKindOf(JSL!TransferUpdateDeclaration) and m.isEventInstead());
var event = self.getUpdateEventDeclaration();
return event.isDefined() and event.isEventInstead();
}
return false;
}
Expand Down Expand Up @@ -154,10 +171,29 @@ operation JSL!TransferDeclaration isRefreshSupported(): Boolean {

@cached
operation JSL!TransferDeclaration isGenerated() : Boolean {
return actorDeclaration.getExposedTransferObjects().includes(self);
return actorDeclaration.getExposedTransferObjects().includes(self);
}


operation JSL!TransferDeclaration uiContainer() : UI!ui::VisualElement {
return self.equivalent("TransferDeclarationVisualElement");
}

@cached
operation JSL!TransferDeclaration getCreateEventDeclaration() : JSL!TransferCreateDeclaration {
return self.members.selectOne(m | m.isKindOf(JSL!TransferCreateDeclaration));
}

@cached
operation JSL!TransferDeclaration getFetchEventDeclaration() : JSL!TransferFetchDeclaration {
return self.members.selectOne(m | m.isKindOf(JSL!TransferFetchDeclaration));
}

@cached
operation JSL!TransferDeclaration getUpdateEventDeclaration() : JSL!TransferUpdateDeclaration {
return self.members.selectOne(m | m.isKindOf(JSL!TransferUpdateDeclaration));
}

@cached
operation JSL!TransferDeclaration getDeleteEventDeclaration() : JSL!TransferDeleteDeclaration {
return self.members.selectOne(m | m.isKindOf(JSL!TransferDeleteDeclaration));
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ operation JSL!TransferRelationDeclaration getFqName(): String {
return self.eContainer.getFqName() + "::" + self.name;
}

@cached
operation JSL!TransferRelationDeclaration isFormRelation(): Boolean {
return self.isCreateAllowed()
and self.referenceType.getCreateEventDeclaration().isDefined()
and self.referenceType.getCreateEventDeclaration().parameterType.isDefined();
}

@cached
operation JSL!TransferRelationDeclaration isEager(): Boolean {
return jslUtils.isEager(self);
Expand Down Expand Up @@ -111,7 +118,7 @@ operation JSL!TransferRelationDeclaration isGetRangeAllowed(): Boolean {

@cached
operation JSL!TransferRelationDeclaration isRefreshAllowed(): Boolean {
return self.maps();
return self.maps() or self.reads();
}

@cached
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import "modelDeclaration.eol";
import "modifiable.eol";
import "modifier.eol";
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@cached
operation JSL!Modifier getId(): String {
return (self.eContainer.getId() + "/" + self.name);
}

@cached
operation JSL!Modifier getFqName(): String {
return self.eContainer.getFqName() + "::" + self.name;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import "icon.eol";
import "rowLinkDeclaration.eol";
import "viewActionDeclaration.eol";
import "viewDeclaration.eol";
import "viewFieldDeclaration.eol";
import "viewGroupDeclaration.eol";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
operation String createSyntheticIcon(id: String, prefix: String): UI!ui::Icon {
var icon: UI!ui::Icon = new UI!ui::Icon();
icon.iconName = self;
icon.name = prefix + "::" + self + "::" + "Icon";
icon.setId(actorDeclaration.name + "/(jsl/" + id + ")/" + self + "SyntheticIcon");
return icon;
}
noherczeg marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@cached
operation JSL!ViewActionDeclaration getId(): String {
return (self.eContainer.getId() + "/" + self.name);
}

@cached
operation JSL!ViewActionDeclaration getFqName(): String {
return self.eContainer.getFqName() + "::" + self.name;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
@cached
operation JSL!ViewPanelDeclaration getDirectRelations(): Set {
var relations = new Set();

if (self.isTypeOf(JSL!ViewGroupDeclaration)) {
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());
}
} else if (self.isTypeOf(JSL!ViewTabsDeclaration)) {
for (group in self.groups) {
relations.addAll(group.getAllRelations());
}
}

return relations;
}
noherczeg marked this conversation as resolved.
Show resolved Hide resolved

@cached
operation JSL!ViewPanelDeclaration getAllRelations(): Set {
var relations = new Set();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ pre {
group.~pos = container.groups.indexOf(group) + 1;
}
}
}
for (visible : JSL!VisibleDeclaration in JSL!VisibleDeclaration.all()) {
}
for (visible : JSL!VisibleDeclaration in JSL!VisibleDeclaration.all()) {
if (visible.isTypeOf(JSL!ViewDeclaration) or visible.isTypeOf(JSL!RowDeclaration)) {
for (member in visible.members) {
member.~pos = visible.members.indexOf(member) + 1;
}
}
}
}
}

post {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ rule EmptyDashboardPageDefinition
to t: UI!ui::PageDefinition {
guard: s = actorDeclaration

t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/EmptyDashboardPageDefinition");
t.name = s.getFqName() + "::DashboardPage";
t.dashboard = true;
t.dataElement = s.equivalent("Actor");
t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/EmptyDashboardPageDefinition");
t.name = s.getFqName() + "::DashboardPage";
t.dashboard = true;
t.dataElement = s.equivalent("Actor");

t.container = s.equivalent("EmptyDashboardPageContainer");
actorDeclaration.equivalent("Application").pages.add(t);
Expand All @@ -130,12 +130,12 @@ rule EmptyDashboardPageContainer
guard: s = actorDeclaration

t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/EmptyDashboardPageContainer");
t.name = s.getFqName() + "::Dashboard";
t.label = "Dashboard";
t.type = UI!ui::PageContainerType#TABLE;
t.dataElement = s.equivalent("Actor");
t.name = s.getFqName() + "::Dashboard";
t.label = "Dashboard";
t.type = UI!ui::PageContainerType#TABLE;
t.dataElement = s.equivalent("Actor");

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

log.debug("EmptyDashboardPageContainer [" + t.name + "]");
log.debug("EmptyDashboardPageContainer [" + t.name + "]");
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ rule MenuItemGroup
to t : UI!ui::NavigationItem {
guard: s.getActorDeclaration().isDefined() and s.getActorDeclaration() == actorDeclaration

t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/MenuItemGroup");
t.name = s.getFqName();
t.setId(actorDeclaration.name + "/(jsl/" + s.getId() + ")/MenuItemGroup");
t.name = s.getFqName();

log.debug("Create Navigation Group: " + s.name );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ rule AccessPageDefinition

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

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

actorDeclaration.equivalent("Application").pages.add(t);
Expand All @@ -54,16 +54,47 @@ rule AccessPageDefinition
*/

for (link in relations.select(r | r.isKindOf(JSL!ViewLinkDeclaration))) {
t.actions.add(link.equivalent("ViewLinkDeclarationOpenPageAction"));
t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenPageAction", "AccessPageDefinition"));
if (link.isRefreshAllowed() and not link.isEager()) {
t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRefreshAction", "AccessPageDefinition"));
}
if (link.isCreateAllowed()) {
t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationOpenFormAction", "AccessPageDefinition"));
}
if (link.isDeleteAllowed()) {
t.actions.add(link.equivalentDiscriminated("ViewLinkDeclarationRowDeleteAction", "AccessPageDefinition"));
}
}

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"));
t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenPageAction", "AccessPageDefinition"));
}
if (table.isFilterSupported()) {
t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationFilterAction", "AccessPageDefinition"));
}
if (table.isRefreshAllowed()) {
t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRefreshAction", "AccessPageDefinition"));
}
if (table.isCreateAllowed()) {
t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationOpenCreateAction", "AccessPageDefinition"));
}
if (table.isDeleteAllowed()) {
t.actions.add(table.equivalentDiscriminated("ViewTableDeclarationRowDeleteAction", "AccessPageDefinition"));
}
}

t.actions.add(s.equivalent("ViewLinkPageDefinitionBackAction"));
if (s.isRefreshAllowed()) {
t.actions.add(s.equivalent("ViewLinkPageDefinitionRefreshAction"));
}
if (s.isUpdateAllowed()) {
t.actions.add(s.equivalent("ViewLinkPageDefinitionUpdateAction"));
}
if (s.isDeleteAllowed()) {
t.actions.add(s.equivalent("ViewLinkPageDefinitionDeleteAction"));
}

log.debug("Create AccessPageDefinition: " + t.name);
Expand Down
Loading
Loading