From 560f7c00ef5b4e4960437a2309316fe9a7943600 Mon Sep 17 00:00:00 2001 From: Mohamed ENNAHDI EL IDRISSI Date: Mon, 18 Nov 2024 11:27:51 +0000 Subject: [PATCH] Landing page + client page + relationship bug correction --- .../src/main/resources/public/client.html | 66 +++++++++++++++++++ .../src/main/resources/public/index.html | 16 +++-- .../renderer/relation/RelationRenderer.java | 8 ++- 3 files changed, 82 insertions(+), 8 deletions(-) create mode 100644 objectmorph-app/src/main/resources/public/client.html diff --git a/objectmorph-app/src/main/resources/public/client.html b/objectmorph-app/src/main/resources/public/client.html new file mode 100644 index 0000000..a6f1154 --- /dev/null +++ b/objectmorph-app/src/main/resources/public/client.html @@ -0,0 +1,66 @@ + + + + +Objectmorph-Sample-Client + + +

Objectmorph Sample Client

+

+ This page executes client side code. It can be downloaded and executed locally. +

+
+ +
+ + + \ No newline at end of file diff --git a/objectmorph-app/src/main/resources/public/index.html b/objectmorph-app/src/main/resources/public/index.html index f26c7db..c0860c3 100644 --- a/objectmorph-app/src/main/resources/public/index.html +++ b/objectmorph-app/src/main/resources/public/index.html @@ -6,10 +6,16 @@

ObjectMorph application

- - The HTML endpoint: HTML Renderer. - -

- The Swagger page: HTML Renderer +
+

+ The HTML endpoint: HTML Renderer. +

+

+ The Swagger page here. +

+

+ Access to the sample client here. +

+
\ No newline at end of file diff --git a/objectmorph-renderer/src/main/java/com/github/mohamedennahdi/objectmorph/renderer/relation/RelationRenderer.java b/objectmorph-renderer/src/main/java/com/github/mohamedennahdi/objectmorph/renderer/relation/RelationRenderer.java index 4a71419..f8a018e 100644 --- a/objectmorph-renderer/src/main/java/com/github/mohamedennahdi/objectmorph/renderer/relation/RelationRenderer.java +++ b/objectmorph-renderer/src/main/java/com/github/mohamedennahdi/objectmorph/renderer/relation/RelationRenderer.java @@ -25,7 +25,7 @@ public List getGeneralizationRelations() { JavaClassInterpreter interpreter2 = interpreters.get(j); if (interpreter1.getSuperClassName().equals(interpreter2.getClassName())) { - relations.add(new Relation(interpreter2.getClassName(), interpreter1.getSuperClassName(), LinkTypes.GENERALIZATION)); + relations.add(new Relation(interpreter1.getClassName(), interpreter2.getClassName(), LinkTypes.GENERALIZATION)); } else if (interpreter2.getSuperClassName().equals(interpreter1.getClassName())) { relations.add(new Relation(interpreter2.getClassName(), interpreter1.getClassName(), LinkTypes.GENERALIZATION)); } @@ -60,14 +60,16 @@ private List establishRelation(JavaClassInterpreter interpreter1, Java for (FieldDeclaration fieldDeclaration : fields1) { VariableDeclarator varDecl = fieldDeclaration.getVariables().get(0); if (varDecl.getTypeAsString().equalsIgnoreCase(interpreter2.getClassName())) { - relations.add(new Relation(interpreter1.getClassName(), interpreter2.getClassName(), LinkTypes.ASSOCIATION)); + if (!relations.stream().anyMatch(e -> e.getFrom().equals(interpreter1.getClassName()))) + relations.add(new Relation(interpreter1.getClassName(), interpreter2.getClassName(), LinkTypes.ASSOCIATION)); } } for (FieldDeclaration fieldDeclaration : fields2) { VariableDeclarator varDecl = fieldDeclaration.getVariables().get(0); if (varDecl.getTypeAsString().equalsIgnoreCase(interpreter1.getClassName())) { - relations.add(new Relation(interpreter2.getClassName(), interpreter1.getClassName(), LinkTypes.ASSOCIATION)); + if (!relations.stream().anyMatch(e -> e.getFrom().equals(interpreter2.getClassName()))) + relations.add(new Relation(interpreter2.getClassName(), interpreter1.getClassName(), LinkTypes.ASSOCIATION)); } }