generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create reusable include for AFF generation (#309)
* Create reusable include for AFF generation The AFF generators will be needed in SAP BASIS coding. To be able to reuse the open sourced generators, one single include is created to export the generator functionality. * Enable upload-standalone for pull requests for testing * Revert "Enable upload-standalone for pull requests for testing" This reverts commit 5517752.
- Loading branch information
1 parent
8f38594
commit c15a8b1
Showing
5 changed files
with
100 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
CLASS lcl_aff_generator DEFINITION CREATE PRIVATE. | ||
|
||
PUBLIC SECTION. | ||
CLASS-METHODS: | ||
"! Generates the AFF JSON schema. | ||
"! | ||
"! @parameter schema_id | The id that should be written in the $id field of the schema | ||
"! @parameter data | The type where the schema should be generated from | ||
"! @parameter format_version | The version of the ABAP file format as integer | ||
"! @parameter result | The generated schema as string | ||
generate_schema | ||
IMPORTING schema_id TYPE string | ||
data TYPE data | ||
format_version TYPE i | ||
RETURNING VALUE(result) TYPE string | ||
RAISING zcx_aff_tools, | ||
|
||
"! Generates the AFF XSLT transformation. | ||
"! | ||
"! @parameter data | The type where the schema should be generated from | ||
"! @parameter result | The generated XSLT as string | ||
generate_xslt | ||
IMPORTING data TYPE data | ||
RETURNING VALUE(result) TYPE string | ||
RAISING zcx_aff_tools. | ||
|
||
ENDCLASS. | ||
|
||
CLASS lcl_aff_generator IMPLEMENTATION. | ||
|
||
METHOD generate_schema. | ||
DATA(schema_writer) = NEW zcl_aff_writer_json_schema( schema_id = schema_id | ||
format_version = format_version ). | ||
DATA(generator) = NEW zcl_aff_generator( schema_writer ). | ||
DATA(result_table) = generator->zif_aff_generator~generate_type( data ). | ||
CONCATENATE LINES OF result_table INTO result SEPARATED BY cl_abap_char_utilities=>newline. | ||
ENDMETHOD. | ||
|
||
METHOD generate_xslt. | ||
DATA(xslt_writer) = NEW zcl_aff_writer_xslt( ). | ||
DATA(generator) = NEW zcl_aff_generator( xslt_writer ). | ||
DATA(result_table) = generator->zif_aff_generator~generate_type( data ). | ||
CONCATENATE LINES OF result_table INTO result SEPARATED BY cl_abap_char_utilities=>newline. | ||
ENDMETHOD. | ||
|
||
ENDCLASS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0"> | ||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> | ||
<asx:values> | ||
<PROGDIR> | ||
<NAME>Z_AFF_GENERATOR</NAME> | ||
<DBAPL>S</DBAPL> | ||
<DBNA>D$</DBNA> | ||
<SUBC>I</SUBC> | ||
<FIXPT>X</FIXPT> | ||
<LDBNAME>D$S</LDBNAME> | ||
<UCCHECK>X</UCCHECK> | ||
</PROGDIR> | ||
<TPOOL> | ||
<item> | ||
<ID>R</ID> | ||
<ENTRY>Reuse include for AFF generator</ENTRY> | ||
<LENGTH>31</LENGTH> | ||
</item> | ||
</TPOOL> | ||
</asx:values> | ||
</asx:abap> | ||
</abapGit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters