From f0471581ff82adbaefdecd0e616cd05bb77cdd6e Mon Sep 17 00:00:00 2001 From: Ernesto Posse Date: Fri, 16 Feb 2024 17:44:03 -0500 Subject: [PATCH 1/3] Issue #493: change IDL generation replacing //@top-level with @nested Signed-off-by: Ernesto Posse --- .../writers/AxciomaWriterSwitch.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AxciomaWriterSwitch.java b/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AxciomaWriterSwitch.java index 694bcbdba..db2b369c7 100644 --- a/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AxciomaWriterSwitch.java +++ b/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AxciomaWriterSwitch.java @@ -338,13 +338,13 @@ public Object caseUnionType(UnionType object) { @Override public Object caseStructType(StructType object) { - String commentString = "//@top-level false"; + boolean nested = false; EAnnotation annotation = object.getEAnnotation(AnnotationUtil.ZCX_ANNOTATION); - if( annotation != null ) { + if (annotation != null) { String topLevel = annotation.getDetails().get("toplevel"); - if( topLevel != null && topLevel.matches("true")) { - commentString = "//@top-level true"; + if (topLevel != null && topLevel.matches("true")) { + nested = true; } } @@ -363,10 +363,15 @@ public Object caseStructType(StructType object) { // if AXCIOMA String extensibility = "@final"; - if(object.isIsAppendable()) { + if (object.isIsAppendable()) { extensibility = "@appendable"; } buf.append(String.format("%s%s%n", indentString, extensibility)); + String nestedAnnotation = "@nested(FALSE)"; + if (!nested) { + nestedAnnotation = "@nested(TRUE)"; + } + buf.append(String.format("%s%s%n", indentString, nestedAnnotation)); buf.append(String.format("%sstruct %s {%n", indentString, @@ -376,8 +381,8 @@ public Object caseStructType(StructType object) { doSwitch(m); } popScope(); - buf.append(String.format("%s}; %s%n", - indentString, commentString)); + buf.append(String.format("%s}; %n", + indentString)); conditionalNewLine(); return buf.toString(); } From 0d7166f66547b072c57172317cd4bc4885c0570a Mon Sep 17 00:00:00 2001 From: Ernesto Posse Date: Wed, 21 Feb 2024 13:13:40 -0500 Subject: [PATCH 2/3] Issue #493: Refactored nested annotation logic Signed-off-by: Ernesto Posse --- .../ccm/generator/writers/AtcdWriterSwitch.java | 14 ++++++++++---- .../ccm/generator/writers/AxciomaWriterSwitch.java | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AtcdWriterSwitch.java b/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AtcdWriterSwitch.java index 388b076e5..ccc0dabec 100644 --- a/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AtcdWriterSwitch.java +++ b/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AtcdWriterSwitch.java @@ -284,13 +284,13 @@ private Map getEntityInfo(Object model) { @Override public Object caseStructType(StructType object) { - String commentString = "//@top-level false"; + boolean nested = true; EAnnotation annotation = object.getEAnnotation(AnnotationUtil.ZCX_ANNOTATION); if( annotation != null ) { String topLevel = annotation.getDetails().get("toplevel"); if( topLevel != null && topLevel.matches("true")) { - commentString = "//@top-level true"; + nested = false; } } @@ -307,6 +307,12 @@ public Object caseStructType(StructType object) { } } + String nestedAnnotation = "@nested(FALSE)"; + if (nested) { + nestedAnnotation = "@nested(TRUE)"; + } + buf.append(String.format("%s%s%n", indentString, nestedAnnotation)); + buf.append(String.format("%sstruct %s {%n", indentString, object.getName())); @@ -315,8 +321,8 @@ public Object caseStructType(StructType object) { doSwitch(m); } popScope(); - buf.append(String.format("%s}; %s%n", - indentString, commentString)); + buf.append(String.format("%s};%n", + indentString)); conditionalNewLine(); return buf.toString(); } diff --git a/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AxciomaWriterSwitch.java b/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AxciomaWriterSwitch.java index db2b369c7..6a4f50ea6 100644 --- a/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AxciomaWriterSwitch.java +++ b/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AxciomaWriterSwitch.java @@ -338,13 +338,13 @@ public Object caseUnionType(UnionType object) { @Override public Object caseStructType(StructType object) { - boolean nested = false; + boolean nested = true; EAnnotation annotation = object.getEAnnotation(AnnotationUtil.ZCX_ANNOTATION); if (annotation != null) { String topLevel = annotation.getDetails().get("toplevel"); if (topLevel != null && topLevel.matches("true")) { - nested = true; + nested = false; } } @@ -368,7 +368,7 @@ public Object caseStructType(StructType object) { } buf.append(String.format("%s%s%n", indentString, extensibility)); String nestedAnnotation = "@nested(FALSE)"; - if (!nested) { + if (nested) { nestedAnnotation = "@nested(TRUE)"; } buf.append(String.format("%s%s%n", indentString, nestedAnnotation)); From 15bf14ab0dc3f86d346368ba06e99e809f098de7 Mon Sep 17 00:00:00 2001 From: Ernesto Posse Date: Wed, 21 Feb 2024 14:06:17 -0500 Subject: [PATCH 3/3] Issue #493: Undo AtcdWriter update Signed-off-by: Ernesto Posse --- .../ccm/generator/writers/AtcdWriterSwitch.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AtcdWriterSwitch.java b/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AtcdWriterSwitch.java index ccc0dabec..388b076e5 100644 --- a/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AtcdWriterSwitch.java +++ b/bundles/com.zeligsoft.domain.ngc.ccm.generator/src/com/zeligsoft/domain/ngc/ccm/generator/writers/AtcdWriterSwitch.java @@ -284,13 +284,13 @@ private Map getEntityInfo(Object model) { @Override public Object caseStructType(StructType object) { - boolean nested = true; + String commentString = "//@top-level false"; EAnnotation annotation = object.getEAnnotation(AnnotationUtil.ZCX_ANNOTATION); if( annotation != null ) { String topLevel = annotation.getDetails().get("toplevel"); if( topLevel != null && topLevel.matches("true")) { - nested = false; + commentString = "//@top-level true"; } } @@ -307,12 +307,6 @@ public Object caseStructType(StructType object) { } } - String nestedAnnotation = "@nested(FALSE)"; - if (nested) { - nestedAnnotation = "@nested(TRUE)"; - } - buf.append(String.format("%s%s%n", indentString, nestedAnnotation)); - buf.append(String.format("%sstruct %s {%n", indentString, object.getName())); @@ -321,8 +315,8 @@ public Object caseStructType(StructType object) { doSwitch(m); } popScope(); - buf.append(String.format("%s};%n", - indentString)); + buf.append(String.format("%s}; %s%n", + indentString, commentString)); conditionalNewLine(); return buf.toString(); }