mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 04:08:27 +08:00
refactoring
This commit is contained in:
parent
5556c76293
commit
9eafa5695f
|
@ -231,14 +231,14 @@ CLASS lcl_objects_files DEFINITION FINAL.
|
|||
add
|
||||
IMPORTING is_file TYPE ty_file,
|
||||
add_raw
|
||||
IMPORTING iv_extra TYPE clike OPTIONAL
|
||||
iv_ext TYPE string
|
||||
iv_data TYPE xstring
|
||||
IMPORTING iv_extra TYPE clike OPTIONAL
|
||||
iv_ext TYPE string
|
||||
iv_data TYPE xstring
|
||||
RAISING lcx_exception,
|
||||
read_raw
|
||||
IMPORTING iv_extra TYPE clike OPTIONAL
|
||||
iv_ext TYPE string
|
||||
RETURNING VALUE(rv_data) TYPE xstring
|
||||
IMPORTING iv_extra TYPE clike OPTIONAL
|
||||
iv_ext TYPE string
|
||||
RETURNING VALUE(rv_data) TYPE xstring
|
||||
RAISING lcx_exception,
|
||||
get_files
|
||||
RETURNING VALUE(rt_files) TYPE ty_files_tt,
|
||||
|
@ -323,7 +323,7 @@ INTERFACE lif_object.
|
|||
RAISING lcx_exception.
|
||||
METHODS:
|
||||
compare_to_remote_version
|
||||
IMPORTING io_remote_version_xml TYPE REF TO lcl_xml_input
|
||||
IMPORTING io_remote_version_xml TYPE REF TO lcl_xml_input
|
||||
RETURNING VALUE(ro_comparison_result) TYPE REF TO lif_object_comparison_result
|
||||
RAISING lcx_exception.
|
||||
|
||||
|
@ -794,7 +794,7 @@ CLASS lcl_objects_bridge IMPLEMENTATION.
|
|||
ENDMETHOD. "class_constructor
|
||||
|
||||
METHOD lif_object~compare_to_remote_version.
|
||||
CREATE OBJECT ro_comparison_result TYPE lcl_null_comparison_result.
|
||||
CREATE OBJECT ro_comparison_result TYPE lcl_null_comparison_result.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS. "lcl_objects_bridge IMPLEMENTATION
|
||||
|
@ -1735,4 +1735,12 @@ CLASS lcl_objects DEFINITION FINAL.
|
|||
IMPORTING is_item TYPE ty_item
|
||||
RAISING lcx_exception.
|
||||
|
||||
CLASS-METHODS compare_remote_to_local
|
||||
IMPORTING
|
||||
io_object TYPE REF TO lif_object
|
||||
it_remote TYPE ty_files_tt
|
||||
is_result TYPE ty_result
|
||||
RAISING
|
||||
lcx_exception.
|
||||
|
||||
ENDCLASS. "lcl_object DEFINITION
|
|
@ -589,20 +589,18 @@ CLASS lcl_objects IMPLEMENTATION.
|
|||
|
||||
METHOD deserialize.
|
||||
|
||||
DATA: ls_item TYPE ty_item,
|
||||
lv_cancel TYPE abap_bool,
|
||||
li_obj TYPE REF TO lif_object,
|
||||
lt_remote TYPE ty_files_tt,
|
||||
ls_remote_file LIKE LINE OF lt_remote,
|
||||
lv_package TYPE devclass,
|
||||
lo_files TYPE REF TO lcl_objects_files,
|
||||
lo_xml TYPE REF TO lcl_xml_input,
|
||||
lt_results TYPE ty_results_tt,
|
||||
lt_late TYPE TABLE OF ty_late,
|
||||
lo_current_version TYPE REF TO lcl_xml_input,
|
||||
lo_comparison_result TYPE REF TO lif_object_comparison_result.
|
||||
DATA: ls_item TYPE ty_item,
|
||||
lv_cancel TYPE abap_bool,
|
||||
li_obj TYPE REF TO lif_object,
|
||||
lt_remote TYPE ty_files_tt,
|
||||
ls_remote_file TYPE ty_file,
|
||||
lv_package TYPE devclass,
|
||||
lo_files TYPE REF TO lcl_objects_files,
|
||||
lo_xml TYPE REF TO lcl_xml_input,
|
||||
lt_results TYPE ty_results_tt,
|
||||
lt_late TYPE TABLE OF ty_late.
|
||||
|
||||
FIELD-SYMBOLS: <ls_result> LIKE LINE OF lt_results,
|
||||
FIELD-SYMBOLS: <ls_result> TYPE ty_result,
|
||||
<ls_late> LIKE LINE OF lt_late.
|
||||
|
||||
|
||||
|
@ -658,25 +656,10 @@ CLASS lcl_objects IMPLEMENTATION.
|
|||
iv_language = io_repo->get_master_language( )
|
||||
is_metadata = lo_xml->get_metadata( ) ).
|
||||
|
||||
|
||||
IF <ls_result>-filename CS '.XML'.
|
||||
READ TABLE lt_remote WITH KEY filename = <ls_result>-filename INTO ls_remote_file.
|
||||
|
||||
"if file does not exist in remote, we don't need to validate
|
||||
IF sy-subrc = 0.
|
||||
CREATE OBJECT lo_current_version
|
||||
EXPORTING
|
||||
iv_xml = lcl_convert=>xstring_to_string_utf8( ls_remote_file-data ).
|
||||
lo_comparison_result = li_obj->compare_to_remote_version( lo_current_version ).
|
||||
lo_comparison_result->show_confirmation_dialog( ).
|
||||
|
||||
IF lo_comparison_result->is_result_complete_halt( ) = abap_true.
|
||||
RAISE EXCEPTION TYPE lcx_exception
|
||||
EXPORTING
|
||||
iv_text = 'Deserialization aborted by user'.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
compare_remote_to_local(
|
||||
io_object = li_obj
|
||||
it_remote = lt_remote
|
||||
is_result = <ls_result> ).
|
||||
|
||||
li_obj->mo_files = lo_files.
|
||||
|
||||
|
@ -710,4 +693,34 @@ CLASS lcl_objects IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD. "deserialize
|
||||
|
||||
|
||||
METHOD compare_remote_to_local.
|
||||
|
||||
DATA ls_remote_file TYPE ty_file.
|
||||
|
||||
DATA:
|
||||
lo_remote_version TYPE REF TO lcl_xml_input,
|
||||
lo_comparison_result TYPE REF TO lif_object_comparison_result.
|
||||
|
||||
IF is_result-filename CS '.XML'.
|
||||
READ TABLE it_remote WITH KEY filename = is_result-filename INTO ls_remote_file.
|
||||
|
||||
"if file does not exist in remote, we don't need to validate
|
||||
IF sy-subrc = 0.
|
||||
CREATE OBJECT lo_remote_version
|
||||
EXPORTING
|
||||
iv_xml = lcl_convert=>xstring_to_string_utf8( ls_remote_file-data ).
|
||||
lo_comparison_result = io_object->compare_to_remote_version( lo_remote_version ).
|
||||
lo_comparison_result->show_confirmation_dialog( ).
|
||||
|
||||
IF lo_comparison_result->is_result_complete_halt( ) = abap_true.
|
||||
RAISE EXCEPTION TYPE lcx_exception
|
||||
EXPORTING
|
||||
iv_text = 'Deserialization aborted by user'.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS. "lcl_objects IMPLEMENTATION
|
Loading…
Reference in New Issue
Block a user