Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | CLASS zcl_abapgit_apack_writer DEFINITION
PUBLIC
FINAL
CREATE PRIVATE .
PUBLIC SECTION.
CLASS-METHODS create_instance
IMPORTING
!is_apack_manifest_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor
RETURNING
VALUE(ro_manifest_writer) TYPE REF TO zcl_abapgit_apack_writer .
METHODS serialize
RETURNING
VALUE(rv_xml) TYPE string
RAISING
zcx_abapgit_exception .
METHODS constructor
IMPORTING
!is_apack_manifest_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor .
PROTECTED SECTION.
PRIVATE SECTION.
DATA ms_manifest_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor .
ENDCLASS.
CLASS zcl_abapgit_apack_writer IMPLEMENTATION.
METHOD constructor.
ms_manifest_descriptor = is_apack_manifest_descriptor.
ENDMETHOD.
METHOD create_instance.
CREATE OBJECT ro_manifest_writer EXPORTING is_apack_manifest_descriptor = is_apack_manifest_descriptor.
ENDMETHOD.
METHOD serialize.
DATA: ls_manifest_descriptor LIKE ms_manifest_descriptor.
FIELD-SYMBOLS: <ls_dependency> LIKE LINE OF ls_manifest_descriptor-dependencies.
" Setting repository type automatically to 'abapGit' as there is no other one right now
ms_manifest_descriptor-repository_type = zif_abapgit_apack_definitions=>c_repository_type_abapgit.
ls_manifest_descriptor = ms_manifest_descriptor.
CLEAR: ls_manifest_descriptor-sem_version.
LOOP AT ls_manifest_descriptor-dependencies ASSIGNING <ls_dependency>.
CLEAR: <ls_dependency>-sem_version.
ENDLOOP.
CALL TRANSFORMATION id
OPTIONS initial_components = 'suppress'
SOURCE data = ls_manifest_descriptor
RESULT XML rv_xml.
rv_xml = zcl_abapgit_xml_pretty=>print( rv_xml ).
REPLACE FIRST OCCURRENCE
OF REGEX '<\?xml version="1\.0" encoding="[\w-]+"\?>'
IN rv_xml
WITH '<?xml version="1.0" encoding="utf-8"?>'.
ENDMETHOD.
ENDCLASS.
|