mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 11:46:38 +08:00
Store user and time for last deserialize
With this commit after every deserialize operation the user, date and time are stored in repo xml. The information is shown in repo overview.
This commit is contained in:
parent
5d439e3699
commit
335759f741
|
@ -79,10 +79,18 @@ CLASS zcl_abapgit_persistence_repo DEFINITION
|
|||
zcx_abapgit_exception .
|
||||
METHODS update_local_settings
|
||||
IMPORTING
|
||||
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
|
||||
!is_settings TYPE zif_abapgit_persistence=>ty_repo_xml-local_settings
|
||||
iv_key TYPE zif_abapgit_persistence=>ty_repo-key
|
||||
is_settings TYPE zif_abapgit_persistence=>ty_repo_xml-local_settings
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS update_deserialized
|
||||
IMPORTING
|
||||
iv_key TYPE zif_abapgit_persistence=>ty_value
|
||||
iv_deserialized_at TYPE timestampl
|
||||
iv_deserialized_by TYPE xubname
|
||||
RAISING
|
||||
zcx_abapgit_exception.
|
||||
|
||||
PRIVATE SECTION.
|
||||
|
||||
DATA mo_db TYPE REF TO zcl_abapgit_persistence_db .
|
||||
|
@ -444,4 +452,34 @@ CLASS zcl_abapgit_persistence_repo IMPLEMENTATION.
|
|||
iv_data = ls_content-data_str ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD update_deserialized.
|
||||
|
||||
DATA: lt_content TYPE zif_abapgit_persistence=>tt_content,
|
||||
ls_content LIKE LINE OF lt_content,
|
||||
ls_repo TYPE zif_abapgit_persistence=>ty_repo.
|
||||
|
||||
ASSERT NOT iv_key IS INITIAL.
|
||||
|
||||
TRY.
|
||||
ls_repo = read( iv_key ).
|
||||
CATCH zcx_abapgit_not_found.
|
||||
zcx_abapgit_exception=>raise( 'key not found' ).
|
||||
ENDTRY.
|
||||
|
||||
IF iv_deserialized_at IS NOT INITIAL.
|
||||
ls_repo-deserialized_at = iv_deserialized_at.
|
||||
ENDIF.
|
||||
|
||||
IF iv_deserialized_by IS NOT INITIAL.
|
||||
ls_repo-deserialized_by = iv_deserialized_by.
|
||||
ENDIF.
|
||||
|
||||
ls_content-data_str = to_xml( ls_repo ).
|
||||
|
||||
mo_db->update( iv_type = zcl_abapgit_persistence_db=>c_type_repo
|
||||
iv_value = iv_key
|
||||
iv_data = ls_content-data_str ).
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
|
|
@ -35,6 +35,8 @@ INTERFACE zif_abapgit_persistence PUBLIC.
|
|||
package TYPE devclass,
|
||||
created_by TYPE xubname,
|
||||
created_at TYPE timestampl,
|
||||
deserialized_by TYPE xubname,
|
||||
deserialized_at TYPE timestampl,
|
||||
offline TYPE sap_bool,
|
||||
local_checksums TYPE ty_local_checksum_tt,
|
||||
dot_abapgit TYPE zif_abapgit_dot_abapgit=>ty_dot_abapgit,
|
||||
|
|
|
@ -28,6 +28,8 @@ CLASS zcl_abapgit_gui_page_repo_over DEFINITION
|
|||
branch TYPE string,
|
||||
created_by TYPE string,
|
||||
created_at TYPE string,
|
||||
deserialized_by TYPE string,
|
||||
deserialized_at TYPE string,
|
||||
END OF ty_overview,
|
||||
tty_overview TYPE STANDARD TABLE OF ty_overview
|
||||
WITH NON-UNIQUE DEFAULT KEY.
|
||||
|
@ -164,7 +166,9 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
|
|||
AND package NS mv_filter
|
||||
AND branch NS mv_filter
|
||||
AND created_by NS mv_filter
|
||||
AND created_at NS mv_filter.
|
||||
AND created_at NS mv_filter
|
||||
AND deserialized_by NS mv_filter
|
||||
AND deserialized_at NS mv_filter.
|
||||
|
||||
ENDIF.
|
||||
|
||||
|
@ -242,6 +246,17 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
|
|||
ls_overview-created_at = |{ lv_date DATE = USER } { lv_time TIME = USER }|.
|
||||
ENDIF.
|
||||
|
||||
ls_overview-deserialized_by = <ls_repo>-deserialized_by.
|
||||
|
||||
IF <ls_repo>-deserialized_at IS NOT INITIAL.
|
||||
CONVERT TIME STAMP <ls_repo>-deserialized_at
|
||||
TIME ZONE mv_time_zone
|
||||
INTO DATE lv_date
|
||||
TIME lv_time.
|
||||
|
||||
ls_overview-deserialized_at = |{ lv_date DATE = USER } { lv_time TIME = USER }|.
|
||||
ENDIF.
|
||||
|
||||
INSERT ls_overview INTO TABLE rt_overview.
|
||||
|
||||
ENDLOOP.
|
||||
|
@ -406,6 +421,8 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
|
|||
io_html->add( |<th>Branch name</th>| ).
|
||||
io_html->add( |<th>Creator</th>| ).
|
||||
io_html->add( |<th>Created at [{ mv_time_zone }]</th>| ).
|
||||
io_html->add( |<th>Deserialized by</th>| ).
|
||||
io_html->add( |<th>Deserialized at [{ mv_time_zone }]</th>| ).
|
||||
io_html->add( |<th></th>| ).
|
||||
io_html->add( '</tr>' ).
|
||||
io_html->add( '</thead>' ).
|
||||
|
@ -473,6 +490,8 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
|
|||
io_html->add( |<td>{ <ls_overview>-branch }</td>| ).
|
||||
io_html->add( |<td>{ <ls_overview>-created_by }</td>| ).
|
||||
io_html->add( |<td>{ <ls_overview>-created_at }</td>| ).
|
||||
io_html->add( |<td>{ <ls_overview>-deserialized_by }</td>| ).
|
||||
io_html->add( |<td>{ <ls_overview>-deserialized_at }</td>| ).
|
||||
io_html->add( |<td>| ).
|
||||
io_html->add( |</td>| ).
|
||||
io_html->add( |</tr>| ).
|
||||
|
@ -510,6 +529,12 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
|
|||
add_order_by_option( iv_option = |CREATED_AT|
|
||||
io_html = io_html ).
|
||||
|
||||
add_order_by_option( iv_option = |DESERIALIZED_BY|
|
||||
io_html = io_html ).
|
||||
|
||||
add_order_by_option( iv_option = |DESERIALIZED_AT|
|
||||
io_html = io_html ).
|
||||
|
||||
io_html->add( |</select>| ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
|
|
@ -110,7 +110,6 @@ CLASS zcl_abapgit_repo DEFINITION
|
|||
|
||||
|
||||
PROTECTED SECTION.
|
||||
|
||||
DATA mt_local TYPE zif_abapgit_definitions=>ty_files_item_tt .
|
||||
DATA mt_remote TYPE zif_abapgit_definitions=>ty_files_tt .
|
||||
DATA mv_do_local_refresh TYPE abap_bool .
|
||||
|
@ -127,6 +126,14 @@ CLASS zcl_abapgit_repo DEFINITION
|
|||
!iv_offline TYPE zif_abapgit_persistence=>ty_repo-offline OPTIONAL
|
||||
!is_dot_abapgit TYPE zif_abapgit_persistence=>ty_repo-dot_abapgit OPTIONAL
|
||||
!is_local_settings TYPE zif_abapgit_persistence=>ty_repo-local_settings OPTIONAL
|
||||
!iv_deserialized_at TYPE zif_abapgit_persistence=>ty_repo-deserialized_at OPTIONAL
|
||||
!iv_deserialized_by TYPE zif_abapgit_persistence=>ty_repo-deserialized_by OPTIONAL
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
|
||||
PRIVATE SECTION.
|
||||
METHODS:
|
||||
update_last_deserialize
|
||||
RAISING
|
||||
zcx_abapgit_exception.
|
||||
|
||||
|
@ -215,6 +222,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
|||
CLEAR: mt_local, mv_last_serialization.
|
||||
|
||||
update_local_checksums( lt_updated_files ).
|
||||
update_last_deserialize( ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
@ -494,7 +502,9 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
|||
OR iv_head_branch IS SUPPLIED
|
||||
OR iv_offline IS SUPPLIED
|
||||
OR is_dot_abapgit IS SUPPLIED
|
||||
OR is_local_settings IS SUPPLIED.
|
||||
OR is_local_settings IS SUPPLIED
|
||||
OR iv_deserialized_by IS SUPPLIED
|
||||
OR iv_deserialized_at IS SUPPLIED.
|
||||
|
||||
CREATE OBJECT lo_persistence.
|
||||
|
||||
|
@ -547,6 +557,15 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
|||
ms_data-local_settings = is_local_settings.
|
||||
ENDIF.
|
||||
|
||||
IF iv_deserialized_at IS SUPPLIED
|
||||
OR iv_deserialized_by IS SUPPLIED.
|
||||
lo_persistence->update_deserialized(
|
||||
iv_key = ms_data-key
|
||||
iv_deserialized_at = iv_deserialized_at
|
||||
iv_deserialized_by = iv_deserialized_by ).
|
||||
ms_data-deserialized_at = iv_deserialized_at.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
|
@ -648,5 +667,17 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
|||
ENDMETHOD. " update_local_checksums
|
||||
|
||||
|
||||
METHOD update_last_deserialize.
|
||||
|
||||
DATA: lv_deserialized_at TYPE zif_abapgit_persistence=>ty_repo-deserialized_at,
|
||||
lv_deserialized_by TYPE zif_abapgit_persistence=>ty_repo-deserialized_by.
|
||||
|
||||
GET TIME STAMP FIELD lv_deserialized_at.
|
||||
lv_deserialized_by = sy-uname.
|
||||
|
||||
set( iv_deserialized_at = lv_deserialized_at
|
||||
iv_deserialized_by = lv_deserialized_by ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
|
Loading…
Reference in New Issue
Block a user