hexsha
stringlengths 40
40
| size
int64 356
30.6k
| ext
stringclasses 1
value | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 27
62
| max_stars_repo_name
stringclasses 16
values | max_stars_repo_head_hexsha
stringclasses 16
values | max_stars_repo_licenses
sequence | max_stars_count
int64 199
797
| max_stars_repo_stars_event_min_datetime
stringclasses 5
values | max_stars_repo_stars_event_max_datetime
stringclasses 5
values | max_issues_repo_path
stringlengths 28
62
| max_issues_repo_name
stringclasses 15
values | max_issues_repo_head_hexsha
stringclasses 15
values | max_issues_repo_licenses
sequence | max_issues_count
int64 278
2.78k
| max_issues_repo_issues_event_min_datetime
stringclasses 5
values | max_issues_repo_issues_event_max_datetime
stringclasses 5
values | max_forks_repo_path
stringlengths 28
62
| max_forks_repo_name
stringclasses 15
values | max_forks_repo_head_hexsha
stringclasses 15
values | max_forks_repo_licenses
sequence | max_forks_count
int64 59
499
| max_forks_repo_forks_event_min_datetime
stringclasses 5
values | max_forks_repo_forks_event_max_datetime
stringclasses 5
values | text
stringlengths 355
30.6k
| avg_line_length
float64 14.1
51.1
| max_line_length
int64 48
140
| alphanum_fraction
float64 0.46
0.79
| stats
dict | simhash
float64 126,633,855B
18,322,467,230B
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7413ec96dcef18660c1c9193a3bf5ceb94585a0 | 10,730 | abap | ABAP | src/ui/zcl_abapgit_gui_page_tag.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/ui/zcl_abapgit_gui_page_tag.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/ui/zcl_abapgit_gui_page_tag.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_gui_page_tag DEFINITION PUBLIC FINAL
CREATE PUBLIC INHERITING FROM zcl_abapgit_gui_page.
PUBLIC SECTION.
CONSTANTS: BEGIN OF c_action,
commit_post TYPE string VALUE 'commit_post',
commit_cancel TYPE string VALUE 'commit_cancel',
change_tag_type TYPE string VALUE 'change_tag_type',
END OF c_action.
METHODS:
constructor
IMPORTING io_repo TYPE REF TO zcl_abapgit_repo
RAISING zcx_abapgit_exception,
zif_abapgit_gui_event_handler~on_event REDEFINITION.
PROTECTED SECTION.
METHODS:
render_content REDEFINITION.
PRIVATE SECTION.
CONSTANTS:
BEGIN OF c_tag_type,
lightweight TYPE string VALUE 'lightweight',
annotated TYPE string VALUE 'annotated',
END OF c_tag_type .
DATA mo_repo_online TYPE REF TO zcl_abapgit_repo_online .
DATA mv_selected_type TYPE string .
METHODS render_menu
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html .
METHODS render_form
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
METHODS render_text_input
IMPORTING
!iv_name TYPE string
!iv_label TYPE string
!iv_value TYPE string OPTIONAL
!iv_max_length TYPE string OPTIONAL
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html .
METHODS create_tag
IMPORTING
!ii_event TYPE REF TO zif_abapgit_gui_event
RAISING
zcx_abapgit_exception .
METHODS parse_tag_request
IMPORTING
!ii_event TYPE REF TO zif_abapgit_gui_event
RETURNING
VALUE(rs_git_tag) TYPE zif_abapgit_definitions=>ty_git_tag
RAISING
zcx_abapgit_exception .
METHODS parse_change_tag_type_request
IMPORTING
!it_postdata TYPE zif_abapgit_html_viewer=>ty_post_data .
METHODS render_scripts
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS ZCL_ABAPGIT_GUI_PAGE_TAG IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
mo_repo_online ?= io_repo.
ms_control-page_title = 'Tag'.
mv_selected_type = c_tag_type-lightweight.
ENDMETHOD.
METHOD create_tag.
DATA:
ls_tag TYPE zif_abapgit_definitions=>ty_git_tag,
lx_error TYPE REF TO zcx_abapgit_exception,
lv_text TYPE string.
ls_tag = parse_tag_request( ii_event ).
IF ls_tag-name IS INITIAL.
zcx_abapgit_exception=>raise( |Please supply a tag name| ).
ENDIF.
ls_tag-name = zcl_abapgit_git_tag=>add_tag_prefix( ls_tag-name ).
ASSERT ls_tag-name CP zif_abapgit_definitions=>c_git_branch-tags.
CASE mv_selected_type.
WHEN c_tag_type-lightweight.
ls_tag-type = zif_abapgit_definitions=>c_git_branch_type-lightweight_tag.
WHEN c_tag_type-annotated.
ls_tag-type = zif_abapgit_definitions=>c_git_branch_type-annotated_tag.
WHEN OTHERS.
zcx_abapgit_exception=>raise( |Invalid tag type: { mv_selected_type }| ).
ENDCASE.
TRY.
zcl_abapgit_git_porcelain=>create_tag( iv_url = mo_repo_online->get_url( )
is_tag = ls_tag ).
CATCH zcx_abapgit_exception INTO lx_error.
zcx_abapgit_exception=>raise( |Cannot create tag { ls_tag-name }. Error: '{ lx_error->get_text( ) }'| ).
ENDTRY.
IF ls_tag-type = zif_abapgit_definitions=>c_git_branch_type-lightweight_tag.
lv_text = |Lightweight tag { zcl_abapgit_git_tag=>remove_tag_prefix( ls_tag-name ) } created|.
ELSEIF ls_tag-type = zif_abapgit_definitions=>c_git_branch_type-annotated_tag.
lv_text = |Annotated tag { zcl_abapgit_git_tag=>remove_tag_prefix( ls_tag-name ) } created|.
ENDIF.
MESSAGE lv_text TYPE 'S'.
ENDMETHOD.
METHOD parse_change_tag_type_request.
FIELD-SYMBOLS <lv_postdata> LIKE LINE OF it_postdata.
READ TABLE it_postdata ASSIGNING <lv_postdata> INDEX 1.
IF sy-subrc = 0.
FIND FIRST OCCURRENCE OF REGEX `type=(.*)` IN <lv_postdata> SUBMATCHES mv_selected_type.
ENDIF.
mv_selected_type = condense( mv_selected_type ).
ENDMETHOD.
METHOD parse_tag_request.
DATA lo_map TYPE REF TO zcl_abapgit_string_map.
lo_map = ii_event->form_data( ).
lo_map->strict( abap_false ). " Hack, refactor !
lo_map->to_abap( CHANGING cs_container = rs_git_tag ).
REPLACE ALL OCCURRENCES
OF zif_abapgit_definitions=>c_crlf
IN rs_git_tag-body
WITH zif_abapgit_definitions=>c_newline.
ENDMETHOD.
METHOD render_content.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( '<div class="repo">' ).
ri_html->add( render_menu( ) ).
ri_html->add( render_form( ) ).
ri_html->add( '</div>' ).
register_deferred_script( render_scripts( ) ).
ENDMETHOD.
METHOD render_form.
CONSTANTS: lc_body_col_max TYPE i VALUE 150.
DATA: li_user TYPE REF TO zif_abapgit_persist_user,
lv_user TYPE string,
lv_email TYPE string,
lv_s_param TYPE string,
lo_settings TYPE REF TO zcl_abapgit_settings,
lv_body_size TYPE i,
lt_type TYPE string_table,
lv_selected TYPE string.
FIELD-SYMBOLS: <lv_type> LIKE LINE OF lt_type.
li_user = zcl_abapgit_persistence_user=>get_instance( ).
lv_user = li_user->get_repo_git_user_name( mo_repo_online->get_url( ) ).
IF lv_user IS INITIAL.
lv_user = li_user->get_default_git_user_name( ).
ENDIF.
IF lv_user IS INITIAL.
" get default from user record
lv_user = zcl_abapgit_user_record=>get_instance( sy-uname )->get_name( ).
ENDIF.
lv_email = li_user->get_repo_git_user_email( mo_repo_online->get_url( ) ).
IF lv_email IS INITIAL.
lv_email = li_user->get_default_git_user_email( ).
ENDIF.
IF lv_email IS INITIAL.
" get default from user record
lv_email = zcl_abapgit_user_record=>get_instance( sy-uname )->get_email( ).
ENDIF.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( '<div class="form-container">' ).
ri_html->add( '<form id="commit_form" class="aligned-form grey70"'
&& ' method="post" action="">' ).
INSERT c_tag_type-lightweight
INTO TABLE lt_type.
INSERT c_tag_type-annotated
INTO TABLE lt_type.
ri_html->add( '<div class="row">' ).
ri_html->add( 'Tag type <select name="folder_logic" onchange="onTagTypeChange(this)">' ).
LOOP AT lt_type ASSIGNING <lv_type>.
IF mv_selected_type = <lv_type>.
lv_selected = 'selected'.
ELSE.
CLEAR: lv_selected.
ENDIF.
ri_html->add( |<option value="{ <lv_type> }" | && |{ lv_selected }>| && |{ <lv_type> }</option>| ).
ENDLOOP.
ri_html->add( '</div>' ).
ri_html->add( '</select>' ).
ri_html->add( '<br>' ).
ri_html->add( '<br>' ).
ri_html->add( render_text_input( iv_name = 'sha1'
iv_label = 'SHA1'
iv_value = mo_repo_online->get_current_remote( ) ) ).
ri_html->add( render_text_input( iv_name = 'name'
iv_label = 'tag name' ) ).
IF mv_selected_type = c_tag_type-annotated.
ri_html->add( render_text_input( iv_name = 'tagger_name'
iv_label = 'tagger name'
iv_value = lv_user ) ).
ri_html->add( render_text_input( iv_name = 'tagger_email'
iv_label = 'tagger e-mail'
iv_value = lv_email ) ).
lo_settings = zcl_abapgit_persist_factory=>get_settings( )->read( ).
lv_s_param = lo_settings->get_commitmsg_comment_length( ).
ri_html->add( render_text_input( iv_name = 'message'
iv_label = 'message'
iv_max_length = lv_s_param ) ).
ri_html->add( '<div class="row">' ).
ri_html->add( '<label for="c-body">body</label>' ).
lv_body_size = lo_settings->get_commitmsg_body_size( ).
IF lv_body_size > lc_body_col_max.
lv_body_size = lc_body_col_max.
ENDIF.
ri_html->add( |<textarea id="c-body" name="body" rows="10" cols="{ lv_body_size }"></textarea>| ).
ENDIF.
ri_html->add( '<input type="submit" class="hidden-submit">' ).
ri_html->add( '</div>' ).
ri_html->add( '</form>' ).
ri_html->add( '</div>' ).
ENDMETHOD.
METHOD render_menu.
DATA lo_toolbar TYPE REF TO zcl_abapgit_html_toolbar.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
CREATE OBJECT lo_toolbar.
lo_toolbar->add( iv_act = 'submitFormById(''commit_form'');'
iv_txt = 'Create'
iv_typ = zif_abapgit_html=>c_action_type-onclick
iv_opt = zif_abapgit_html=>c_html_opt-strong ).
lo_toolbar->add( iv_act = c_action-commit_cancel
iv_txt = 'Cancel'
iv_opt = zif_abapgit_html=>c_html_opt-cancel ).
ri_html->add( '<div class="paddings">' ).
ri_html->add( lo_toolbar->render( ) ).
ri_html->add( '</div>' ).
ENDMETHOD.
METHOD render_scripts.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->set_title( cl_abap_typedescr=>describe_by_object_ref( me )->get_relative_name( ) ).
ri_html->add( 'setInitialFocus("name");' ).
ENDMETHOD.
METHOD render_text_input.
DATA lv_attrs TYPE string.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
IF iv_value IS NOT INITIAL.
lv_attrs = | value="{ iv_value }"|.
ENDIF.
IF iv_max_length IS NOT INITIAL.
lv_attrs = | maxlength="{ iv_max_length }"|.
ENDIF.
ri_html->add( '<div class="row">' ).
ri_html->add( |<label for="{ iv_name }">{ iv_label }</label>| ).
ri_html->add( |<input id="{ iv_name }" name="{ iv_name }" type="text"{ lv_attrs }>| ).
ri_html->add( '</div>' ).
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event.
CASE ii_event->mv_action.
WHEN c_action-commit_post.
create_tag( ii_event ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back.
WHEN c_action-change_tag_type.
parse_change_tag_type_request( ii_event->mt_postdata ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN c_action-commit_cancel.
rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back.
ENDCASE.
ENDMETHOD.
ENDCLASS. | 29.078591 | 112 | 0.642777 | {
"alnum_ratio": 0.5901578112,
"alpha_token_ratio": 1.6982503365,
"avg_line_length": 29.1005434783,
"char_rep_ratio": 0.1512149533,
"max_line_length": 112,
"num_words": 713,
"text_len": 10709,
"word_rep_ratio": 0
} | 628,723,976,018,621,300 |
f7adc6e42088d51f71135ad00a52b4e7c8a30a6c | 2,626 | abap | ABAP | src/objects/core/zcl_abapgit_item_graph.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/core/zcl_abapgit_item_graph.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/core/zcl_abapgit_item_graph.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_item_graph DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor
IMPORTING
!it_items TYPE zif_abapgit_definitions=>ty_items_tt .
METHODS add_edge
IMPORTING
!is_from TYPE zif_abapgit_definitions=>ty_item
!is_to TYPE zif_abapgit_definitions=>ty_item .
METHODS has_vertices
RETURNING
VALUE(rv_bool) TYPE abap_bool .
METHODS get_next
IMPORTING
!ii_log TYPE REF TO zif_abapgit_log
RETURNING
VALUE(rs_item) TYPE zif_abapgit_definitions=>ty_item .
PRIVATE SECTION.
TYPES: BEGIN OF ty_edge,
from TYPE zif_abapgit_definitions=>ty_item,
to TYPE zif_abapgit_definitions=>ty_item,
END OF ty_edge.
DATA mt_vertices TYPE STANDARD TABLE OF zif_abapgit_definitions=>ty_item WITH DEFAULT KEY.
DATA mt_edges TYPE STANDARD TABLE OF ty_edge WITH DEFAULT KEY.
DATA mv_warning TYPE abap_bool.
METHODS remove_vertex IMPORTING iv_index TYPE i.
ENDCLASS.
CLASS ZCL_ABAPGIT_ITEM_GRAPH IMPLEMENTATION.
METHOD add_edge.
DATA ls_edge LIKE LINE OF mt_edges.
ASSERT is_from IS NOT INITIAL.
ASSERT is_to IS NOT INITIAL.
ls_edge-from = is_from.
ls_edge-to = is_to.
APPEND ls_edge TO mt_edges.
ENDMETHOD.
METHOD constructor.
INSERT LINES OF it_items INTO TABLE mt_vertices.
ENDMETHOD.
METHOD get_next.
* find a vertex with no inbound edges, if it does not exist pick anything
DATA ls_vertex LIKE LINE OF mt_vertices.
DATA lv_index TYPE i.
LOOP AT mt_vertices INTO ls_vertex.
lv_index = sy-tabix.
READ TABLE mt_edges WITH KEY
to-obj_type = ls_vertex-obj_type
to-obj_name = ls_vertex-obj_name
TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
remove_vertex( lv_index ).
rs_item = ls_vertex.
RETURN.
ENDIF.
ENDLOOP.
IF mv_warning = abap_false.
* only issue the warning once per graph
ii_log->add_warning( |Cycle detected in item graph| ).
mv_warning = abap_true.
ENDIF.
READ TABLE mt_vertices INTO rs_item INDEX 1.
ASSERT sy-subrc = 0.
remove_vertex( 1 ).
ENDMETHOD.
METHOD has_vertices.
rv_bool = boolc( lines( mt_vertices ) > 0 ).
ENDMETHOD.
METHOD remove_vertex.
DATA ls_vertex LIKE LINE OF mt_vertices.
READ TABLE mt_vertices INDEX iv_index INTO ls_vertex.
ASSERT sy-subrc = 0.
DELETE mt_vertices INDEX iv_index.
DELETE mt_edges WHERE
from-obj_type = ls_vertex-obj_type AND
from-obj_name = ls_vertex-obj_name.
ENDMETHOD.
ENDCLASS. | 25.009524 | 94 | 0.690784 | {
"alnum_ratio": 0.6502857143,
"alpha_token_ratio": 1.9090909091,
"avg_line_length": 25.2403846154,
"char_rep_ratio": 0.1112385321,
"max_line_length": 94,
"num_words": 248,
"text_len": 2625,
"word_rep_ratio": 0
} | 18,322,467,229,596,588,000 |
f7d57157806c56f64bc21f5bd85f997716b94c23 | 6,968 | abap | ABAP | src/http/zcl_abapgit_http.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/http/zcl_abapgit_http.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/http/zcl_abapgit_http.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_http DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
CONSTANTS:
BEGIN OF c_scheme,
digest TYPE string VALUE 'Digest',
END OF c_scheme .
CLASS-METHODS get_agent
RETURNING
VALUE(rv_agent) TYPE string .
CLASS-METHODS create_by_url
IMPORTING
!iv_url TYPE string
!iv_service TYPE string
RETURNING
VALUE(ro_client) TYPE REF TO zcl_abapgit_http_client
RAISING
zcx_abapgit_exception .
PROTECTED SECTION.
CLASS-METHODS check_auth_requested
IMPORTING
!ii_client TYPE REF TO if_http_client
RETURNING
VALUE(rv_auth_requested) TYPE abap_bool
RAISING
zcx_abapgit_exception .
CLASS-METHODS is_local_system
IMPORTING
!iv_url TYPE string
RETURNING
VALUE(rv_bool) TYPE abap_bool .
CLASS-METHODS acquire_login_details
IMPORTING
!ii_client TYPE REF TO if_http_client
!io_client TYPE REF TO zcl_abapgit_http_client
!iv_url TYPE string
RETURNING
VALUE(rv_scheme) TYPE string
RAISING
zcx_abapgit_exception .
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_abapgit_http IMPLEMENTATION.
METHOD acquire_login_details.
DATA: lv_default_user TYPE string,
lv_user TYPE string,
lv_pass TYPE string,
lo_digest TYPE REF TO zcl_abapgit_http_digest.
lv_default_user = zcl_abapgit_persistence_user=>get_instance( )->get_repo_login( iv_url ).
lv_user = lv_default_user.
zcl_abapgit_password_dialog=>popup(
EXPORTING
iv_repo_url = iv_url
CHANGING
cv_user = lv_user
cv_pass = lv_pass ).
IF lv_user IS INITIAL.
zcx_abapgit_exception=>raise( 'Unauthorized access. Check your credentials' ).
ENDIF.
IF lv_user <> lv_default_user.
zcl_abapgit_persistence_user=>get_instance( )->set_repo_login(
iv_url = iv_url
iv_login = lv_user ).
ENDIF.
rv_scheme = ii_client->response->get_header_field( 'www-authenticate' ).
FIND REGEX '^(\w+)' IN rv_scheme SUBMATCHES rv_scheme.
CASE rv_scheme.
WHEN c_scheme-digest.
*
* e.g. used by
CREATE OBJECT lo_digest
EXPORTING
ii_client = ii_client
iv_username = lv_user
iv_password = lv_pass.
lo_digest->run( ii_client ).
io_client->set_digest( lo_digest ).
WHEN OTHERS.
*
ii_client->authenticate(
username = lv_user
password = lv_pass ).
ENDCASE.
ENDMETHOD.
METHOD check_auth_requested.
DATA: lv_code TYPE i.
ii_client->response->get_status( IMPORTING code = lv_code ).
IF lv_code = 401.
rv_auth_requested = abap_true.
ENDIF.
ENDMETHOD.
METHOD create_by_url.
DATA: lv_uri TYPE string,
lv_scheme TYPE string,
li_client TYPE REF TO if_http_client,
lo_proxy_configuration TYPE REF TO zcl_abapgit_proxy_config,
lv_text TYPE string.
CREATE OBJECT lo_proxy_configuration.
li_client = zcl_abapgit_exit=>get_instance( )->create_http_client( iv_url ).
IF li_client IS NOT BOUND.
cl_http_client=>create_by_url(
EXPORTING
url = zcl_abapgit_url=>host( iv_url )
ssl_id = zcl_abapgit_exit=>get_instance( )->get_ssl_id( )
proxy_host = lo_proxy_configuration->get_proxy_url( iv_url )
proxy_service = lo_proxy_configuration->get_proxy_port( iv_url )
IMPORTING
client = li_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
CASE sy-subrc.
WHEN 1.
" make sure:
" a) SSL is setup properly in STRUST
lv_text = 'HTTPS ARGUMENT_NOT_FOUND | STRUST/SSL Setup correct?'.
WHEN OTHERS.
lv_text = 'While creating HTTP Client'.
ENDCASE.
zcx_abapgit_exception=>raise( lv_text ).
ENDIF.
ENDIF.
IF lo_proxy_configuration->get_proxy_authentication( iv_url ) = abap_true.
zcl_abapgit_proxy_auth=>run( li_client ).
ENDIF.
CREATE OBJECT ro_client
EXPORTING
ii_client = li_client.
IF is_local_system( iv_url ) = abap_true.
li_client->send_sap_logon_ticket( ).
ENDIF.
li_client->request->set_cdata( '' ).
li_client->request->set_header_field(
name = '~request_method'
value = 'GET' ).
li_client->request->set_header_field(
name = 'user-agent'
value = get_agent( ) ).
lv_uri = zcl_abapgit_url=>path_name( iv_url ) &&
'/info/refs?service=git-' &&
iv_service &&
'-pack'.
li_client->request->set_header_field(
name = '~request_uri'
value = lv_uri ).
" Disable internal auth dialog (due to its unclarity)
li_client->propertytype_logon_popup = if_http_client=>co_disabled.
zcl_abapgit_login_manager=>load(
iv_uri = iv_url
ii_client = li_client ).
zcl_abapgit_exit=>get_instance( )->http_client(
iv_url = iv_url
ii_client = li_client ).
ro_client->send_receive( ).
IF check_auth_requested( li_client ) = abap_true.
lv_scheme = acquire_login_details( ii_client = li_client
io_client = ro_client
iv_url = iv_url ).
ro_client->send_receive( ).
ENDIF.
ro_client->check_http_200( ).
IF lv_scheme <> c_scheme-digest.
zcl_abapgit_login_manager=>save( iv_uri = iv_url
ii_client = li_client ).
ENDIF.
ENDMETHOD.
METHOD get_agent.
* bitbucket require agent prefix = "git/"
* also see
rv_agent = |git/2.0 (abapGit { zif_abapgit_version=>c_abap_version })|.
ENDMETHOD.
METHOD is_local_system.
DATA: lv_host TYPE string,
lt_list TYPE zif_abapgit_definitions=>ty_string_tt,
li_exit TYPE REF TO zif_abapgit_exit.
cl_http_server=>get_location( IMPORTING host = lv_host ).
APPEND lv_host TO lt_list.
APPEND 'localhost' TO lt_list.
li_exit = zcl_abapgit_exit=>get_instance( ).
li_exit->change_local_host( CHANGING ct_hosts = lt_list ).
FIND REGEX 'https?://([^/^:]*)' IN iv_url SUBMATCHES lv_host.
READ TABLE lt_list WITH KEY table_line = lv_host TRANSPORTING NO FIELDS.
rv_bool = boolc( sy-subrc = 0 ).
ENDMETHOD.
ENDCLASS. | 28.210526 | 94 | 0.621412 | {
"alnum_ratio": 0.5676952606,
"alpha_token_ratio": 1.7377495463,
"avg_line_length": 27.5325203252,
"char_rep_ratio": 0.1286221171,
"max_line_length": 94,
"num_words": 450,
"text_len": 6773,
"word_rep_ratio": 0
} | 9,234,174,715,337,748,000 |
7989de5cf513c6eddc099f464627fce6d60da13e | 7,268 | abap | ABAP | src/ui/zcl_abapgit_gui_page_main.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/ui/zcl_abapgit_gui_page_main.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/ui/zcl_abapgit_gui_page_main.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_gui_page_main DEFINITION
PUBLIC
FINAL
CREATE PUBLIC INHERITING FROM zcl_abapgit_gui_page.
PUBLIC SECTION.
INTERFACES: zif_abapgit_gui_hotkeys.
METHODS:
constructor
IMPORTING iv_only_favorites TYPE abap_bool
RAISING zcx_abapgit_exception,
zif_abapgit_gui_event_handler~on_event REDEFINITION.
PROTECTED SECTION.
METHODS:
render_content REDEFINITION.
PRIVATE SECTION.
CONSTANTS:
BEGIN OF c_actions,
show TYPE string VALUE 'show' ##NO_TEXT,
overview TYPE string VALUE 'overview',
select TYPE string VALUE 'select',
apply_filter TYPE string VALUE 'apply_filter',
abapgit_home TYPE string VALUE 'abapgit_home',
END OF c_actions.
DATA: mo_repo_overview TYPE REF TO zcl_abapgit_gui_page_repo_over,
mv_repo_key TYPE zif_abapgit_persistence=>ty_value,
mv_only_favorites TYPE abap_bool.
METHODS build_main_menu
RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar.
ENDCLASS.
CLASS ZCL_ABAPGIT_GUI_PAGE_MAIN IMPLEMENTATION.
METHOD build_main_menu.
CREATE OBJECT ro_menu EXPORTING iv_id = 'toolbar-main'.
ro_menu->add(
iv_txt = zcl_abapgit_gui_buttons=>new_online( )
iv_act = zif_abapgit_definitions=>c_action-repo_newonline
)->add(
iv_txt = zcl_abapgit_gui_buttons=>new_offline( )
iv_act = zif_abapgit_definitions=>c_action-repo_newoffline
)->add(
iv_txt = zcl_abapgit_gui_buttons=>settings( )
iv_act = zif_abapgit_definitions=>c_action-go_settings
)->add(
iv_txt = zcl_abapgit_gui_buttons=>advanced( )
iv_title = 'Utilities'
io_sub = zcl_abapgit_gui_chunk_lib=>advanced_submenu( )
)->add(
iv_txt = zcl_abapgit_gui_buttons=>help( )
iv_title = 'Help'
io_sub = zcl_abapgit_gui_chunk_lib=>help_submenu( ) ).
ENDMETHOD.
METHOD constructor.
super->constructor( ).
ms_control-page_menu = build_main_menu( ).
ms_control-page_title = 'Repository List'.
mv_only_favorites = iv_only_favorites.
ENDMETHOD.
METHOD render_content.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
gui_services( )->get_hotkeys_ctl( )->register_hotkeys( zif_abapgit_gui_hotkeys~get_hotkey_actions( ) ).
IF mo_repo_overview IS INITIAL OR mo_repo_overview->mv_only_favorites <> mv_only_favorites.
CREATE OBJECT mo_repo_overview EXPORTING iv_only_favorites = mv_only_favorites.
ENDIF.
ri_html->add( mo_repo_overview->zif_abapgit_gui_renderable~render( ) ).
register_deferred_script( zcl_abapgit_gui_chunk_lib=>render_repo_palette( c_actions-select ) ).
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event.
DATA: lv_key TYPE zif_abapgit_persistence=>ty_value.
lv_key = ii_event->query( )->get( 'KEY' ).
CASE ii_event->mv_action.
WHEN c_actions-abapgit_home.
CLEAR mv_repo_key.
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN c_actions-select.
zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( lv_key ).
TRY.
zcl_abapgit_repo_srv=>get_instance( )->get( lv_key )->refresh( ).
CATCH zcx_abapgit_exception ##NO_HANDLER.
ENDTRY.
mv_repo_key = lv_key.
CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_repo_view
EXPORTING
iv_key = lv_key.
rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page.
WHEN zif_abapgit_definitions=>c_action-change_order_by.
mo_repo_overview->set_order_by( ii_event->query( )->get( 'ORDERBY' ) ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN zif_abapgit_definitions=>c_action-toggle_favorites.
mv_only_favorites = ii_event->query( )->get( 'FAVORITES' ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN zif_abapgit_definitions=>c_action-direction.
mo_repo_overview->set_order_direction(
boolc( ii_event->query( )->get( 'DIRECTION' ) = 'DESCENDING' ) ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN c_actions-apply_filter.
mo_repo_overview->set_filter( ii_event->mt_postdata ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN zif_abapgit_definitions=>c_action-go_patch.
CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_patch
EXPORTING
iv_key = lv_key.
rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page.
WHEN OTHERS.
rs_handled = super->zif_abapgit_gui_event_handler~on_event( ii_event ).
ENDCASE.
ENDMETHOD.
METHOD zif_abapgit_gui_hotkeys~get_hotkey_actions.
DATA: ls_hotkey_action LIKE LINE OF rt_hotkey_actions.
ls_hotkey_action-ui_component = 'Main'.
ls_hotkey_action-description = |abapGit Settings|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_settings.
ls_hotkey_action-hotkey = |x|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |New Online Repository|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_newonline.
ls_hotkey_action-hotkey = |n|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |New Offline Repository|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_newoffline.
ls_hotkey_action-hotkey = |o|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Stage|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_stage.
ls_hotkey_action-hotkey = |s|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Diff|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_repo_diff.
ls_hotkey_action-hotkey = |d|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Check|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_code_inspector.
ls_hotkey_action-hotkey = |c|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Pull|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-git_reset.
ls_hotkey_action-hotkey = |p|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Patch|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_patch.
ls_hotkey_action-hotkey = |p|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
" registered/handled in js
ls_hotkey_action-description = |Previous Repository|.
ls_hotkey_action-action = `#`.
ls_hotkey_action-hotkey = |4|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Next Repository|.
ls_hotkey_action-action = `##`.
ls_hotkey_action-hotkey = |6|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Open Repository|.
ls_hotkey_action-action = `###`.
ls_hotkey_action-hotkey = |Enter|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ENDMETHOD.
ENDCLASS. | 33.187215 | 107 | 0.729499 | {
"alnum_ratio": 0.6672629696,
"alpha_token_ratio": 1.8304380665,
"avg_line_length": 33.3348623853,
"char_rep_ratio": 0.1898594654,
"max_line_length": 107,
"num_words": 402,
"text_len": 7267,
"word_rep_ratio": 0
} | 1,288,424,671,841,002,800 |
79a94acf6371884e060cede941bff713be44d58d | 1,490 | abap | ABAP | src/objects/zcl_abapgit_object_pdts.clas.locals_def.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/zcl_abapgit_object_pdts.clas.locals_def.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/zcl_abapgit_object_pdts.clas.locals_def.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | INTERFACE lif_task_definition.
TYPES: BEGIN OF ty_task_data,
short_text TYPE hr_mcshort,
plvar TYPE plvar,
wi_text TYPE witext,
method TYPE hrs1201,
method_binding TYPE hrsmtbind,
starting_events TYPE hrsevtab,
starting_events_binding TYPE hrsevbind,
terminating_events TYPE hrsetmtab,
terminating_events_binding TYPE hrsevbind,
descriptions TYPE wstexts,
END OF ty_task_data.
METHODS clear_origin_data.
METHODS get_definition RETURNING VALUE(rs_result) TYPE ty_task_data.
METHODS get_container RETURNING VALUE(ri_result) TYPE REF TO if_swf_cnt_container.
METHODS get_user_container RETURNING VALUE(ri_result) TYPE REF TO if_swf_cnt_container.
METHODS import_container IMPORTING iv_xml_string TYPE xstring
RAISING zcx_abapgit_exception.
METHODS create_task RAISING zcx_abapgit_exception.
METHODS save IMPORTING iv_package TYPE devclass OPTIONAL
RAISING zcx_abapgit_exception.
METHODS change_wi_text RAISING zcx_abapgit_exception.
METHODS change_method RAISING zcx_abapgit_exception.
METHODS change_start_events RAISING zcx_abapgit_exception.
METHODS change_terminating_events RAISING zcx_abapgit_exception.
METHODS change_text RAISING zcx_abapgit_exception.
ENDINTERFACE. | 46.5625 | 89 | 0.69396 | {
"alnum_ratio": 0.6527871054,
"alpha_token_ratio": 2.2669789227,
"avg_line_length": 48.0322580645,
"char_rep_ratio": 0.2256756757,
"max_line_length": 89,
"num_words": 105,
"text_len": 1489,
"word_rep_ratio": 0
} | 3,800,832,169,395,036,000 |
79c7d4ab2f70338aafa1ac37fd4e4a79fe4d108a | 1,274 | abap | ABAP | src/zif_abapgit_sap_package.intf.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/zif_abapgit_sap_package.intf.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/zif_abapgit_sap_package.intf.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | INTERFACE zif_abapgit_sap_package
PUBLIC .
TYPES:
ty_devclass_tt TYPE STANDARD TABLE OF devclass WITH DEFAULT KEY .
METHODS create
IMPORTING
!is_package TYPE scompkdtln
RAISING
zcx_abapgit_exception .
METHODS create_local
RAISING
zcx_abapgit_exception .
METHODS list_subpackages
RETURNING
VALUE(rt_list) TYPE ty_devclass_tt .
METHODS list_superpackages
RETURNING
VALUE(rt_list) TYPE ty_devclass_tt
RAISING
zcx_abapgit_exception .
METHODS read_parent
RETURNING
VALUE(rv_parentcl) TYPE tdevc-parentcl
RAISING
zcx_abapgit_exception .
METHODS create_child
IMPORTING
!iv_child TYPE devclass
RAISING
zcx_abapgit_exception .
METHODS exists
RETURNING
VALUE(rv_bool) TYPE abap_bool .
METHODS are_changes_recorded_in_tr_req
RETURNING
VALUE(rv_are_changes_rec_in_tr_req) TYPE abap_bool
RAISING
zcx_abapgit_exception .
METHODS get_transport_type
RETURNING
VALUE(rs_transport_type) TYPE zif_abapgit_definitions=>ty_transport_type
RAISING
zcx_abapgit_exception .
METHODS get_transport_layer
RETURNING
VALUE(rv_transport_layer) TYPE devlayer
RAISING
zcx_abapgit_exception .
ENDINTERFACE. | 24.037736 | 78 | 0.739403 | {
"alnum_ratio": 0.6920659859,
"alpha_token_ratio": 2.0440835267,
"avg_line_length": 24.4807692308,
"char_rep_ratio": 0.1764240506,
"max_line_length": 78,
"num_words": 86,
"text_len": 1273,
"word_rep_ratio": 0
} | 3,449,537,884,030,178,000 |
79d9b927dec18f5f4c07cb30af06f689b1b284a1 | 2,560 | abap | ABAP | src/objects/zcl_abapgit_object_iwsg.clas.abap | ed-holland/abapGit | 380508d72c02f37f15344165411fc5a145f73e72 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/zcl_abapgit_object_iwsg.clas.abap | ed-holland/abapGit | 380508d72c02f37f15344165411fc5a145f73e72 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/zcl_abapgit_object_iwsg.clas.abap | ed-holland/abapGit | 380508d72c02f37f15344165411fc5a145f73e72 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_object_iwsg DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_objects_super
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_abapgit_object .
PROTECTED SECTION.
METHODS get_generic
RETURNING
VALUE(ro_generic) TYPE REF TO zcl_abapgit_objects_generic
RAISING
zcx_abapgit_exception .
PRIVATE SECTION.
METHODS get_field_rules
RETURNING
VALUE(ro_result) TYPE REF TO zif_abapgit_field_rules.
ENDCLASS.
CLASS zcl_abapgit_object_iwsg IMPLEMENTATION.
METHOD get_generic.
CREATE OBJECT ro_generic
EXPORTING
io_field_rules = get_field_rules( )
is_item = ms_item
iv_language = mv_language.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = zcl_abapgit_objects_super=>c_user_unknown.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
get_generic( )->delete( iv_package ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
get_generic( )->deserialize(
iv_package = iv_package
io_xml = io_xml ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
rv_bool = get_generic( )->exists( ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
rs_metadata-delete_tadir = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
get_generic( )->serialize( io_xml ).
ENDMETHOD.
METHOD get_field_rules.
ro_result = zcl_abapgit_field_rules=>create( ).
ro_result->add(
iv_table = '/IWFND/I_MED_SRH'
iv_field = 'CREATED_BY'
iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-user
)->add(
iv_table = '/IWFND/I_MED_SRH'
iv_field = 'CREATED_TIMESTMP'
iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-timestamp
)->add(
iv_table = '/IWFND/I_MED_SRH'
iv_field = 'CHANGED_BY'
iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-user
)->add(
iv_table = '/IWFND/I_MED_SRH'
iv_field = 'CHANGED_TIMESTMP'
iv_fill_rule = zif_abapgit_field_rules=>c_fill_rule-timestamp ).
ENDMETHOD.
ENDCLASS. | 19.844961 | 70 | 0.703125 | {
"alnum_ratio": 0.6447831184,
"alpha_token_ratio": 1.7313746065,
"avg_line_length": 19.9921875,
"char_rep_ratio": 0.1949019608,
"max_line_length": 70,
"num_words": 149,
"text_len": 2559,
"word_rep_ratio": 0
} | 4,716,796,218,827,222,000 |
79e9c26918590421cc9a3be137085d626e8839f4 | 1,655 | abap | ABAP | src/utils/zcl_abapgit_hash.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/utils/zcl_abapgit_hash.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/utils/zcl_abapgit_hash.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS ltcl_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS FINAL.
PRIVATE SECTION.
METHODS:
adler32 FOR TESTING,
sha1 FOR TESTING RAISING zcx_abapgit_exception,
sha1_raw_valid FOR TESTING RAISING zcx_abapgit_exception,
sha1_raw_invalid FOR TESTING RAISING zcx_abapgit_exception.
ENDCLASS.
CLASS ltcl_test IMPLEMENTATION.
METHOD adler32.
DATA: lv_adler TYPE zif_abapgit_definitions=>ty_adler32.
lv_adler = zcl_abapgit_hash=>adler32( '1122334455667788' ).
cl_abap_unit_assert=>assert_equals(
act = lv_adler
exp = '08000265' ).
ENDMETHOD.
METHOD sha1.
DATA: lv_sha1 TYPE zif_abapgit_definitions=>ty_sha1.
lv_sha1 = zcl_abapgit_hash=>sha1(
iv_type = zif_abapgit_definitions=>c_type-commit
iv_data = '112211221122' ).
cl_abap_unit_assert=>assert_equals(
act = lv_sha1
exp = 'af2261a340c5188baf86a64a581d22012303023c' ).
ENDMETHOD.
METHOD sha1_raw_valid.
DATA: lv_sha1 TYPE zif_abapgit_definitions=>ty_sha1,
lv_input TYPE xstring.
lv_input = 'C5188BAF86A64A581D2201'.
lv_sha1 = zcl_abapgit_hash=>sha1_raw( lv_input ).
cl_abap_unit_assert=>assert_equals(
act = lv_sha1
exp = '0ec2eba75071f87988ced3237cae5ec7c5efd795' ).
ENDMETHOD.
METHOD sha1_raw_invalid.
DATA: lv_sha1 TYPE zif_abapgit_definitions=>ty_sha1,
lv_input TYPE xstring.
lv_input = 'LOREM_IPSUM'.
lv_sha1 = zcl_abapgit_hash=>sha1_raw( lv_input ).
cl_abap_unit_assert=>assert_equals(
act = lv_sha1
exp = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' ).
ENDMETHOD.
ENDCLASS. | 22.364865 | 65 | 0.720846 | {
"alnum_ratio": 0.6745311555,
"alpha_token_ratio": 1.40969163,
"avg_line_length": 22.9583333333,
"char_rep_ratio": 0.0888077859,
"max_line_length": 65,
"num_words": 107,
"text_len": 1653,
"word_rep_ratio": 0
} | 14,822,831,653,648,120,000 |
79eeeba671e89751876dcc8e8e4df006b72d4c15 | 7,295 | abap | ABAP | src/apack/zcl_abapgit_apack_reader.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/apack/zcl_abapgit_apack_reader.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/apack/zcl_abapgit_apack_reader.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_apack_reader DEFINITION
PUBLIC
FINAL
CREATE PRIVATE .
PUBLIC SECTION.
TYPES ty_package_name TYPE devclass .
CLASS-METHODS create_instance
IMPORTING
!iv_package_name TYPE ty_package_name
RETURNING
VALUE(ro_manifest_reader) TYPE REF TO zcl_abapgit_apack_reader .
CLASS-METHODS deserialize
IMPORTING
!iv_package_name TYPE ty_package_name
!iv_xstr TYPE xstring
RETURNING
VALUE(ro_manifest_reader) TYPE REF TO zcl_abapgit_apack_reader
RAISING
zcx_abapgit_exception.
METHODS get_manifest_descriptor
RETURNING
VALUE(rs_manifest_descriptor) TYPE zif_abapgit_apack_definitions=>ty_descriptor
RAISING
zcx_abapgit_exception.
METHODS set_manifest_descriptor
IMPORTING
!is_manifest_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor
RAISING
zcx_abapgit_exception.
METHODS copy_manifest_descriptor
IMPORTING
!io_manifest_provider TYPE REF TO object
RAISING
zcx_abapgit_exception.
METHODS has_manifest
RETURNING
VALUE(rv_has_manifest) TYPE abap_bool
RAISING
zcx_abapgit_exception.
METHODS constructor
IMPORTING
!iv_package_name TYPE ty_package_name .
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_s_manifest_declaration,
clsname TYPE seoclsname,
devclass TYPE devclass,
END OF ty_s_manifest_declaration .
DATA mv_package_name TYPE ty_package_name .
DATA ms_cached_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor .
DATA mv_is_cached TYPE abap_bool .
CLASS-METHODS from_xml
IMPORTING
iv_xml TYPE string
RETURNING
VALUE(rs_data) TYPE zif_abapgit_apack_definitions=>ty_descriptor.
METHODS format_version
RAISING
zcx_abapgit_exception.
ENDCLASS.
CLASS zcl_abapgit_apack_reader IMPLEMENTATION.
METHOD constructor.
mv_package_name = iv_package_name.
ENDMETHOD.
METHOD copy_manifest_descriptor.
DATA: ls_my_manifest_wo_deps TYPE zif_abapgit_apack_definitions=>ty_descriptor_wo_dependencies,
ls_my_dependency TYPE zif_abapgit_apack_definitions=>ty_dependency,
ls_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor,
lv_descriptor_cust TYPE string,
lv_descriptor_sap TYPE string.
FIELD-SYMBOLS: <lg_descriptor> TYPE any,
<lt_dependencies> TYPE ANY TABLE,
<lg_dependency> TYPE any.
lv_descriptor_cust = zif_abapgit_apack_definitions=>c_apack_interface_cust && '~DESCRIPTOR'.
lv_descriptor_sap = zif_abapgit_apack_definitions=>c_apack_interface_sap && '~DESCRIPTOR'.
ASSIGN io_manifest_provider->(lv_descriptor_cust) TO <lg_descriptor>.
IF <lg_descriptor> IS NOT ASSIGNED.
ASSIGN io_manifest_provider->(lv_descriptor_sap) TO <lg_descriptor>.
ENDIF.
IF <lg_descriptor> IS ASSIGNED.
" A little more complex than a normal MOVE-CORRSPONDING
" to avoid dumps in case of future updates to the dependencies table structure
ASSIGN COMPONENT 'DEPENDENCIES' OF STRUCTURE <lg_descriptor> TO <lt_dependencies>.
IF <lt_dependencies> IS ASSIGNED.
LOOP AT <lt_dependencies> ASSIGNING <lg_dependency>.
MOVE-CORRESPONDING <lg_dependency> TO ls_my_dependency.
INSERT ls_my_dependency INTO TABLE ls_descriptor-dependencies.
ENDLOOP.
MOVE-CORRESPONDING <lg_descriptor> TO ls_my_manifest_wo_deps.
MOVE-CORRESPONDING ls_my_manifest_wo_deps TO ls_descriptor.
ENDIF.
ENDIF.
set_manifest_descriptor( ls_descriptor ).
ENDMETHOD.
METHOD create_instance.
CREATE OBJECT ro_manifest_reader
EXPORTING
iv_package_name = iv_package_name.
ENDMETHOD.
METHOD deserialize.
DATA: lv_xml TYPE string,
ls_data TYPE zif_abapgit_apack_definitions=>ty_descriptor.
lv_xml = zcl_abapgit_convert=>xstring_to_string_utf8( iv_xstr ).
ls_data = from_xml( lv_xml ).
ro_manifest_reader = create_instance( iv_package_name ).
ro_manifest_reader = create_instance( iv_package_name ).
ro_manifest_reader->set_manifest_descriptor( ls_data ).
ENDMETHOD.
METHOD format_version.
FIELD-SYMBOLS: <ls_dependency> TYPE zif_abapgit_apack_definitions=>ty_dependency.
TRANSLATE ms_cached_descriptor-version TO LOWER CASE.
ms_cached_descriptor-sem_version = zcl_abapgit_version=>conv_str_to_version( ms_cached_descriptor-version ).
LOOP AT ms_cached_descriptor-dependencies ASSIGNING <ls_dependency>.
<ls_dependency>-sem_version = zcl_abapgit_version=>conv_str_to_version( <ls_dependency>-version ).
ENDLOOP.
ENDMETHOD.
METHOD from_xml.
DATA: lv_xml TYPE string.
lv_xml = iv_xml.
CALL TRANSFORMATION id
OPTIONS value_handling = 'accept_data_loss'
SOURCE XML lv_xml
RESULT data = rs_data.
ENDMETHOD.
METHOD get_manifest_descriptor.
DATA: lo_manifest_provider TYPE REF TO object,
ls_manifest_implementation TYPE ty_s_manifest_declaration.
IF mv_is_cached IS INITIAL AND mv_package_name IS NOT INITIAL.
SELECT SINGLE seometarel~clsname tadir~devclass FROM seometarel "#EC CI_NOORDER
INNER JOIN tadir ON seometarel~clsname = tadir~obj_name "#EC CI_BUFFJOIN
INTO ls_manifest_implementation
WHERE tadir~pgmid = 'R3TR' AND
tadir~object = 'CLAS' AND
seometarel~version = '1' AND
seometarel~refclsname = zif_abapgit_apack_definitions=>c_apack_interface_cust AND
tadir~devclass = mv_package_name.
IF ls_manifest_implementation IS INITIAL.
SELECT SINGLE seometarel~clsname tadir~devclass FROM seometarel "#EC CI_NOORDER
INNER JOIN tadir ON seometarel~clsname = tadir~obj_name "#EC CI_BUFFJOIN
INTO ls_manifest_implementation
WHERE tadir~pgmid = 'R3TR' AND
tadir~object = 'CLAS' AND
seometarel~version = '1' AND
seometarel~refclsname = zif_abapgit_apack_definitions=>c_apack_interface_sap AND
tadir~devclass = mv_package_name.
ENDIF.
IF ls_manifest_implementation IS NOT INITIAL.
TRY.
CREATE OBJECT lo_manifest_provider TYPE (ls_manifest_implementation-clsname).
CATCH cx_sy_create_object_error.
CLEAR: rs_manifest_descriptor.
ENDTRY.
IF lo_manifest_provider IS BOUND.
copy_manifest_descriptor( lo_manifest_provider ).
ENDIF.
ENDIF.
mv_is_cached = abap_true.
ENDIF.
rs_manifest_descriptor = ms_cached_descriptor.
ENDMETHOD.
METHOD has_manifest.
DATA: ls_returned_manifest TYPE zif_abapgit_apack_definitions=>ty_descriptor.
ls_returned_manifest = get_manifest_descriptor( ).
rv_has_manifest = abap_false.
IF ls_returned_manifest IS NOT INITIAL.
rv_has_manifest = abap_true.
ENDIF.
ENDMETHOD.
METHOD set_manifest_descriptor.
mv_is_cached = abap_true.
ms_cached_descriptor = is_manifest_descriptor.
format_version( ).
ENDMETHOD.
ENDCLASS. | 31.175214 | 112 | 0.714462 | {
"alnum_ratio": 0.6663010694,
"alpha_token_ratio": 2.121013543,
"avg_line_length": 31.30472103,
"char_rep_ratio": 0.1457789979,
"max_line_length": 112,
"num_words": 473,
"text_len": 7294,
"word_rep_ratio": 0.0862068966
} | 14,606,137,192,457,090,000 |
035a6450a5689c22e6a151c3d856db575d5794ba | 9,878 | abap | ABAP | src/objects/zcl_abapgit_object_suso.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/objects/zcl_abapgit_object_suso.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/objects/zcl_abapgit_object_suso.clas.abap | wangdongcheng/abapGit | 7cf4e4b5fe718cb95d12d0a439aa9f2cfb128eab | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_object_suso DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
METHODS:
constructor
IMPORTING
is_item TYPE zif_abapgit_definitions=>ty_item
iv_language TYPE spras.
PROTECTED SECTION.
PRIVATE SECTION.
DATA:
mv_objectname TYPE tobj-objct.
METHODS:
delete_documentation
RAISING
zcx_abapgit_exception,
pre_check
RAISING
zcx_abapgit_exception,
regenerate_sap_all.
ENDCLASS.
CLASS zcl_abapgit_object_suso IMPLEMENTATION.
METHOD constructor.
super->constructor( is_item = is_item
iv_language = iv_language ).
mv_objectname = ms_item-obj_name.
ENDMETHOD.
METHOD delete_documentation.
DATA:
lv_docu_obj TYPE dokhl-object,
lv_dummy TYPE sy-langu.
lv_docu_obj = mv_objectname.
SELECT SINGLE langu
FROM dokil INTO lv_dummy
WHERE id = 'UO' "#EC CI_GENBUFF
AND object = lv_docu_obj.
IF sy-subrc = 0.
CALL FUNCTION 'DOKU_DELETE_ALL'
EXPORTING
doku_id = 'UO'
doku_object = lv_docu_obj
suppress_transport = space
EXCEPTIONS
header_without_text = 1
index_without_header = 2
no_authority_for_devclass_xxxx = 3
no_docu_found = 4
object_is_already_enqueued = 5
object_is_enqueued_by_corr = 6
techn_enqueue_problem = 7
user_break = 8
OTHERS = 9.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD pre_check.
CONSTANTS:
lc_act_delete TYPE activ_auth VALUE '06'.
DATA:
lv_act_head TYPE activ_auth,
lv_dummy TYPE string,
lo_suso TYPE REF TO object,
lv_failed TYPE abap_bool,
lv_suso_collect_in_cts TYPE i,
ls_clskey TYPE seoclskey.
" Downport: CL_SUSO_GEN doesn't exist in 702
ls_clskey-clsname = |CL_SUSO_GEN|.
CALL FUNCTION 'SEO_CLASS_EXISTENCE_CHECK'
EXPORTING
clskey = ls_clskey
EXCEPTIONS
not_specified = 1
not_existing = 2
is_interface = 3
no_text = 4
inconsistent = 5
OTHERS = 6.
IF sy-subrc = 0.
" so these check are not executed in 702
CREATE OBJECT lo_suso
TYPE
('CL_SUSO_GEN').
CALL METHOD lo_suso->('SUSO_LOAD_FROM_DB')
EXPORTING
id_object = mv_objectname
RECEIVING
ed_failed = lv_failed.
IF lv_failed = abap_true.
" Object & does not exist; choose an existing object
MESSAGE s111(01) WITH mv_objectname INTO lv_dummy.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
CALL METHOD lo_suso->('GET_SUSO_EDIT_MODE')
EXPORTING
id_object = mv_objectname
id_planed_act = lc_act_delete
IMPORTING
ed_mode_head = lv_act_head.
IF lv_act_head <> lc_act_delete.
zcx_abapgit_exception=>raise( |SUSO { mv_objectname }: Delete not allowed. Check where-used in SU21| ).
ENDIF.
CALL METHOD lo_suso->('SUSO_COLLECT_IN_CTS')
EXPORTING
id_object = mv_objectname
RECEIVING
ed_result = lv_suso_collect_in_cts.
IF lv_suso_collect_in_cts IS NOT INITIAL.
zcx_abapgit_exception=>raise( |SUSO { mv_objectname }: Cannot delete| ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD regenerate_sap_all.
DATA: ls_e071 TYPE e071,
lt_e071 TYPE STANDARD TABLE OF e071,
lt_e071k TYPE STANDARD TABLE OF e071k.
ls_e071-pgmid = 'R3TR'.
ls_e071-object = ms_item-obj_type.
ls_e071-obj_name = ms_item-obj_name.
INSERT ls_e071 INTO TABLE lt_e071.
CALL FUNCTION 'PRGN_AFTER_IMP_SUSO_SAP_ALL'
EXPORTING
iv_tarclient = '000'
iv_is_upgrade = space
TABLES
tt_e071 = lt_e071
tt_e071k = lt_e071k.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD zif_abapgit_object~delete.
" FM SUSR_DELETE_OBJECT calls the UI. Therefore we reimplement it here.
" As the class CL_SUSO_GEN isn't present in 702, we call dynamically and
" skip the pre checks on 702 system. That seems ok.
pre_check( ).
delete_documentation( ).
DELETE FROM tobj WHERE objct = mv_objectname.
DELETE FROM tobjt WHERE object = mv_objectname.
DELETE FROM tactz WHERE brobj = mv_objectname.
CALL FUNCTION 'SUPV_DELETE_OBJECT_ASSIGNMENTS'
EXPORTING
object_name = mv_objectname
all_releases = abap_true.
CALL FUNCTION 'RS_TREE_OBJECT_PLACEMENT'
EXPORTING
object = mv_objectname
type = 'SUSO'
operation = 'DELETE'.
regenerate_sap_all( ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
* see function group SUSA
DATA: lv_objectname TYPE trobj_name,
ls_tobj TYPE tobj,
ls_tobjt TYPE tobjt,
ls_tobjvorflg TYPE tobjvorflg,
lt_tactz TYPE TABLE OF tactz,
lt_tobjvordat TYPE TABLE OF tobjvordat,
lt_tobjvor TYPE TABLE OF tobjvor.
ASSERT NOT ms_item-obj_name IS INITIAL.
io_xml->read( EXPORTING iv_name = 'TOBJ'
CHANGING cg_data = ls_tobj ).
ls_tobj-bname = sy-uname.
io_xml->read( EXPORTING iv_name = 'TOBJT'
CHANGING cg_data = ls_tobjt ).
io_xml->read( EXPORTING iv_name = 'TOBJVORFLG'
CHANGING cg_data = ls_tobjvorflg ).
io_xml->read( EXPORTING iv_name = 'TACTZ'
CHANGING cg_data = lt_tactz ).
io_xml->read( EXPORTING iv_name = 'TOBJVORDAT'
CHANGING cg_data = lt_tobjvordat ).
io_xml->read( EXPORTING iv_name = 'TOBJVOR'
CHANGING cg_data = lt_tobjvor ).
tadir_insert( iv_package ).
lv_objectname = mv_objectname.
CALL FUNCTION 'SUSR_COMMEDITCHECK'
EXPORTING
objectname = lv_objectname
transobjecttype = 'O'.
MODIFY tobj FROM ls_tobj. "#EC CI_SUBRC
MODIFY tobjt FROM ls_tobjt. "#EC CI_SUBRC
MODIFY tobjvorflg FROM ls_tobjvorflg. "#EC CI_SUBRC
DELETE FROM tactz WHERE brobj = ms_item-obj_name. "#EC CI_SUBRC
INSERT tactz FROM TABLE lt_tactz. "#EC CI_SUBRC
DELETE FROM tobjvordat WHERE objct = ms_item-obj_name. "#EC CI_SUBRC
INSERT tobjvordat FROM TABLE lt_tobjvordat. "#EC CI_SUBRC
DELETE FROM tobjvor WHERE objct = ms_item-obj_name. "#EC CI_SUBRC
INSERT tobjvor FROM TABLE lt_tobjvor. "#EC CI_SUBRC
regenerate_sap_all( ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_objct TYPE tobj-objct.
SELECT SINGLE objct FROM tobj INTO lv_objct
WHERE objct = ms_item-obj_name.
rv_bool = boolc( sy-subrc = 0 ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
CALL FUNCTION 'SUSR_SHOW_OBJECT'
EXPORTING
object = mv_objectname.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: ls_tobj TYPE tobj,
ls_tobjt TYPE tobjt,
ls_tobjvorflg TYPE tobjvorflg,
lt_tactz TYPE TABLE OF tactz,
lt_tobjvordat TYPE TABLE OF tobjvordat,
lt_tobjvor TYPE TABLE OF tobjvor.
SELECT SINGLE * FROM tobj INTO ls_tobj
WHERE objct = ms_item-obj_name.
IF sy-subrc <> 0.
RETURN.
ENDIF.
CLEAR ls_tobj-bname.
SELECT SINGLE * FROM tobjt INTO ls_tobjt
WHERE object = ms_item-obj_name
AND langu = mv_language. "#EC CI_GENBUFF
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'TOBJT no english description'
&& ' for object (' && ms_item-obj_name && ')' ).
ENDIF.
SELECT SINGLE * FROM tobjvorflg INTO ls_tobjvorflg
WHERE objct = ms_item-obj_name. "#EC CI_SUBRC
SELECT * FROM tactz INTO TABLE lt_tactz
WHERE brobj = ms_item-obj_name
ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF
SELECT * FROM tobjvordat INTO TABLE lt_tobjvordat
WHERE objct = ms_item-obj_name
ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF
SELECT * FROM tobjvor INTO TABLE lt_tobjvor
WHERE objct = ms_item-obj_name
ORDER BY PRIMARY KEY. "#EC CI_SUBRC
io_xml->add( iv_name = 'TOBJ'
ig_data = ls_tobj ).
io_xml->add( iv_name = 'TOBJT'
ig_data = ls_tobjt ).
io_xml->add( iv_name = 'TOBJVORFLG'
ig_data = ls_tobjvorflg ).
io_xml->add( ig_data = lt_tactz
iv_name = 'TACTZ' ).
io_xml->add( ig_data = lt_tobjvordat
iv_name = 'TOBJVORDAT' ).
io_xml->add( ig_data = lt_tobjvor
iv_name = 'TOBJVOR' ).
ENDMETHOD.
ENDCLASS. | 26.625337 | 111 | 0.612168 | {
"alnum_ratio": 0.5728460059,
"alpha_token_ratio": 1.6404129794,
"avg_line_length": 26.6945945946,
"char_rep_ratio": 0.1489663559,
"max_line_length": 111,
"num_words": 740,
"text_len": 9877,
"word_rep_ratio": 0.0465116279
} | 6,763,849,213,477,315,000 |
0372632e144510e0900d89e7a2c5a87ebe061e9d | 1,702 | abap | ABAP | src/ui/zcl_abapgit_ui_injector.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/ui/zcl_abapgit_ui_injector.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/ui/zcl_abapgit_ui_injector.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_ui_injector DEFINITION
PUBLIC
CREATE PRIVATE .
PUBLIC SECTION.
CLASS-METHODS set_popups
IMPORTING
!ii_popups TYPE REF TO zif_abapgit_popups .
CLASS-METHODS set_tag_popups
IMPORTING
!ii_tag_popups TYPE REF TO zif_abapgit_tag_popups .
CLASS-METHODS set_frontend_services
IMPORTING
!ii_fe_serv TYPE REF TO zif_abapgit_frontend_services .
CLASS-METHODS set_gui_services
IMPORTING
!ii_gui_services TYPE REF TO zif_abapgit_gui_services .
CLASS-METHODS get_dummy_gui_services
RETURNING
VALUE(ri_gui_services) TYPE REF TO zif_abapgit_gui_services .
CLASS-METHODS set_html_viewer
IMPORTING
!ii_html_viewer TYPE REF TO zif_abapgit_html_viewer .
CLASS-METHODS set_gui_jumper
IMPORTING
!ii_gui_jumper TYPE REF TO zif_abapgit_gui_jumper .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_abapgit_ui_injector IMPLEMENTATION.
METHOD get_dummy_gui_services.
ri_gui_services = lcl_gui_services_dummy=>create( ).
ENDMETHOD.
METHOD set_frontend_services.
zcl_abapgit_ui_factory=>gi_fe_services = ii_fe_serv.
ENDMETHOD.
METHOD set_gui_jumper.
zcl_abapgit_ui_factory=>gi_gui_jumper = ii_gui_jumper.
ENDMETHOD.
METHOD set_gui_services.
zcl_abapgit_ui_factory=>gi_gui_services = ii_gui_services.
ENDMETHOD.
METHOD set_html_viewer.
zcl_abapgit_ui_factory=>gi_html_viewer = ii_html_viewer.
ENDMETHOD.
METHOD set_popups.
zcl_abapgit_ui_factory=>gi_popups = ii_popups.
ENDMETHOD.
METHOD set_tag_popups.
zcl_abapgit_ui_factory=>gi_tag_popups = ii_tag_popups.
ENDMETHOD.
ENDCLASS. | 20.023529 | 69 | 0.752056 | {
"alnum_ratio": 0.6866549089,
"alpha_token_ratio": 1.8393700787,
"avg_line_length": 20.25,
"char_rep_ratio": 0.1317966903,
"max_line_length": 69,
"num_words": 108,
"text_len": 1701,
"word_rep_ratio": 0
} | 6,659,243,800,928,970,000 |
037c6ccbaa70fbb421cdc3a3fd1778f19e84a107 | 17,136 | abap | ABAP | src/ui/zcl_abapgit_gui_page_commit.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/ui/zcl_abapgit_gui_page_commit.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/ui/zcl_abapgit_gui_page_commit.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_gui_page_commit DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_gui_component
FINAL
CREATE PRIVATE.
PUBLIC SECTION.
INTERFACES zif_abapgit_gui_event_handler.
INTERFACES zif_abapgit_gui_renderable.
CLASS-METHODS create
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo_online
!io_stage TYPE REF TO zcl_abapgit_stage
!iv_sci_result TYPE zif_abapgit_definitions=>ty_sci_result DEFAULT zif_abapgit_definitions=>c_sci_result-no_run
RETURNING
VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable
RAISING
zcx_abapgit_exception.
METHODS constructor
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo_online
!io_stage TYPE REF TO zcl_abapgit_stage
!iv_sci_result TYPE zif_abapgit_definitions=>ty_sci_result
RAISING
zcx_abapgit_exception.
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS:
BEGIN OF c_id,
committer TYPE string VALUE 'committer',
committer_name TYPE string VALUE 'committer_name',
committer_email TYPE string VALUE 'committer_email',
message TYPE string VALUE 'message',
comment TYPE string VALUE 'comment',
body TYPE string VALUE 'body',
author TYPE string VALUE 'author',
author_name TYPE string VALUE 'author_name',
author_email TYPE string VALUE 'author_email',
new_branch_name TYPE string VALUE 'new_branch_name',
END OF c_id.
CONSTANTS:
BEGIN OF c_event,
commit TYPE string VALUE 'commit',
END OF c_event.
DATA mo_form TYPE REF TO zcl_abapgit_html_form.
DATA mo_form_data TYPE REF TO zcl_abapgit_string_map.
DATA mo_form_util TYPE REF TO zcl_abapgit_html_form_utils.
DATA mo_validation_log TYPE REF TO zcl_abapgit_string_map.
DATA mo_settings TYPE REF TO zcl_abapgit_settings.
DATA mo_repo TYPE REF TO zcl_abapgit_repo_online.
DATA mo_stage TYPE REF TO zcl_abapgit_stage.
DATA mt_stage TYPE zif_abapgit_definitions=>ty_stage_tt.
DATA ms_commit TYPE zif_abapgit_services_git=>ty_commit_fields.
DATA mv_sci_result TYPE zif_abapgit_definitions=>ty_sci_result.
METHODS render_stage_summary
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception.
METHODS render_stage_details
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception.
METHODS validate_form
IMPORTING
!io_form_data TYPE REF TO zcl_abapgit_string_map
RETURNING
VALUE(ro_validation_log) TYPE REF TO zcl_abapgit_string_map
RAISING
zcx_abapgit_exception.
METHODS get_form_schema
RETURNING
VALUE(ro_form) TYPE REF TO zcl_abapgit_html_form.
METHODS get_defaults
RAISING
zcx_abapgit_exception.
METHODS get_committer_name
RETURNING
VALUE(rv_user) TYPE string
RAISING
zcx_abapgit_exception.
METHODS get_committer_email
RETURNING
VALUE(rv_email) TYPE string
RAISING
zcx_abapgit_exception.
METHODS get_comment_default
RETURNING
VALUE(rv_text) TYPE string.
METHODS get_comment_object
IMPORTING
!it_stage TYPE zif_abapgit_definitions=>ty_stage_tt
RETURNING
VALUE(rv_text) TYPE string.
METHODS get_comment_file
IMPORTING
!it_stage TYPE zif_abapgit_definitions=>ty_stage_tt
RETURNING
VALUE(rv_text) TYPE string.
METHODS is_valid_email
IMPORTING
iv_email TYPE string
RETURNING
VALUE(rv_valid) TYPE abap_bool.
METHODS branch_name_to_internal
IMPORTING
iv_branch_name TYPE string
RETURNING
VALUE(rv_new_branch_name) TYPE string.
ENDCLASS.
CLASS zcl_abapgit_gui_page_commit IMPLEMENTATION.
METHOD branch_name_to_internal.
rv_new_branch_name = zcl_abapgit_git_branch_list=>complete_heads_branch_name(
zcl_abapgit_git_branch_list=>normalize_branch_name( iv_branch_name ) ).
ENDMETHOD.
METHOD constructor.
super->constructor( ).
mo_repo = io_repo.
mo_stage = io_stage.
mt_stage = mo_stage->get_all( ).
mv_sci_result = iv_sci_result.
" Get settings from DB
mo_settings = zcl_abapgit_persist_factory=>get_settings( )->read( ).
CREATE OBJECT mo_validation_log.
CREATE OBJECT mo_form_data.
mo_form = get_form_schema( ).
mo_form_util = zcl_abapgit_html_form_utils=>create( mo_form ).
ENDMETHOD.
METHOD create.
DATA lo_component TYPE REF TO zcl_abapgit_gui_page_commit.
CREATE OBJECT lo_component
EXPORTING
io_repo = io_repo
io_stage = io_stage
iv_sci_result = iv_sci_result.
ri_page = zcl_abapgit_gui_page_hoc=>create(
iv_page_title = 'Commit'
ii_child_component = lo_component ).
ENDMETHOD.
METHOD get_comment_default.
rv_text = mo_settings->get_commitmsg_comment_default( ).
IF rv_text IS INITIAL.
RETURN.
ENDIF.
REPLACE '$FILE' IN rv_text WITH get_comment_file( mt_stage ).
REPLACE '$OBJECT' IN rv_text WITH get_comment_object( mt_stage ).
ENDMETHOD.
METHOD get_comment_file.
DATA:
lv_count TYPE i,
lv_value TYPE c LENGTH 10.
FIELD-SYMBOLS <ls_stage> LIKE LINE OF it_stage.
lv_count = lines( it_stage ).
IF lv_count = 1.
" Just one file so we use the file name
READ TABLE it_stage ASSIGNING <ls_stage> INDEX 1.
ASSERT sy-subrc = 0.
rv_text = <ls_stage>-file-filename.
ELSE.
" For multiple file we use the count instead
WRITE lv_count TO lv_value LEFT-JUSTIFIED.
CONCATENATE lv_value 'files' INTO rv_text SEPARATED BY space.
ENDIF.
ENDMETHOD.
METHOD get_comment_object.
DATA:
lv_count TYPE i,
lv_value TYPE c LENGTH 10,
ls_item TYPE zif_abapgit_definitions=>ty_item,
lt_items TYPE zif_abapgit_definitions=>ty_items_tt.
FIELD-SYMBOLS <ls_stage> LIKE LINE OF it_stage.
" Get objects
LOOP AT it_stage ASSIGNING <ls_stage>.
CLEAR ls_item.
ls_item-obj_type = <ls_stage>-status-obj_type.
ls_item-obj_name = <ls_stage>-status-obj_name.
COLLECT ls_item INTO lt_items.
ENDLOOP.
lv_count = lines( lt_items ).
IF lv_count = 1.
" Just one object so we use the object name
READ TABLE lt_items INTO ls_item INDEX 1.
ASSERT sy-subrc = 0.
CONCATENATE ls_item-obj_type ls_item-obj_name INTO rv_text SEPARATED BY space.
ELSE.
" For multiple objects we use the count instead
WRITE lv_count TO lv_value LEFT-JUSTIFIED.
CONCATENATE lv_value 'objects' INTO rv_text SEPARATED BY space.
ENDIF.
ENDMETHOD.
METHOD get_committer_email.
DATA li_user TYPE REF TO zif_abapgit_persist_user.
li_user = zcl_abapgit_persistence_user=>get_instance( ).
rv_email = li_user->get_repo_git_user_email( mo_repo->get_url( ) ).
IF rv_email IS INITIAL.
rv_email = li_user->get_default_git_user_email( ).
ENDIF.
IF rv_email IS INITIAL.
" get default from user record
rv_email = zcl_abapgit_user_record=>get_instance( sy-uname )->get_email( ).
ENDIF.
ENDMETHOD.
METHOD get_committer_name.
DATA li_user TYPE REF TO zif_abapgit_persist_user.
li_user = zcl_abapgit_persistence_user=>get_instance( ).
rv_user = li_user->get_repo_git_user_name( mo_repo->get_url( ) ).
IF rv_user IS INITIAL.
rv_user = li_user->get_default_git_user_name( ).
ENDIF.
IF rv_user IS INITIAL.
" get default from user record
rv_user = zcl_abapgit_user_record=>get_instance( sy-uname )->get_name( ).
ENDIF.
ENDMETHOD.
METHOD get_defaults.
ms_commit-committer_name = get_committer_name( ).
ms_commit-committer_email = get_committer_email( ).
ms_commit-comment = get_comment_default( ).
" Committer
mo_form_data->set(
iv_key = c_id-committer_name
iv_val = ms_commit-committer_name ).
mo_form_data->set(
iv_key = c_id-committer_email
iv_val = ms_commit-committer_email ).
" Message
mo_form_data->set(
iv_key = c_id-comment
iv_val = ms_commit-comment ).
ENDMETHOD.
METHOD get_form_schema.
DATA: lv_commitmsg_comment_length TYPE i.
ro_form = zcl_abapgit_html_form=>create(
iv_form_id = 'commit-form'
iv_help_page = '' ).
lv_commitmsg_comment_length = mo_settings->get_commitmsg_comment_length( ).
ro_form->text(
iv_name = c_id-comment
iv_label = 'Comment'
iv_required = abap_true
iv_max = lv_commitmsg_comment_length
iv_placeholder = |Add a mandatory comment with max { lv_commitmsg_comment_length } characters|
)->textarea(
iv_name = c_id-body
iv_label = 'Body'
iv_rows = 6
iv_cols = mo_settings->get_commitmsg_body_size( )
iv_placeholder = 'Add an optional description...'
)->text(
iv_name = c_id-committer_name
iv_label = 'Committer Name'
iv_required = abap_true
)->text(
iv_name = c_id-committer_email
iv_label = 'Committer Email'
iv_required = abap_true ).
IF mo_settings->get_commitmsg_hide_author( ) IS INITIAL.
ro_form->text(
iv_name = c_id-author_name
iv_label = 'Author Name'
iv_placeholder = 'Optionally, specify an author (same as committer by default)'
)->text(
iv_name = c_id-author_email
iv_label = 'Author Email' ).
ENDIF.
ro_form->text(
iv_name = c_id-new_branch_name
iv_label = 'New Branch Name'
iv_placeholder = 'Optionally, enter a new branch name for this commit'
iv_condense = abap_true ).
ro_form->command(
iv_label = 'Commit'
iv_cmd_type = zif_abapgit_html_form=>c_cmd_type-input_main
iv_action = c_event-commit
)->command(
iv_label = 'Back'
iv_action = zif_abapgit_definitions=>c_action-go_back ).
ENDMETHOD.
METHOD is_valid_email.
" Email address validation (RFC 5322)
"
CONSTANTS lc_email_regex TYPE string VALUE
'[\w!#$%&*+/=?`{|}~^-]+(?:\.[\w!#$%&*+/=?`{|}~^-]+)*@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,6}'.
IF iv_email IS INITIAL.
rv_valid = abap_true.
ELSE.
FIND REGEX lc_email_regex IN iv_email.
rv_valid = boolc( sy-subrc = 0 ).
ENDIF.
ENDMETHOD.
METHOD render_stage_details.
FIELD-SYMBOLS <ls_stage> LIKE LINE OF mt_stage.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( '<table class="stage_tab">' ).
ri_html->add( '<thead>' ).
ri_html->add( '<tr>' ).
ri_html->add( '<th colspan="3">Staged Files (See <a href="#top">Summary</a> Above)</th>' ).
ri_html->add( '</tr>' ).
ri_html->add( '</thead>' ).
ri_html->add( '<tbody>' ).
LOOP AT mt_stage ASSIGNING <ls_stage>.
ri_html->add( '<tr>' ).
ri_html->add( '<td>' ).
ri_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state(
iv_lstate = <ls_stage>-status-lstate
iv_rstate = <ls_stage>-status-rstate ) ).
ri_html->add( '</td>' ).
ri_html->add( '<td class="method">' ).
ri_html->add( zcl_abapgit_stage=>method_description( <ls_stage>-method ) ).
ri_html->add( '</td>' ).
ri_html->add( '<td>' ).
ri_html->add( <ls_stage>-file-path && <ls_stage>-file-filename ).
ri_html->add( '</td>' ).
ri_html->add( '</tr>' ).
ENDLOOP.
ri_html->add( '</tbody>' ).
ri_html->add( '</table>' ).
ENDMETHOD.
METHOD render_stage_summary.
DATA:
BEGIN OF ls_sum,
method TYPE string,
count TYPE i,
END OF ls_sum,
lt_sum LIKE STANDARD TABLE OF ls_sum WITH DEFAULT KEY.
FIELD-SYMBOLS <ls_stage> LIKE LINE OF mt_stage.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
LOOP AT mt_stage ASSIGNING <ls_stage>.
ls_sum-method = <ls_stage>-method.
ls_sum-count = 1.
COLLECT ls_sum INTO lt_sum.
ENDLOOP.
ri_html->add( 'Stage Summary: ' ).
READ TABLE lt_sum INTO ls_sum WITH TABLE KEY method = zif_abapgit_definitions=>c_method-add.
IF sy-subrc = 0.
ri_html->add( |<span class="diff_banner diff_ins" title="add">+ { ls_sum-count }</span>| ).
ENDIF.
READ TABLE lt_sum INTO ls_sum WITH TABLE KEY method = zif_abapgit_definitions=>c_method-rm.
IF sy-subrc = 0.
ri_html->add( |<span class="diff_banner diff_del" title="remove">- { ls_sum-count }</span>| ).
ENDIF.
READ TABLE lt_sum INTO ls_sum WITH TABLE KEY method = zif_abapgit_definitions=>c_method-ignore.
IF sy-subrc = 0.
ri_html->add( |<span class="diff_banner diff_upd" title="ignore">~ { ls_sum-count }</span>| ).
ENDIF.
IF lines( mt_stage ) = 1.
ri_html->add( 'file' ).
ELSE.
ri_html->add( 'files' ).
ENDIF.
ri_html->add( '(See <a href="#stage-details">Details</a> Below)' ).
ENDMETHOD.
METHOD validate_form.
DATA: lt_branches TYPE zif_abapgit_definitions=>ty_git_branch_list_tt,
lv_new_branch_name TYPE string.
ro_validation_log = mo_form_util->validate( io_form_data ).
IF is_valid_email( io_form_data->get( c_id-committer_email ) ) = abap_false.
ro_validation_log->set(
iv_key = c_id-committer_email
iv_val = |Invalid email address| ).
ENDIF.
IF is_valid_email( io_form_data->get( c_id-author_email ) ) = abap_false.
ro_validation_log->set(
iv_key = c_id-author_email
iv_val = |Invalid email address| ).
ENDIF.
lv_new_branch_name = io_form_data->get( c_id-new_branch_name ).
IF lv_new_branch_name IS NOT INITIAL.
" check if branch already exists
lt_branches = zcl_abapgit_git_transport=>branches( mo_repo->get_url( ) )->get_branches_only( ).
READ TABLE lt_branches TRANSPORTING NO FIELDS WITH TABLE KEY name_key
COMPONENTS name = branch_name_to_internal( lv_new_branch_name ).
IF sy-subrc = 0.
ro_validation_log->set(
iv_key = c_id-new_branch_name
iv_val = |Branch already exists| ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event.
DATA lv_new_branch_name TYPE string.
mo_form_data = mo_form_util->normalize( ii_event->form_data( ) ).
CASE ii_event->mv_action.
WHEN zif_abapgit_definitions=>c_action-go_back.
rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back.
WHEN c_event-commit.
" Validate form entries before committing
mo_validation_log = validate_form( mo_form_data ).
IF mo_validation_log->is_empty( ) = abap_true.
" new branch fields not needed in commit data
mo_form_data->strict( abap_false ).
mo_form_data->to_abap( CHANGING cs_container = ms_commit ).
REPLACE ALL OCCURRENCES
OF zif_abapgit_definitions=>c_crlf
IN ms_commit-body
WITH zif_abapgit_definitions=>c_newline.
lv_new_branch_name = mo_form_data->get( c_id-new_branch_name ).
" create new branch and commit to it if branch name is not empty
IF lv_new_branch_name IS NOT INITIAL.
lv_new_branch_name = branch_name_to_internal( lv_new_branch_name ).
" creates a new branch and automatically switches to it
mo_repo->create_branch( lv_new_branch_name ).
ENDIF.
zcl_abapgit_services_git=>commit(
is_commit = ms_commit
io_repo = mo_repo
io_stage = mo_stage ).
MESSAGE 'Commit was successful' TYPE 'S'.
rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back_to_bookmark.
ELSE.
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
ENDIF.
ENDCASE.
ENDMETHOD.
METHOD zif_abapgit_gui_renderable~render.
gui_services( )->register_event_handler( me ).
IF mo_form_util->is_empty( mo_form_data ) = abap_true.
get_defaults( ).
ENDIF.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( '<div id="top" class="paddings">' ).
ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( mo_repo ) ).
ri_html->add( '</div>' ).
ri_html->add( '<div id="stage-summary" class="dialog w800px paddings">' ).
ri_html->add( render_stage_summary( ) ).
ri_html->add( '</div>' ).
ri_html->add( mo_form->render(
iv_form_class = 'w800px'
io_values = mo_form_data
io_validation_log = mo_validation_log ) ).
ri_html->add( '<div id="stage-details" class="dialog w800px">' ).
ri_html->add( render_stage_details( ) ).
ri_html->add( '</div>' ).
ENDMETHOD.
ENDCLASS. | 30.010508 | 119 | 0.663107 | {
"alnum_ratio": 0.6101794645,
"alpha_token_ratio": 1.7604770017,
"avg_line_length": 29.8157894737,
"char_rep_ratio": 0.1172141764,
"max_line_length": 119,
"num_words": 1233,
"text_len": 16995,
"word_rep_ratio": 0.0212418301
} | 5,028,805,886,648,274,000 |
039ceffca1158284df9b108aeb7b521bcad84cf2 | 356 | abap | ABAP | src/zif_abapgit_code_inspector.intf.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/zif_abapgit_code_inspector.intf.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/zif_abapgit_code_inspector.intf.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | INTERFACE zif_abapgit_code_inspector
PUBLIC .
METHODS run
IMPORTING
!iv_variant TYPE sci_chkv
!iv_save TYPE abap_bool DEFAULT abap_false
RETURNING
VALUE(rt_list) TYPE scit_alvlist
RAISING
zcx_abapgit_exception .
METHODS is_successful
RETURNING
VALUE(rv_success) TYPE abap_bool .
ENDINTERFACE. | 20.941176 | 54 | 0.710674 | {
"alnum_ratio": 0.6704225352,
"alpha_token_ratio": 1.9508196721,
"avg_line_length": 22.1875,
"char_rep_ratio": 0.1040462428,
"max_line_length": 54,
"num_words": 27,
"text_len": 355,
"word_rep_ratio": 0
} | 3,172,155,845,220,974,000 |
03b61fa271fa1bf00818e7c350e94bb582daae09 | 1,698 | abap | ABAP | src/persist/zif_abapgit_persist_repo.intf.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/persist/zif_abapgit_persist_repo.intf.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/persist/zif_abapgit_persist_repo.intf.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | INTERFACE zif_abapgit_persist_repo
PUBLIC .
METHODS add
IMPORTING
!iv_url TYPE string
!iv_branch_name TYPE string
!iv_branch TYPE zif_abapgit_definitions=>ty_sha1 OPTIONAL
iv_display_name TYPE string OPTIONAL
!iv_package TYPE devclass
!iv_offline TYPE abap_bool DEFAULT abap_false
!is_dot_abapgit TYPE zif_abapgit_dot_abapgit=>ty_dot_abapgit
RETURNING
VALUE(rv_key) TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception .
METHODS delete
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception .
METHODS list
RETURNING
VALUE(rt_repos) TYPE zif_abapgit_persistence=>ty_repos
RAISING
zcx_abapgit_exception .
METHODS list_favorites
IMPORTING it_keys TYPE zif_abapgit_persistence=>ty_repo_keys
RETURNING VALUE(rt_repos) TYPE zif_abapgit_persistence=>ty_repos
RAISING
zcx_abapgit_exception .
METHODS lock
IMPORTING
!iv_mode TYPE enqmode
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception .
METHODS read
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RETURNING
VALUE(rs_repo) TYPE zif_abapgit_persistence=>ty_repo
RAISING
zcx_abapgit_exception
zcx_abapgit_not_found .
METHODS update_metadata
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
!is_meta TYPE zif_abapgit_persistence=>ty_repo_xml
!is_change_mask TYPE zif_abapgit_persistence=>ty_repo_meta_mask
RAISING
zcx_abapgit_exception .
ENDINTERFACE. | 30.872727 | 72 | 0.722615 | {
"alnum_ratio": 0.6688273424,
"alpha_token_ratio": 1.8837209302,
"avg_line_length": 31.4259259259,
"char_rep_ratio": 0.2026066351,
"max_line_length": 72,
"num_words": 104,
"text_len": 1697,
"word_rep_ratio": 0
} | 8,072,360,762,168,377,000 |
03d05cc7c6ce652c629b981ea7c0ba3fde08a24a | 647 | abap | ABAP | src/profiles/ycx_failed_to_add_a_line.clas.abap | thomham/code-pal-for-abap | c58c4333f236a17937335871d9261b0897209399 | [
"Apache-2.0"
] | 202 | 2020-05-05T13:41:12.000Z | 2022-03-26T15:18:13.000Z | src/profiles/ycx_failed_to_add_a_line.clas.abap | thomham/code-pal-for-abap | c58c4333f236a17937335871d9261b0897209399 | [
"Apache-2.0"
] | 322 | 2020-05-05T19:14:35.000Z | 2022-03-22T14:48:44.000Z | src/profiles/ycx_failed_to_add_a_line.clas.abap | lucasborin/code-pal-for-abap | 4e1247693457e7687648806b18b63cb8968f927a | [
"Apache-2.0"
] | 59 | 2020-05-05T18:59:19.000Z | 2022-03-20T11:24:48.000Z | class YCX_FAILED_TO_ADD_A_LINE definition
public
inheriting from CX_STATIC_CHECK
final
create public .
public section.
interfaces IF_T100_MESSAGE .
methods CONSTRUCTOR
importing
!TEXTID like IF_T100_MESSAGE=>T100KEY optional
!PREVIOUS like PREVIOUS optional .
protected section.
private section.
ENDCLASS.
CLASS YCX_FAILED_TO_ADD_A_LINE IMPLEMENTATION.
method CONSTRUCTOR.
CALL METHOD SUPER->CONSTRUCTOR
EXPORTING
PREVIOUS = PREVIOUS
.
clear me->textid.
if textid is initial.
IF_T100_MESSAGE~T100KEY = IF_T100_MESSAGE=>DEFAULT_TEXTID.
else.
IF_T100_MESSAGE~T100KEY = TEXTID.
endif.
endmethod.
ENDCLASS. | 17.486486 | 60 | 0.785162 | {
"alnum_ratio": 0.7507739938,
"alpha_token_ratio": 2.067264574,
"avg_line_length": 17.9444444444,
"char_rep_ratio": 0.1098901099,
"max_line_length": 60,
"num_words": 55,
"text_len": 646,
"word_rep_ratio": 0
} | 3,172,528,766,988,770,000 |
03d8551ec4bb068dc96cb781cfcc9be4e4e6fa74 | 1,001 | abap | ABAP | src/objects/texts/zif_abapgit_lxe_texts.intf.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/texts/zif_abapgit_lxe_texts.intf.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/texts/zif_abapgit_lxe_texts.intf.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | INTERFACE zif_abapgit_lxe_texts
PUBLIC .
TYPES:
BEGIN OF ty_lxe_i18n,
source_lang TYPE lxeisolang,
target_lang TYPE lxeisolang,
custmnr TYPE lxecustmnr,
objtype TYPE trobjtype,
objname TYPE lxeobjname,
text_pairs TYPE STANDARD TABLE OF lxe_pcx_s1 WITH DEFAULT KEY,
END OF ty_lxe_i18n .
TYPES:
ty_tlxe_i18n TYPE STANDARD TABLE OF ty_lxe_i18n WITH DEFAULT KEY .
METHODS serialize
IMPORTING
!iv_lxe_text_name TYPE string DEFAULT 'LXE_TEXTS'
!iv_object_type TYPE trobjtype
!iv_object_name TYPE sobj_name
!ii_xml TYPE REF TO zif_abapgit_xml_output
RAISING
zcx_abapgit_exception .
METHODS deserialize
IMPORTING
!iv_lxe_text_name TYPE string DEFAULT 'LXE_TEXTS'
!iv_object_type TYPE trobjtype OPTIONAL
!iv_object_name TYPE sobj_name OPTIONAL
!ii_xml TYPE REF TO zif_abapgit_xml_input
RAISING
zcx_abapgit_exception .
ENDINTERFACE. | 29.441176 | 70 | 0.701299 | {
"alnum_ratio": 0.656,
"alpha_token_ratio": 1.7299465241,
"avg_line_length": 30.303030303,
"char_rep_ratio": 0.0928355197,
"max_line_length": 70,
"num_words": 89,
"text_len": 1000,
"word_rep_ratio": 0
} | 4,754,980,455,551,480,000 |
ff2bd5b385e64b8ef602abd441a2bdd6f1905aa1 | 9,365 | abap | ABAP | src/checks/y_check_db_access_in_ut.clas.abap | pokrakam/code-pal-for-abap | 65c008f75d4d2453c6994c57dc03741862c1d510 | [
"Apache-2.0"
] | 202 | 2020-05-05T13:41:12.000Z | 2022-03-26T15:18:13.000Z | src/checks/y_check_db_access_in_ut.clas.abap | pokrakam/code-pal-for-abap | 65c008f75d4d2453c6994c57dc03741862c1d510 | [
"Apache-2.0"
] | 322 | 2020-05-05T19:14:35.000Z | 2022-03-22T14:48:44.000Z | src/checks/y_check_db_access_in_ut.clas.abap | lucasborin/code-pal-for-abap | 4e1247693457e7687648806b18b63cb8968f927a | [
"Apache-2.0"
] | 59 | 2020-05-05T18:59:19.000Z | 2022-03-20T11:24:48.000Z | CLASS y_check_db_access_in_ut DEFINITION PUBLIC INHERITING FROM y_check_base CREATE PUBLIC.
PUBLIC SECTION.
METHODS constructor.
PROTECTED SECTION.
METHODS inspect_structures REDEFINITION.
METHODS inspect_tokens REDEFINITION.
PRIVATE SECTION.
CONSTANTS: BEGIN OF risk_level,
harmless TYPE string VALUE 'HARMLESS',
dangerous TYPE string VALUE 'DANGEROUS',
critical TYPE string VALUE 'CRITICAL',
END OF risk_level.
CONSTANTS: BEGIN OF check_for,
alter TYPE char40 VALUE 'ALTER',
delete TYPE char40 VALUE 'DELETE',
update TYPE char40 VALUE 'UPDATE',
modify TYPE char40 VALUE 'MODIFY',
insert TYPE char40 VALUE 'INSERT',
select TYPE char40 VALUE 'SELECT',
commit TYPE char40 VALUE 'COMMIT',
rollback TYPE char40 VALUE 'ROLLBACK',
END OF check_for.
CONSTANTS: BEGIN OF framework,
qsql_if TYPE char40 VALUE 'IF_OSQL_TEST_ENVIRONMENT',
qsql_cl TYPE char40 VALUE 'CL_OSQL_TEST_ENVIRONMENT',
cds_if TYPE char40 VALUE 'IF_CDS_TEST_ENVIRONMENT',
cds_cl TYPE char40 VALUE 'CL_CDS_TEST_ENVIRONMENT',
END OF framework.
CONSTANTS: BEGIN OF keys,
from TYPE char40 VALUE 'FROM',
into TYPE char40 VALUE 'INTO',
class TYPE char40 VALUE 'CLASS',
table TYPE char4 VALUE 'TABL',
END OF keys.
TYPES: BEGIN OF properties,
name TYPE string,
risk_level TYPE string,
END OF properties.
DATA defined_classes TYPE STANDARD TABLE OF properties.
METHODS get_class_name IMPORTING structure TYPE sstruc
RETURNING VALUE(result) TYPE string
RAISING cx_sy_itab_line_not_found.
METHODS get_risk_level IMPORTING statement TYPE sstmnt
RETURNING VALUE(result) TYPE string.
METHODS add_line_to_defined_classes IMPORTING statement TYPE sstmnt
structure TYPE sstruc.
METHODS check_class IMPORTING index TYPE i
statement TYPE sstmnt
structure TYPE sstruc.
METHODS is_part_of_framework IMPORTING structure TYPE sstruc
RETURNING VALUE(result) TYPE abap_bool.
METHODS is_persistent_object IMPORTING obj_name TYPE tadir-obj_name
RETURNING VALUE(result) TYPE abap_bool.
METHODS is_internal_table IMPORTING statement TYPE sstmnt
RETURNING VALUE(result) TYPE abap_bool.
METHODS get_forbidden_tokens IMPORTING class_name TYPE string
RETURNING VALUE(result) TYPE y_char255_tab.
METHODS has_ddic_itab_same_syntax IMPORTING token TYPE stokesx
RETURNING VALUE(result) TYPE abap_bool.
ENDCLASS.
CLASS Y_CHECK_DB_ACCESS_IN_UT IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
settings-pseudo_comment = '"#EC DB_ACCESS_UT' ##NO_TEXT.
settings-disable_threshold_selection = abap_true.
settings-disable_on_prodcode_selection = abap_true.
settings-disable_on_testcode_selection = abap_true.
settings-threshold = 0.
settings-apply_on_productive_code = abap_false.
settings-apply_on_test_code = abap_true.
settings-documentation = |{ c_docs_path-checks }db-access-in-ut.md|.
relevant_statement_types = VALUE #( ( scan_struc_stmnt_type-class_definition )
( scan_struc_stmnt_type-class_implementation ) ).
relevant_structure_types = VALUE #( ).
set_check_message( 'Database access(es) within a Unit-Test should be removed!' ).
ENDMETHOD.
METHOD inspect_tokens.
CASE structure-stmnt_type.
WHEN scan_struc_stmnt_type-class_definition.
add_line_to_defined_classes( statement = statement
structure = structure ).
WHEN scan_struc_stmnt_type-class_implementation.
check_class( index = index
statement = statement
structure = structure ).
ENDCASE.
ENDMETHOD.
METHOD is_persistent_object.
DATA(upper_name) = to_upper( obj_name ).
SELECT SINGLE @abap_true
FROM tadir
INTO @result
WHERE obj_name = @upper_name
AND object = @keys-table
AND delflag = @space.
ENDMETHOD.
METHOD is_internal_table.
DATA(second_token) = get_token_abs( statement-from + 1 ).
DATA(third_token) = get_token_abs( statement-from + 2 ).
DATA(fourth_token) = get_token_abs( statement-from + 2 ).
IF second_token = keys-into.
RETURN.
ENDIF.
DATA(table_name) = COND #( WHEN second_token = keys-from THEN third_token
WHEN third_token = keys-into THEN fourth_token
ELSE second_token ).
IF strlen( table_name ) > 40.
RETURN.
ENDIF.
result = xsdbool( is_persistent_object( CONV #( table_name ) ) = abap_false ).
ENDMETHOD.
METHOD add_line_to_defined_classes.
TRY.
DATA(class_config) = VALUE properties( name = get_class_name( structure ) ).
CATCH cx_sy_itab_line_not_found.
RETURN.
ENDTRY.
IF line_exists( defined_classes[ name = class_config-name ] ).
RETURN.
ENDIF.
class_config-risk_level = get_risk_level( statement ).
IF is_part_of_framework( structure ) = abap_false.
APPEND class_config TO defined_classes.
ENDIF.
ENDMETHOD.
METHOD check_class.
TRY.
DATA(class_name) = get_class_name( structure ).
CATCH cx_sy_itab_line_not_found.
RETURN.
ENDTRY.
IF NOT line_exists( defined_classes[ name = class_name ] ).
RETURN.
ENDIF.
DATA(forbidden_tokens) = get_forbidden_tokens( class_name ).
DATA(token) = ref_scan_manager->tokens[ statement-from ].
IF NOT line_exists( forbidden_tokens[ table_line = token-str ] ).
RETURN.
ENDIF.
IF has_ddic_itab_same_syntax( token ) = abap_true
AND is_internal_table( statement ) = abap_true.
RETURN.
ENDIF.
IF ref_scan_manager->tokens[ statement-from + 1 ]-str = '='.
RETURN.
ENDIF.
DATA(check_configuration) = detect_check_configuration( statement ).
IF check_configuration IS INITIAL.
RETURN.
ENDIF.
raise_error( statement_level = statement-level
statement_index = index
statement_from = statement-from
error_priority = check_configuration-prio ).
ENDMETHOD.
METHOD get_forbidden_tokens.
DATA risk_lvl TYPE properties-risk_level.
TRY.
risk_lvl = defined_classes[ name = class_name ]-risk_level.
CATCH cx_sy_itab_line_not_found.
risk_lvl = space.
ENDTRY.
CASE risk_lvl.
WHEN risk_level-dangerous OR risk_level-critical.
result = VALUE #( ( check_for-alter )
( check_for-delete )
( check_for-update )
( check_for-modify ) ).
WHEN OTHERS.
result = VALUE #( ( check_for-alter )
( check_for-delete )
( check_for-update )
( check_for-modify )
( check_for-insert )
( check_for-select )
( check_for-commit )
( check_for-rollback ) ).
ENDCASE.
ENDMETHOD.
METHOD is_part_of_framework.
LOOP AT ref_scan_manager->statements ASSIGNING FIELD-SYMBOL(<statement>)
FROM structure-stmnt_from TO structure-stmnt_to.
LOOP AT ref_scan_manager->tokens TRANSPORTING NO FIELDS
FROM <statement>-from TO <statement>-to
WHERE str = framework-qsql_if
OR str = framework-qsql_cl
OR str = framework-cds_if
OR str = framework-cds_cl.
result = abap_true.
RETURN.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD get_class_name.
DATA(index) = ref_scan_manager->statements[ structure-stmnt_from ]-from.
IF get_token_abs( index ) = keys-class.
result = get_token_abs( index + 1 ).
ENDIF.
ENDMETHOD.
METHOD get_risk_level.
LOOP AT ref_scan_manager->tokens ASSIGNING FIELD-SYMBOL(<token>)
FROM statement-from TO statement-to
WHERE str = risk_level-harmless
OR str = risk_level-dangerous
OR str = risk_level-critical.
result = <token>-str.
ENDLOOP.
ENDMETHOD.
METHOD inspect_structures.
relevant_statement_types = VALUE #( ( scan_struc_stmnt_type-class_definition ) ).
super->inspect_structures( ).
relevant_statement_types = VALUE #( ( scan_struc_stmnt_type-class_implementation ) ).
super->inspect_structures( ).
ENDMETHOD.
METHOD has_ddic_itab_same_syntax.
result = xsdbool( token-str = check_for-modify
OR token-str = check_for-update
OR token-str = check_for-delete
OR token-str = check_for-insert ).
ENDMETHOD.
ENDCLASS. | 32.071918 | 91 | 0.621356 | {
"alnum_ratio": 0.5888509184,
"alpha_token_ratio": 2.0066006601,
"avg_line_length": 32.1786941581,
"char_rep_ratio": 0.1841795831,
"max_line_length": 91,
"num_words": 635,
"text_len": 9364,
"word_rep_ratio": 0
} | 8,559,763,524,118,234,000 |
ff557b2f2e5ffb026a1fcd9e819dffdecb968adf | 6,750 | abap | ABAP | src/checks/zcl_aoc_check_25.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_25.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_25.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | CLASS zcl_aoc_check_25 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor .
METHODS check
REDEFINITION .
METHODS get_attributes
REDEFINITION .
METHODS if_ci_test~query_attributes
REDEFINITION .
METHODS put_attributes
REDEFINITION .
PROTECTED SECTION.
TYPES:
BEGIN OF ty_field,
name TYPE string,
level TYPE i,
row TYPE token_row,
END OF ty_field .
TYPES:
ty_fields_tt TYPE STANDARD TABLE OF ty_field WITH NON-UNIQUE DEFAULT KEY .
DATA mv_skip_radio TYPE sychar01 .
METHODS strip
IMPORTING
!iv_input TYPE string
RETURNING
VALUE(rv_output) TYPE string .
METHODS analyze
IMPORTING
!io_scan TYPE REF TO zcl_aoc_scan
!it_fields TYPE ty_fields_tt .
METHODS find_fields
IMPORTING
!it_tokens TYPE stokesx_tab
!it_statements TYPE sstmnt_tab
RETURNING
VALUE(rt_fields) TYPE ty_fields_tt .
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_AOC_CHECK_25 IMPLEMENTATION.
METHOD analyze.
* this might not be 100% correct but will work for most cases
DATA: lv_include TYPE program,
lv_name TYPE string,
lt_fields LIKE it_fields.
FIELD-SYMBOLS: <ls_statement> LIKE LINE OF io_scan->statements,
<ls_field> LIKE LINE OF it_fields,
<ls_token> LIKE LINE OF io_scan->tokens.
lt_fields = it_fields.
LOOP AT io_scan->statements ASSIGNING <ls_statement>.
LOOP AT io_scan->tokens ASSIGNING <ls_token>
FROM <ls_statement>-from
TO <ls_statement>-to
WHERE type <> io_scan->gc_token-comment
AND type <> io_scan->gc_token-literal.
lv_name = strip( <ls_token>-str ).
DELETE lt_fields
WHERE name = lv_name
AND ( row <> <ls_token>-row
OR level <> <ls_statement>-level ).
ENDLOOP.
ENDLOOP.
LOOP AT lt_fields ASSIGNING <ls_field>.
lv_include = io_scan->get_include( <ls_field>-level ).
inform( p_sub_obj_name = lv_include
p_line = <ls_field>-row
p_kind = mv_errty
p_test = myname
p_code = '001'
p_param_1 = <ls_field>-name ).
ENDLOOP.
ENDMETHOD.
METHOD check.
* abapOpenChecks
*
* MIT License
DATA: lt_fields TYPE ty_fields_tt.
lt_fields = find_fields( it_tokens = io_scan->tokens
it_statements = io_scan->statements ).
analyze( io_scan = io_scan
it_fields = lt_fields ).
ENDMETHOD.
METHOD constructor.
super->constructor( ).
version = '001'.
position = '025'.
has_attributes = abap_true.
attributes_ok = abap_true.
enable_rfc( ).
mv_skip_radio = abap_true.
insert_scimessage(
iv_code = '001'
iv_text = '&1 not referenced statically'(m01) ).
ENDMETHOD.
METHOD find_fields.
DATA: lv_keyword TYPE string,
lt_code TYPE string_table,
ls_result TYPE zcl_aoc_parser=>ty_result,
ls_field LIKE LINE OF rt_fields,
lv_statement TYPE string.
FIELD-SYMBOLS: <ls_statement> LIKE LINE OF it_statements,
<ls_rt> LIKE LINE OF ls_result-tokens,
<ls_token> LIKE LINE OF it_tokens.
LOOP AT it_statements ASSIGNING <ls_statement>
WHERE type = zcl_aoc_scan=>gc_statement-standard.
CLEAR lv_keyword.
CLEAR lv_statement.
LOOP AT it_tokens ASSIGNING <ls_token>
FROM <ls_statement>-from
TO <ls_statement>-to
WHERE type <> zcl_aoc_scan=>gc_token-comment.
IF lv_keyword IS INITIAL.
lv_keyword = <ls_token>-str.
ENDIF.
IF lv_statement IS INITIAL.
lv_statement = <ls_token>-str.
ELSE.
CONCATENATE lv_statement <ls_token>-str INTO lv_statement SEPARATED BY space.
ENDIF.
ENDLOOP.
IF lv_keyword <> 'PARAMETERS'
AND lv_keyword <> 'PARAMETER'
AND lv_keyword <> 'SELECT-OPTIONS'.
CONTINUE. " current loop
ENDIF.
CLEAR lt_code.
APPEND lv_statement TO lt_code.
ls_result = zcl_aoc_parser=>run( it_code = lt_code
iv_rule = lv_keyword ).
IF ls_result-match = abap_false.
CONTINUE.
ENDIF.
LOOP AT ls_result-tokens ASSIGNING <ls_rt>
WHERE value = zcl_aoc_parser=>c_role-fielddefid
AND type = zcl_aoc_parser=>c_type-role.
IF mv_skip_radio = abap_true.
READ TABLE ls_result-tokens
WITH KEY type = zcl_aoc_parser=>c_type-terminal code = 'RADIOBUTTON'
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
ENDIF.
CLEAR ls_field.
ls_field-name = strip( <ls_rt>-code ).
ls_field-level = <ls_statement>-level.
ls_field-row = <ls_token>-row.
APPEND ls_field TO rt_fields.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD get_attributes.
EXPORT
mv_errty = mv_errty
mv_skip_radio = mv_skip_radio
TO DATA BUFFER p_attributes.
ENDMETHOD.
METHOD if_ci_test~query_attributes.
zzaoc_top.
zzaoc_fill_att mv_errty 'Error Type' ''. "#EC NOTEXT
zzaoc_fill_att mv_skip_radio 'Skip radio buttons' 'C'. "#EC NOTEXT
zzaoc_popup.
ENDMETHOD.
METHOD put_attributes.
IMPORT
mv_errty = mv_errty
mv_skip_radio = mv_skip_radio
FROM DATA BUFFER p_attributes. "#EC CI_USE_WANTED
ASSERT sy-subrc = 0.
ENDMETHOD.
METHOD strip.
DATA: lv_offset TYPE i,
lv_length TYPE i.
rv_output = iv_input.
FIND FIRST OCCURRENCE OF '[' IN rv_output MATCH OFFSET lv_offset.
IF sy-subrc = 0.
rv_output = rv_output(lv_offset).
ENDIF.
FIND FIRST OCCURRENCE OF '+' IN rv_output MATCH OFFSET lv_offset.
IF sy-subrc = 0.
rv_output = rv_output(lv_offset).
ENDIF.
lv_length = strlen( rv_output ) - 1.
IF strlen( rv_output ) > 1 AND rv_output(1) = '(' AND rv_output+lv_length(1) = ')'.
lv_length = lv_length - 1.
rv_output = rv_output+1(lv_length).
ELSE.
FIND FIRST OCCURRENCE OF '(' IN rv_output MATCH OFFSET lv_offset.
IF sy-subrc = 0.
rv_output = rv_output(lv_offset).
ENDIF.
ENDIF.
IF strlen( rv_output ) > 1 AND rv_output(1) = '@'.
rv_output = rv_output+1.
ENDIF.
ENDMETHOD.
ENDCLASS. | 24.107143 | 87 | 0.607111 | {
"alnum_ratio": 0.5683410344,
"alpha_token_ratio": 1.7084653689,
"avg_line_length": 24.0465949821,
"char_rep_ratio": 0.1137313433,
"max_line_length": 87,
"num_words": 524,
"text_len": 6709,
"word_rep_ratio": 0.0291262136
} | 3,819,693,131,489,001,000 |
ffd3eb704fba497ba7596bd6fd898d48b0e65d9d | 13,180 | abap | ABAP | src/ui/zcl_abapgit_gui_page_sett_repo.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/ui/zcl_abapgit_gui_page_sett_repo.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/ui/zcl_abapgit_gui_page_sett_repo.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_gui_page_sett_repo DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_gui_component
FINAL
CREATE PRIVATE .
PUBLIC SECTION.
INTERFACES zif_abapgit_gui_event_handler .
INTERFACES zif_abapgit_gui_renderable .
CLASS-METHODS create
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo
RETURNING
VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable
RAISING
zcx_abapgit_exception .
METHODS constructor
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo
RAISING
zcx_abapgit_exception .
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS:
BEGIN OF c_id,
dot TYPE string VALUE 'dot',
main_language TYPE string VALUE 'main_language',
i18n_langs TYPE string VALUE 'i18n_langs',
starting_folder TYPE string VALUE 'starting_folder',
folder_logic TYPE string VALUE 'folder_logic',
ignore TYPE string VALUE 'ignore',
requirements TYPE string VALUE 'requirements',
END OF c_id .
CONSTANTS:
BEGIN OF c_event,
save TYPE string VALUE 'save',
END OF c_event .
CONSTANTS c_empty_rows TYPE i VALUE 2 ##NO_TEXT.
DATA mo_form TYPE REF TO zcl_abapgit_html_form .
DATA mo_form_data TYPE REF TO zcl_abapgit_string_map .
DATA mo_form_util TYPE REF TO zcl_abapgit_html_form_utils .
DATA mo_validation_log TYPE REF TO zcl_abapgit_string_map .
DATA mo_repo TYPE REF TO zcl_abapgit_repo .
DATA mv_requirements_count TYPE i .
METHODS validate_form
IMPORTING
!io_form_data TYPE REF TO zcl_abapgit_string_map
RETURNING
VALUE(ro_validation_log) TYPE REF TO zcl_abapgit_string_map
RAISING
zcx_abapgit_exception .
METHODS get_form_schema
RETURNING
VALUE(ro_form) TYPE REF TO zcl_abapgit_html_form
RAISING
zcx_abapgit_exception .
METHODS read_settings
RAISING
zcx_abapgit_exception .
METHODS save_settings
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS zcl_abapgit_gui_page_sett_repo IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT mo_validation_log.
CREATE OBJECT mo_form_data.
mo_repo = io_repo.
mo_form = get_form_schema( ).
mo_form_util = zcl_abapgit_html_form_utils=>create( mo_form ).
read_settings( ).
ENDMETHOD.
METHOD create.
DATA lo_component TYPE REF TO zcl_abapgit_gui_page_sett_repo.
CREATE OBJECT lo_component
EXPORTING
io_repo = io_repo.
ri_page = zcl_abapgit_gui_page_hoc=>create(
iv_page_title = 'Repository Settings'
io_page_menu = zcl_abapgit_gui_chunk_lib=>settings_repo_toolbar(
iv_key = io_repo->get_key( )
iv_act = zif_abapgit_definitions=>c_action-repo_settings )
ii_child_component = lo_component ).
ENDMETHOD.
METHOD get_form_schema.
ro_form = zcl_abapgit_html_form=>create(
iv_form_id = 'repo-settings-form'
iv_help_page = '' ).
ro_form->start_group(
iv_name = c_id-dot
iv_label = 'Repository Settings (.abapgit.xml)'
iv_hint = 'Settings stored in root folder in .abapgit.xml file'
)->text(
iv_name = c_id-main_language
iv_label = 'Main Language'
iv_hint = 'Main language of repository (cannot be changed)'
iv_readonly = abap_true
)->text(
iv_name = c_id-i18n_langs
iv_label = 'Serialize Translations (experimental LXE approach)'
iv_hint = 'Comma-separate 2-letter ISO language codes e.g. "DE,ES,..." - should not include main language'
)->radio(
iv_name = c_id-folder_logic
iv_default_value = zif_abapgit_dot_abapgit=>c_folder_logic-prefix
iv_label = 'Folder Logic'
iv_hint = 'Define how package folders are named in repository'
)->option(
iv_label = 'Prefix'
iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-prefix
)->option(
iv_label = 'Full'
iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-full
)->text(
iv_name = c_id-starting_folder
iv_label = 'Starting Folder'
iv_hint = 'Root folder that defines where serialization starts'
)->textarea(
iv_name = c_id-ignore
iv_label = 'Ignore Files'
iv_hint = 'List of files in starting folder that shall not be serialized'
)->table(
iv_name = c_id-requirements
iv_label = 'Requirements'
iv_hint = 'List of software components with minimum release and patch'
)->column(
iv_label = 'Software Component'
iv_width = '40%'
)->column(
iv_label = 'Minimum Release'
iv_width = '30%'
)->column(
iv_label = 'Minimum Patch'
iv_width = '30%'
)->command(
iv_label = 'Save Settings'
iv_cmd_type = zif_abapgit_html_form=>c_cmd_type-input_main
iv_action = c_event-save
)->command(
iv_label = 'Back'
iv_action = zif_abapgit_definitions=>c_action-go_back ).
ENDMETHOD.
METHOD read_settings.
DATA:
lo_dot TYPE REF TO zcl_abapgit_dot_abapgit,
ls_dot TYPE zif_abapgit_dot_abapgit=>ty_dot_abapgit,
lv_main_lang TYPE spras,
lv_language TYPE t002t-sptxt,
lv_ignore TYPE string,
ls_requirements LIKE LINE OF ls_dot-requirements,
lv_row TYPE i,
lv_val TYPE string.
FIELD-SYMBOLS:
<lv_ignore> TYPE string.
" Get settings from DB
lo_dot = mo_repo->get_dot_abapgit( ).
ls_dot = lo_dot->get_data( ).
lv_main_lang = lo_dot->get_main_language( ).
" Repository Settings
SELECT SINGLE sptxt INTO lv_language FROM t002t
WHERE spras = sy-langu AND sprsl = lv_main_lang.
IF sy-subrc <> 0.
lv_language = 'Unknown language; Check your .abapgit.xml file'.
ENDIF.
mo_form_data->set(
iv_key = c_id-main_language
iv_val = |{ lv_main_lang } ({ lv_language })| ).
mo_form_data->set(
iv_key = c_id-i18n_langs
iv_val = zcl_abapgit_lxe_texts=>convert_table_to_lang_string( lo_dot->get_i18n_languages( ) ) ).
mo_form_data->set(
iv_key = c_id-folder_logic
iv_val = ls_dot-folder_logic ).
mo_form_data->set(
iv_key = c_id-starting_folder
iv_val = ls_dot-starting_folder ).
LOOP AT ls_dot-ignore ASSIGNING <lv_ignore>.
lv_ignore = lv_ignore && <lv_ignore> && zif_abapgit_definitions=>c_newline.
ENDLOOP.
IF sy-subrc <> 0.
lv_ignore = zif_abapgit_definitions=>c_newline.
ENDIF.
mo_form_data->set(
iv_key = c_id-ignore
iv_val = lv_ignore ).
LOOP AT ls_dot-requirements INTO ls_requirements.
lv_row = lv_row + 1.
DO 3 TIMES.
CASE sy-index.
WHEN 1.
lv_val = ls_requirements-component.
WHEN 2.
lv_val = ls_requirements-min_release.
WHEN 3.
lv_val = ls_requirements-min_patch.
ENDCASE.
mo_form_data->set(
iv_key = |{ c_id-requirements }-{ lv_row }-{ sy-index }|
iv_val = lv_val ).
ENDDO.
ENDLOOP.
DO c_empty_rows TIMES.
lv_row = lv_row + 1.
DO 3 TIMES.
mo_form_data->set(
iv_key = |{ c_id-requirements }-{ lv_row }-{ sy-index }|
iv_val = '' ).
ENDDO.
ENDDO.
mv_requirements_count = lv_row.
mo_form_data->set(
iv_key = |{ c_id-requirements }-{ zif_abapgit_html_form=>c_rows }|
iv_val = |{ mv_requirements_count }| ).
" Set for is_dirty check
mo_form_util->set_data( mo_form_data ).
ENDMETHOD.
METHOD save_settings.
DATA:
lo_dot TYPE REF TO zcl_abapgit_dot_abapgit,
lv_ignore TYPE string,
lt_ignore TYPE STANDARD TABLE OF string WITH DEFAULT KEY,
ls_requirements TYPE zif_abapgit_dot_abapgit=>ty_requirement,
lt_requirements TYPE zif_abapgit_dot_abapgit=>ty_requirement_tt.
lo_dot = mo_repo->get_dot_abapgit( ).
lo_dot->set_folder_logic( mo_form_data->get( c_id-folder_logic ) ).
lo_dot->set_starting_folder( mo_form_data->get( c_id-starting_folder ) ).
lo_dot->set_i18n_languages(
zcl_abapgit_lxe_texts=>convert_lang_string_to_table(
iv_langs = mo_form_data->get( c_id-i18n_langs )
iv_skip_main_language = lo_dot->get_main_language( ) ) ).
" Remove all ignores
lt_ignore = lo_dot->get_data( )-ignore.
LOOP AT lt_ignore INTO lv_ignore.
lo_dot->remove_ignore( iv_path = ''
iv_filename = lv_ignore ).
ENDLOOP.
" Add newly entered ignores
lt_ignore = zcl_abapgit_convert=>split_string( mo_form_data->get( c_id-ignore ) ).
LOOP AT lt_ignore INTO lv_ignore WHERE table_line IS NOT INITIAL.
lo_dot->add_ignore( iv_path = ''
iv_filename = lv_ignore ).
ENDLOOP.
" Requirements
DO mv_requirements_count TIMES.
ls_requirements-component = to_upper( mo_form_data->get( |{ c_id-requirements }-{ sy-index }-1| ) ).
ls_requirements-min_release = mo_form_data->get( |{ c_id-requirements }-{ sy-index }-2| ).
ls_requirements-min_patch = mo_form_data->get( |{ c_id-requirements }-{ sy-index }-3| ).
APPEND ls_requirements TO lt_requirements.
ENDDO.
SORT lt_requirements BY component min_release min_patch.
DELETE lt_requirements WHERE component IS INITIAL.
DELETE ADJACENT DUPLICATES FROM lt_requirements COMPARING ALL FIELDS.
lo_dot->set_requirements( lt_requirements ).
mo_repo->set_dot_abapgit( lo_dot ).
mo_repo->refresh( ).
COMMIT WORK AND WAIT.
MESSAGE 'Settings succesfully saved' TYPE 'S'.
read_settings( ).
ENDMETHOD.
METHOD validate_form.
DATA:
lv_folder TYPE string,
lv_len TYPE i,
lv_component TYPE zif_abapgit_dot_abapgit=>ty_requirement-component,
lv_min_release TYPE zif_abapgit_dot_abapgit=>ty_requirement-min_release,
lv_min_patch TYPE zif_abapgit_dot_abapgit=>ty_requirement-min_patch.
ro_validation_log = mo_form_util->validate( io_form_data ).
lv_folder = io_form_data->get( c_id-starting_folder ).
lv_len = strlen( lv_folder ) - 1.
IF lv_len > 0 AND lv_folder(1) <> '/'.
ro_validation_log->set(
iv_key = c_id-starting_folder
iv_val = |The folder must begin with /| ).
ELSEIF lv_len > 0 AND lv_folder+lv_len(1) <> '/'.
ro_validation_log->set(
iv_key = c_id-starting_folder
iv_val = |The folder must end with /| ).
ELSEIF lv_folder CA '\'.
ro_validation_log->set(
iv_key = c_id-starting_folder
iv_val = |Use / instead of \\| ).
ENDIF.
DO mv_requirements_count TIMES.
lv_component = mo_form_data->get( |{ c_id-requirements }-{ sy-index }-1| ).
lv_min_release = mo_form_data->get( |{ c_id-requirements }-{ sy-index }-2| ).
lv_min_patch = mo_form_data->get( |{ c_id-requirements }-{ sy-index }-3| ).
IF lv_component IS INITIAL AND ( lv_min_release IS NOT INITIAL OR lv_min_patch IS NOT INITIAL ).
ro_validation_log->set(
iv_key = c_id-requirements
iv_val = |If you enter a release or patch, you must also enter a software component| ).
ELSEIF lv_component IS NOT INITIAL AND lv_min_release IS INITIAL.
ro_validation_log->set(
iv_key = c_id-requirements
iv_val = |If you enter a software component, you must also enter a minumum release| ).
ENDIF.
ENDDO.
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event.
mo_form_data = mo_form_util->normalize( ii_event->form_data( ) ).
CASE ii_event->mv_action.
WHEN zif_abapgit_definitions=>c_action-go_back.
rs_handled-state = mo_form_util->exit( mo_form_data ).
WHEN c_event-save.
" Validate all form entries
mo_validation_log = validate_form( mo_form_data ).
IF mo_validation_log->is_empty( ) = abap_true.
save_settings( ).
ENDIF.
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
ENDCASE.
ENDMETHOD.
METHOD zif_abapgit_gui_renderable~render.
gui_services( )->register_event_handler( me ).
IF mo_form_util->is_empty( mo_form_data ) = abap_true.
read_settings( ).
ENDIF.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( `<div class="repo">` ).
ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top(
io_repo = mo_repo
iv_show_commit = abap_false
iv_interactive_branch = abap_true ) ).
ri_html->add( mo_form->render(
io_values = mo_form_data
io_validation_log = mo_validation_log ) ).
ri_html->add( `</div>` ).
ENDMETHOD.
ENDCLASS. | 31.912833 | 119 | 0.645903 | {
"alnum_ratio": 0.5937999848,
"alpha_token_ratio": 1.7187222715,
"avg_line_length": 31.8665048544,
"char_rep_ratio": 0.125304878,
"max_line_length": 119,
"num_words": 906,
"text_len": 13129,
"word_rep_ratio": 0
} | 12,228,686,424,605,415,000 |
ffdaaebd89e1cc4e2f1053f571c49b84a5356592 | 6,383 | abap | ABAP | src/foundation/y_exemption_of_class.clas.abap | pokrakam/code-pal-for-abap | 65c008f75d4d2453c6994c57dc03741862c1d510 | [
"Apache-2.0"
] | 202 | 2020-05-05T13:41:12.000Z | 2022-03-26T15:18:13.000Z | src/foundation/y_exemption_of_class.clas.abap | pokrakam/code-pal-for-abap | 65c008f75d4d2453c6994c57dc03741862c1d510 | [
"Apache-2.0"
] | 322 | 2020-05-05T19:14:35.000Z | 2022-03-22T14:48:44.000Z | src/foundation/y_exemption_of_class.clas.abap | lucasborin/code-pal-for-abap | 4e1247693457e7687648806b18b63cb8968f927a | [
"Apache-2.0"
] | 59 | 2020-05-05T18:59:19.000Z | 2022-03-20T11:24:48.000Z | CLASS y_exemption_of_class DEFINITION PUBLIC CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES y_if_exemption_of_object.
ALIASES is_exempted FOR y_if_exemption_of_object~is_exempted.
PRIVATE SECTION.
CLASS-DATA class_header_data TYPE seoclassdf.
CLASS-METHODS is_srv_maint_ui_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_odata_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_ecatt_odata_test_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_fin_infotype_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_extensibility_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_shma_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_proxy_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_sadl_generate RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_exit_class RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_exception_class RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_bcp_application RETURNING VALUE(result) TYPE abap_bool.
ENDCLASS.
CLASS y_exemption_of_class IMPLEMENTATION.
METHOD y_if_exemption_of_object~is_exempted.
result = abap_true.
SELECT SINGLE *
FROM seoclassdf
INTO @class_header_data
WHERE clsname = @object_name
AND version = 1.
IF sy-subrc = 0.
result = xsdbool( is_srv_maint_ui_generate( ) = abap_true OR
is_odata_generate( ) = abap_true OR
is_ecatt_odata_test_generate( ) = abap_true OR
is_fin_infotype_generate( ) = abap_true OR
is_extensibility_generate( ) = abap_true OR
is_shma_generate( ) = abap_true OR
is_proxy_generate( ) = abap_true OR
is_sadl_generate( ) = abap_true OR
is_exit_class( ) = abap_true OR
is_exception_class( ) = abap_true OR
is_bcp_application( ) = abap_true ).
ENDIF.
ENDMETHOD.
METHOD is_bcp_application.
DATA it_bsp_classes TYPE STANDARD TABLE OF seoclsname.
it_bsp_classes = VALUE #( ( 'CL_BSP_WD_COMPONENT_CONTROLLER' )
( 'CL_BSP_WD_CONTEXT' )
( 'CL_BSP_WD_CONTEXT_NODE' )
( 'CL_BSP_WD_WINDOW' )
( 'CL_BSP_WD_CUSTOM_CONTROLLER' )
( 'CL_BSP_WD_VIEW_CONTROLLER' )
( 'CL_BSP_WD_ADVSEARCH_CONTROLLER' )
( 'CL_BSP_WD_CONTEXT_NODE_ASP' ) ).
SELECT SINGLE refclsname FROM seometarel
WHERE clsname = @class_header_data-clsname AND refclsname IS NOT NULL
INTO @DATA(inherited_by).
IF sy-subrc <> 0.
RETURN.
ENDIF.
"Multi Inheritance
DO.
LOOP AT it_bsp_classes TRANSPORTING NO FIELDS WHERE table_line = inherited_by.
result = abap_true.
RETURN.
ENDLOOP.
SELECT SINGLE refclsname FROM seometarel
WHERE clsname = @inherited_by AND refclsname IS NOT NULL
INTO @inherited_by.
IF sy-subrc = 4.
RETURN.
ENDIF.
ENDDO.
ENDMETHOD.
METHOD is_ecatt_odata_test_generate.
SELECT SINGLE @abap_true
FROM seoclassdf
INTO @result
WHERE clsname = @class_header_data-clsname
AND author = 'eCATTClassGe'.
ENDMETHOD.
METHOD is_exception_class.
CONSTANTS exception_clase_type LIKE class_header_data-category VALUE '40'.
IF class_header_data-category = exception_clase_type.
result = abap_true.
ENDIF.
ENDMETHOD.
METHOD is_exit_class.
CONSTANTS exit_class_type LIKE class_header_data-category VALUE '01'.
IF class_header_data-category = exit_class_type.
result = abap_true.
ENDIF.
ENDMETHOD.
METHOD is_extensibility_generate.
DATA: lt_interfaces TYPE seor_implementing_keys.
DATA: lv_seoclskey TYPE seoclskey.
lv_seoclskey = class_header_data-clsname.
CALL FUNCTION 'SEO_CLASS_ALL_IMPLEMENTG_GET'
EXPORTING
clskey = lv_seoclskey
IMPORTING
set = lt_interfaces
EXCEPTIONS
not_existing = 1
is_interface = 2
model_only = 3
OTHERS = 4.
IF sy-subrc <> 0.
RETURN.
ENDIF.
LOOP AT lt_interfaces TRANSPORTING NO FIELDS
WHERE refclsname = 'IF_CFD_ODATA_MPC_FLX' OR refclsname = 'IF_CFD_ODATA_DPC_FLX'.
result = abap_true.
RETURN.
ENDLOOP.
ENDMETHOD.
METHOD is_fin_infotype_generate.
SELECT SINGLE @abap_true
FROM t777ditclass
INTO @result
WHERE idclass = @class_header_data-clsname
OR cont_db = @class_header_data-clsname
OR bl_class = @class_header_data-clsname.
ENDMETHOD.
METHOD is_odata_generate.
SELECT SINGLE @abap_true
FROM /iwbep/i_sbd_ga
INTO @result
WHERE ( gen_art_type = 'DPCB' OR gen_art_type = 'MPCB' )
AND trobj_type = 'CLAS'
AND trobj_name = @class_header_data-clsname. "#EC CI_NOFIELD
ENDMETHOD.
METHOD is_proxy_generate.
result = xsdbool( class_header_data-clsproxy = abap_true ).
ENDMETHOD.
METHOD is_sadl_generate.
SELECT SINGLE @abap_true
FROM seoclasstx
INTO @result
WHERE clsname = @class_header_data-clsname
AND descript = 'Generated by SADL Generation Toolkit' ##NO_TEXT.
ENDMETHOD.
METHOD is_shma_generate.
SELECT SINGLE @abap_true
FROM tadir
INTO @result
WHERE pgmid = 'R3TR'
AND object = 'SHMA'
AND obj_name = @class_header_data-clsname.
ENDMETHOD.
METHOD is_srv_maint_ui_generate.
DATA: lt_interfaces TYPE seor_implementing_keys.
DATA: lv_seoclskey TYPE seoclskey.
lv_seoclskey = class_header_data-clsname.
CALL FUNCTION 'SEO_CLASS_ALL_IMPLEMENTG_GET'
EXPORTING
clskey = lv_seoclskey
IMPORTING
set = lt_interfaces
EXCEPTIONS
not_existing = 1
is_interface = 2
model_only = 3
OTHERS = 4.
IF sy-subrc <> 0.
RETURN.
ENDIF.
LOOP AT lt_interfaces TRANSPORTING NO FIELDS
WHERE refclsname = '/FTI/IF_FTI_MODEL' OR refclsname = '/FTI/IF_NATIVE_SQL_GENERATOR'.
result = abap_true.
RETURN.
ENDLOOP.
ENDMETHOD.
ENDCLASS. | 30.108491 | 92 | 0.666614 | {
"alnum_ratio": 0.6233155751,
"alpha_token_ratio": 1.7989995452,
"avg_line_length": 30.2464454976,
"char_rep_ratio": 0.1484387259,
"max_line_length": 92,
"num_words": 447,
"text_len": 6382,
"word_rep_ratio": 0.1232876712
} | 14,143,860,330,382,924,000 |
ffdc71d4a7915b854095265840e36298d8b5927f | 2,044 | abap | ABAP | src/zcl_abapgit_injector.clas.testclasses.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/zcl_abapgit_injector.clas.testclasses.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/zcl_abapgit_injector.clas.testclasses.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS ltcl_abapgit_tadir_mock DEFINITION FOR TESTING.
PUBLIC SECTION.
INTERFACES: zif_abapgit_tadir.
ENDCLASS.
CLASS ltcl_no_dependency_injection DEFINITION FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT.
PRIVATE SECTION.
METHODS:
no_injection FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_simple_dependency_inject DEFINITION FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT.
PRIVATE SECTION.
METHODS:
setup,
simple_injection FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_abapgit_tadir_mock IMPLEMENTATION.
METHOD zif_abapgit_tadir~get_object_package.
ENDMETHOD.
METHOD zif_abapgit_tadir~read.
ENDMETHOD.
METHOD zif_abapgit_tadir~read_single.
ENDMETHOD.
ENDCLASS.
CLASS ltcl_no_dependency_injection IMPLEMENTATION.
METHOD no_injection.
DATA: li_tadir TYPE REF TO zif_abapgit_tadir,
lo_class_descr TYPE REF TO cl_abap_classdescr.
li_tadir = zcl_abapgit_factory=>get_tadir( ).
lo_class_descr ?= cl_abap_classdescr=>describe_by_object_ref( li_tadir ).
cl_abap_unit_assert=>assert_equals(
exp = '\CLASS=ZCL_ABAPGIT_TADIR'
act = lo_class_descr->absolute_name ).
ENDMETHOD.
ENDCLASS.
CLASS ltcl_simple_dependency_inject IMPLEMENTATION.
METHOD setup.
DATA: lo_tadir_mock TYPE REF TO ltcl_abapgit_tadir_mock.
CREATE OBJECT lo_tadir_mock.
zcl_abapgit_injector=>set_tadir( lo_tadir_mock ).
ENDMETHOD.
METHOD simple_injection.
DATA: li_tadir TYPE REF TO zif_abapgit_tadir,
lo_class_descr TYPE REF TO cl_abap_classdescr.
li_tadir = zcl_abapgit_factory=>get_tadir( ).
lo_class_descr ?= cl_abap_classdescr=>describe_by_object_ref( li_tadir ).
cl_abap_unit_assert=>assert_equals(
exp = '\CLASS-POOL=ZCL_ABAPGIT_INJECTOR\CLASS=LTCL_ABAPGIT_TADIR_MOCK'
act = lo_class_descr->absolute_name ).
ENDMETHOD.
ENDCLASS. | 22.217391 | 77 | 0.716732 | {
"alnum_ratio": 0.6642192854,
"alpha_token_ratio": 1.790237467,
"avg_line_length": 22.4505494505,
"char_rep_ratio": 0.1420845624,
"max_line_length": 77,
"num_words": 132,
"text_len": 2043,
"word_rep_ratio": 0.1788617886
} | 13,042,564,264,104,036,000 |
0822769d8b019a837b16435fca5a0550e55cc514 | 902 | abap | ABAP | src/repo/zif_abapgit_dot_abapgit.intf.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/repo/zif_abapgit_dot_abapgit.intf.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/repo/zif_abapgit_dot_abapgit.intf.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | INTERFACE zif_abapgit_dot_abapgit PUBLIC.
TYPES:
BEGIN OF ty_requirement,
component TYPE tdevc-dlvunit,
min_release TYPE saprelease,
min_patch TYPE sappatchlv,
END OF ty_requirement .
TYPES:
ty_requirement_tt TYPE STANDARD TABLE OF ty_requirement WITH DEFAULT KEY .
TYPES:
BEGIN OF ty_dot_abapgit,
master_language TYPE spras,
i18n_languages TYPE zif_abapgit_definitions=>ty_languages,
starting_folder TYPE string,
folder_logic TYPE string,
ignore TYPE STANDARD TABLE OF string WITH DEFAULT KEY,
requirements TYPE ty_requirement_tt,
END OF ty_dot_abapgit .
CONSTANTS:
BEGIN OF c_folder_logic,
prefix TYPE string VALUE 'PREFIX',
full TYPE string VALUE 'FULL',
END OF c_folder_logic .
ENDINTERFACE. | 31.103448 | 82 | 0.646341 | {
"alnum_ratio": 0.6170921199,
"alpha_token_ratio": 2.0827067669,
"avg_line_length": 32.1785714286,
"char_rep_ratio": 0.168161435,
"max_line_length": 82,
"num_words": 78,
"text_len": 901,
"word_rep_ratio": 0
} | 12,119,524,896,609,092,000 |
0830015039778b5da25f695ab0641421ae61c563 | 9,945 | abap | ABAP | src/ui/zcl_abapgit_gui_page_addonline.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/ui/zcl_abapgit_gui_page_addonline.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/ui/zcl_abapgit_gui_page_addonline.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_gui_page_addonline DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_gui_component
FINAL
CREATE PRIVATE.
PUBLIC SECTION.
INTERFACES zif_abapgit_gui_event_handler.
INTERFACES zif_abapgit_gui_renderable.
CLASS-METHODS create
RETURNING
VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable
RAISING
zcx_abapgit_exception.
METHODS constructor
RAISING
zcx_abapgit_exception.
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS:
BEGIN OF c_id,
url TYPE string VALUE 'url',
package TYPE string VALUE 'package',
branch_name TYPE string VALUE 'branch_name',
display_name TYPE string VALUE 'display_name',
folder_logic TYPE string VALUE 'folder_logic',
ignore_subpackages TYPE string VALUE 'ignore_subpackages',
main_lang_only TYPE string VALUE 'main_lang_only',
END OF c_id.
CONSTANTS:
BEGIN OF c_event,
go_back TYPE string VALUE 'go-back',
choose_package TYPE string VALUE 'choose-package',
create_package TYPE string VALUE 'create-package',
choose_branch TYPE string VALUE 'choose-branch',
add_online_repo TYPE string VALUE 'add-repo-online',
END OF c_event.
DATA mo_form TYPE REF TO zcl_abapgit_html_form .
DATA mo_form_data TYPE REF TO zcl_abapgit_string_map .
DATA mo_form_util TYPE REF TO zcl_abapgit_html_form_utils.
DATA mo_validation_log TYPE REF TO zcl_abapgit_string_map .
METHODS validate_form
IMPORTING
io_form_data TYPE REF TO zcl_abapgit_string_map
RETURNING
VALUE(ro_validation_log) TYPE REF TO zcl_abapgit_string_map
RAISING
zcx_abapgit_exception.
METHODS get_form_schema
RETURNING
VALUE(ro_form) TYPE REF TO zcl_abapgit_html_form.
ENDCLASS.
CLASS zcl_abapgit_gui_page_addonline IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT mo_validation_log.
CREATE OBJECT mo_form_data.
mo_form = get_form_schema( ).
mo_form_util = zcl_abapgit_html_form_utils=>create( mo_form ).
ENDMETHOD.
METHOD create.
DATA lo_component TYPE REF TO zcl_abapgit_gui_page_addonline.
CREATE OBJECT lo_component.
ri_page = zcl_abapgit_gui_page_hoc=>create(
iv_page_title = 'New Online Repository'
ii_child_component = lo_component ).
ENDMETHOD.
METHOD get_form_schema.
ro_form = zcl_abapgit_html_form=>create(
iv_form_id = 'add-repo-online-form'
iv_help_page = '' ).
ro_form->text(
iv_name = c_id-url
iv_required = abap_true
iv_condense = abap_true
iv_label = 'Git Repository URL'
iv_hint = 'HTTPS address of the repository'
iv_placeholder = ''
)->text(
iv_name = c_id-package
iv_side_action = c_event-choose_package
iv_required = abap_true
iv_upper_case = abap_true
iv_label = 'Package'
iv_hint = 'SAP package for repository (should be a dedicated one)'
iv_placeholder = 'Z... / $...'
)->text(
iv_name = c_id-branch_name
iv_side_action = c_event-choose_branch
iv_label = 'Branch'
iv_hint = 'Switch to a specific branch (default: autodetect)'
iv_placeholder = 'Autodetect default branch'
)->radio(
iv_name = c_id-folder_logic
iv_default_value = zif_abapgit_dot_abapgit=>c_folder_logic-prefix
iv_label = 'Folder Logic'
iv_hint = 'Define how package folders are named in repository'
)->option(
iv_label = 'Prefix'
iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-prefix
)->option(
iv_label = 'Full'
iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-full
)->option(
iv_label = 'Mixed'
iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-mixed
)->text(
iv_name = c_id-display_name
iv_label = 'Display Name'
iv_hint = 'Name to show instead of original repository name (optional)'
)->checkbox(
iv_name = c_id-ignore_subpackages
iv_label = 'Ignore Subpackages'
iv_hint = 'Synchronize root package only'
)->checkbox(
iv_name = c_id-main_lang_only
iv_label = 'Serialize Main Language Only'
iv_hint = 'Ignore translations, serialize just main language'
)->command(
iv_label = 'Create Online Repo'
iv_cmd_type = zif_abapgit_html_form=>c_cmd_type-input_main
iv_action = c_event-add_online_repo
)->command(
iv_label = 'Create Package'
iv_action = c_event-create_package
)->command(
iv_label = 'Back'
iv_action = c_event-go_back ).
ENDMETHOD.
METHOD validate_form.
DATA lx_err TYPE REF TO zcx_abapgit_exception.
ro_validation_log = mo_form_util->validate( io_form_data ).
IF io_form_data->get( c_id-url ) IS NOT INITIAL.
TRY.
zcl_abapgit_repo_srv=>get_instance( )->validate_url( io_form_data->get( c_id-url ) ).
CATCH zcx_abapgit_exception INTO lx_err.
ro_validation_log->set(
iv_key = c_id-url
iv_val = lx_err->get_text( ) ).
ENDTRY.
ENDIF.
IF io_form_data->get( c_id-package ) IS NOT INITIAL.
TRY.
zcl_abapgit_repo_srv=>get_instance( )->validate_package(
iv_package = |{ io_form_data->get( c_id-package ) }|
iv_ign_subpkg = |{ io_form_data->get( c_id-ignore_subpackages ) }| ).
CATCH zcx_abapgit_exception INTO lx_err.
ro_validation_log->set(
iv_key = c_id-package
iv_val = lx_err->get_text( ) ).
ENDTRY.
ENDIF.
IF io_form_data->get( c_id-folder_logic ) <> zif_abapgit_dot_abapgit=>c_folder_logic-prefix
AND io_form_data->get( c_id-folder_logic ) <> zif_abapgit_dot_abapgit=>c_folder_logic-full
AND io_form_data->get( c_id-folder_logic ) <> zif_abapgit_dot_abapgit=>c_folder_logic-mixed.
ro_validation_log->set(
iv_key = c_id-folder_logic
iv_val = |Invalid folder logic { io_form_data->get( c_id-folder_logic ) }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event.
DATA: ls_repo_params TYPE zif_abapgit_services_repo=>ty_repo_params,
lo_new_online_repo TYPE REF TO zcl_abapgit_repo_online.
mo_form_data = mo_form_util->normalize( ii_event->form_data( ) ).
CASE ii_event->mv_action.
WHEN c_event-go_back.
rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back.
WHEN c_event-create_package.
mo_form_data->set(
iv_key = c_id-package
iv_val = zcl_abapgit_services_basis=>create_package(
iv_prefill_package = |{ mo_form_data->get( c_id-package ) }| ) ).
IF mo_form_data->get( c_id-package ) IS NOT INITIAL.
mo_validation_log = validate_form( mo_form_data ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
ELSE.
rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act.
ENDIF.
WHEN c_event-choose_package.
mo_form_data->set(
iv_key = c_id-package
iv_val = zcl_abapgit_ui_factory=>get_popups( )->popup_search_help( 'TDEVC-DEVCLASS' ) ).
IF mo_form_data->get( c_id-package ) IS NOT INITIAL.
mo_validation_log = validate_form( mo_form_data ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
ELSE.
rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act.
ENDIF.
WHEN c_event-choose_branch.
mo_validation_log = validate_form( mo_form_data ).
IF mo_validation_log->has( c_id-url ) = abap_true.
mo_validation_log->set(
iv_key = c_id-branch_name
iv_val = 'Check URL issues' ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. " Display errors
RETURN.
ENDIF.
mo_form_data->set(
iv_key = c_id-branch_name
iv_val = zcl_abapgit_ui_factory=>get_popups( )->branch_list_popup( mo_form_data->get( c_id-url ) )-name ).
IF mo_form_data->get( c_id-branch_name ) IS INITIAL.
rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act.
ELSE.
mo_form_data->set(
iv_key = c_id-branch_name
iv_val = replace( " strip technical
val = mo_form_data->get( c_id-branch_name )
sub = zif_abapgit_definitions=>c_git_branch-heads_prefix
with = '' ) ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
ENDIF.
WHEN c_event-add_online_repo.
mo_validation_log = validate_form( mo_form_data ).
IF mo_validation_log->is_empty( ) = abap_true.
mo_form_data->to_abap( CHANGING cs_container = ls_repo_params ).
lo_new_online_repo = zcl_abapgit_services_repo=>new_online( ls_repo_params ).
CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_repo_view
EXPORTING
iv_key = lo_new_online_repo->get_key( ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page_replacing.
ELSE.
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. " Display errors
ENDIF.
ENDCASE.
ENDMETHOD.
METHOD zif_abapgit_gui_renderable~render.
gui_services( )->register_event_handler( me ).
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( mo_form->render(
io_values = mo_form_data
io_validation_log = mo_validation_log ) ).
ENDMETHOD.
ENDCLASS. | 34.293103 | 116 | 0.654399 | {
"alnum_ratio": 0.5957037187,
"alpha_token_ratio": 1.7465834819,
"avg_line_length": 34.1487889273,
"char_rep_ratio": 0.1352941176,
"max_line_length": 116,
"num_words": 614,
"text_len": 9869,
"word_rep_ratio": 0.0231404959
} | 4,795,104,471,449,308,000 |
084a5e94805cf6887f9f8407899a7290425afe17 | 425 | abap | ABAP | src/checks/zcl_aoc_check_69.clas.locals_imp.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_69.clas.locals_imp.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_69.clas.locals_imp.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | CLASS lcl_stack IMPLEMENTATION.
METHOD push.
APPEND iv_string TO mt_data.
ENDMETHOD.
METHOD concatenate.
rv_string = concat_lines_of( mt_data ) && iv_string.
ENDMETHOD.
METHOD set.
clear( ).
push( iv_string ).
ENDMETHOD.
METHOD clear.
CLEAR mt_data.
ENDMETHOD.
METHOD pop.
IF lines( mt_data ) > 0.
DELETE mt_data INDEX lines( mt_data ).
ENDIF.
ENDMETHOD.
ENDCLASS. | 15.740741 | 56 | 0.661176 | {
"alnum_ratio": 0.6320754717,
"alpha_token_ratio": 1.7565789474,
"avg_line_length": 16.3076923077,
"char_rep_ratio": 0.1927710843,
"max_line_length": 56,
"num_words": 41,
"text_len": 424,
"word_rep_ratio": 0
} | 14,028,541,844,102,660,000 |
0852cf3b4cafd7ee0d0965a97c1a1689d0087b32 | 2,370 | abap | ABAP | src/checks/zcl_aoc_check_13.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_13.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_13.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | CLASS zcl_aoc_check_13 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor .
METHODS check
REDEFINITION .
METHODS get_attributes
REDEFINITION .
METHODS if_ci_test~query_attributes
REDEFINITION .
METHODS put_attributes
REDEFINITION .
PROTECTED SECTION.
DATA mv_lines TYPE linestotal .
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_AOC_CHECK_13 IMPLEMENTATION.
METHOD check.
* abapOpenChecks
*
* MIT License
DATA: lt_code TYPE string_table,
lv_seq TYPE i,
lv_line TYPE token_row.
FIELD-SYMBOLS: <ls_level> LIKE LINE OF io_scan->levels,
<lv_code> LIKE LINE OF lt_code.
LOOP AT io_scan->levels ASSIGNING <ls_level> WHERE type = io_scan->gc_level-program.
lt_code = get_source( <ls_level> ).
LOOP AT lt_code ASSIGNING <lv_code>.
lv_line = sy-tabix.
IF strlen( <lv_code> ) = 0.
lv_seq = lv_seq + 1.
ELSE.
lv_seq = 0.
ENDIF.
IF lv_seq >= mv_lines.
inform( p_sub_obj_name = <ls_level>-name
p_line = lv_line
p_kind = mv_errty
p_test = myname
p_code = '001' ).
* only report one error per include
EXIT. " current loop
ENDIF.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
version = '001'.
position = '013'.
has_attributes = abap_true.
attributes_ok = abap_true.
mv_lines = 4.
enable_rfc( ).
insert_scimessage(
iv_code = '001'
iv_text = 'Sequential blank lines'(m01) ).
ENDMETHOD.
METHOD get_attributes.
EXPORT mv_errty = mv_errty mv_maxlength = mv_lines TO DATA BUFFER p_attributes.
ENDMETHOD.
METHOD if_ci_test~query_attributes.
zzaoc_top.
zzaoc_fill_att mv_errty 'Error Type' ''. "#EC NOTEXT
zzaoc_fill_att mv_lines 'Lines' ''. "#EC NOTEXT
zzaoc_popup.
ENDMETHOD.
METHOD put_attributes.
IMPORT
mv_errty = mv_errty
mv_maxlength = mv_lines
FROM DATA BUFFER p_attributes. "#EC CI_USE_WANTED
ASSERT sy-subrc = 0.
ENDMETHOD.
ENDCLASS. | 19.75 | 88 | 0.603376 | {
"alnum_ratio": 0.5637612709,
"alpha_token_ratio": 1.6538461538,
"avg_line_length": 19.5714285714,
"char_rep_ratio": 0.1215517241,
"max_line_length": 88,
"num_words": 178,
"text_len": 2329,
"word_rep_ratio": 0
} | 2,869,114,584,371,828,700 |
08577d2efa2ba9ea666153ff1ca458af91528d6f | 20,225 | abap | ABAP | src/objects/zcl_abapgit_object_fdt0.clas.abap | Fmueller17/abapGit | 0db2c9c0859403330726fc64913e133c854f2667 | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/objects/zcl_abapgit_object_fdt0.clas.abap | Fmueller17/abapGit | 0db2c9c0859403330726fc64913e133c854f2667 | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/objects/zcl_abapgit_object_fdt0.clas.abap | Fmueller17/abapGit | 0db2c9c0859403330726fc64913e133c854f2667 | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_object_fdt0 DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_objects_super
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_abapgit_object .
PROTECTED SECTION.
PRIVATE SECTION.
METHODS check_is_local
RETURNING
VALUE(rv_is_local) TYPE abap_bool .
METHODS get_application_id
RETURNING
VALUE(rv_application_id) TYPE fdt_admn_0000s-application_id .
METHODS before_xml_deserialize
IMPORTING
!iv_package TYPE devclass
EXPORTING
!ev_create TYPE abap_bool
!ev_is_local TYPE abap_bool
CHANGING
!co_dom_tree TYPE REF TO if_ixml_document
RAISING
zcx_abapgit_exception .
METHODS filter_xml_serialize
CHANGING
!co_ixml_element TYPE REF TO if_ixml_element
RAISING
zcx_abapgit_exception .
METHODS set_field
IMPORTING
!iv_name TYPE string
!iv_value TYPE string DEFAULT ''
CHANGING
!co_ixml_element TYPE REF TO if_ixml_element
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS zcl_abapgit_object_fdt0 IMPLEMENTATION.
METHOD before_xml_deserialize.
DATA lv_application_id TYPE fdt_admn_0000s-application_id.
DATA lv_timestamp TYPE timestamp.
DATA lv_transport TYPE string.
DATA lv_dlvunit TYPE tdevc-dlvunit.
DATA lo_node_local TYPE REF TO if_ixml_element.
DATA lo_node_package TYPE REF TO if_ixml_element.
DATA lo_node_id TYPE REF TO if_ixml_element.
DATA lo_xml_element TYPE REF TO if_ixml_element.
DATA lv_count TYPE i.
lo_node_local = co_dom_tree->find_from_name( name = 'Local'
namespace = 'FDTNS' ).
IF lo_node_local IS BOUND.
ev_is_local = lo_node_local->get_value( ).
ENDIF.
lo_node_package = co_dom_tree->find_from_name(
name = 'DevelopmentPackage'
namespace = 'FDTNS' ).
IF lo_node_package IS BOUND.
lo_node_package->set_value( value = |{ iv_package }| ).
ENDIF.
lo_node_id = co_dom_tree->find_from_name(
name = 'ApplicationId'
namespace = 'FDTNS' ).
IF lo_node_id IS BOUND.
lv_application_id = lo_node_id->get_value( ).
SELECT COUNT( * ) FROM fdt_admn_0000s INTO lv_count
WHERE object_type = 'AP'
AND id = lv_application_id
AND deleted = ''.
ev_create = boolc( lv_count = 0 ).
ENDIF.
" Fill in user/time/system-specific fields
GET TIME STAMP FIELD lv_timestamp.
lv_transport = |${ sy-sysid }0000000000000001|.
lo_xml_element = co_dom_tree->get_root_element( ).
IF ev_create = abap_true.
set_field(
EXPORTING
iv_name = 'CreationUser'
iv_value = |{ sy-uname }|
CHANGING
co_ixml_element = lo_xml_element ).
set_field(
EXPORTING
iv_name = 'CreationTimestamp'
iv_value = |{ lv_timestamp }|
CHANGING
co_ixml_element = lo_xml_element ).
ENDIF.
set_field(
EXPORTING
iv_name = 'ChangeUser'
iv_value = |{ sy-uname }|
CHANGING
co_ixml_element = lo_xml_element ).
set_field(
EXPORTING
iv_name = 'ChangeTimestamp'
iv_value = |{ lv_timestamp }|
CHANGING
co_ixml_element = lo_xml_element ).
set_field(
EXPORTING
iv_name = 'User'
iv_value = |{ sy-uname }|
CHANGING
co_ixml_element = lo_xml_element ).
set_field(
EXPORTING
iv_name = 'Timestamp'
iv_value = |{ lv_timestamp }|
CHANGING
co_ixml_element = lo_xml_element ).
set_field(
EXPORTING
iv_name = 'Trrequest'
iv_value = lv_transport
CHANGING
co_ixml_element = lo_xml_element ).
set_field(
EXPORTING
iv_name = 'Trversion'
iv_value = '000001'
CHANGING
co_ixml_element = lo_xml_element ).
set_field(
EXPORTING
iv_name = 'Trtimestamp'
iv_value = |{ lv_timestamp }|
CHANGING
co_ixml_element = lo_xml_element ).
set_field(
EXPORTING
iv_name = 'Trsysid'
iv_value = |{ sy-sysid }|
CHANGING
co_ixml_element = lo_xml_element ).
set_field(
EXPORTING
iv_name = 'Trclient'
iv_value = |{ sy-mandt }|
CHANGING
co_ixml_element = lo_xml_element ).
set_field(
EXPORTING
iv_name = 'OversId'
iv_value = |{ lv_application_id }|
CHANGING
co_ixml_element = lo_xml_element ).
SELECT SINGLE dlvunit FROM tdevc INTO lv_dlvunit WHERE devclass = iv_package.
IF sy-subrc = 0.
set_field(
EXPORTING
iv_name = 'SoftwareComponent'
iv_value = |{ lv_dlvunit }|
CHANGING
co_ixml_element = lo_xml_element ).
ENDIF.
lo_xml_element->set_attribute(
name = 'Client'
value = |{ sy-mandt }| ).
lo_xml_element->set_attribute(
name = 'Date'
value = |{ sy-datum }| ).
lo_xml_element->set_attribute(
name = 'SAPRelease'
value = |{ sy-saprl }| ).
lo_xml_element->set_attribute(
name = 'Server'
value = |{ sy-host }| ).
lo_xml_element->set_attribute(
name = 'SourceExportReqID'
value = lv_transport ).
lo_xml_element->set_attribute(
name = 'SystemID'
value = |{ sy-sysid }| ).
lo_xml_element->set_attribute(
name = 'Time'
value = |{ sy-uzeit }| ).
lo_xml_element->set_attribute(
name = 'User'
value = |{ sy-uname }| ).
ENDMETHOD.
METHOD check_is_local.
SELECT SINGLE local_object FROM fdt_admn_0000s INTO rv_is_local
WHERE object_type = 'AP'
AND name = ms_item-obj_name.
ENDMETHOD.
METHOD filter_xml_serialize.
DATA lo_components_node TYPE REF TO if_ixml_element.
lo_components_node = co_ixml_element->find_from_name( name = 'ComponentReleases'
namespace = 'FDTNS' ).
IF lo_components_node IS BOUND.
co_ixml_element->remove_child( old_child = lo_components_node ).
ENDIF.
" Clear user/time/system-specific fields
set_field(
EXPORTING
iv_name = 'CreationUser'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'CreationTimestamp'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'ChangeUser'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'ChangeTimestamp'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'User'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'Timestamp'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'Trrequest'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'Trversion'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'Trtimestamp'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'Trsysid'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'Trclient'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'OversId'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'SoftwareComponent'
CHANGING
co_ixml_element = co_ixml_element ).
set_field(
EXPORTING
iv_name = 'DevelopmentPackage'
CHANGING
co_ixml_element = co_ixml_element ).
" Clear attributes of root node
co_ixml_element->set_attribute(
name = 'Client'
value = '' ).
co_ixml_element->set_attribute(
name = 'Date'
value = '' ).
co_ixml_element->set_attribute(
name = 'SAPRelease'
value = '' ).
co_ixml_element->set_attribute(
name = 'Server'
value = '' ).
co_ixml_element->set_attribute(
name = 'SourceExportReqID'
value = '' ).
co_ixml_element->set_attribute(
name = 'SystemID'
value = '' ).
co_ixml_element->set_attribute(
name = 'Time'
value = '' ).
co_ixml_element->set_attribute(
name = 'User'
value = '' ).
ENDMETHOD.
METHOD get_application_id.
SELECT SINGLE application_id FROM fdt_admn_0000s INTO rv_application_id
WHERE object_type = 'AP'
AND name = ms_item-obj_name.
ENDMETHOD.
METHOD set_field.
DATA:
lo_node_collection TYPE REF TO if_ixml_node_collection,
lo_node TYPE REF TO if_ixml_node,
lv_index TYPE i.
lo_node_collection = co_ixml_element->get_elements_by_tag_name(
namespace = 'FDTNS'
name = iv_name ).
lv_index = 0.
WHILE lv_index < lo_node_collection->get_length( ).
lo_node = lo_node_collection->get_item( lv_index ).
lo_node->set_value( iv_value ).
lv_index = lv_index + 1.
ENDWHILE.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
DATA lv_ch_user TYPE fdt_admn_0000s-ch_user.
SELECT SINGLE ch_user FROM fdt_admn_0000s INTO lv_ch_user
WHERE object_type = 'AP'
AND name = ms_item-obj_name.
rv_user = lv_ch_user.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA lv_is_local TYPE abap_bool.
DATA lt_application_id TYPE TABLE OF fdt_admn_0000s-application_id.
DATA ls_object_category_sel TYPE if_fdt_query=>s_object_category_sel.
DATA lv_failure TYPE abap_bool.
DATA lx_fdt_input TYPE REF TO cx_fdt_input.
lv_is_local = check_is_local( ).
SELECT application_id FROM fdt_admn_0000s INTO TABLE lt_application_id
WHERE object_type = 'AP'
AND name = ms_item-obj_name.
ls_object_category_sel-system_objects = 'X'.
TRY.
IF lv_is_local = abap_true.
cl_fdt_delete_handling=>mark_for_delete_via_job(
EXPORTING
is_object_category_sel = ls_object_category_sel
ita_application_id = lt_application_id
iv_background = abap_true
iv_local_option = '1'
iv_appl_transported_option = '2'
iv_obj_transported_option = '2'
IMPORTING
ev_failure = lv_failure ).
IF lv_failure IS INITIAL.
cl_fdt_delete_handling=>delete_logical_via_job(
EXPORTING
is_object_category_sel = ls_object_category_sel
ita_application_id = lt_application_id
iv_retention_time = 0
iv_background = abap_true
iv_local_option = '1'
iv_appl_transported_option = '2'
iv_obj_transported_option = '2'
IMPORTING
ev_failure = lv_failure ).
IF lv_failure IS INITIAL.
cl_fdt_delete_handling=>delete_physical_via_job(
EXPORTING
is_object_category_sel = ls_object_category_sel
ita_application_id = lt_application_id
iv_retention_time = 0
iv_background = abap_true
iv_local_option = '1'
iv_appl_transported_option = '2'
IMPORTING
ev_failure = lv_failure ).
ENDIF.
ENDIF.
ELSE.
cl_fdt_delete_handling=>mark_for_delete_via_job(
EXPORTING
is_object_category_sel = ls_object_category_sel
ita_application_id = lt_application_id
iv_background = abap_true
iv_local_option = '2'
iv_appl_transported_option = '1'
iv_obj_transported_option = '1'
IMPORTING
ev_failure = lv_failure ).
IF lv_failure IS INITIAL.
cl_fdt_delete_handling=>delete_logical_via_job(
EXPORTING
is_object_category_sel = ls_object_category_sel
ita_application_id = lt_application_id
iv_retention_time = 0
iv_background = abap_true
iv_local_option = '2'
iv_appl_transported_option = '1'
iv_obj_transported_option = '1'
IMPORTING
ev_failure = lv_failure ).
IF lv_failure IS INITIAL.
cl_fdt_delete_handling=>delete_physical_via_job(
EXPORTING
is_object_category_sel = ls_object_category_sel
ita_application_id = lt_application_id
iv_retention_time = 0
iv_background = abap_true
iv_local_option = '2'
iv_appl_transported_option = '1'
IMPORTING
ev_failure = lv_failure ).
ENDIF.
ENDIF.
ENDIF.
IF lv_failure = abap_true.
zcx_abapgit_exception=>raise( |Error deleting { ms_item-obj_type } { ms_item-obj_name }| ).
ENDIF.
CATCH cx_fdt_input INTO lx_fdt_input.
zcx_abapgit_exception=>raise_with_text( lx_fdt_input ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA lo_dexc TYPE REF TO if_fdt_data_exchange.
DATA lx_fdt_input TYPE REF TO cx_fdt_input.
DATA lo_dom_tree TYPE REF TO if_ixml_document.
DATA lv_is_local TYPE abap_bool.
DATA lt_message TYPE if_fdt_types=>t_message.
DATA lv_create TYPE abap_bool.
FIELD-SYMBOLS <ls_message> TYPE if_fdt_types=>s_message.
lo_dom_tree = io_xml->get_raw( ).
before_xml_deserialize(
EXPORTING
iv_package = iv_package
IMPORTING
ev_create = lv_create
ev_is_local = lv_is_local
CHANGING
co_dom_tree = lo_dom_tree ).
lo_dexc = cl_fdt_factory=>if_fdt_factory~get_instance( )->get_data_exchange( ).
TRY.
IF lv_is_local = abap_true. "Local Object
lo_dexc->import_xml(
EXPORTING
io_dom_tree = lo_dom_tree
iv_create = lv_create
iv_activate = abap_true
iv_simulate = abap_false
IMPORTING
et_message = lt_message ).
ELSE. "Transportable Object
lo_dexc->import_xml(
EXPORTING
io_dom_tree = lo_dom_tree
iv_create = lv_create
iv_activate = abap_true
iv_simulate = abap_false
iv_workbench_trrequest = iv_transport
IMPORTING
et_message = lt_message ).
ENDIF.
LOOP AT lt_message ASSIGNING <ls_message>.
ii_log->add(
iv_msg = <ls_message>-text
iv_type = <ls_message>-msgty ).
ENDLOOP.
CATCH cx_fdt_input INTO lx_fdt_input.
zcx_abapgit_exception=>raise_with_text( lx_fdt_input ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA lv_count TYPE i.
SELECT COUNT( * ) FROM fdt_admn_0000s INTO lv_count
WHERE object_type = 'AP'
AND name = ms_item-obj_name
AND deleted = ''.
rv_bool = boolc( lv_count > 0 ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
DATA lo_local_version_output TYPE REF TO zcl_abapgit_xml_output.
DATA lo_local_version_input TYPE REF TO zcl_abapgit_xml_input.
CREATE OBJECT lo_local_version_output.
zif_abapgit_object~serialize( lo_local_version_output ).
CREATE OBJECT lo_local_version_input
EXPORTING
iv_xml = lo_local_version_output->zif_abapgit_xml_output~render( ).
CREATE OBJECT ri_comparator TYPE zcl_abapgit_object_tabl_compar
EXPORTING
ii_local = lo_local_version_input.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
rs_metadata-delete_tadir = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
DATA lv_application_id TYPE fdt_admn_0000s-application_id.
DATA lx_fdt_input TYPE REF TO cx_fdt_input.
DATA lo_instance TYPE REF TO if_fdt_admin_data.
DATA lt_version TYPE if_fdt_admin_data=>ts_version.
DATA lv_index TYPE sy-tabix.
FIELD-SYMBOLS <ls_version> LIKE LINE OF lt_version.
lv_application_id = get_application_id( ).
TRY.
cl_fdt_factory=>get_instance_generic(
EXPORTING
iv_id = lv_application_id
IMPORTING
eo_instance = lo_instance ).
CATCH cx_fdt_input INTO lx_fdt_input.
zcx_abapgit_exception=>raise_with_text( lx_fdt_input ).
ENDTRY.
lo_instance->get_versions( IMPORTING ets_version = lt_version ).
lv_index = lines( lt_version ).
READ TABLE lt_version ASSIGNING <ls_version> INDEX lv_index.
rv_active = boolc( <ls_version>-state = 'A' ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
DATA lv_application_id TYPE string.
lv_application_id = get_application_id( ).
rv_is_locked = exists_a_lock_entry_for(
iv_lock_object = 'FDT_ENQUEUE_ID'
iv_argument = |$ST{ lv_application_id }| ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
DATA lv_application_id TYPE fdt_admn_0000s-application_id.
DATA lx_root TYPE REF TO cx_root.
DATA lo_fdt_wd TYPE REF TO if_fdt_wd_factory.
lv_application_id = get_application_id( ).
IF lv_application_id IS NOT INITIAL.
TRY.
lo_fdt_wd = cl_fdt_wd_factory=>if_fdt_wd_factory~get_instance( ).
lo_fdt_wd->get_ui_execution( )->execute_workbench( iv_id = lv_application_id ).
CATCH cx_root INTO lx_root.
zcx_abapgit_exception=>raise_with_text( lx_root ).
ENDTRY.
ELSE.
zcx_abapgit_exception=>raise( 'Could not open BRF+ Workbench' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA lo_dexc TYPE REF TO if_fdt_data_exchange.
DATA lv_application_id TYPE fdt_admn_0000s-application_id.
DATA lx_fdt_input TYPE REF TO cx_fdt_input.
DATA lv_xml_fdt0_application TYPE string.
DATA lo_xml_document TYPE REF TO if_ixml_document.
DATA lo_xml_element TYPE REF TO if_ixml_element.
lv_application_id = get_application_id( ).
lo_dexc = cl_fdt_factory=>if_fdt_factory~get_instance( )->get_data_exchange( ).
TRY.
lo_dexc->export_xml_application(
EXPORTING
iv_application_id = lv_application_id
iv_schema = if_fdt_data_exchange=>gc_xml_schema_type_external
iv_xml_version = if_fdt_data_exchange=>gc_xml_version
IMPORTING
ev_string = lv_xml_fdt0_application ).
lo_xml_document = cl_ixml_80_20=>parse_to_document( stream_string = lv_xml_fdt0_application ).
lo_xml_element = lo_xml_document->get_root_element( ).
filter_xml_serialize( CHANGING co_ixml_element = lo_xml_element ).
io_xml->set_raw( lo_xml_element ).
CATCH cx_fdt_input INTO lx_fdt_input.
zcx_abapgit_exception=>raise_with_text( lx_fdt_input ).
ENDTRY.
ENDMETHOD.
ENDCLASS. | 28.485915 | 102 | 0.613053 | {
"alnum_ratio": 0.558446698,
"alpha_token_ratio": 1.7000152045,
"avg_line_length": 28.5119887165,
"char_rep_ratio": 0.2066217955,
"max_line_length": 102,
"num_words": 1181,
"text_len": 20215,
"word_rep_ratio": 0.0836177474
} | 4,653,427,762,278,923,000 |
08de55b00bac1f2881477868b64fd8bf30191677 | 2,128 | abap | ABAP | src/apack/zcl_abapgit_apack_reader.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/apack/zcl_abapgit_apack_reader.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/apack/zcl_abapgit_apack_reader.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | *"* use this source file for your ABAP unit test classes
CLASS ltcl_apack_manifest_reader DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
PRIVATE SECTION.
METHODS:
setup RAISING cx_static_check,
manifest_descriptor FOR TESTING RAISING cx_static_check,
verify_own_descriptor IMPORTING is_manifest_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor.
DATA: mo_manifest_reader TYPE REF TO zcl_abapgit_apack_reader.
ENDCLASS.
CLASS ltcl_apack_manifest_reader IMPLEMENTATION.
METHOD manifest_descriptor.
verify_own_descriptor( mo_manifest_reader->get_manifest_descriptor( ) ).
ENDMETHOD.
METHOD setup.
DATA: ls_apack_manifest_descriptor TYPE zif_abapgit_apack_definitions=>ty_descriptor.
ls_apack_manifest_descriptor-group_id = ''.
ls_apack_manifest_descriptor-artifact_id = 'abapGit'.
ls_apack_manifest_descriptor-version = '1.42'.
ls_apack_manifest_descriptor-git_url = ''.
mo_manifest_reader = zcl_abapgit_apack_reader=>create_instance( '$TMP' ).
mo_manifest_reader->set_manifest_descriptor( ls_apack_manifest_descriptor ).
ENDMETHOD.
METHOD verify_own_descriptor.
cl_abap_unit_assert=>assert_not_initial( is_manifest_descriptor ).
cl_abap_unit_assert=>assert_equals( exp = ''
act = is_manifest_descriptor-group_id ).
cl_abap_unit_assert=>assert_equals( exp = 'abapGit'
act = is_manifest_descriptor-artifact_id ).
cl_abap_unit_assert=>assert_equals( exp = '1.42'
act = is_manifest_descriptor-version ).
" Repository type is added automatically by serializer later
cl_abap_unit_assert=>assert_initial( is_manifest_descriptor-repository_type ).
cl_abap_unit_assert=>assert_equals( exp = ''
act = is_manifest_descriptor-git_url ).
cl_abap_unit_assert=>assert_initial( is_manifest_descriptor-dependencies ).
ENDMETHOD.
ENDCLASS. | 45.276596 | 111 | 0.740132 | {
"alnum_ratio": 0.6779156328,
"alpha_token_ratio": 2.2591362126,
"avg_line_length": 43.8043478261,
"char_rep_ratio": 0.239780658,
"max_line_length": 111,
"num_words": 103,
"text_len": 2015,
"word_rep_ratio": 0
} | 757,304,700,187,930,600 |
08df2d526f0622f511f92e07539b0429571a33ab | 1,982 | abap | ABAP | src/http/zcl_abapgit_http_agent.clas.locals_imp.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/http/zcl_abapgit_http_agent.clas.locals_imp.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/http/zcl_abapgit_http_agent.clas.locals_imp.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS lcl_http_response DEFINITION FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_http_response.
CLASS-METHODS create
IMPORTING
ii_client TYPE REF TO if_http_client
RETURNING
VALUE(ri_response) TYPE REF TO zif_abapgit_http_response.
PRIVATE SECTION.
DATA mi_client TYPE REF TO if_http_client.
DATA mi_response TYPE REF TO if_http_response.
ENDCLASS.
CLASS lcl_http_response IMPLEMENTATION.
METHOD create.
DATA lo_response TYPE REF TO lcl_http_response.
CREATE OBJECT lo_response.
lo_response->mi_client = ii_client.
lo_response->mi_response = ii_client->response.
ri_response ?= lo_response.
ENDMETHOD.
METHOD zif_abapgit_http_response~close.
mi_client->close( ).
ENDMETHOD.
METHOD zif_abapgit_http_response~is_ok.
DATA lv_code TYPE i.
lv_code = zif_abapgit_http_response~code( ).
rv_yes = boolc( lv_code >= 200 AND lv_code < 300 ).
ENDMETHOD.
METHOD zif_abapgit_http_response~data.
rv_data = mi_response->get_data( ).
ENDMETHOD.
METHOD zif_abapgit_http_response~cdata.
rv_data = mi_response->get_cdata( ).
ENDMETHOD.
METHOD zif_abapgit_http_response~code.
DATA lv_msg TYPE string ##NEEDED.
mi_response->get_status(
IMPORTING
reason = lv_msg " for debug
code = rv_code ).
ENDMETHOD.
METHOD zif_abapgit_http_response~json.
ri_json = zcl_abapgit_ajson=>parse( zif_abapgit_http_response~cdata( ) ).
ENDMETHOD.
METHOD zif_abapgit_http_response~error.
rv_message = mi_response->get_cdata( ).
ENDMETHOD.
METHOD zif_abapgit_http_response~headers.
DATA lt_headers TYPE tihttpnvp.
FIELD-SYMBOLS <ls_h> LIKE LINE OF lt_headers.
CREATE OBJECT ro_headers.
mi_response->get_header_fields( CHANGING fields = lt_headers ).
LOOP AT lt_headers ASSIGNING <ls_h>.
ro_headers->set(
iv_key = <ls_h>-name
iv_val = <ls_h>-value ).
ENDLOOP.
ENDMETHOD.
ENDCLASS. | 24.775 | 77 | 0.717962 | {
"alnum_ratio": 0.6673397274,
"alpha_token_ratio": 1.8535211268,
"avg_line_length": 25.0759493671,
"char_rep_ratio": 0.1926977688,
"max_line_length": 77,
"num_words": 145,
"text_len": 1981,
"word_rep_ratio": 0
} | 13,045,323,047,734,634,000 |
08e8f838c3d51b6a6343aa25b7370936829c6863 | 1,846 | abap | ABAP | src/json/zcl_abapgit_ajson_mapping.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/json/zcl_abapgit_ajson_mapping.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/json/zcl_abapgit_ajson_mapping.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_ajson_mapping DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
CLASS-METHODS create_camel_case
IMPORTING
it_mapping_fields TYPE zif_abapgit_ajson_mapping=>ty_mapping_fields OPTIONAL
iv_first_json_upper TYPE abap_bool DEFAULT abap_true
RETURNING
VALUE(ri_mapping) TYPE REF TO zif_abapgit_ajson_mapping.
CLASS-METHODS create_upper_case
IMPORTING
it_mapping_fields TYPE zif_abapgit_ajson_mapping=>ty_mapping_fields OPTIONAL
RETURNING
VALUE(ri_mapping) TYPE REF TO zif_abapgit_ajson_mapping.
CLASS-METHODS create_lower_case
IMPORTING
it_mapping_fields TYPE zif_abapgit_ajson_mapping=>ty_mapping_fields OPTIONAL
RETURNING
VALUE(ri_mapping) TYPE REF TO zif_abapgit_ajson_mapping.
CLASS-METHODS create_field_mapping
IMPORTING
it_mapping_fields TYPE zif_abapgit_ajson_mapping=>ty_mapping_fields
RETURNING
VALUE(ri_mapping) TYPE REF TO zif_abapgit_ajson_mapping.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_abapgit_ajson_mapping IMPLEMENTATION.
METHOD create_camel_case.
CREATE OBJECT ri_mapping TYPE lcl_mapping_camel
EXPORTING
it_mapping_fields = it_mapping_fields
iv_first_json_upper = iv_first_json_upper.
ENDMETHOD.
METHOD create_field_mapping.
CREATE OBJECT ri_mapping TYPE lcl_mapping_fields
EXPORTING
it_mapping_fields = it_mapping_fields.
ENDMETHOD.
METHOD create_lower_case.
CREATE OBJECT ri_mapping TYPE lcl_mapping_to_lower
EXPORTING
it_mapping_fields = it_mapping_fields.
ENDMETHOD.
METHOD create_upper_case.
CREATE OBJECT ri_mapping TYPE lcl_mapping_to_upper
EXPORTING
it_mapping_fields = it_mapping_fields.
ENDMETHOD.
ENDCLASS. | 23.367089 | 86 | 0.756771 | {
"alnum_ratio": 0.6991869919,
"alpha_token_ratio": 2.1608040201,
"avg_line_length": 23.6538461538,
"char_rep_ratio": 0.1715686275,
"max_line_length": 86,
"num_words": 120,
"text_len": 1845,
"word_rep_ratio": 0.0540540541
} | 9,559,289,578,991,458,000 |
1c8350888a5532bfd37115b6b7fa5f089b86d76d | 4,450 | abap | ABAP | src/checks/zcl_aoc_super_root.clas.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_super_root.clas.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_super_root.clas.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | CLASS zcl_aoc_super_root DEFINITION
PUBLIC
INHERITING FROM cl_ci_test_root
ABSTRACT
CREATE PUBLIC .
PUBLIC SECTION.
TYPE-POOLS zzaoc .
METHODS constructor .
METHODS get_attributes
REDEFINITION .
METHODS if_ci_test~display_documentation
REDEFINITION .
METHODS if_ci_test~query_attributes
REDEFINITION .
METHODS put_attributes
REDEFINITION .
PROTECTED SECTION.
TYPES:
ty_scimessage_text TYPE c LENGTH 255 .
DATA mv_errty TYPE sci_errty .
METHODS enable_rfc .
METHODS set_kind .
CLASS-METHODS get_destination
RETURNING
VALUE(rv_result) TYPE rfcdest .
METHODS insert_scimessage
IMPORTING
!iv_code TYPE scimessage-code
!iv_text TYPE ty_scimessage_text
!iv_pcom TYPE scimessage-pcom OPTIONAL .
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_AOC_SUPER_ROOT IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
"get description of check class
SELECT SINGLE descript FROM seoclasstx INTO description
WHERE clsname = myname
AND langu = sy-langu.
IF sy-subrc <> 0.
SELECT SINGLE descript FROM seoclasstx INTO description
WHERE clsname = myname. "#EC CI_NOORDER "#EC CI_SUBRC
ENDIF.
category = 'ZCL_AOC_CATEGORY'.
mv_errty = 'E'.
ENDMETHOD.
METHOD enable_rfc.
* RFC enable the check, new feature for central ATC on 7.51
FIELD-SYMBOLS: <lv_rfc> TYPE abap_bool.
ASSIGN ('REMOTE_RFC_ENABLED') TO <lv_rfc>.
IF sy-subrc = 0.
<lv_rfc> = abap_true.
ENDIF.
ENDMETHOD.
METHOD get_attributes.
EXPORT mv_errty = mv_errty TO DATA BUFFER p_attributes.
ENDMETHOD.
METHOD get_destination.
"get destination of calling system (RFC enabled checks only)
"class, method and variable may not valid in 7.02 systems -> dynamic calls
CONSTANTS lc_classname TYPE seoclsname VALUE 'CL_ABAP_SOURCE_ID'.
CONSTANTS lc_methodname TYPE seocpdname VALUE 'GET_DESTINATION'.
FIELD-SYMBOLS: <lv_srcid> TYPE sysuuid_x.
ASSIGN ('SRCID') TO <lv_srcid>.
IF NOT <lv_srcid> IS ASSIGNED.
rv_result = |NONE|.
RETURN.
ENDIF.
IF <lv_srcid> IS INITIAL.
rv_result = |NONE|.
RETURN.
ENDIF.
TRY.
CALL METHOD (lc_classname)=>(lc_methodname)
EXPORTING
p_srcid = <lv_srcid>
RECEIVING
p_destination = rv_result
EXCEPTIONS
not_found = 1.
IF sy-subrc <> 0.
rv_result = |NONE|.
ENDIF.
CATCH cx_sy_dyn_call_illegal_class
cx_sy_dyn_call_illegal_method.
rv_result = |NONE|.
ENDTRY.
ENDMETHOD.
METHOD if_ci_test~display_documentation.
DATA: lv_url TYPE string VALUE '' ##NO_TEXT,
lv_len TYPE i.
lv_len = strlen( myname ) - 2.
CONCATENATE lv_url myname+lv_len(2) INTO lv_url.
cl_gui_frontend_services=>execute(
EXPORTING
document = lv_url
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
synchronous_failed = 8
not_supported_by_gui = 9
OTHERS = 10 ). "#EC CI_SUBRC
ENDMETHOD.
METHOD if_ci_test~query_attributes.
zzaoc_top.
zzaoc_fill_att mv_errty 'Error Type' ''. "#EC NOTEXT
zzaoc_popup.
ENDMETHOD.
METHOD insert_scimessage.
* Insert entry into table scimessages, this table is used to determine the message text for a finding.
DATA ls_scimessage LIKE LINE OF scimessages.
ls_scimessage-test = myname.
ls_scimessage-code = iv_code.
ls_scimessage-kind = mv_errty.
ls_scimessage-text = iv_text.
ls_scimessage-pcom = iv_pcom.
INSERT ls_scimessage INTO TABLE scimessages.
ENDMETHOD.
METHOD put_attributes.
IMPORT
mv_errty = mv_errty
FROM DATA BUFFER p_attributes. "#EC CI_USE_WANTED
ASSERT sy-subrc = 0.
set_kind( ).
ENDMETHOD.
METHOD set_kind.
FIELD-SYMBOLS: <ls_message> LIKE LINE OF scimessages.
LOOP AT scimessages ASSIGNING <ls_message>.
<ls_message>-kind = mv_errty.
ENDLOOP.
ENDMETHOD.
ENDCLASS. | 22.029703 | 102 | 0.642921 | {
"alnum_ratio": 0.6089322149,
"alpha_token_ratio": 1.8063858696,
"avg_line_length": 21.9452736318,
"char_rep_ratio": 0.1047251249,
"max_line_length": 102,
"num_words": 352,
"text_len": 4411,
"word_rep_ratio": 0.0058309038
} | 16,065,009,075,749,980,000 |
1cce39499284756719320f2f693604c813f002f5 | 5,166 | abap | ABAP | src/ui/zcl_abapgit_gui_page_ex_pckage.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/ui/zcl_abapgit_gui_page_ex_pckage.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/ui/zcl_abapgit_gui_page_ex_pckage.clas.abap | wangdongcheng/abapGit | 7cf4e4b5fe718cb95d12d0a439aa9f2cfb128eab | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_gui_page_ex_pckage DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_gui_component
FINAL
CREATE PRIVATE.
PUBLIC SECTION.
INTERFACES zif_abapgit_gui_event_handler.
INTERFACES zif_abapgit_gui_renderable.
CLASS-METHODS create
RETURNING
VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable
RAISING
zcx_abapgit_exception.
METHODS constructor
RAISING
zcx_abapgit_exception.
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS:
BEGIN OF c_id,
package TYPE string VALUE 'package',
folder_logic TYPE string VALUE 'folder_logic',
main_lang_only TYPE string VALUE 'main_lang_only',
END OF c_id.
CONSTANTS:
BEGIN OF c_event,
go_back TYPE string VALUE 'go-back',
export_package TYPE string VALUE 'export-package',
choose_package TYPE string VALUE 'choose-object-type',
END OF c_event.
DATA mo_form TYPE REF TO zcl_abapgit_html_form.
DATA mo_form_data TYPE REF TO zcl_abapgit_string_map.
DATA mo_validation_log TYPE REF TO zcl_abapgit_string_map.
DATA mo_form_util TYPE REF TO zcl_abapgit_html_form_utils.
METHODS get_form_schema
RETURNING
VALUE(ro_form) TYPE REF TO zcl_abapgit_html_form.
METHODS export_package
RAISING
zcx_abapgit_exception.
ENDCLASS.
CLASS zcl_abapgit_gui_page_ex_pckage IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
CREATE OBJECT mo_validation_log.
CREATE OBJECT mo_form_data.
mo_form = get_form_schema( ).
mo_form_util = zcl_abapgit_html_form_utils=>create( mo_form ).
ENDMETHOD.
METHOD create.
DATA lo_component TYPE REF TO zcl_abapgit_gui_page_ex_pckage.
CREATE OBJECT lo_component.
ri_page = zcl_abapgit_gui_page_hoc=>create(
iv_page_title = 'Export Package to ZIP'
ii_child_component = lo_component ).
ENDMETHOD.
METHOD get_form_schema.
ro_form = zcl_abapgit_html_form=>create( iv_form_id = 'export-package-to-files' ).
ro_form->text(
iv_name = c_id-package
iv_label = 'Package'
iv_required = abap_true
iv_upper_case = abap_true
iv_side_action = c_event-choose_package
)->radio(
iv_name = c_id-folder_logic
iv_label = 'Folder Logic'
iv_default_value = zif_abapgit_dot_abapgit=>c_folder_logic-prefix
iv_hint = 'Define how package folders are named in repository'
)->option(
iv_label = 'Prefix'
iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-prefix
)->option(
iv_label = 'Full'
iv_value = zif_abapgit_dot_abapgit=>c_folder_logic-full
)->checkbox(
iv_name = c_id-main_lang_only
iv_label = 'Serialize Main Language Only'
iv_hint = 'Ignore translations, serialize just main language'
)->command(
iv_label = 'Export Package to ZIP'
iv_action = c_event-export_package
iv_cmd_type = zif_abapgit_html_form=>c_cmd_type-input_main
)->command(
iv_label = 'Back'
iv_action = c_event-go_back ).
ENDMETHOD.
METHOD zif_abapgit_gui_renderable~render.
gui_services( )->register_event_handler( me ).
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( mo_form->render(
io_values = mo_form_data
io_validation_log = mo_validation_log ) ).
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event.
mo_form_data = mo_form_util->normalize( ii_event->form_data( ) ).
CASE ii_event->mv_action.
WHEN c_event-go_back.
rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back.
WHEN c_event-export_package.
mo_validation_log = mo_form_util->validate( mo_form_data ).
IF mo_validation_log->is_empty( ) = abap_false.
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
ELSE.
export_package( ).
MESSAGE 'Package successfully exported' TYPE 'S'.
rs_handled-state = zcl_abapgit_gui=>c_event_state-go_back.
ENDIF.
WHEN c_event-choose_package.
mo_form_data->set(
iv_key = c_id-package
iv_val = zcl_abapgit_ui_factory=>get_popups( )->popup_search_help( 'TDEVC-DEVCLASS' ) ).
IF mo_form_data->get( c_id-package ) IS NOT INITIAL.
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
ELSE.
rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act.
ENDIF.
ENDCASE.
ENDMETHOD.
METHOD export_package.
DATA lv_package TYPE devclass.
DATA lv_folder_logic TYPE string.
DATA lv_main_lang_only TYPE abap_bool.
lv_package = mo_form_data->get( c_id-package ).
lv_folder_logic = mo_form_data->get( c_id-folder_logic ).
lv_main_lang_only = mo_form_data->get( c_id-main_lang_only ).
zcl_abapgit_zip=>export_package(
iv_package = lv_package
iv_folder_logic = lv_folder_logic
iv_main_lang_only = lv_main_lang_only ).
ENDMETHOD.
ENDCLASS. | 30.75 | 98 | 0.679055 | {
"alnum_ratio": 0.6203291384,
"alpha_token_ratio": 1.7959641256,
"avg_line_length": 30.9281437126,
"char_rep_ratio": 0.1076415826,
"max_line_length": 98,
"num_words": 333,
"text_len": 5165,
"word_rep_ratio": 0
} | 12,862,329,104,361,312,000 |
1cf4cbe17dda2b9f8fc14f44a2f87ad6d0e088e1 | 4,949 | abap | ABAP | src/zabapgit_forms.prog.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/zabapgit_forms.prog.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/zabapgit_forms.prog.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | *&---------------------------------------------------------------------*
*& Include ZABAPGIT_FORMS
*&---------------------------------------------------------------------*
FORM run.
DATA: lx_exception TYPE REF TO zcx_abapgit_exception.
TRY.
zcl_abapgit_migrations=>run( ).
PERFORM open_gui.
CATCH zcx_abapgit_exception INTO lx_exception.
MESSAGE lx_exception TYPE 'E'.
ENDTRY.
ENDFORM. "run
FORM open_gui RAISING zcx_abapgit_exception.
IF sy-batch = abap_true.
zcl_abapgit_background=>run( ).
ELSE.
zcl_abapgit_services_abapgit=>prepare_gui_startup( ).
zcl_abapgit_ui_factory=>get_gui( )->go_home( ).
CALL SELECTION-SCREEN 1001. " trigger screen
ENDIF.
ENDFORM.
FORM branch_popup TABLES tt_fields TYPE zif_abapgit_popups=>ty_sval_tt
USING pv_code TYPE clike
CHANGING cs_error TYPE svale
cv_show_popup TYPE c
RAISING zcx_abapgit_exception ##CALLED ##NEEDED.
* called dynamically from function module POPUP_GET_VALUES_USER_BUTTONS
DATA: lx_error TYPE REF TO zcx_abapgit_exception,
li_popups TYPE REF TO zif_abapgit_popups.
TRY.
li_popups = zcl_abapgit_ui_factory=>get_popups( ).
li_popups->branch_popup_callback(
EXPORTING
iv_code = pv_code
CHANGING
ct_fields = tt_fields[]
cs_error = cs_error
cv_show_popup = cv_show_popup ).
CATCH zcx_abapgit_exception INTO lx_error.
MESSAGE lx_error TYPE 'S' DISPLAY LIKE 'E'.
ENDTRY.
ENDFORM. "branch_popup
FORM output.
DATA: lx_error TYPE REF TO zcx_abapgit_exception,
lt_ucomm TYPE TABLE OF sy-ucomm.
PERFORM set_pf_status IN PROGRAM rsdbrunt IF FOUND.
APPEND 'CRET' TO lt_ucomm. "Button Execute
APPEND 'SPOS' TO lt_ucomm. "Button Save
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = sy-pfkey
TABLES
p_exclude = lt_ucomm.
TRY.
zcl_abapgit_ui_factory=>get_gui( )->set_focus( ).
CATCH zcx_abapgit_exception INTO lx_error.
MESSAGE lx_error TYPE 'S' DISPLAY LIKE 'E'.
ENDTRY.
ENDFORM.
FORM exit.
DATA lx_error TYPE REF TO zcx_abapgit_exception.
" The exit logic should only be applied for our 'main' selection screen 1001.
" All other selection-screens are called as popups and shouldn't influence
" the gui navigation as it would lead to inpredictable behaviour like dumps.
IF sy-dynnr <> 1001.
RETURN.
ENDIF.
TRY.
CASE sy-ucomm.
WHEN 'CBAC' OR 'CCAN'. "Back & Escape
IF zcl_abapgit_ui_factory=>get_gui( )->back( ) = abap_true. " end of stack
zcl_abapgit_ui_factory=>get_gui( )->free( ). " Graceful shutdown
ELSE.
LEAVE TO SCREEN 1001.
ENDIF.
ENDCASE.
CATCH zcx_abapgit_exception INTO lx_error.
MESSAGE lx_error TYPE 'S' DISPLAY LIKE 'E'.
ENDTRY.
ENDFORM.
FORM password_popup
USING
pv_repo_url TYPE string
CHANGING
cv_user TYPE string
cv_pass TYPE string.
lcl_password_dialog=>popup(
EXPORTING
iv_repo_url = pv_repo_url
CHANGING
cv_user = cv_user
cv_pass = cv_pass ).
ENDFORM.
FORM remove_toolbar USING pv_dynnr TYPE sy-dynnr.
DATA: ls_header TYPE rpy_dyhead,
lt_containers TYPE dycatt_tab,
lt_fields_to_containers TYPE dyfatc_tab,
lt_flow_logic TYPE swydyflow.
CALL FUNCTION 'RPY_DYNPRO_READ'
EXPORTING
progname = sy-cprog
dynnr = pv_dynnr
IMPORTING
header = ls_header
TABLES
containers = lt_containers
fields_to_containers = lt_fields_to_containers
flow_logic = lt_flow_logic
EXCEPTIONS
cancelled = 1
not_found = 2
permission_error = 3
OTHERS = 4.
IF sy-subrc IS NOT INITIAL.
RETURN. " Ignore errors, just exit
ENDIF.
IF ls_header-no_toolbar = abap_true.
RETURN. " No change required
ENDIF.
ls_header-no_toolbar = abap_true.
CALL FUNCTION 'RPY_DYNPRO_INSERT'
EXPORTING
header = ls_header
suppress_exist_checks = abap_true
TABLES
containers = lt_containers
fields_to_containers = lt_fields_to_containers
flow_logic = lt_flow_logic
EXCEPTIONS
cancelled = 1
already_exists = 2
program_not_exists = 3
not_executed = 4
missing_required_field = 5
illegal_field_value = 6
field_not_allowed = 7
not_generated = 8
illegal_field_position = 9
OTHERS = 10.
IF sy-subrc <> 2 AND sy-subrc <> 0.
RETURN. " Ignore errors, just exit
ENDIF.
ENDFORM. | 27.494444 | 84 | 0.60982 | {
"alnum_ratio": 0.5721503638,
"alpha_token_ratio": 1.7314356436,
"avg_line_length": 27.6424581006,
"char_rep_ratio": 0.140311804,
"max_line_length": 84,
"num_words": 374,
"text_len": 4948,
"word_rep_ratio": 0.0383561644
} | 7,639,450,574,808,905,000 |
1cf701471cbe0fc4b174ae263c0a97e6bdb2dd31 | 20,645 | abap | ABAP | src/zcl_excel_sheet_setup.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 251 | 2019-02-23T03:36:38.000Z | 2021-12-10T21:39:23.000Z | src/zcl_excel_sheet_setup.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 278 | 2019-02-17T10:42:59.000Z | 2021-12-10T20:24:56.000Z | src/zcl_excel_sheet_setup.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 130 | 2019-02-20T13:25:30.000Z | 2021-12-09T03:20:31.000Z | CLASS zcl_excel_sheet_setup DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
*"* public components of class ZCL_EXCEL_SHEET_SETUP
*"* do not include other source files here!!!
TYPE-POOLS abap .
DATA black_and_white TYPE flag .
DATA cell_comments TYPE stringval .
DATA copies TYPE int2 .
CONSTANTS c_break_column TYPE zexcel_break VALUE 2. "#EC NOTEXT
CONSTANTS c_break_none TYPE zexcel_break VALUE 0. "#EC NOTEXT
CONSTANTS c_break_row TYPE zexcel_break VALUE 1. "#EC NOTEXT
CONSTANTS c_cc_as_displayed TYPE string VALUE 'asDisplayed'. "#EC NOTEXT
CONSTANTS c_cc_at_end TYPE string VALUE 'atEnd'. "#EC NOTEXT
CONSTANTS c_cc_none TYPE string VALUE 'none'. "#EC NOTEXT
CONSTANTS c_ord_downthenover TYPE string VALUE 'downThenOver'. "#EC NOTEXT
CONSTANTS c_ord_overthendown TYPE string VALUE 'overThenDown'. "#EC NOTEXT
CONSTANTS c_orientation_default TYPE zexcel_sheet_orienatation VALUE 'default'. "#EC NOTEXT
CONSTANTS c_orientation_landscape TYPE zexcel_sheet_orienatation VALUE 'landscape'. "#EC NOTEXT
CONSTANTS c_orientation_portrait TYPE zexcel_sheet_orienatation VALUE 'portrait'. "#EC NOTEXT
CONSTANTS c_papersize_6_3_4_envelope TYPE zexcel_sheet_paper_size VALUE 38. "#EC NOTEXT
CONSTANTS c_papersize_a2_paper TYPE zexcel_sheet_paper_size VALUE 64. "#EC NOTEXT
CONSTANTS c_papersize_a3 TYPE zexcel_sheet_paper_size VALUE 8. "#EC NOTEXT
CONSTANTS c_papersize_a3_extra_paper TYPE zexcel_sheet_paper_size VALUE 61. "#EC NOTEXT
CONSTANTS c_papersize_a3_extra_tv_paper TYPE zexcel_sheet_paper_size VALUE 66. "#EC NOTEXT
CONSTANTS c_papersize_a3_tv_paper TYPE zexcel_sheet_paper_size VALUE 65. "#EC NOTEXT
CONSTANTS c_papersize_a4 TYPE zexcel_sheet_paper_size VALUE 9. "#EC NOTEXT
CONSTANTS c_papersize_a4_extra_paper TYPE zexcel_sheet_paper_size VALUE 51. "#EC NOTEXT
CONSTANTS c_papersize_a4_plus_paper TYPE zexcel_sheet_paper_size VALUE 58. "#EC NOTEXT
CONSTANTS c_papersize_a4_small TYPE zexcel_sheet_paper_size VALUE 10. "#EC NOTEXT
CONSTANTS c_papersize_a4_tv_paper TYPE zexcel_sheet_paper_size VALUE 53. "#EC NOTEXT
CONSTANTS c_papersize_a5 TYPE zexcel_sheet_paper_size VALUE 11. "#EC NOTEXT
CONSTANTS c_papersize_a5_extra_paper TYPE zexcel_sheet_paper_size VALUE 62. "#EC NOTEXT
CONSTANTS c_papersize_a5_tv_paper TYPE zexcel_sheet_paper_size VALUE 59. "#EC NOTEXT
CONSTANTS c_papersize_b4 TYPE zexcel_sheet_paper_size VALUE 12. "#EC NOTEXT
CONSTANTS c_papersize_b4_envelope TYPE zexcel_sheet_paper_size VALUE 33. "#EC NOTEXT
CONSTANTS c_papersize_b5 TYPE zexcel_sheet_paper_size VALUE 13. "#EC NOTEXT
CONSTANTS c_papersize_b5_envelope TYPE zexcel_sheet_paper_size VALUE 34. "#EC NOTEXT
CONSTANTS c_papersize_b6_envelope TYPE zexcel_sheet_paper_size VALUE 35. "#EC NOTEXT
CONSTANTS c_papersize_c TYPE zexcel_sheet_paper_size VALUE 24. "#EC NOTEXT
CONSTANTS c_papersize_c3_envelope TYPE zexcel_sheet_paper_size VALUE 29. "#EC NOTEXT
CONSTANTS c_papersize_c4_envelope TYPE zexcel_sheet_paper_size VALUE 30. "#EC NOTEXT
CONSTANTS c_papersize_c5_envelope TYPE zexcel_sheet_paper_size VALUE 28. "#EC NOTEXT
CONSTANTS c_papersize_c65_envelope TYPE zexcel_sheet_paper_size VALUE 32. "#EC NOTEXT
CONSTANTS c_papersize_c6_envelope TYPE zexcel_sheet_paper_size VALUE 31. "#EC NOTEXT
CONSTANTS c_papersize_d TYPE zexcel_sheet_paper_size VALUE 25. "#EC NOTEXT
CONSTANTS c_papersize_de_leg_fanfold TYPE zexcel_sheet_paper_size VALUE 41. "#EC NOTEXT
CONSTANTS c_papersize_de_std_fanfold TYPE zexcel_sheet_paper_size VALUE 40. "#EC NOTEXT
CONSTANTS c_papersize_dl_envelope TYPE zexcel_sheet_paper_size VALUE 27. "#EC NOTEXT
CONSTANTS c_papersize_e TYPE zexcel_sheet_paper_size VALUE 26. "#EC NOTEXT
CONSTANTS c_papersize_executive TYPE zexcel_sheet_paper_size VALUE 7. "#EC NOTEXT
CONSTANTS c_papersize_folio TYPE zexcel_sheet_paper_size VALUE 14. "#EC NOTEXT
CONSTANTS c_papersize_invite_envelope TYPE zexcel_sheet_paper_size VALUE 47. "#EC NOTEXT
CONSTANTS c_papersize_iso_b4 TYPE zexcel_sheet_paper_size VALUE 42. "#EC NOTEXT
CONSTANTS c_papersize_iso_b5_extra_paper TYPE zexcel_sheet_paper_size VALUE 63. "#EC NOTEXT
CONSTANTS c_papersize_italy_envelope TYPE zexcel_sheet_paper_size VALUE 36. "#EC NOTEXT
CONSTANTS c_papersize_jis_b5_tv_paper TYPE zexcel_sheet_paper_size VALUE 60. "#EC NOTEXT
CONSTANTS c_papersize_jpn_dbl_postcard TYPE zexcel_sheet_paper_size VALUE 43. "#EC NOTEXT
CONSTANTS c_papersize_ledger TYPE zexcel_sheet_paper_size VALUE 4. "#EC NOTEXT
CONSTANTS c_papersize_legal TYPE zexcel_sheet_paper_size VALUE 5. "#EC NOTEXT
CONSTANTS c_papersize_legal_extra_paper TYPE zexcel_sheet_paper_size VALUE 49. "#EC NOTEXT
CONSTANTS c_papersize_letter TYPE zexcel_sheet_paper_size VALUE 1. "#EC NOTEXT
CONSTANTS c_papersize_letter_extra_paper TYPE zexcel_sheet_paper_size VALUE 48. "#EC NOTEXT
CONSTANTS c_papersize_letter_extv_paper TYPE zexcel_sheet_paper_size VALUE 54. "#EC NOTEXT
CONSTANTS c_papersize_letter_plus_paper TYPE zexcel_sheet_paper_size VALUE 57. "#EC NOTEXT
CONSTANTS c_papersize_letter_small TYPE zexcel_sheet_paper_size VALUE 2. "#EC NOTEXT
CONSTANTS c_papersize_letter_tv_paper TYPE zexcel_sheet_paper_size VALUE 52. "#EC NOTEXT
CONSTANTS c_papersize_monarch_envelope TYPE zexcel_sheet_paper_size VALUE 37. "#EC NOTEXT
CONSTANTS c_papersize_no10_envelope TYPE zexcel_sheet_paper_size VALUE 20. "#EC NOTEXT
CONSTANTS c_papersize_no11_envelope TYPE zexcel_sheet_paper_size VALUE 21. "#EC NOTEXT
CONSTANTS c_papersize_no12_envelope TYPE zexcel_sheet_paper_size VALUE 22. "#EC NOTEXT
CONSTANTS c_papersize_no14_envelope TYPE zexcel_sheet_paper_size VALUE 23. "#EC NOTEXT
CONSTANTS c_papersize_no9_envelope TYPE zexcel_sheet_paper_size VALUE 19. "#EC NOTEXT
CONSTANTS c_papersize_note TYPE zexcel_sheet_paper_size VALUE 18. "#EC NOTEXT
CONSTANTS c_papersize_quarto TYPE zexcel_sheet_paper_size VALUE 15. "#EC NOTEXT
CONSTANTS c_papersize_standard_1 TYPE zexcel_sheet_paper_size VALUE 16. "#EC NOTEXT
CONSTANTS c_papersize_standard_2 TYPE zexcel_sheet_paper_size VALUE 17. "#EC NOTEXT
CONSTANTS c_papersize_standard_paper_1 TYPE zexcel_sheet_paper_size VALUE 44. "#EC NOTEXT
CONSTANTS c_papersize_standard_paper_2 TYPE zexcel_sheet_paper_size VALUE 45. "#EC NOTEXT
CONSTANTS c_papersize_standard_paper_3 TYPE zexcel_sheet_paper_size VALUE 46. "#EC NOTEXT
CONSTANTS c_papersize_statement TYPE zexcel_sheet_paper_size VALUE 6. "#EC NOTEXT
CONSTANTS c_papersize_supera_a4_paper TYPE zexcel_sheet_paper_size VALUE 55. "#EC NOTEXT
CONSTANTS c_papersize_superb_a3_paper TYPE zexcel_sheet_paper_size VALUE 56. "#EC NOTEXT
CONSTANTS c_papersize_tabloid TYPE zexcel_sheet_paper_size VALUE 3. "#EC NOTEXT
CONSTANTS c_papersize_tabl_extra_paper TYPE zexcel_sheet_paper_size VALUE 50. "#EC NOTEXT
CONSTANTS c_papersize_us_std_fanfold TYPE zexcel_sheet_paper_size VALUE 39. "#EC NOTEXT
CONSTANTS c_pe_blank TYPE string VALUE 'blank'. "#EC NOTEXT
CONSTANTS c_pe_dash TYPE string VALUE 'dash'. "#EC NOTEXT
CONSTANTS c_pe_displayed TYPE string VALUE 'displayed'. "#EC NOTEXT
CONSTANTS c_pe_na TYPE string VALUE 'NA'. "#EC NOTEXT
DATA diff_oddeven_headerfooter TYPE flag .
DATA draft TYPE flag .
DATA errors TYPE stringval .
DATA even_footer TYPE zexcel_s_worksheet_head_foot .
DATA even_header TYPE zexcel_s_worksheet_head_foot .
DATA first_page_number TYPE int2 .
DATA fit_to_height TYPE int2 .
DATA fit_to_page TYPE flag .
DATA fit_to_width TYPE int2 .
DATA horizontal_centered TYPE flag .
DATA horizontal_dpi TYPE int2 .
DATA margin_bottom TYPE zexcel_dec_8_2 .
DATA margin_footer TYPE zexcel_dec_8_2 .
DATA margin_header TYPE zexcel_dec_8_2 .
DATA margin_left TYPE zexcel_dec_8_2 .
DATA margin_right TYPE zexcel_dec_8_2 .
DATA margin_top TYPE zexcel_dec_8_2 .
DATA odd_footer TYPE zexcel_s_worksheet_head_foot .
DATA odd_header TYPE zexcel_s_worksheet_head_foot .
DATA orientation TYPE zexcel_sheet_orienatation .
DATA page_order TYPE string .
DATA paper_height TYPE string .
DATA paper_size TYPE int2 .
DATA paper_width TYPE string .
DATA scale TYPE int2 .
DATA use_first_page_num TYPE flag .
DATA use_printer_defaults TYPE flag .
DATA vertical_centered TYPE flag .
DATA vertical_dpi TYPE int2 .
METHODS constructor .
METHODS set_page_margins
IMPORTING
!ip_bottom TYPE float OPTIONAL
!ip_footer TYPE float OPTIONAL
!ip_header TYPE float OPTIONAL
!ip_left TYPE float OPTIONAL
!ip_right TYPE float OPTIONAL
!ip_top TYPE float OPTIONAL
!ip_unit TYPE csequence DEFAULT 'in' .
METHODS set_header_footer
IMPORTING
!ip_odd_header TYPE zexcel_s_worksheet_head_foot OPTIONAL
!ip_odd_footer TYPE zexcel_s_worksheet_head_foot OPTIONAL
!ip_even_header TYPE zexcel_s_worksheet_head_foot OPTIONAL
!ip_even_footer TYPE zexcel_s_worksheet_head_foot OPTIONAL .
METHODS get_header_footer_string
EXPORTING
!ep_odd_header TYPE string
!ep_odd_footer TYPE string
!ep_even_header TYPE string
!ep_even_footer TYPE string .
METHODS get_header_footer
EXPORTING
!ep_odd_header TYPE zexcel_s_worksheet_head_foot
!ep_odd_footer TYPE zexcel_s_worksheet_head_foot
!ep_even_header TYPE zexcel_s_worksheet_head_foot
!ep_even_footer TYPE zexcel_s_worksheet_head_foot .
PROTECTED SECTION.
*"* protected components of class ZCL_EXCEL_SHEET_SETUP
*"* do not include other source files here!!!
METHODS process_header_footer
IMPORTING
!ip_header TYPE zexcel_s_worksheet_head_foot
!ip_side TYPE string
RETURNING
VALUE(rv_processed_string) TYPE string .
PRIVATE SECTION.
*"* private components of class ZCL_EXCEL_SHEET_SETUP
*"* do not include other source files here!!!
ENDCLASS.
CLASS zcl_excel_sheet_setup IMPLEMENTATION.
METHOD constructor.
orientation = me->c_orientation_default.
* default margins
margin_bottom = '0.75'.
margin_footer = '0.3'.
margin_header = '0.3'.
margin_left = '0.7'.
margin_right = '0.7'.
margin_top = '0.75'.
* clear page settings
CLEAR: black_and_white,
cell_comments,
copies,
draft,
errors,
first_page_number,
fit_to_page,
fit_to_height,
fit_to_width,
horizontal_dpi,
orientation,
page_order,
paper_height,
paper_size,
paper_width,
scale,
use_first_page_num,
use_printer_defaults,
vertical_dpi.
ENDMETHOD.
METHOD get_header_footer.
* Only Basic font/text formatting possible:
* Bold (yes / no), Font Type, Font Size
*
* usefull placeholders, which can be used in header/footer value strings
* '&P' - page number
* '&N' - total number of pages
* '&D' - Date
* '&T' - Time
* '&F' - File Name
* '&Z' - Path
* '&A' - Sheet name
* new line via class constant CL_ABAP_CHAR_UTILITIES=>newline
*
* Example Value String 'page &P of &N'
*
* DO NOT USE &L , &C or &R which automatically created as position markers
ep_odd_header = me->odd_header.
ep_odd_footer = me->odd_footer.
ep_even_header = me->even_header.
ep_even_footer = me->even_footer.
ENDMETHOD.
METHOD get_header_footer_string.
* ----------------------------------------------------------------------
DATA: lc_marker_left(2) TYPE c VALUE '&L'
, lc_marker_right(2) TYPE c VALUE '&R'
, lc_marker_center(2) TYPE c VALUE '&C'
, lv_value TYPE string
.
* ----------------------------------------------------------------------
IF ep_odd_header IS SUPPLIED.
IF me->odd_header-left_value IS NOT INITIAL.
lv_value = me->process_header_footer( ip_header = me->odd_header ip_side = 'LEFT' ).
CONCATENATE lc_marker_left lv_value INTO ep_odd_header.
ENDIF.
IF me->odd_header-center_value IS NOT INITIAL.
lv_value = me->process_header_footer( ip_header = me->odd_header ip_side = 'CENTER' ).
CONCATENATE ep_odd_header lc_marker_center lv_value INTO ep_odd_header.
ENDIF.
IF me->odd_header-right_value IS NOT INITIAL.
lv_value = me->process_header_footer( ip_header = me->odd_header ip_side = 'RIGHT' ).
CONCATENATE ep_odd_header lc_marker_right lv_value INTO ep_odd_header.
ENDIF.
IF me->odd_header-left_image IS NOT INITIAL.
lv_value = '&G'.
CONCATENATE ep_odd_header lc_marker_left lv_value INTO ep_odd_header.
ENDIF.
IF me->odd_header-center_image IS NOT INITIAL.
lv_value = '&G'.
CONCATENATE ep_odd_header lc_marker_center lv_value INTO ep_odd_header.
ENDIF.
IF me->odd_header-right_image IS NOT INITIAL.
lv_value = '&G'.
CONCATENATE ep_odd_header lc_marker_right lv_value INTO ep_odd_header.
ENDIF.
ENDIF.
* ----------------------------------------------------------------------
IF ep_odd_footer IS SUPPLIED.
IF me->odd_footer-left_value IS NOT INITIAL.
lv_value = me->process_header_footer( ip_header = me->odd_footer ip_side = 'LEFT' ).
CONCATENATE lc_marker_left lv_value INTO ep_odd_footer.
ENDIF.
IF me->odd_footer-center_value IS NOT INITIAL.
lv_value = me->process_header_footer( ip_header = me->odd_footer ip_side = 'CENTER' ).
CONCATENATE ep_odd_footer lc_marker_center lv_value INTO ep_odd_footer.
ENDIF.
IF me->odd_footer-right_value IS NOT INITIAL.
lv_value = me->process_header_footer( ip_header = me->odd_footer ip_side = 'RIGHT' ).
CONCATENATE ep_odd_footer lc_marker_right lv_value INTO ep_odd_footer.
ENDIF.
IF me->odd_footer-left_image IS NOT INITIAL.
lv_value = '&G'.
CONCATENATE ep_odd_header lc_marker_left lv_value INTO ep_odd_footer.
ENDIF.
IF me->odd_footer-center_image IS NOT INITIAL.
lv_value = '&G'.
CONCATENATE ep_odd_header lc_marker_center lv_value INTO ep_odd_footer.
ENDIF.
IF me->odd_footer-right_image IS NOT INITIAL.
lv_value = '&G'.
CONCATENATE ep_odd_header lc_marker_right lv_value INTO ep_odd_footer.
ENDIF.
ENDIF.
* ----------------------------------------------------------------------
IF ep_even_header IS SUPPLIED.
IF me->even_header-left_value IS NOT INITIAL.
lv_value = me->process_header_footer( ip_header = me->even_header ip_side = 'LEFT' ).
CONCATENATE lc_marker_left lv_value INTO ep_even_header.
ENDIF.
IF me->even_header-center_value IS NOT INITIAL.
lv_value = me->process_header_footer( ip_header = me->even_header ip_side = 'CENTER' ).
CONCATENATE ep_even_header lc_marker_center lv_value INTO ep_even_header.
ENDIF.
IF me->even_header-right_value IS NOT INITIAL.
lv_value = me->process_header_footer( ip_header = me->even_header ip_side = 'RIGHT' ).
CONCATENATE ep_even_header lc_marker_right lv_value INTO ep_even_header.
ENDIF.
IF me->even_header-left_image IS NOT INITIAL.
lv_value = '&G'.
CONCATENATE ep_odd_header lc_marker_left lv_value INTO ep_even_header.
ENDIF.
IF me->even_header-center_image IS NOT INITIAL.
lv_value = '&G'.
CONCATENATE ep_odd_header lc_marker_center lv_value INTO ep_even_header.
ENDIF.
IF me->even_header-right_image IS NOT INITIAL.
lv_value = '&G'.
CONCATENATE ep_odd_header lc_marker_right lv_value INTO ep_even_header.
ENDIF.
ENDIF.
* ----------------------------------------------------------------------
IF ep_even_footer IS SUPPLIED.
IF me->even_footer-left_value IS NOT INITIAL.
lv_value = me->process_header_footer( ip_header = me->even_footer ip_side = 'LEFT' ).
CONCATENATE lc_marker_left lv_value INTO ep_even_footer.
ENDIF.
IF me->even_footer-center_value IS NOT INITIAL.
lv_value = me->process_header_footer( ip_header = me->even_footer ip_side = 'CENTER' ).
CONCATENATE ep_even_footer lc_marker_center lv_value INTO ep_even_footer.
ENDIF.
IF me->even_footer-right_value IS NOT INITIAL.
lv_value = me->process_header_footer( ip_header = me->even_footer ip_side = 'RIGHT' ).
CONCATENATE ep_even_footer lc_marker_right lv_value INTO ep_even_footer.
ENDIF.
IF me->even_footer-left_image IS NOT INITIAL.
lv_value = '&G'.
CONCATENATE ep_odd_header lc_marker_left lv_value INTO ep_even_footer.
ENDIF.
IF me->even_footer-center_image IS NOT INITIAL.
lv_value = '&G'.
CONCATENATE ep_odd_header lc_marker_center lv_value INTO ep_even_footer.
ENDIF.
IF me->even_footer-right_image IS NOT INITIAL.
lv_value = '&G'.
CONCATENATE ep_odd_header lc_marker_right lv_value INTO ep_even_footer.
ENDIF.
ENDIF.
* ----------------------------------------------------------------------
ENDMETHOD.
METHOD process_header_footer.
* ----------------------------------------------------------------------
* Only Basic font/text formatting possible:
* Bold (yes / no), Font Type, Font Size
DATA: lv_fname(12) TYPE c
, lv_string TYPE string
.
FIELD-SYMBOLS: <lv_value> TYPE string
, <ls_font> TYPE zexcel_s_style_font
.
* ----------------------------------------------------------------------
CONCATENATE ip_side '_VALUE' INTO lv_fname.
ASSIGN COMPONENT lv_fname OF STRUCTURE ip_header TO <lv_value>.
CONCATENATE ip_side '_FONT' INTO lv_fname.
ASSIGN COMPONENT lv_fname OF STRUCTURE ip_header TO <ls_font>.
IF <ls_font> IS ASSIGNED AND <lv_value> IS ASSIGNED.
IF <lv_value> = '&G'. "image header
rv_processed_string = <lv_value>.
ELSE.
IF <ls_font>-name IS NOT INITIAL.
CONCATENATE '&"' <ls_font>-name ',' INTO rv_processed_string.
ELSE.
rv_processed_string = '&"-,'.
ENDIF.
IF <ls_font>-bold = abap_true.
CONCATENATE rv_processed_string 'Bold"' INTO rv_processed_string.
ELSE.
CONCATENATE rv_processed_string 'Standard"' INTO rv_processed_string.
ENDIF.
IF <ls_font>-size IS NOT INITIAL.
lv_string = <ls_font>-size.
CONCATENATE rv_processed_string '&' lv_string INTO rv_processed_string.
CONDENSE rv_processed_string NO-GAPS.
ENDIF.
CONCATENATE rv_processed_string <lv_value> INTO rv_processed_string.
ENDIF.
ENDIF.
* ----------------------------------------------------------------------
ENDMETHOD.
METHOD set_header_footer.
* Only Basic font/text formatting possible:
* Bold (yes / no), Font Type, Font Size
*
* usefull placeholders, which can be used in header/footer value strings
* '&P' - page number
* '&N' - total number of pages
* '&D' - Date
* '&T' - Time
* '&F' - File Name
* '&Z' - Path
* '&A' - Sheet name
* new line via class constant CL_ABAP_CHAR_UTILITIES=>newline
*
* Example Value String 'page &P of &N'
*
* DO NOT USE &L , &C or &R which automatically created as position markers
me->odd_header = ip_odd_header.
me->odd_footer = ip_odd_footer.
me->even_header = ip_even_header.
me->even_footer = ip_even_footer.
IF me->even_header IS NOT INITIAL OR me->even_footer IS NOT INITIAL.
me->diff_oddeven_headerfooter = abap_true.
ENDIF.
ENDMETHOD.
METHOD set_page_margins.
DATA: lv_coef TYPE f,
lv_unit TYPE string.
lv_unit = ip_unit.
TRANSLATE lv_unit TO UPPER CASE.
CASE lv_unit.
WHEN 'IN'. lv_coef = 1.
WHEN 'CM'. lv_coef = '0.393700787'.
WHEN 'MM'. lv_coef = '0.0393700787'.
ENDCASE.
IF ip_bottom IS SUPPLIED. margin_bottom = lv_coef * ip_bottom. ENDIF.
IF ip_footer IS SUPPLIED. margin_footer = lv_coef * ip_footer. ENDIF.
IF ip_header IS SUPPLIED. margin_header = lv_coef * ip_header. ENDIF.
IF ip_left IS SUPPLIED. margin_left = lv_coef * ip_left. ENDIF.
IF ip_right IS SUPPLIED. margin_right = lv_coef * ip_right. ENDIF.
IF ip_top IS SUPPLIED. margin_top = lv_coef * ip_top. ENDIF.
ENDMETHOD.
ENDCLASS. | 43.010417 | 99 | 0.705304 | {
"alnum_ratio": 0.6524898276,
"alpha_token_ratio": 1.8945183913,
"avg_line_length": 43.0981210856,
"char_rep_ratio": 0.2694935789,
"max_line_length": 99,
"num_words": 1686,
"text_len": 20644,
"word_rep_ratio": 0.1103160405
} | 11,281,855,092,999,086,000 |
e80338cf63a13b27e8e824ab9addd34a7aa79771 | 5,251 | abap | ABAP | src/ui/core/zcl_abapgit_gui_html_processor.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/ui/core/zcl_abapgit_gui_html_processor.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/ui/core/zcl_abapgit_gui_html_processor.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_gui_html_processor DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CONSTANTS c_css_build_name TYPE string VALUE 'css/bundle.css'.
CONSTANTS c_preprocess_marker TYPE string VALUE `<!-- abapgit HTML preprocessor -->`.
CONSTANTS c_comment_start TYPE string VALUE `<!--`.
CONSTANTS c_comment_end TYPE string VALUE `-->`.
INTERFACES zif_abapgit_gui_html_processor .
METHODS constructor
IMPORTING
ii_asset_man TYPE REF TO zif_abapgit_gui_asset_manager.
METHODS preserve_css
IMPORTING
!iv_css_url TYPE string .
PROTECTED SECTION.
PRIVATE SECTION.
DATA mt_preserve_css TYPE string_table.
DATA mi_asset_man TYPE REF TO zif_abapgit_gui_asset_manager.
METHODS patch_html
IMPORTING
iv_html TYPE string
EXPORTING
ev_html TYPE string
et_css_urls TYPE string_table
RAISING
zcx_abapgit_exception.
METHODS is_preserved
IMPORTING
!iv_css_url TYPE string
RETURNING
VALUE(rv_yes) TYPE abap_bool.
METHODS find_head_offset
IMPORTING
iv_html TYPE string
RETURNING
VALUE(rv_head_end) TYPE i
RAISING
zcx_abapgit_exception.
ENDCLASS.
CLASS ZCL_ABAPGIT_GUI_HTML_PROCESSOR IMPLEMENTATION.
METHOD constructor.
mi_asset_man = ii_asset_man.
ENDMETHOD.
METHOD is_preserved.
READ TABLE mt_preserve_css TRANSPORTING NO FIELDS WITH KEY table_line = iv_css_url.
rv_yes = boolc( sy-subrc = 0 ).
ENDMETHOD.
METHOD patch_html.
CONSTANTS lc_css_re TYPE string VALUE `<link\s+rel="stylesheet"\s+type="text/css"\s+href="(\S+)">`.
DATA lv_head_end TYPE i.
DATA lo_css_re TYPE REF TO cl_abap_regex.
DATA lo_matcher TYPE REF TO cl_abap_matcher.
DATA lv_css_path TYPE string.
DATA lv_marker TYPE string.
DATA lv_off TYPE i.
DATA lv_len TYPE i.
DATA lv_cur TYPE i.
DATA lv_css_build TYPE string VALUE '<link rel="stylesheet" type="text/css" href="$BUILD_NAME">'.
REPLACE FIRST OCCURRENCE OF '$BUILD_NAME' IN lv_css_build WITH c_css_build_name. " Mmmm
CLEAR: ev_html, et_css_urls.
lv_head_end = find_head_offset( iv_html ).
CREATE OBJECT lo_css_re
EXPORTING
ignore_case = abap_true
pattern = lc_css_re.
lo_matcher = lo_css_re->create_matcher( text = substring( val = iv_html len = lv_head_end ) ).
WHILE lo_matcher->find_next( ) = abap_true.
lv_css_path = lo_matcher->get_submatch( 1 ).
IF abap_false = is_preserved( lv_css_path ).
lv_off = lo_matcher->get_offset( ).
lv_len = lo_matcher->get_length( ).
ev_html = ev_html && substring( val = iv_html
off = lv_cur
len = lv_off - lv_cur ).
ev_html = ev_html && c_comment_start && substring( val = iv_html
off = lv_off
len = lv_len ) && c_comment_end.
lv_cur = lv_off + lv_len.
APPEND lv_css_path TO et_css_urls.
ENDIF.
ENDWHILE.
ev_html = ev_html && substring( val = iv_html
off = lv_cur
len = lv_head_end - lv_cur ).
IF lines( et_css_urls ) > 0.
lv_marker = cl_abap_char_utilities=>newline
&& ` ` " Assume 4 space indent, maybe improve and detect ?
&& c_preprocess_marker
&& cl_abap_char_utilities=>newline
&& ` `.
ev_html = ev_html && lv_marker && lv_css_build.
ENDIF.
ev_html = ev_html && substring( val = iv_html
off = lv_head_end ).
ENDMETHOD.
METHOD preserve_css.
APPEND iv_css_url TO mt_preserve_css.
ENDMETHOD.
METHOD zif_abapgit_gui_html_processor~process.
DATA lo_css_processor TYPE REF TO zcl_abapgit_gui_css_processor.
DATA lt_css_urls TYPE string_table.
DATA lv_css_build TYPE string.
FIELD-SYMBOLS <lv_url> LIKE LINE OF lt_css_urls.
patch_html(
EXPORTING
iv_html = iv_html
IMPORTING
ev_html = rv_html
et_css_urls = lt_css_urls ).
IF lines( lt_css_urls ) > 0.
CREATE OBJECT lo_css_processor
EXPORTING
ii_asset_manager = mi_asset_man.
LOOP AT lt_css_urls ASSIGNING <lv_url>.
lo_css_processor->add_file( <lv_url> ).
ENDLOOP.
lv_css_build = lo_css_processor->process( ).
ii_gui_services->cache_asset(
iv_url = |{ c_css_build_name }|
iv_type = 'text'
iv_subtype = 'css'
iv_text = lv_css_build ).
ENDIF.
ENDMETHOD.
METHOD find_head_offset.
rv_head_end = find( val = iv_html
regex = |{ cl_abap_char_utilities=>newline }?\\s*</head>|
case = abap_false ).
IF rv_head_end <= 0.
rv_head_end = find( val = iv_html
regex = |</head>|
case = abap_false ).
IF rv_head_end <= 0.
zcx_abapgit_exception=>raise( 'HTML preprocessor: </head> not found' ).
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS. | 28.231183 | 103 | 0.617406 | {
"alnum_ratio": 0.5666666667,
"alpha_token_ratio": 1.6825396825,
"avg_line_length": 28.3783783784,
"char_rep_ratio": 0.1526426255,
"max_line_length": 103,
"num_words": 391,
"text_len": 5250,
"word_rep_ratio": 0
} | 12,946,335,070,895,389,000 |
e8531c6142ead345ae37568dd8316f25ef24a137 | 5,301 | abap | ABAP | src/checks/zcl_aoc_check_101.clas.testclasses.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_101.clas.testclasses.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_101.clas.testclasses.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | *----------------------------------------------------------------------*
* CLASS lcl_Test DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS
FINAL.
PRIVATE SECTION.
* ================
DATA: mt_code TYPE string_table,
ms_result TYPE scirest_ad,
mo_check TYPE REF TO zcl_aoc_check_101.
METHODS:
setup,
export_import FOR TESTING,
test001_01 FOR TESTING,
test001_02 FOR TESTING,
test001_03 FOR TESTING RAISING cx_static_check,
test001_04 FOR TESTING RAISING cx_static_check,
test001_05 FOR TESTING RAISING cx_static_check,
test001_06 FOR TESTING RAISING cx_static_check,
test002_01 FOR TESTING RAISING cx_static_check,
test002_02 FOR TESTING RAISING cx_static_check,
test002_03 FOR TESTING RAISING cx_static_check,
test002_04 FOR TESTING RAISING cx_static_check,
test002_05 FOR TESTING RAISING cx_static_check.
ENDCLASS. "lcl_Test
*----------------------------------------------------------------------*
* CLASS lcl_Test IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test IMPLEMENTATION.
* ==============================
DEFINE _code.
APPEND &1 TO mt_code.
END-OF-DEFINITION.
METHOD setup.
CREATE OBJECT mo_check.
zcl_aoc_unit_test=>set_check( mo_check ).
ENDMETHOD. "setup
METHOD export_import.
zcl_aoc_unit_test=>export_import( mo_check ).
ENDMETHOD.
METHOD test001_01.
* ===========
_code 'IF foo IS NOT INITIAL.'.
_code ' foo = foo + 1.'.
_code 'ENDIF.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD. "test1
METHOD test001_02.
* ===========
cl_abap_unit_assert=>assert_initial( ms_result ).
_code 'IF NOT foo IS INITIAL.'.
_code ' foo = foo + 1.'.
_code 'ENDIF.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD. "test2
METHOD test001_03.
* ===========
cl_abap_unit_assert=>assert_initial( ms_result ).
_code 'IF foo IS NOT INITIAL AND NOT bar IS INITIAL.'.
_code ' foo = foo + 1.'.
_code 'ENDIF.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD. "test2
METHOD test001_04.
* ===========
_code 'IF NOT ( foo IS INITIAL ).'. "Not handled by check
_code ' foo = foo + 1.'.
_code 'ENDIF.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test001_05.
* ===========
_code 'IF ( NOT foo IS INITIAL ).'.
_code ' foo = foo + 1.'.
_code 'ENDIF.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD.
METHOD test001_06.
* ===========
_code 'IF lines( foo ) > 1.'. "Not handled by check
_code ' bar = bar + 1.'.
_code 'ENDIF.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test002_01.
* ===========
_code 'IF NOT line_exists( foo[ 1 ] ).'.
_code ' WRITE 1.'.
_code 'ENDIF.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test002_02.
* ===========
_code 'IF NOT line_exists( foo[ bar = 1 ] ).'.
_code ' WRITE 1.'.
_code 'ENDIF.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test002_03.
* ===========
_code 'IF NOT foo[ bar = 1 ]-var = 1.'.
_code ' WRITE 1.'.
_code 'ENDIF.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD.
METHOD test002_04.
* ===========
_code 'IF matches( val = <ls_token>-str regex = `^\w*\[$` ).'.
_code ' WRITE 1.'.
_code 'ENDIF.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test002_05.
* ===========
_code 'if not line_exists( foo['.
_code ' var1 = 1'.
_code ' var2 = 2 ] ).'.
_code ' select * from mara into table lt_mara'.
_code ' where matnr = ls_matnr.'.
_code ' endif.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
ENDCLASS. "lcl_Test | 25.73301 | 80 | 0.534427 | {
"alnum_ratio": 0.4909433962,
"alpha_token_ratio": 1.4555160142,
"avg_line_length": 25.8536585366,
"char_rep_ratio": 0.2502362502,
"max_line_length": 80,
"num_words": 356,
"text_len": 5300,
"word_rep_ratio": 0.3371757925
} | 6,053,701,108,087,700,000 |
e8564ed866a111bca5ae1d66d237ad61b6e0d60b | 1,715 | abap | ABAP | src/utils/zaoc_count_classes_with_tests.prog.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/utils/zaoc_count_classes_with_tests.prog.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/utils/zaoc_count_classes_with_tests.prog.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | REPORT zaoc_count_classes_with_tests.
TABLES: tadir.
SELECT-OPTIONS: s_objn FOR tadir-obj_name,
s_devc FOR tadir-devclass.
START-OF-SELECTION.
PERFORM run.
FORM run RAISING cx_salv_msg.
TYPES: BEGIN OF ty_alv,
obj_name TYPE tadir-obj_name,
with TYPE i,
without TYPE i,
END OF ty_alv.
TYPES: BEGIN OF ty_tadir,
object TYPE tadir-object,
obj_name TYPE tadir-obj_name,
END OF ty_tadir.
DATA: lt_tadir TYPE STANDARD TABLE OF ty_tadir WITH DEFAULT KEY,
ls_tadir LIKE LINE OF lt_tadir,
lo_alv TYPE REF TO cl_salv_table,
lt_alv TYPE STANDARD TABLE OF ty_alv WITH DEFAULT KEY,
ls_alv LIKE LINE OF lt_alv,
ls_aunit_info TYPE if_aunit_prog_info_types=>ty_s_program.
SELECT object obj_name FROM tadir INTO TABLE lt_tadir
WHERE pgmid = 'R3TR'
AND object = 'CLAS'
AND obj_name IN s_objn
AND devclass IN s_devc
AND delflag = abap_false. "#EC CI_GENBUFF "#EC CI_SUBRC
LOOP AT lt_tadir INTO ls_tadir.
CLEAR ls_alv.
ls_aunit_info = cl_aunit_prog_info=>get_program_info(
allow_commit = abap_true
obj_type = ls_tadir-object
obj_name = ls_tadir-obj_name ).
ls_alv-obj_name = ls_tadir-obj_name.
IF ls_aunit_info-has_tests = abap_true.
ls_alv-with = 1.
ELSE.
ls_alv-without = 1.
ENDIF.
APPEND ls_alv TO lt_alv.
ENDLOOP.
cl_salv_table=>factory(
IMPORTING
r_salv_table = lo_alv
CHANGING
t_table = lt_alv ).
lo_alv->get_functions( )->set_all( ).
lo_alv->get_columns( )->set_optimize( ).
lo_alv->display( ).
ENDFORM. | 26.796875 | 71 | 0.644898 | {
"alnum_ratio": 0.5945157526,
"alpha_token_ratio": 1.5119047619,
"avg_line_length": 27.2063492063,
"char_rep_ratio": 0.0944281525,
"max_line_length": 71,
"num_words": 155,
"text_len": 1714,
"word_rep_ratio": 0
} | 4,382,500,172,618,437,000 |
e8a293c5a403a9b41ad18ef867c0a7c2fa9c9575 | 1,121 | abap | ABAP | src/ui/zcl_abapgit_gui_component.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/ui/zcl_abapgit_gui_component.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/ui/zcl_abapgit_gui_component.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_gui_component DEFINITION
PUBLIC
ABSTRACT
CREATE PUBLIC .
PUBLIC SECTION.
CONSTANTS:
BEGIN OF c_html_parts,
scripts TYPE string VALUE 'scripts',
hidden_forms TYPE string VALUE 'hidden_forms',
END OF c_html_parts.
PROTECTED SECTION.
METHODS register_deferred_script
IMPORTING
ii_part TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception.
METHODS gui_services
RETURNING
VALUE(ri_gui_services) TYPE REF TO zif_abapgit_gui_services
RAISING
zcx_abapgit_exception.
PRIVATE SECTION.
DATA mi_gui_services TYPE REF TO zif_abapgit_gui_services.
ENDCLASS.
CLASS ZCL_ABAPGIT_GUI_COMPONENT IMPLEMENTATION.
METHOD gui_services.
IF mi_gui_services IS NOT BOUND.
mi_gui_services = zcl_abapgit_ui_factory=>get_gui_services( ).
ENDIF.
ri_gui_services = mi_gui_services.
ENDMETHOD.
METHOD register_deferred_script.
gui_services( )->get_html_parts( )->add_part(
iv_collection = c_html_parts-scripts
ii_part = ii_part ).
ENDMETHOD.
ENDCLASS. | 22.42 | 68 | 0.717217 | {
"alnum_ratio": 0.6669642857,
"alpha_token_ratio": 1.9606299213,
"avg_line_length": 22.8571428571,
"char_rep_ratio": 0.1179117912,
"max_line_length": 68,
"num_words": 84,
"text_len": 1120,
"word_rep_ratio": 0
} | 325,177,058,917,300,000 |
e8ccc60e4530f2890c632f2dbc7bdf1d11fbfbf6 | 10,965 | abap | ABAP | src/objects/zcl_abapgit_object_pdts.clas.locals_imp.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/zcl_abapgit_object_pdts.clas.locals_imp.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/zcl_abapgit_object_pdts.clas.locals_imp.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS lcl_attribute_setter DEFINITION
INHERITING FROM cl_workflow_general_task_def
CREATE PUBLIC
FINAL.
PUBLIC SECTION.
CLASS-METHODS set_objid IMPORTING iv_objid TYPE hrobject-objid
io_task TYPE REF TO cl_workflow_general_task_def.
CLASS-METHODS set_container_id IMPORTING iv_id TYPE guid_32
io_task TYPE REF TO cl_workflow_general_task_def. "#EC NEEDED
ENDCLASS.
CLASS lcl_attribute_setter IMPLEMENTATION.
METHOD set_container_id.
FIELD-SYMBOLS <lv_object> TYPE REF TO if_swf_cnt_container.
ASSIGN ('IO_TASK->CONTAINER') TO <lv_object>.
ASSERT sy-subrc = 0.
CALL METHOD <lv_object>->('SET_GUID')
EXPORTING
guid_32 = iv_id.
ENDMETHOD.
METHOD set_objid.
io_task->objid = iv_objid.
ENDMETHOD.
ENDCLASS.
CLASS lcl_task_definition DEFINITION
CREATE PUBLIC
FINAL.
PUBLIC SECTION.
INTERFACES lif_task_definition.
CLASS-METHODS load IMPORTING iv_objid TYPE hrobject-objid
RETURNING VALUE(ri_result) TYPE REF TO lif_task_definition
RAISING zcx_abapgit_exception.
CLASS-METHODS create IMPORTING iv_objid TYPE hrobject-objid
is_task_data TYPE lif_task_definition=>ty_task_data
RETURNING VALUE(ri_result) TYPE REF TO lif_task_definition
RAISING zcx_abapgit_exception.
PRIVATE SECTION.
CONSTANTS c_subty_task_description TYPE hr_s_subty VALUE '0120'.
DATA mo_taskdef TYPE REF TO cl_workflow_task_ts.
DATA ms_task TYPE lif_task_definition=>ty_task_data.
DATA: mv_objid TYPE hrobjid.
METHODS supply_instance RAISING zcx_abapgit_exception.
METHODS check_subrc_for IMPORTING iv_call TYPE clike OPTIONAL
RAISING zcx_abapgit_exception.
ENDCLASS.
CLASS lcl_task_definition IMPLEMENTATION.
METHOD load.
DATA lo_taskdef TYPE REF TO lcl_task_definition.
CREATE OBJECT lo_taskdef.
lo_taskdef->mv_objid = iv_objid.
lo_taskdef->supply_instance( ).
ri_result = lo_taskdef.
ENDMETHOD.
METHOD check_subrc_for.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( iv_call && ' returned ' && sy-subrc ).
ENDIF.
ENDMETHOD.
METHOD supply_instance.
cl_workflow_factory=>create_ts(
EXPORTING
objid = mv_objid
RECEIVING
ts_inst = mo_taskdef
EXCEPTIONS
standard_task_does_not_exist = 1
object_could_not_be_locked = 2
objid_not_given = 3
OTHERS = 4 ) ##SUBRC_OK.
check_subrc_for( 'CREATE_TS' ).
ms_task-wi_text = mo_taskdef->wi_text.
ms_task-short_text = mo_taskdef->short_text.
ms_task-plvar = mo_taskdef->plvar.
ms_task-method = mo_taskdef->method.
ms_task-method_binding = mo_taskdef->method_binding.
ms_task-starting_events = mo_taskdef->starting_events.
ms_task-starting_events_binding = mo_taskdef->starting_events_binding.
ms_task-terminating_events = mo_taskdef->terminating_events.
ms_task-terminating_events_binding = mo_taskdef->terminating_events_binding.
ms_task-descriptions = mo_taskdef->descriptions.
ENDMETHOD.
METHOD lif_task_definition~clear_origin_data.
FIELD-SYMBOLS: <ls_description> TYPE hrs1002,
<ls_method_binding> TYPE hrs1214,
<ls_starting_events_binding> TYPE hrs1212,
<ls_term_events_binding> TYPE hrs1212.
CLEAR: ms_task-method-aedtm,
ms_task-method-uname.
LOOP AT ms_task-method_binding ASSIGNING <ls_method_binding>.
CLEAR: <ls_method_binding>-aedtm,
<ls_method_binding>-uname.
ENDLOOP.
LOOP AT ms_task-starting_events_binding ASSIGNING <ls_starting_events_binding>.
CLEAR: <ls_starting_events_binding>-aedtm,
<ls_starting_events_binding>-uname.
ENDLOOP.
LOOP AT ms_task-descriptions ASSIGNING <ls_description>.
CLEAR: <ls_description>-aedtm,
<ls_description>-uname.
ENDLOOP.
LOOP AT ms_task-terminating_events_binding ASSIGNING <ls_term_events_binding>.
CLEAR: <ls_term_events_binding>-aedtm,
<ls_term_events_binding>-uname.
ENDLOOP.
ENDMETHOD.
METHOD lif_task_definition~get_definition.
rs_result = me->ms_task.
ENDMETHOD.
METHOD lif_task_definition~get_container.
ri_result = mo_taskdef->container.
ENDMETHOD.
METHOD lif_task_definition~get_user_container.
DATA: li_container TYPE REF TO if_swf_cnt_element_access_1,
lt_user_elements TYPE swfdnamtab,
lt_system_elements TYPE swfdnamtab,
lv_element TYPE swfdname.
li_container = mo_taskdef->container.
lt_user_elements = li_container->all_elements_list( ).
lt_system_elements = li_container->all_elements_list( list_system = abap_true ).
LOOP AT lt_system_elements INTO lv_element.
READ TABLE lt_user_elements WITH KEY table_line = lv_element TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
TRY.
li_container->element_remove( name = lv_element ).
CATCH cx_swf_cnt_container.
"Shouldn't happen, doesn't matter if it does
ENDTRY.
ENDIF.
ENDLOOP.
ri_result ?= li_container.
ENDMETHOD.
METHOD create.
DATA lo_task TYPE REF TO lcl_task_definition.
CREATE OBJECT lo_task TYPE lcl_task_definition.
lo_task->mv_objid = iv_objid.
lo_task->ms_task = is_task_data.
ri_result = lo_task.
ENDMETHOD.
METHOD lif_task_definition~import_container.
DATA lt_exception_list TYPE swf_cx_tab.
DATA lx_exception TYPE REF TO cx_swf_ifs_exception.
mo_taskdef->container->import_from_xml(
EXPORTING xml_stream = iv_xml_string
IMPORTING exception_list = lt_exception_list ).
IF lt_exception_list IS NOT INITIAL.
READ TABLE lt_exception_list INDEX 1 INTO lx_exception.
zcx_abapgit_exception=>raise_with_text( lx_exception ).
ENDIF.
ENDMETHOD.
METHOD lif_task_definition~create_task.
cl_workflow_factory=>create_new_ts(
EXPORTING
short_text = |{ ms_task-short_text }|
text = |{ ms_task-wi_text }|
RECEIVING
task_object = mo_taskdef
EXCEPTIONS
text_exists_already = 1
OTHERS = 2 ). "#EC SUBRC_OK
check_subrc_for( `CREATE_NEW_TS` ).
lcl_attribute_setter=>set_objid( iv_objid = mv_objid
io_task = mo_taskdef ).
lcl_attribute_setter=>set_container_id( iv_id = |TS{ mv_objid }|
io_task = mo_taskdef ).
ENDMETHOD.
METHOD lif_task_definition~change_start_events.
mo_taskdef->change_start_events_complete(
EXPORTING
starting_events = ms_task-starting_events
EXCEPTIONS
no_changes_allowed = 1
OTHERS = 2 ). "#EC SUBRC_OK
check_subrc_for( `CHANGE_START_EVENTS_COMPLETE` ).
mo_taskdef->change_start_evt_bind_complete(
EXPORTING
new_bindings = ms_task-starting_events_binding
EXCEPTIONS
no_changes_allowed = 1
OTHERS = 2 ). "#EC SUBRC_OK
check_subrc_for( `CHANGE_START_EVT_BIND_COMPLETE` ).
ENDMETHOD.
METHOD lif_task_definition~save.
DATA ls_hrsobject TYPE hrsobject.
ls_hrsobject-otype = 'TS'. "swfco_org_standard_task - todo: linter can't resolve this
ls_hrsobject-objid = mv_objid.
INSERT hrsobject FROM ls_hrsobject.
mo_taskdef->save_standard_task(
EXPORTING
development_class = iv_package
iv_force_gen = abap_true
EXCEPTIONS
no_changes_allowed = 1
no_client_indep_maint = 2
update_error = 3
insert_error_new_ts = 4
new_ts_could_not_be_locked = 5
save_abort_by_user = 6
OTHERS = 7 ). "#EC SUBRC_OK
check_subrc_for( `SAVE_STANDARD_TASK` ).
ENDMETHOD.
METHOD lif_task_definition~change_wi_text.
mo_taskdef->change_wi_text(
EXPORTING
new_wi_text = ms_task-wi_text
EXCEPTIONS
no_changes_allowed = 1
OTHERS = 2 ). "#EC SUBRC_OK
check_subrc_for( `CHANGE_WI_TEXT` ).
ENDMETHOD.
METHOD lif_task_definition~change_method.
FIELD-SYMBOLS <ls_method_binding> TYPE hrs1214.
mo_taskdef->change_method(
EXPORTING
new_method = ms_task-method " New Method or Settings
EXCEPTIONS
no_changes_allowed = 1
problem_method_web_enabling = 2
problem_method_phon_enabling = 3
OTHERS = 4 ). "#EC SUBRC_OK
check_subrc_for( `CHANGE_METHOD` ).
LOOP AT ms_task-method_binding ASSIGNING <ls_method_binding>.
mo_taskdef->change_method_binding(
EXPORTING
binding = <ls_method_binding>
delete = abap_false
insert = abap_true
EXCEPTIONS
no_changes_allowed = 1
desired_action_not_clear = 2
ts_cnt_element_does_not_exist = 3
binding_could_not_be_deleted = 4
OTHERS = 5 ). "#EC SUBRC_OK
check_subrc_for( `CHANGE_METHOD_BINDING` ).
ENDLOOP.
ENDMETHOD.
METHOD lif_task_definition~change_terminating_events.
mo_taskdef->change_term_events_complete(
EXPORTING
terminating_events = ms_task-terminating_events
EXCEPTIONS
no_changes_allowed = 1
OTHERS = 2 ). "#EC SUBRC_OK
check_subrc_for( `CHANGE_TERM_EVENTS_COMPLETE` ).
mo_taskdef->change_term_evt_bind_complete(
EXPORTING
new_bindings = ms_task-terminating_events_binding
EXCEPTIONS
no_changes_allowed = 1
OTHERS = 2 ). "#EC SUBRC_OK
check_subrc_for( `CHANGE_TERM_EVT_BIND_COMPLETE` ).
ENDMETHOD.
METHOD lif_task_definition~change_text.
mo_taskdef->change_text(
EXPORTING
subty = c_subty_task_description
new_text = ms_task-descriptions
EXCEPTIONS
no_changes_allowed = 1
OTHERS = 2 ). "#EC SUBRC_OK
check_subrc_for( `CHANGE_TEXT` ).
ENDMETHOD.
ENDCLASS. | 29.635135 | 106 | 0.629001 | {
"alnum_ratio": 0.5792593944,
"alpha_token_ratio": 1.8487790527,
"avg_line_length": 29.7127371274,
"char_rep_ratio": 0.1725239617,
"max_line_length": 106,
"num_words": 588,
"text_len": 10964,
"word_rep_ratio": 0
} | 15,742,161,872,169,136,000 |
e8dabfd6b1bbcc6e34763c123a22407cce312a20 | 10,101 | abap | ABAP | src/objects/zcl_abapgit_object_amsd.clas.abap | D047539/abapGit | cbaf3711b4c41e8376144ad7bd848e6a3d3722bb | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/zcl_abapgit_object_amsd.clas.abap | larshp/abapGit | 143f7d4d3b938bdbb418fef5f94665ba1f150fb6 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/zcl_abapgit_object_amsd.clas.abap | D047539/abapGit | cbaf3711b4c41e8376144ad7bd848e6a3d3722bb | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_object_amsd DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
METHODS:
constructor
IMPORTING
is_item TYPE zif_abapgit_definitions=>ty_item
iv_language TYPE spras
RAISING
zcx_abapgit_exception.
PROTECTED SECTION.
PRIVATE SECTION.
METHODS:
clear_fields
CHANGING
cs_logical_db_schema TYPE any,
clear_field
IMPORTING
iv_fieldname TYPE csequence
CHANGING
cs_logical_db_schema TYPE any,
fill_metadata_from_db
CHANGING
cs_logical_db_schema TYPE any
RAISING
zcx_abapgit_exception,
get_wb_object_operator
RETURNING
VALUE(ri_wb_object_operator) TYPE REF TO object
RAISING
zcx_abapgit_exception.
DATA:
mr_logical_db_schema TYPE REF TO data,
mv_logical_db_schema_key TYPE seu_objkey,
mi_persistence TYPE REF TO if_wb_object_persist,
mi_wb_object_operator TYPE REF TO object.
ENDCLASS.
CLASS zcl_abapgit_object_amsd IMPLEMENTATION.
METHOD clear_field.
FIELD-SYMBOLS: <lv_value> TYPE data.
ASSIGN COMPONENT iv_fieldname OF STRUCTURE cs_logical_db_schema
TO <lv_value>.
ASSERT sy-subrc = 0.
CLEAR: <lv_value>.
ENDMETHOD.
METHOD clear_fields.
clear_field(
EXPORTING
iv_fieldname = 'METADATA-CREATED_AT'
CHANGING
cs_logical_db_schema = cs_logical_db_schema ).
clear_field(
EXPORTING
iv_fieldname = 'METADATA-CREATED_BY'
CHANGING
cs_logical_db_schema = cs_logical_db_schema ).
clear_field(
EXPORTING
iv_fieldname = 'METADATA-CHANGED_AT'
CHANGING
cs_logical_db_schema = cs_logical_db_schema ).
clear_field(
EXPORTING
iv_fieldname = 'METADATA-CHANGED_BY'
CHANGING
cs_logical_db_schema = cs_logical_db_schema ).
ENDMETHOD.
METHOD constructor.
super->constructor(
is_item = is_item
iv_language = iv_language ).
mv_logical_db_schema_key = ms_item-obj_name.
TRY.
CREATE DATA mr_logical_db_schema TYPE ('CL_AMDP_SCHEMA_OBJECT_DATA=>TY_OBJECT_DATA').
CREATE OBJECT mi_persistence TYPE ('CL_AMDP_SCHEMA_OBJECT_PERSIST').
CATCH cx_sy_create_error.
zcx_abapgit_exception=>raise( |AMSD not supported by your NW release| ).
ENDTRY.
ENDMETHOD.
METHOD fill_metadata_from_db.
DATA:
li_wb_object_operator TYPE REF TO object,
lr_logical_db_schema_old TYPE REF TO data.
FIELD-SYMBOLS:
<ls_logical_db_schema_old> TYPE any,
<lv_created_at> TYPE xsddatetime_z,
<lv_created_by> TYPE syuname,
<lv_created_at_old> TYPE xsddatetime_z,
<lv_created_by_old> TYPE syuname.
li_wb_object_operator = get_wb_object_operator( ).
CREATE DATA lr_logical_db_schema_old TYPE ('CL_AMDP_SCHEMA_OBJECT_DATA=>TY_OBJECT_DATA').
ASSIGN lr_logical_db_schema_old->* TO <ls_logical_db_schema_old>.
ASSERT sy-subrc = 0.
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~READ')
IMPORTING
data = <ls_logical_db_schema_old>.
ASSIGN COMPONENT 'METADATA-CREATED_BY' OF STRUCTURE cs_logical_db_schema
TO <lv_created_by>.
ASSERT sy-subrc = 0.
ASSIGN COMPONENT 'METADATA-CREATED_AT' OF STRUCTURE cs_logical_db_schema
TO <lv_created_at>.
ASSERT sy-subrc = 0.
ASSIGN COMPONENT 'METADATA-CREATED_BY' OF STRUCTURE <ls_logical_db_schema_old>
TO <lv_created_by_old>.
ASSERT sy-subrc = 0.
ASSIGN COMPONENT 'METADATA-CREATED_AT' OF STRUCTURE <ls_logical_db_schema_old>
TO <lv_created_at_old>.
ASSERT sy-subrc = 0.
<lv_created_at> = <lv_created_at_old>.
<lv_created_by> = <lv_created_by_old>.
ENDMETHOD.
METHOD get_wb_object_operator.
DATA:
ls_object_type TYPE wbobjtype,
lx_error TYPE REF TO cx_root.
IF mi_wb_object_operator IS BOUND.
ri_wb_object_operator = mi_wb_object_operator.
ENDIF.
ls_object_type-objtype_tr = 'AMSD'.
ls_object_type-subtype_wb = 'TYP'.
TRY.
CALL METHOD ('CL_WB_OBJECT_OPERATOR')=>('CREATE_INSTANCE')
EXPORTING
object_type = ls_object_type
object_key = mv_logical_db_schema_key
RECEIVING
result = mi_wb_object_operator.
CATCH cx_root INTO lx_error.
zcx_abapgit_exception=>raise_with_text( lx_error ).
ENDTRY.
ri_wb_object_operator = mi_wb_object_operator.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
DATA:
li_wb_object_operator TYPE REF TO object,
li_object_data_model TYPE REF TO if_wb_object_data_model,
lx_error TYPE REF TO cx_root.
TRY.
li_wb_object_operator = get_wb_object_operator( ).
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~READ')
IMPORTING
eo_object_data = li_object_data_model.
rv_user = li_object_data_model->get_changed_by( ).
CATCH cx_root INTO lx_error.
zcx_abapgit_exception=>raise_with_text( lx_error ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA:
li_wb_object_operator TYPE REF TO object,
lx_error TYPE REF TO cx_root.
li_wb_object_operator = get_wb_object_operator( ).
TRY.
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~DELETE')
EXPORTING
transport_request = iv_transport.
CATCH cx_root INTO lx_error.
zcx_abapgit_exception=>raise_with_text( lx_error ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA:
li_object_data_model TYPE REF TO if_wb_object_data_model,
li_wb_object_operator TYPE REF TO object,
lx_error TYPE REF TO cx_root.
FIELD-SYMBOLS:
<ls_logical_db_schema> TYPE any.
ASSIGN mr_logical_db_schema->* TO <ls_logical_db_schema>.
ASSERT sy-subrc = 0.
io_xml->read(
EXPORTING
iv_name = 'AMSD'
CHANGING
cg_data = <ls_logical_db_schema> ).
li_wb_object_operator = get_wb_object_operator( ).
TRY.
CREATE OBJECT li_object_data_model TYPE ('CL_AMDP_SCHEMA_OBJECT_DATA').
tadir_insert( iv_package ).
IF zif_abapgit_object~exists( ) = abap_true.
" We need to populate created_at, created_by, because otherwise update is not possible
fill_metadata_from_db( CHANGING cs_logical_db_schema = <ls_logical_db_schema> ).
li_object_data_model->set_data( <ls_logical_db_schema> ).
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE')
EXPORTING
io_object_data = li_object_data_model
transport_request = iv_transport.
ELSE.
li_object_data_model->set_data( <ls_logical_db_schema> ).
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~CREATE')
EXPORTING
io_object_data = li_object_data_model
data_selection = 'P' " if_wb_object_data_selection_co=>c_properties
package = iv_package
transport_request = iv_transport.
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE')
EXPORTING
io_object_data = li_object_data_model
data_selection = 'D' " if_wb_object_data_selection_co=>c_data_content
transport_request = iv_transport.
ENDIF.
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~ACTIVATE').
corr_insert( iv_package ).
CATCH cx_root INTO lx_error.
zcx_abapgit_exception=>raise_with_text( lx_error ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~exists.
TRY.
mi_persistence->get(
p_object_key = mv_logical_db_schema_key
p_version = 'A'
p_existence_check_only = abap_true ).
rv_bool = abap_true.
CATCH cx_swb_exception.
rv_bool = abap_false.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
rs_metadata-delete_tadir = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'ESWB_EO'
iv_argument = |{ ms_item-obj_type }{ ms_item-obj_name }| ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
" Covered by ZCL_ABAPGIT_OBJECTS=>JUMP
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA:
li_object_data_model TYPE REF TO if_wb_object_data_model,
lx_error TYPE REF TO cx_root,
li_wb_object_operator TYPE REF TO object.
FIELD-SYMBOLS:
<ls_logical_db_schema> TYPE any.
ASSIGN mr_logical_db_schema->* TO <ls_logical_db_schema>.
ASSERT sy-subrc = 0.
li_wb_object_operator = get_wb_object_operator( ).
TRY.
CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~READ')
EXPORTING
version = 'A'
IMPORTING
data = <ls_logical_db_schema>
eo_object_data = li_object_data_model.
clear_fields( CHANGING cs_logical_db_schema = <ls_logical_db_schema> ).
CATCH cx_root INTO lx_error.
zcx_abapgit_exception=>raise_with_text( lx_error ).
ENDTRY.
io_xml->add(
iv_name = 'AMSD'
ig_data = <ls_logical_db_schema> ).
ENDMETHOD.
ENDCLASS. | 26.442408 | 106 | 0.668251 | {
"alnum_ratio": 0.6061386139,
"alpha_token_ratio": 1.7856308411,
"avg_line_length": 26.5091863517,
"char_rep_ratio": 0.1728272718,
"max_line_length": 106,
"num_words": 603,
"text_len": 10100,
"word_rep_ratio": 0.0101010101
} | 16,202,076,285,453,590,000 |
3336b2988728a3db4e3ece77ea73c4923b34475d | 5,394 | abap | ABAP | src/objects/zcl_abapgit_object_pinf.clas.locals_imp.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/objects/zcl_abapgit_object_pinf.clas.locals_imp.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/objects/zcl_abapgit_object_pinf.clas.locals_imp.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS lcl_package_interface_facade IMPLEMENTATION.
METHOD constructor.
mi_interface = ii_interface.
ENDMETHOD.
METHOD lif_package_interface_facade~get_elements.
mi_interface->get_elements(
IMPORTING
e_elements = rt_elements
EXCEPTIONS
object_invalid = 1
intern_err = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD lif_package_interface_facade~set_elements_changeable.
mi_interface->set_elements_changeable(
EXPORTING
i_changeable = iv_changeable
EXCEPTIONS
object_already_changeable = 1
object_already_unlocked = 2
object_locked_by_other_user = 3
object_modified = 4
object_just_created = 5
object_deleted = 6
permission_failure = 7
object_invalid = 8
unexpected_error = 9
OTHERS = 10 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD lif_package_interface_facade~save_elements.
mi_interface->save_elements(
EXCEPTIONS
object_not_changeable = 1
object_invalid = 2
cancelled_in_corr = 3
permission_failure = 4
unexpected_error = 5
intern_err = 6
OTHERS = 7 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD lif_package_interface_facade~get_all_attributes.
mi_interface->get_all_attributes(
IMPORTING
e_package_interface_data = rs_package_interface_data
EXCEPTIONS
object_invalid = 1
OTHERS = 2 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD lif_package_interface_facade~set_changeable.
mi_interface->set_changeable(
EXPORTING
i_changeable = iv_changeable
EXCEPTIONS
object_locked_by_other_user = 1
permission_failure = 2
object_already_changeable = 3
object_already_unlocked = 4
object_just_created = 5
object_deleted = 6
object_modified = 7
object_not_existing = 8
object_invalid = 9
unexpected_error = 10
OTHERS = 11 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD lif_package_interface_facade~delete.
mi_interface->delete(
EXCEPTIONS
object_not_empty = 1
object_not_changeable = 2
object_invalid = 3
intern_err = 4
OTHERS = 5 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD lif_package_interface_facade~save.
mi_interface->save(
EXCEPTIONS
short_text_missing = 1
object_not_changeable = 2
object_invalid = 3
cancelled_in_corr = 4
permission_failure = 5
unexpected_error = 6
intern_err = 7
OTHERS = 8 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD lif_package_interface_facade~remove_elements.
mi_interface->remove_elements(
EXPORTING
i_elements = it_elements
EXCEPTIONS
object_deleted = 1
object_invalid = 2
object_not_changeable = 3
element_not_contained = 4
intern_err = 5
OTHERS = 6 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD lif_package_interface_facade~add_elements.
mi_interface->add_elements(
EXPORTING
i_elements_data = it_elements_data
EXCEPTIONS
object_invalid = 1
intern_err = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD lif_package_interface_facade~set_all_attributes.
mi_interface->set_all_attributes(
EXPORTING
i_package_interface_data = is_package_interface_data
i_data_sign = is_data_sign
EXCEPTIONS
object_deleted = 1
object_not_changeable = 2
interface_not_empty = 3
acl_not_empty = 4
author_not_existing = 5
object_type_mismatch = 6
object_invalid = 7
OTHERS = 8 ).
* Downport: exception "logical_package_types_differ"
* does not exist in lower versions
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD lif_package_interface_facade~get_changeable.
mi_interface->get_changeable(
IMPORTING
e_changeable = rv_changeable
EXCEPTIONS
object_invalid = 1
OTHERS = 2 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
ENDCLASS. | 25.088372 | 64 | 0.570819 | {
"alnum_ratio": 0.5301316521,
"alpha_token_ratio": 1.7665594855,
"avg_line_length": 25.2009345794,
"char_rep_ratio": 0.1712481426,
"max_line_length": 64,
"num_words": 208,
"text_len": 5393,
"word_rep_ratio": 0.0502512563
} | 15,523,696,160,133,833,000 |
33467f814bfe117a0dcdbc829e9db2808657cfe7 | 2,709 | abap | ABAP | src/persist/zif_abapgit_persistence.intf.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/persist/zif_abapgit_persistence.intf.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/persist/zif_abapgit_persistence.intf.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | INTERFACE zif_abapgit_persistence PUBLIC.
TYPES:
ty_type TYPE c LENGTH 12 .
TYPES:
ty_value TYPE c LENGTH 12 .
TYPES:
BEGIN OF ty_content,
type TYPE ty_type,
value TYPE ty_value,
data_str TYPE string,
END OF ty_content .
TYPES:
ty_contents TYPE SORTED TABLE OF ty_content WITH UNIQUE KEY type value .
TYPES: BEGIN OF ty_local_checksum,
item TYPE zif_abapgit_definitions=>ty_item,
files TYPE zif_abapgit_definitions=>ty_file_signatures_tt,
END OF ty_local_checksum.
TYPES:
BEGIN OF ty_local_settings,
display_name TYPE string,
ignore_subpackages TYPE abap_bool,
write_protected TYPE abap_bool,
only_local_objects TYPE abap_bool,
code_inspector_check_variant TYPE sci_chkv,
block_commit TYPE abap_bool,
main_language_only TYPE abap_bool,
END OF ty_local_settings.
TYPES: ty_local_checksum_tt TYPE STANDARD TABLE OF ty_local_checksum WITH DEFAULT KEY.
TYPES: BEGIN OF ty_repo_xml,
url TYPE string,
branch_name TYPE string,
selected_commit TYPE zif_abapgit_definitions=>ty_sha1,
package TYPE devclass,
created_by TYPE syuname,
created_at TYPE timestampl,
deserialized_by TYPE syuname,
deserialized_at TYPE timestampl,
offline TYPE abap_bool,
switched_origin TYPE string,
local_checksums TYPE ty_local_checksum_tt,
dot_abapgit TYPE zif_abapgit_dot_abapgit=>ty_dot_abapgit,
head_branch TYPE string, " HEAD symref of the repo, master branch
local_settings TYPE ty_local_settings,
END OF ty_repo_xml.
TYPES:
BEGIN OF ty_repo_meta_mask,
url TYPE abap_bool,
branch_name TYPE abap_bool,
selected_commit TYPE abap_bool,
package TYPE abap_bool,
created_by TYPE abap_bool,
created_at TYPE abap_bool,
deserialized_by TYPE abap_bool,
deserialized_at TYPE abap_bool,
offline TYPE abap_bool,
switched_origin TYPE abap_bool,
local_checksums TYPE abap_bool,
dot_abapgit TYPE abap_bool,
head_branch TYPE abap_bool,
local_settings TYPE abap_bool,
END OF ty_repo_meta_mask.
TYPES: BEGIN OF ty_repo,
key TYPE ty_value.
INCLUDE TYPE ty_repo_xml.
TYPES: END OF ty_repo.
TYPES: ty_repos TYPE STANDARD TABLE OF ty_repo WITH DEFAULT KEY.
TYPES: ty_repo_keys TYPE STANDARD TABLE OF ty_repo-key WITH DEFAULT KEY.
ENDINTERFACE. | 35.181818 | 88 | 0.653747 | {
"alnum_ratio": 0.6100443131,
"alpha_token_ratio": 1.9399293286,
"avg_line_length": 35.6315789474,
"char_rep_ratio": 0.2171174509,
"max_line_length": 88,
"num_words": 232,
"text_len": 2708,
"word_rep_ratio": 0
} | 1,336,673,896,945,168,000 |
d561e5000de3c83499fefa7b1fe18e0b8115d198 | 5,372 | abap | ABAP | src/repo/zcl_abapgit_object_filter_tran.clas.abap | Fmueller17/abapGit | 0db2c9c0859403330726fc64913e133c854f2667 | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/repo/zcl_abapgit_object_filter_tran.clas.abap | Fmueller17/abapGit | 0db2c9c0859403330726fc64913e133c854f2667 | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/repo/zcl_abapgit_object_filter_tran.clas.abap | Fmueller17/abapGit | 0db2c9c0859403330726fc64913e133c854f2667 | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_object_filter_tran DEFINITION
PUBLIC
CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES zif_abapgit_object_filter.
TYPES ty_trrngtrkor_tt TYPE RANGE OF trkorr.
TYPES: BEGIN OF ty_e071_filter,
pgmid TYPE tadir-pgmid,
object TYPE tadir-object,
obj_name TYPE trobj_name,
END OF ty_e071_filter,
ty_e071_filter_tt TYPE STANDARD TABLE OF ty_e071_filter.
METHODS set_filter_values
IMPORTING
iv_package TYPE tadir-devclass
it_r_trkorr TYPE ty_trrngtrkor_tt
RAISING
zcx_abapgit_exception .
METHODS get_filter_values
EXPORTING
ev_package TYPE tadir-devclass
et_r_trkorr TYPE ty_trrngtrkor_tt.
PROTECTED SECTION.
METHODS adjust_local_filter
IMPORTING
it_e071_filter TYPE ty_e071_filter_tt
iv_package TYPE tadir-devclass
RETURNING VALUE(rt_filter) TYPE zif_abapgit_definitions=>ty_tadir_tt
RAISING
zcx_abapgit_exception.
PRIVATE SECTION.
DATA mt_filter TYPE zif_abapgit_definitions=>ty_tadir_tt .
DATA mt_r_trkorr TYPE ty_trrngtrkor_tt .
DATA mv_package TYPE tadir-devclass.
METHODS generate_local_filter
IMPORTING
iv_package TYPE tadir-devclass
it_r_trkorr TYPE ty_trrngtrkor_tt
RETURNING
VALUE(rt_filter) TYPE zif_abapgit_definitions=>ty_tadir_tt
RAISING
zcx_abapgit_exception .
METHODS init .
METHODS get_all_sub_packages
IMPORTING
iv_package TYPE tadir-devclass
RETURNING
VALUE(rt_filter) TYPE zif_abapgit_definitions=>ty_tadir_tt.
ENDCLASS.
CLASS zcl_abapgit_object_filter_tran IMPLEMENTATION.
METHOD generate_local_filter.
DATA lt_e071_filter TYPE ty_e071_filter_tt.
SELECT DISTINCT pgmid
object
obj_name
INTO CORRESPONDING FIELDS OF TABLE lt_e071_filter
FROM e071
WHERE trkorr IN it_r_trkorr.
IF sy-subrc <> 0.
CLEAR lt_e071_filter.
ENDIF.
rt_filter = adjust_local_filter(
iv_package = iv_package
it_e071_filter = lt_e071_filter ).
ENDMETHOD.
METHOD get_filter_values.
et_r_trkorr = mt_r_trkorr.
ev_package = mv_package.
ENDMETHOD.
METHOD zif_abapgit_object_filter~get_filter.
rt_filter = mt_filter.
ENDMETHOD.
METHOD init.
CLEAR mt_filter.
CLEAR mt_r_trkorr.
CLEAR mv_package.
ENDMETHOD.
METHOD set_filter_values.
init( ).
mt_r_trkorr = it_r_trkorr.
mv_package = iv_package.
IF it_r_trkorr IS NOT INITIAL.
mt_filter = generate_local_filter(
iv_package = mv_package
it_r_trkorr = mt_r_trkorr ).
ENDIF.
ENDMETHOD.
METHOD adjust_local_filter.
DATA lt_e071_filter TYPE ty_e071_filter_tt.
DATA lr_e071_filter TYPE REF TO ty_e071_filter.
DATA ls_filter TYPE zif_abapgit_definitions=>ty_tadir.
DATA lv_trobj_name_new TYPE trobj_name.
DATA lv_trobj_type_new TYPE tadir-object.
DATA lt_filter TYPE zif_abapgit_definitions=>ty_tadir_tt.
DATA lr_cts_api TYPE REF TO zif_abapgit_cts_api.
lt_e071_filter = it_e071_filter.
LOOP AT lt_e071_filter REFERENCE INTO lr_e071_filter.
IF lr_e071_filter->pgmid = 'LIMU'.
"Get Main Object from LIMU Object (Example the Class (R3TR) of a Method (LIMU))
lr_cts_api = zcl_abapgit_factory=>get_cts_api( ).
TRY.
lr_cts_api->get_r3tr_obj_for_limu_obj(
EXPORTING
iv_object = lr_e071_filter->object
iv_obj_name = lr_e071_filter->obj_name
IMPORTING
ev_object = lv_trobj_type_new
ev_obj_name = lv_trobj_name_new ).
CATCH zcx_abapgit_exception.
CONTINUE.
ENDTRY.
CLEAR ls_filter.
ls_filter-pgmid = 'R3TR'.
ls_filter-object = lv_trobj_type_new.
ls_filter-obj_name = lv_trobj_name_new.
ELSE.
ls_filter-pgmid = lr_e071_filter->pgmid.
ls_filter-object = lr_e071_filter->object.
ls_filter-obj_name = lr_e071_filter->obj_name.
ENDIF.
INSERT ls_filter INTO TABLE rt_filter.
ENDLOOP.
IF iv_package IS NOT INITIAL.
ls_filter-pgmid = 'R3TR'.
ls_filter-object = 'DEVC'.
ls_filter-obj_name = iv_package.
INSERT ls_filter INTO TABLE rt_filter.
lt_filter = get_all_sub_packages( iv_package ).
INSERT LINES OF lt_filter INTO TABLE rt_filter.
ENDIF.
SORT rt_filter.
DELETE ADJACENT DUPLICATES FROM rt_filter.
IF rt_filter IS INITIAL.
zcx_abapgit_exception=>raise( 'No objects found for transport filter' ).
ENDIF.
ENDMETHOD.
METHOD get_all_sub_packages.
DATA li_package TYPE REF TO zif_abapgit_sap_package.
DATA lt_list TYPE zif_abapgit_sap_package=>ty_devclass_tt.
DATA lr_list TYPE REF TO devclass.
DATA ls_filter TYPE zif_abapgit_definitions=>ty_tadir.
li_package = zcl_abapgit_factory=>get_sap_package( iv_package = iv_package ).
lt_list = li_package->list_subpackages( ).
LOOP AT lt_list REFERENCE INTO lr_list.
ls_filter-pgmid = 'R3TR'.
ls_filter-object = 'DEVC'.
ls_filter-obj_name = lr_list->*.
INSERT ls_filter INTO TABLE rt_filter.
ENDLOOP.
ENDMETHOD.
ENDCLASS. | 27.834197 | 87 | 0.685406 | {
"alnum_ratio": 0.6291193446,
"alpha_token_ratio": 1.697782362,
"avg_line_length": 27.9739583333,
"char_rep_ratio": 0.1288698247,
"max_line_length": 87,
"num_words": 390,
"text_len": 5371,
"word_rep_ratio": 0
} | 9,818,174,828,592,185,000 |
d569f503f73108aba19bd4cad40107f3db06372e | 2,036 | abap | ABAP | src/foundation/y_exemption_general.clas.abap | steve192/code-pal-for-abap | 5f701f5239036cbb724756a86e805fdbae377ab7 | [
"Apache-2.0"
] | 202 | 2020-05-05T13:41:12.000Z | 2022-03-26T15:18:13.000Z | src/foundation/y_exemption_general.clas.abap | steve192/code-pal-for-abap | 5f701f5239036cbb724756a86e805fdbae377ab7 | [
"Apache-2.0"
] | 322 | 2020-05-05T19:14:35.000Z | 2022-03-22T14:48:44.000Z | src/foundation/y_exemption_general.clas.abap | lucasborin/code-pal-for-abap | 4e1247693457e7687648806b18b63cb8968f927a | [
"Apache-2.0"
] | 59 | 2020-05-05T18:59:19.000Z | 2022-03-20T11:24:48.000Z | CLASS y_exemption_general DEFINITION PUBLIC CREATE PUBLIC.
PUBLIC SECTION.
INTERFACES y_if_exemption.
ALIASES is_object_exempted FOR y_if_exemption~is_object_exempted.
PRIVATE SECTION.
CLASS-METHODS is_tadir_generated IMPORTING object_type TYPE trobjtype
object_name TYPE sobj_name
RETURNING VALUE(result) TYPE abap_bool.
CLASS-METHODS is_object_existing IMPORTING object_type TYPE trobjtype
object_name TYPE sobj_name
RETURNING VALUE(result) TYPE abap_bool.
ENDCLASS.
CLASS y_exemption_general IMPLEMENTATION.
METHOD y_if_exemption~is_object_exempted.
DATA(object_exists) = is_object_existing( object_type = object_type
object_name = object_name ).
DATA(tadir_generated) = is_tadir_generated( object_type = object_type
object_name = object_name ).
result = xsdbool( object_exists = abap_true OR tadir_generated = abap_true ).
ENDMETHOD.
METHOD is_object_existing.
CONSTANTS object_exists TYPE char1 VALUE 'X'.
DATA existence_flag TYPE strl_pari-flag.
DATA l_object_type TYPE e071-object.
DATA l_object_name TYPE e071-obj_name.
l_object_type = object_type.
l_object_name = object_name.
CALL FUNCTION 'TR_CHECK_EXIST'
EXPORTING
iv_pgmid = 'R3TR'
iv_object = l_object_type
iv_obj_name = l_object_name
IMPORTING
e_exist = existence_flag
EXCEPTIONS
tr_no_check_function = 1.
IF sy-subrc = 0 AND existence_flag <> object_exists.
result = abap_true.
ENDIF.
ENDMETHOD.
METHOD is_tadir_generated.
SELECT SINGLE genflag
FROM tadir
INTO @result
WHERE pgmid = 'R3TR'
AND object = @object_type
AND obj_name = @object_name.
ENDMETHOD.
ENDCLASS. | 29.507246 | 81 | 0.630157 | {
"alnum_ratio": 0.5886977887,
"alpha_token_ratio": 1.9684908789,
"avg_line_length": 29.9264705882,
"char_rep_ratio": 0.213721619,
"max_line_length": 81,
"num_words": 136,
"text_len": 2035,
"word_rep_ratio": 0.031496063
} | 6,706,070,632,878,378,000 |
d5824fb845e7d0558e5049cd0962fe0e000497e6 | 26,671 | abap | ABAP | src/objects/core/zcl_abapgit_file_status.clas.abap | Fmueller17/abapGit | 0db2c9c0859403330726fc64913e133c854f2667 | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/objects/core/zcl_abapgit_file_status.clas.abap | Fmueller17/abapGit | 0db2c9c0859403330726fc64913e133c854f2667 | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/objects/core/zcl_abapgit_file_status.clas.abap | Fmueller17/abapGit | 0db2c9c0859403330726fc64913e133c854f2667 | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_file_status DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS status
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo
!ii_log TYPE REF TO zif_abapgit_log OPTIONAL
RETURNING
VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt
RAISING
zcx_abapgit_exception .
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-METHODS calculate_status
IMPORTING
!iv_devclass TYPE devclass
!io_dot TYPE REF TO zcl_abapgit_dot_abapgit
!it_local TYPE zif_abapgit_definitions=>ty_files_item_tt
!it_remote TYPE zif_abapgit_definitions=>ty_files_tt
!it_cur_state TYPE zif_abapgit_definitions=>ty_file_signatures_tt
RETURNING
VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt
RAISING
zcx_abapgit_exception .
CLASS-METHODS prepare_remote
IMPORTING
!io_dot TYPE REF TO zcl_abapgit_dot_abapgit
!it_remote TYPE zif_abapgit_definitions=>ty_files_tt
RETURNING
VALUE(rt_remote) TYPE zif_abapgit_definitions=>ty_files_tt
RAISING
zcx_abapgit_exception .
CLASS-METHODS process_local
IMPORTING
!io_dot TYPE REF TO zcl_abapgit_dot_abapgit
!it_local TYPE zif_abapgit_definitions=>ty_files_item_tt
!it_state_idx TYPE zif_abapgit_definitions=>ty_file_signatures_ts
CHANGING
!ct_remote TYPE zif_abapgit_definitions=>ty_files_tt
!ct_items TYPE zif_abapgit_definitions=>ty_items_tt
!ct_results TYPE zif_abapgit_definitions=>ty_results_tt
RAISING
zcx_abapgit_exception .
CLASS-METHODS process_items
IMPORTING
!iv_devclass TYPE devclass
!io_dot TYPE REF TO zcl_abapgit_dot_abapgit
!it_remote TYPE zif_abapgit_definitions=>ty_files_tt
CHANGING
!ct_items TYPE zif_abapgit_definitions=>ty_items_tt
RAISING
zcx_abapgit_exception .
CLASS-METHODS process_remote
IMPORTING
!iv_devclass TYPE devclass
!io_dot TYPE REF TO zcl_abapgit_dot_abapgit
!it_local TYPE zif_abapgit_definitions=>ty_files_item_tt
!it_remote TYPE zif_abapgit_definitions=>ty_files_tt
!it_state_idx TYPE zif_abapgit_definitions=>ty_file_signatures_ts
!it_items_idx TYPE zif_abapgit_definitions=>ty_items_ts
CHANGING
!ct_results TYPE zif_abapgit_definitions=>ty_results_tt
RAISING
zcx_abapgit_exception .
CLASS-METHODS run_checks
IMPORTING
!ii_log TYPE REF TO zif_abapgit_log
!it_results TYPE zif_abapgit_definitions=>ty_results_tt
!io_dot TYPE REF TO zcl_abapgit_dot_abapgit
!iv_top TYPE devclass
RAISING
zcx_abapgit_exception .
CLASS-METHODS build_existing
IMPORTING
!is_local TYPE zif_abapgit_definitions=>ty_file_item
!is_remote TYPE zif_abapgit_definitions=>ty_file
!it_state TYPE zif_abapgit_definitions=>ty_file_signatures_ts
RETURNING
VALUE(rs_result) TYPE zif_abapgit_definitions=>ty_result .
CLASS-METHODS build_new_local
IMPORTING
!is_local TYPE zif_abapgit_definitions=>ty_file_item
RETURNING
VALUE(rs_result) TYPE zif_abapgit_definitions=>ty_result .
CLASS-METHODS build_new_remote
IMPORTING
!iv_devclass TYPE devclass
!io_dot TYPE REF TO zcl_abapgit_dot_abapgit
!is_remote TYPE zif_abapgit_definitions=>ty_file
!it_items TYPE zif_abapgit_definitions=>ty_items_ts
!it_state TYPE zif_abapgit_definitions=>ty_file_signatures_ts
RETURNING
VALUE(rs_result) TYPE zif_abapgit_definitions=>ty_result
RAISING
zcx_abapgit_exception .
CLASS-METHODS get_object_package
IMPORTING
!iv_object TYPE tadir-object
!iv_obj_name TYPE tadir-obj_name
RETURNING
VALUE(rv_devclass) TYPE devclass
RAISING
zcx_abapgit_exception .
CLASS-METHODS check_package_move
IMPORTING
!ii_log TYPE REF TO zif_abapgit_log
!it_results TYPE zif_abapgit_definitions=>ty_results_tt
RAISING
zcx_abapgit_exception .
CLASS-METHODS check_files_folder
IMPORTING
!ii_log TYPE REF TO zif_abapgit_log
!it_results TYPE zif_abapgit_definitions=>ty_results_tt
RAISING
zcx_abapgit_exception .
CLASS-METHODS check_package_folder
IMPORTING
!ii_log TYPE REF TO zif_abapgit_log
!it_results TYPE zif_abapgit_definitions=>ty_results_tt
!io_dot TYPE REF TO zcl_abapgit_dot_abapgit
!iv_top TYPE devclass
RAISING
zcx_abapgit_exception .
CLASS-METHODS check_multiple_files
IMPORTING
!ii_log TYPE REF TO zif_abapgit_log
!it_results TYPE zif_abapgit_definitions=>ty_results_tt
RAISING
zcx_abapgit_exception .
CLASS-METHODS check_namespace
IMPORTING
!ii_log TYPE REF TO zif_abapgit_log
!it_results TYPE zif_abapgit_definitions=>ty_results_tt
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS ZCL_ABAPGIT_FILE_STATUS IMPLEMENTATION.
METHOD build_existing.
DATA: ls_file_sig LIKE LINE OF it_state.
" Item
rs_result-obj_type = is_local-item-obj_type.
rs_result-obj_name = is_local-item-obj_name.
rs_result-package = is_local-item-devclass.
" File
rs_result-path = is_local-file-path.
rs_result-filename = is_local-file-filename.
IF is_local-file-sha1 = is_remote-sha1.
rs_result-match = abap_true.
RETURN.
ENDIF.
" Match against current state
READ TABLE it_state INTO ls_file_sig
WITH KEY path = is_local-file-path
filename = is_local-file-filename
BINARY SEARCH.
IF sy-subrc = 0.
IF ls_file_sig-sha1 <> is_local-file-sha1.
rs_result-lstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
IF ls_file_sig-sha1 <> is_remote-sha1.
rs_result-rstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
rs_result-match = boolc( rs_result-lstate IS INITIAL
AND rs_result-rstate IS INITIAL ).
ELSE.
" This is a strange situation. As both local and remote exist
" the state should also be present. Maybe this is a first run of the code.
" In this case just compare hashes directly and mark both changed
" the user will presumably decide what to do after checking the actual diff
rs_result-match = boolc( is_local-file-sha1 = is_remote-sha1 ).
IF rs_result-match = abap_false.
rs_result-lstate = zif_abapgit_definitions=>c_state-modified.
rs_result-rstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD build_new_local.
" Item
rs_result-obj_type = is_local-item-obj_type.
rs_result-obj_name = is_local-item-obj_name.
rs_result-package = is_local-item-devclass.
" File
rs_result-path = is_local-file-path.
rs_result-filename = is_local-file-filename.
" Match
rs_result-match = abap_false.
rs_result-lstate = zif_abapgit_definitions=>c_state-added.
ENDMETHOD.
METHOD build_new_remote.
DATA: ls_item LIKE LINE OF it_items,
ls_file_sig LIKE LINE OF it_state.
" Common and default part
rs_result-path = is_remote-path.
rs_result-filename = is_remote-filename.
rs_result-match = abap_false.
rs_result-rstate = zif_abapgit_definitions=>c_state-added.
zcl_abapgit_filename_logic=>file_to_object(
EXPORTING
iv_filename = is_remote-filename
iv_path = is_remote-path
iv_devclass = iv_devclass
io_dot = io_dot
IMPORTING
es_item = ls_item ).
" Check if in item index + get package
READ TABLE it_items INTO ls_item
WITH KEY obj_type = ls_item-obj_type obj_name = ls_item-obj_name
BINARY SEARCH.
IF sy-subrc = 0.
" Completely new (xml, abap) and new file in an existing object
rs_result-obj_type = ls_item-obj_type.
rs_result-obj_name = ls_item-obj_name.
rs_result-package = ls_item-devclass.
READ TABLE it_state INTO ls_file_sig
WITH KEY path = is_remote-path filename = is_remote-filename
BINARY SEARCH.
" Existing file but from another package
" was not added during local file proc as was not in tadir for repo package
IF sy-subrc = 0.
IF ls_file_sig-sha1 = is_remote-sha1.
rs_result-match = abap_true.
CLEAR rs_result-rstate.
ELSE.
rs_result-rstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
" Item is in state and in cache but with no package - it was deleted
" OR devclass is the same as repo package (see #532)
IF ls_item-devclass IS INITIAL OR ls_item-devclass = iv_devclass.
rs_result-match = abap_false.
rs_result-lstate = zif_abapgit_definitions=>c_state-deleted.
ENDIF.
ENDIF.
ELSE. " Completely unknown file, probably non-abapgit
ASSERT 1 = 1. " No action, just follow defaults
ENDIF.
ENDMETHOD.
METHOD calculate_status.
DATA:
lt_remote LIKE it_remote,
lt_items TYPE zif_abapgit_definitions=>ty_items_tt,
lt_items_idx TYPE zif_abapgit_definitions=>ty_items_ts, " Sorted by obj_type+obj_name
lt_state_idx TYPE zif_abapgit_definitions=>ty_file_signatures_ts. " Sorted by path+filename
lt_state_idx = it_cur_state. " Force sort it
" Prepare remote files
lt_remote = prepare_remote(
io_dot = io_dot
it_remote = it_remote ).
" Process local files and new local files
process_local(
EXPORTING
io_dot = io_dot
it_local = it_local
it_state_idx = lt_state_idx
CHANGING
ct_remote = lt_remote
ct_items = lt_items
ct_results = rt_results ).
" Complete item index for unmarked remote files
process_items(
EXPORTING
iv_devclass = iv_devclass
io_dot = io_dot
it_remote = lt_remote
CHANGING
ct_items = lt_items ).
lt_items_idx = lt_items. " Self protection + UNIQUE records assertion
" Process new remote files (marked above with empty SHA1)
process_remote(
EXPORTING
iv_devclass = iv_devclass
io_dot = io_dot
it_local = it_local
it_remote = lt_remote
it_state_idx = lt_state_idx
it_items_idx = lt_items_idx
CHANGING
ct_results = rt_results ).
SORT rt_results BY
obj_type ASCENDING
obj_name ASCENDING
filename ASCENDING
path ASCENDING.
ENDMETHOD.
METHOD check_files_folder.
DATA:
ls_item TYPE zif_abapgit_definitions=>ty_item,
lt_res_sort LIKE it_results,
lt_item_idx LIKE it_results.
FIELD-SYMBOLS:
<ls_result> LIKE LINE OF it_results,
<ls_result_idx> LIKE LINE OF it_results.
" Collect object index
lt_res_sort = it_results.
SORT lt_res_sort BY obj_type ASCENDING obj_name ASCENDING.
LOOP AT it_results ASSIGNING <ls_result> WHERE NOT obj_type IS INITIAL AND packmove = abap_false.
IF NOT ( <ls_result>-obj_type = ls_item-obj_type
AND <ls_result>-obj_name = ls_item-obj_name ).
APPEND INITIAL LINE TO lt_item_idx ASSIGNING <ls_result_idx>.
<ls_result_idx>-obj_type = <ls_result>-obj_type.
<ls_result_idx>-obj_name = <ls_result>-obj_name.
<ls_result_idx>-path = <ls_result>-path.
MOVE-CORRESPONDING <ls_result> TO ls_item.
ENDIF.
ENDLOOP.
LOOP AT it_results ASSIGNING <ls_result>
WHERE NOT obj_type IS INITIAL AND obj_type <> 'DEVC' AND packmove = abap_false.
READ TABLE lt_item_idx ASSIGNING <ls_result_idx>
WITH KEY obj_type = <ls_result>-obj_type obj_name = <ls_result>-obj_name
BINARY SEARCH. " Sorted above
IF sy-subrc <> 0 OR <ls_result>-path <> <ls_result_idx>-path. " All paths are same
ii_log->add( iv_msg = |Files for object { <ls_result>-obj_type } {
<ls_result>-obj_name } are not placed in the same folder|
iv_type = 'W' ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD check_multiple_files.
DATA:
lt_res_sort LIKE it_results,
ls_file TYPE zif_abapgit_definitions=>ty_file_signature.
FIELD-SYMBOLS <ls_result> LIKE LINE OF it_results.
lt_res_sort = it_results.
SORT lt_res_sort BY filename ASCENDING.
LOOP AT lt_res_sort ASSIGNING <ls_result> WHERE obj_type <> 'DEVC' AND packmove = abap_false.
IF <ls_result>-filename IS NOT INITIAL AND <ls_result>-filename = ls_file-filename.
ii_log->add( iv_msg = |Multiple files with same filename, { <ls_result>-filename }|
iv_type = 'W' ).
ENDIF.
IF <ls_result>-filename IS INITIAL.
ii_log->add( iv_msg = |Filename is empty for object { <ls_result>-obj_type } { <ls_result>-obj_name }|
iv_type = 'W' ).
ENDIF.
MOVE-CORRESPONDING <ls_result> TO ls_file.
ENDLOOP.
ENDMETHOD.
METHOD check_namespace.
DATA:
lv_namespace TYPE namespace,
lt_namespace TYPE TABLE OF namespace,
ls_trnspace TYPE trnspace.
FIELD-SYMBOLS <ls_result> LIKE LINE OF it_results.
" Collect all namespaces based on name of xml-files
LOOP AT it_results ASSIGNING <ls_result>.
FIND REGEX '^#([a-zA-Z0-9]+)#.*\..*\.xml$' IN <ls_result>-filename SUBMATCHES lv_namespace.
IF sy-subrc = 0.
lv_namespace = '/' && to_upper( lv_namespace ) && '/'.
COLLECT lv_namespace INTO lt_namespace.
ENDIF.
ENDLOOP.
LOOP AT lt_namespace INTO lv_namespace.
CALL FUNCTION 'TR_READ_NAMESPACE'
EXPORTING
iv_namespace = lv_namespace
IMPORTING
es_trnspace = ls_trnspace
EXCEPTIONS
namespace_not_existing = 1
OTHERS = 2.
IF sy-subrc <> 0.
ii_log->add( iv_msg = |Namespace { lv_namespace } does not exist. Create it in transaction SE03|
iv_type = 'W' ).
ELSEIF ls_trnspace-editflag <> 'X'.
ii_log->add( iv_msg = |Namespace { lv_namespace } is not modifiable. Check it in transaction SE03|
iv_type = 'W' ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD check_package_folder.
DATA:
lv_path TYPE string,
lo_folder_logic TYPE REF TO zcl_abapgit_folder_logic.
FIELD-SYMBOLS <ls_result> LIKE LINE OF it_results.
lo_folder_logic = zcl_abapgit_folder_logic=>get_instance( ).
LOOP AT it_results ASSIGNING <ls_result>
WHERE NOT package IS INITIAL AND NOT path IS INITIAL AND packmove = abap_false.
lv_path = lo_folder_logic->package_to_path(
iv_top = iv_top
io_dot = io_dot
iv_package = <ls_result>-package ).
IF lv_path <> <ls_result>-path.
ii_log->add( iv_msg = |Package and path does not match for object, {
<ls_result>-obj_type } { <ls_result>-obj_name }|
iv_type = 'W' ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD check_package_move.
DATA:
lt_move_idx LIKE it_results.
FIELD-SYMBOLS:
<ls_result> LIKE LINE OF it_results,
<ls_result_move> LIKE LINE OF it_results.
LOOP AT it_results ASSIGNING <ls_result>
WHERE lstate = zif_abapgit_definitions=>c_state-added AND packmove = abap_true.
READ TABLE lt_move_idx TRANSPORTING NO FIELDS
WITH KEY obj_type = <ls_result>-obj_type obj_name = <ls_result>-obj_name
BINARY SEARCH. " Sorted since it_result is sorted
IF sy-subrc <> 0.
ii_log->add( iv_msg = |Changed package assignment for object {
<ls_result>-obj_type } { <ls_result>-obj_name }|
iv_type = 'W' ).
APPEND INITIAL LINE TO lt_move_idx ASSIGNING <ls_result_move>.
<ls_result_move>-obj_type = <ls_result>-obj_type.
<ls_result_move>-obj_name = <ls_result>-obj_name.
<ls_result_move>-path = <ls_result>-path.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD get_object_package.
DATA: lv_name TYPE devclass,
li_package TYPE REF TO zif_abapgit_sap_package.
rv_devclass = zcl_abapgit_factory=>get_tadir( )->get_object_package(
iv_object = iv_object
iv_obj_name = iv_obj_name ).
IF rv_devclass IS INITIAL AND iv_object = 'DEVC' AND iv_obj_name(1) = '$'.
" local packages usually have no tadir entry
lv_name = iv_obj_name.
li_package = zcl_abapgit_factory=>get_sap_package( lv_name ).
IF li_package->exists( ) = abap_true.
rv_devclass = lv_name.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD prepare_remote.
DATA lv_index TYPE sy-index.
FIELD-SYMBOLS <ls_remote> LIKE LINE OF it_remote.
rt_remote = it_remote.
SORT rt_remote BY path filename.
" Skip ignored files
LOOP AT rt_remote ASSIGNING <ls_remote>.
lv_index = sy-tabix.
IF io_dot->is_ignored( iv_path = <ls_remote>-path
iv_filename = <ls_remote>-filename ) = abap_true.
DELETE rt_remote INDEX lv_index.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD process_items.
DATA:
ls_item LIKE LINE OF ct_items,
lv_is_xml TYPE abap_bool,
lv_sub_fetched TYPE abap_bool,
lt_sub_packages TYPE zif_abapgit_sap_package=>ty_devclass_tt,
lv_msg TYPE string.
FIELD-SYMBOLS <ls_remote> LIKE LINE OF it_remote.
LOOP AT it_remote ASSIGNING <ls_remote> WHERE sha1 IS NOT INITIAL.
zcl_abapgit_filename_logic=>file_to_object(
EXPORTING
iv_filename = <ls_remote>-filename
iv_path = <ls_remote>-path
io_dot = io_dot
iv_devclass = iv_devclass
IMPORTING
es_item = ls_item
ev_is_xml = lv_is_xml ).
CHECK lv_is_xml = abap_true. " only object definitions
ls_item-devclass = get_object_package(
iv_object = ls_item-obj_type
iv_obj_name = ls_item-obj_name ).
IF NOT ls_item-devclass IS INITIAL AND iv_devclass <> ls_item-devclass.
IF lv_sub_fetched = abap_false.
lt_sub_packages = zcl_abapgit_factory=>get_sap_package( iv_devclass )->list_subpackages( ).
lv_sub_fetched = abap_true.
SORT lt_sub_packages BY table_line. "Optimize Read Access
ENDIF.
" Make sure the package is under the repo main package
READ TABLE lt_sub_packages TRANSPORTING NO FIELDS
WITH KEY table_line = ls_item-devclass
BINARY SEARCH.
IF sy-subrc <> 0.
IF ls_item-obj_type = 'DEVC'.
" If package already exist but is not included in the package hierarchy of
" the package assigned to the repository, then a manual change of the package
" is required i.e. setting a parent package to iv_devclass (or one of its
" subpackages). We don't this automatically since it's not clear where in the
" hierarchy the new package should be located. (#4108)
lv_msg = |Package { ls_item-devclass } already exists but is not a subpackage of { iv_devclass
}. Check your package and folder logic or assign { ls_item-devclass
} to package hierarchy of { iv_devclass } to match the repository.|.
zcx_abapgit_exception=>raise( lv_msg ).
ELSE.
CLEAR ls_item-devclass.
ENDIF.
ENDIF.
ENDIF.
APPEND ls_item TO ct_items.
ENDLOOP.
SORT ct_items DESCENDING. " Default key - type, name, pkg, inactive
DELETE ADJACENT DUPLICATES FROM ct_items COMPARING obj_type obj_name devclass.
ENDMETHOD.
METHOD process_local.
DATA lv_msg TYPE string.
FIELD-SYMBOLS:
<ls_remote> LIKE LINE OF ct_remote,
<ls_result> LIKE LINE OF ct_results,
<ls_state> LIKE LINE OF it_state_idx,
<ls_local> LIKE LINE OF it_local.
LOOP AT it_local ASSIGNING <ls_local>.
" Skip ignored files
IF io_dot->is_ignored( iv_path = <ls_local>-file-path
iv_filename = <ls_local>-file-filename ) = abap_true.
CONTINUE.
ENDIF.
APPEND INITIAL LINE TO ct_results ASSIGNING <ls_result>.
IF <ls_local>-item IS NOT INITIAL.
APPEND <ls_local>-item TO ct_items. " Collect for item index
ENDIF.
READ TABLE ct_remote ASSIGNING <ls_remote>
WITH KEY path = <ls_local>-file-path filename = <ls_local>-file-filename
BINARY SEARCH.
IF sy-subrc = 0. " Exist local and remote
<ls_result> = build_existing(
is_local = <ls_local>
is_remote = <ls_remote>
it_state = it_state_idx ).
IF <ls_remote>-sha1 IS INITIAL.
IF <ls_local>-file-filename = zcl_abapgit_filename_logic=>c_package_file.
lv_msg = |Package name conflict { <ls_local>-item-obj_type } { <ls_local>-item-obj_name }. | &&
|Rename package or use FULL folder logic|.
ELSE.
lv_msg = |Checksum conflict { <ls_local>-item-obj_type } { <ls_local>-item-obj_name }. | &&
|Please create an issue on Github|.
ENDIF.
zcx_abapgit_exception=>raise( lv_msg ).
ENDIF.
CLEAR <ls_remote>-sha1. " Mark as processed
ELSE. " Only L exists
<ls_result> = build_new_local( <ls_local> ).
" Check if same file exists in different location
READ TABLE ct_remote ASSIGNING <ls_remote>
WITH KEY file
COMPONENTS filename = <ls_local>-file-filename.
IF sy-subrc = 0 AND <ls_local>-file-sha1 = <ls_remote>-sha1.
<ls_result>-packmove = abap_true.
ELSEIF sy-subrc = 4.
" Check if file existed before and was deleted remotely
READ TABLE it_state_idx ASSIGNING <ls_state>
WITH KEY path = <ls_local>-file-path filename = <ls_local>-file-filename
BINARY SEARCH.
IF sy-subrc = 0.
IF <ls_local>-file-sha1 = <ls_state>-sha1.
<ls_result>-lstate = zif_abapgit_definitions=>c_state-unchanged.
ELSE.
<ls_result>-lstate = zif_abapgit_definitions=>c_state-modified.
ENDIF.
<ls_result>-rstate = zif_abapgit_definitions=>c_state-deleted.
ENDIF.
ENDIF.
ENDIF.
<ls_result>-inactive = <ls_local>-item-inactive.
ENDLOOP.
ENDMETHOD.
METHOD process_remote.
FIELD-SYMBOLS:
<ls_remote> LIKE LINE OF it_remote,
<ls_result> LIKE LINE OF ct_results,
<ls_local> LIKE LINE OF it_local.
LOOP AT it_remote ASSIGNING <ls_remote> WHERE sha1 IS NOT INITIAL.
APPEND INITIAL LINE TO ct_results ASSIGNING <ls_result>.
<ls_result> = build_new_remote(
iv_devclass = iv_devclass
io_dot = io_dot
is_remote = <ls_remote>
it_items = it_items_idx
it_state = it_state_idx ).
" Check if same file exists in different location
READ TABLE it_local ASSIGNING <ls_local>
WITH KEY file-filename = <ls_remote>-filename.
IF sy-subrc = 0.
<ls_result>-match = abap_false.
<ls_result>-lstate = zif_abapgit_definitions=>c_state-deleted.
<ls_result>-rstate = zif_abapgit_definitions=>c_state-unchanged.
IF <ls_local>-file-sha1 = <ls_remote>-sha1.
<ls_result>-packmove = abap_true.
ENDIF.
ELSEIF sy-subrc = 4.
" Check if file existed before and was deleted locally
READ TABLE it_state_idx TRANSPORTING NO FIELDS
WITH KEY path = <ls_remote>-path filename = <ls_remote>-filename
BINARY SEARCH.
IF sy-subrc = 0.
<ls_result>-match = abap_false.
<ls_result>-lstate = zif_abapgit_definitions=>c_state-deleted.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD run_checks.
" This method just adds messages to the log. No log, nothing to do here
IF ii_log IS INITIAL.
RETURN.
ENDIF.
" Find all objects which were assigned to a different package
check_package_move(
ii_log = ii_log
it_results = it_results ).
" Check files for one object is in the same folder
check_files_folder(
ii_log = ii_log
it_results = it_results ).
" Check that objects are created in package corresponding to folder
check_package_folder(
ii_log = ii_log
it_results = it_results
io_dot = io_dot
iv_top = iv_top ).
" Check for multiple files with same filename
check_multiple_files(
ii_log = ii_log
it_results = it_results ).
" Check if namespaces exist already
check_namespace(
ii_log = ii_log
it_results = it_results ).
ENDMETHOD.
METHOD status.
DATA lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt.
DATA lt_remote TYPE zif_abapgit_definitions=>ty_files_tt.
DATA li_exit TYPE REF TO zif_abapgit_exit.
lt_local = io_repo->get_files_local( ii_log = ii_log ).
IF lines( lt_local ) <= 2.
" Less equal two means that we have only the .abapgit.xml and the package in
" our local repository. In this case we have to update our local .abapgit.xml
" from the remote one. Otherwise we get errors when e.g. the folder starting
" folder is different.
io_repo->find_remote_dot_abapgit( ).
ENDIF.
lt_remote = io_repo->get_files_remote( ).
li_exit = zcl_abapgit_exit=>get_instance( ).
li_exit->pre_calculate_repo_status(
EXPORTING
is_repo_meta = io_repo->ms_data
CHANGING
ct_local = lt_local
ct_remote = lt_remote ).
rt_results = calculate_status(
iv_devclass = io_repo->get_package( )
io_dot = io_repo->get_dot_abapgit( )
it_local = lt_local
it_remote = lt_remote
it_cur_state = io_repo->get_local_checksums_per_file( ) ).
run_checks(
ii_log = ii_log
it_results = rt_results
io_dot = io_repo->get_dot_abapgit( )
iv_top = io_repo->get_package( ) ).
ENDMETHOD.
ENDCLASS. | 33.33875 | 111 | 0.653444 | {
"alnum_ratio": 0.6089613798,
"alpha_token_ratio": 1.8479278456,
"avg_line_length": 33.37922403,
"char_rep_ratio": 0.1478189115,
"max_line_length": 111,
"num_words": 2060,
"text_len": 26670,
"word_rep_ratio": 0.0307167235
} | 10,709,132,859,715,150,000 |
d596acd5169159031e2fecdb0acc0887c64a59fb | 3,173 | abap | ABAP | src/checks/y_check_is_interface_in_class.clas.testclasses.abap | steve192/code-pal-for-abap | 5f701f5239036cbb724756a86e805fdbae377ab7 | [
"Apache-2.0"
] | 202 | 2020-05-05T13:41:12.000Z | 2022-03-26T15:18:13.000Z | src/checks/y_check_is_interface_in_class.clas.testclasses.abap | steve192/code-pal-for-abap | 5f701f5239036cbb724756a86e805fdbae377ab7 | [
"Apache-2.0"
] | 322 | 2020-05-05T19:14:35.000Z | 2022-03-22T14:48:44.000Z | src/checks/y_check_is_interface_in_class.clas.testclasses.abap | lucasborin/code-pal-for-abap | 4e1247693457e7687648806b18b63cb8968f927a | [
"Apache-2.0"
] | 59 | 2020-05-05T18:59:19.000Z | 2022-03-20T11:24:48.000Z | CLASS ltc_class DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
PROTECTED SECTION.
METHODS get_cut REDEFINITION.
METHODS get_code_with_issue REDEFINITION.
METHODS get_code_without_issue REDEFINITION.
METHODS get_code_with_exemption REDEFINITION.
ENDCLASS.
CLASS ltc_class IMPLEMENTATION.
METHOD get_cut.
result ?= NEW y_check_is_interface_in_class( ).
ENDMETHOD.
METHOD get_code_with_issue.
result = VALUE #(
( 'REPORT ut_repo.' )
( 'CLASS lcl_classname DEFINITION.' )
( ' PUBLIC SECTION.' )
( ' METHODS publ_method.' )
( ' PROTECTED SECTION.' )
( ' PRIVATE SECTION.' )
( 'ENDCLASS.' )
( 'CLASS lcl_classname IMPLEMENTATION.' )
( ' METHOD publ_method.' )
( ' ENDMETHOD.' )
( 'ENDCLASS.' )
).
ENDMETHOD.
METHOD get_code_without_issue.
result = VALUE #(
( 'REPORT ut_repo.' )
( 'CLASS lcl_abstr DEFINITION ABSTRACT.' )
( ' PUBLIC SECTION.' )
( ' METHODS abstr_method ABSTRACT.' )
( ' METHODS constructor.' )
( 'ENDCLASS.' )
( 'CLASS lcl_abstr IMPLEMENTATION.' )
( ' METHOD constructor.' )
( ' ENDMETHOD.' )
( 'ENDCLASS.' )
( 'CLASS lcl_inh_abstr DEFINITION INHERITING FROM lcl_abstr.' )
( ' PUBLIC SECTION.' )
( ' METHODS abstr_method REDEFINITION.' )
( ' METHODS constructor.' )
( ' PROTECTED SECTION.' )
( ' METHODS prot_method.' )
( ' PRIVATE SECTION.' )
( ' METHODS priv_method.' )
( 'ENDCLASS.' )
( 'CLASS lcl_inh_abstr IMPLEMENTATION.' )
( ' METHOD constructor.' )
( ' super->constructor( ).' )
( ' ENDMETHOD.' )
( ' METHOD abstr_method.' )
( ' ENDMETHOD.' )
( ' METHOD prot_method.' )
( ' ENDMETHOD.' )
( ' METHOD priv_method.' )
( ' ENDMETHOD.' )
( 'ENDCLASS.' )
).
ENDMETHOD.
METHOD get_code_with_exemption.
result = VALUE #(
( 'REPORT ut_repo.' )
( 'CLASS lcl_classname DEFINITION. ' )
( ' PUBLIC SECTION. "#EC INTF_IN_CLASS' )
( ' METHODS publ_method.' )
( ' PROTECTED SECTION.' )
( ' PRIVATE SECTION.' )
( 'ENDCLASS.' )
( 'CLASS lcl_classname IMPLEMENTATION.' )
( ' METHOD publ_method.' )
( ' ENDMETHOD.' )
( 'ENDCLASS.' )
).
ENDMETHOD.
ENDCLASS.
CLASS ltc_test_class DEFINITION INHERITING FROM ltc_class FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
PROTECTED SECTION.
METHODS get_code_without_issue REDEFINITION.
ENDCLASS.
CLASS ltc_test_class IMPLEMENTATION.
METHOD get_code_without_issue.
result = VALUE #(
( ' REPORT ut_repo.' )
( ' CLASS lcl_classname DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.' )
( ' PUBLIC SECTION.' )
( ' METHODS publ_method.' )
( ' METHODS test_method FOR TESTING.' )
( ' ENDCLASS.' )
( ' CLASS lcl_classname IMPLEMENTATION.' )
( ' METHOD publ_method.' )
( ' ENDMETHOD.' )
( ' METHOD test_method.' )
( ' ENDMETHOD.' )
( ' ENDCLASS.' )
).
ENDMETHOD.
ENDCLASS. | 26.008197 | 107 | 0.591554 | {
"alnum_ratio": 0.5680958386,
"alpha_token_ratio": 1.6441605839,
"avg_line_length": 26.2148760331,
"char_rep_ratio": 0.1947518179,
"max_line_length": 107,
"num_words": 216,
"text_len": 3172,
"word_rep_ratio": 0.0676328502
} | 1,473,696,798,519,945,700 |
d5adeb2d52ed68aab3cd2338c133e6d50b2033bf | 2,919 | abap | ABAP | src/checks/zcl_aoc_check_14.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_14.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_14.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | *----------------------------------------------------------------------*
* CLASS lcl_Test DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS
FINAL.
PRIVATE SECTION.
* ================
DATA: mt_code TYPE string_table,
ms_result TYPE scirest_ad,
mo_check TYPE REF TO zcl_aoc_check_14.
METHODS:
setup,
export_import FOR TESTING,
test001_01 FOR TESTING,
test001_02 FOR TESTING,
test001_03 FOR TESTING,
test001_04 FOR TESTING,
test001_05 FOR TESTING,
test001_06 FOR TESTING.
ENDCLASS. "lcl_Test
*----------------------------------------------------------------------*
* CLASS lcl_Test IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test IMPLEMENTATION.
* ==============================
DEFINE _code.
APPEND &1 TO mt_code.
END-OF-DEFINITION.
METHOD setup.
CREATE OBJECT mo_check.
zcl_aoc_unit_test=>set_check( mo_check ).
ENDMETHOD. "setup
METHOD export_import.
zcl_aoc_unit_test=>export_import( mo_check ).
ENDMETHOD.
METHOD test001_01.
* ===========
_code '*IF lv_foo = lv_bar. '.
_code '* WRITE ''foo''. '.
_code '*ENDIF. '.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD. "test1
METHOD test001_02.
* ===========
_code '* IF that is the case, then do this because of something'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD. "test2
METHOD test001_03.
* ===========
_code '* MESSAGE s111(zzz) WITH <ls_foo>-progname.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD.
METHOD test001_04.
* ===========
_code '* Aaaaa aaaaaaaaaaa aa all aaaas in aaa aaa aaaaaaa of other aaaa''s result'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test001_05.
* ===========
_code '** double star'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test001_06.
* ===========
_code '* ...'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
ENDCLASS. "lcl_Test | 23.92623 | 88 | 0.511477 | {
"alnum_ratio": 0.4732693626,
"alpha_token_ratio": 1.5074971165,
"avg_line_length": 24.1157024793,
"char_rep_ratio": 0.2674458577,
"max_line_length": 88,
"num_words": 179,
"text_len": 2918,
"word_rep_ratio": 0.0647058824
} | 10,116,339,599,987,343,000 |
d5bb471a702cd22b8739b31dd836a098bde0ecf2 | 2,038 | abap | ABAP | src/zcl_excel_worksheets.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 251 | 2019-02-23T03:36:38.000Z | 2021-12-10T21:39:23.000Z | src/zcl_excel_worksheets.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 278 | 2019-02-17T10:42:59.000Z | 2021-12-10T20:24:56.000Z | src/zcl_excel_worksheets.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 130 | 2019-02-20T13:25:30.000Z | 2021-12-09T03:20:31.000Z | CLASS zcl_excel_worksheets DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
*"* public components of class ZCL_EXCEL_WORKSHEETS
*"* do not include other source files here!!!
PUBLIC SECTION.
DATA active_worksheet TYPE zexcel_active_worksheet VALUE 1. "#EC NOTEXT . . . . . . . . . " .
DATA name TYPE zexcel_worksheets_name VALUE 'Worksheets'. "#EC NOTEXT . . . . . . . . . " .
METHODS add
IMPORTING
!ip_worksheet TYPE REF TO zcl_excel_worksheet .
METHODS clear .
METHODS constructor .
METHODS get
IMPORTING
!ip_index TYPE zexcel_active_worksheet
RETURNING
VALUE(eo_worksheet) TYPE REF TO zcl_excel_worksheet .
METHODS get_iterator
RETURNING
VALUE(eo_iterator) TYPE REF TO cl_object_collection_iterator .
METHODS is_empty
RETURNING
VALUE(is_empty) TYPE flag .
METHODS remove
IMPORTING
!ip_worksheet TYPE REF TO zcl_excel_worksheet .
METHODS size
RETURNING
VALUE(ep_size) TYPE i .
*"* protected components of class ZCL_EXCEL_WORKSHEETS
*"* do not include other source files here!!!
PROTECTED SECTION.
*"* private components of class ZCL_EXCEL_WORKSHEETS
*"* do not include other source files here!!!
PRIVATE SECTION.
DATA worksheets TYPE REF TO cl_object_collection .
ENDCLASS.
CLASS zcl_excel_worksheets IMPLEMENTATION.
METHOD add.
worksheets->add( ip_worksheet ).
ENDMETHOD.
METHOD clear.
worksheets->clear( ).
ENDMETHOD.
METHOD constructor.
CREATE OBJECT worksheets.
ENDMETHOD.
METHOD get.
DATA lv_index TYPE i.
lv_index = ip_index.
eo_worksheet ?= worksheets->get( lv_index ).
ENDMETHOD.
METHOD get_iterator.
eo_iterator ?= worksheets->get_iterator( ).
ENDMETHOD.
METHOD is_empty.
is_empty = worksheets->is_empty( ).
ENDMETHOD.
METHOD remove.
worksheets->remove( ip_worksheet ).
ENDMETHOD.
METHOD size.
ep_size = worksheets->size( ).
ENDMETHOD.
ENDCLASS. | 19.046729 | 105 | 0.675662 | {
"alnum_ratio": 0.6509572901,
"alpha_token_ratio": 1.9984917044,
"avg_line_length": 19.2169811321,
"char_rep_ratio": 0.141025641,
"max_line_length": 105,
"num_words": 174,
"text_len": 2037,
"word_rep_ratio": 0.0363636364
} | 10,239,233,764,933,988,000 |
91090058eebeb29c588f68e1049bbb4e1189c3d4 | 11,301 | abap | ABAP | src/json/zcl_abapgit_ajson_utilities.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/json/zcl_abapgit_ajson_utilities.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/json/zcl_abapgit_ajson_utilities.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | **********************************************************************
* UTIL
**********************************************************************
CLASS lcl_nodes_helper DEFINITION FINAL.
PUBLIC SECTION.
DATA mt_nodes TYPE zif_abapgit_ajson=>ty_nodes_tt READ-ONLY.
METHODS add
IMPORTING
iv_str TYPE string.
METHODS sorted
RETURNING
VALUE(rt_nodes) TYPE zif_abapgit_ajson=>ty_nodes_ts.
ENDCLASS.
CLASS lcl_nodes_helper IMPLEMENTATION.
METHOD add.
FIELD-SYMBOLS <n> LIKE LINE OF mt_nodes.
DATA lv_children TYPE string.
DATA lv_index TYPE string.
APPEND INITIAL LINE TO mt_nodes ASSIGNING <n>.
SPLIT iv_str AT '|' INTO
<n>-path
<n>-name
<n>-type
<n>-value
lv_index
lv_children.
CONDENSE <n>-path.
CONDENSE <n>-name.
CONDENSE <n>-type.
CONDENSE <n>-value.
<n>-index = lv_index.
<n>-children = lv_children.
ENDMETHOD.
METHOD sorted.
rt_nodes = mt_nodes.
ENDMETHOD.
ENDCLASS.
**********************************************************************
* PARSER
**********************************************************************
CLASS ltcl_parser_test DEFINITION FINAL
FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT.
PUBLIC SECTION.
CLASS-METHODS sample_json
IMPORTING
iv_separator TYPE string OPTIONAL
RETURNING
VALUE(rv_json) TYPE string.
ENDCLASS.
CLASS ltcl_parser_test IMPLEMENTATION.
METHOD sample_json.
rv_json =
'{\n' &&
' "string": "abc",\n' &&
' "number": 123,\n' &&
' "float": 123.45,\n' &&
' "boolean": true,\n' &&
' "false": false,\n' &&
' "null": null,\n' &&
' "date": "2020-03-15",\n' &&
' "issues": [\n' &&
' {\n' &&
' "message": "Indentation problem ...",\n' &&
' "key": "indentation",\n' &&
' "start": {\n' &&
' "row": 4,\n' &&
' "col": 3\n' &&
' },\n' &&
' "end": {\n' &&
' "row": 4,\n' &&
' "col": 26\n' &&
' },\n' &&
' "filename": "./zxxx.prog.abap"\n' &&
' },\n' &&
' {\n' &&
' "message": "Remove space before XXX",\n' &&
' "key": "space_before_dot",\n' &&
' "start": {\n' &&
' "row": 3,\n' &&
' "col": 21\n' &&
' },\n' &&
' "end": {\n' &&
' "row": 3,\n' &&
' "col": 22\n' &&
' },\n' &&
' "filename": "./zxxx.prog.abap"\n' &&
' }\n' &&
' ]\n' &&
'}'.
REPLACE ALL OCCURRENCES OF '\n' IN rv_json WITH iv_separator.
ENDMETHOD.
ENDCLASS.
**********************************************************************
* JSON UTILITIES
**********************************************************************
CLASS ltcl_json_utils DEFINITION
FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT
FINAL.
PRIVATE SECTION.
METHODS json_diff FOR TESTING RAISING zcx_abapgit_ajson_error.
METHODS json_diff_types FOR TESTING RAISING zcx_abapgit_ajson_error.
METHODS json_sort FOR TESTING RAISING zcx_abapgit_ajson_error.
ENDCLASS.
CLASS ltcl_json_utils IMPLEMENTATION.
METHOD json_diff.
DATA:
lv_json TYPE string,
lo_util TYPE REF TO zcl_abapgit_ajson_utilities,
lo_insert TYPE REF TO zif_abapgit_ajson,
lo_delete TYPE REF TO zif_abapgit_ajson,
lo_change TYPE REF TO zif_abapgit_ajson,
lo_insert_exp TYPE REF TO lcl_nodes_helper,
lo_delete_exp TYPE REF TO lcl_nodes_helper,
lo_change_exp TYPE REF TO lcl_nodes_helper.
lv_json =
'{\n' &&
' "string": "abc",\n' && " no changes
' "number": 789,\n' && " changed value
' "float": 123.45,\n' &&
' "boolean": "true",\n' && " changed type
' "true": true,\n' && " insert
* ' "false": false,\n' && " delete
' "null": null,\n' &&
' "date": "2020-03-15",\n' &&
' "issues": [\n' &&
' {\n' &&
' "message": "Indentation problem ...",\n' &&
' "key": "indentation",\n' &&
' "start": {\n' &&
' "row": 5,\n' && " array change
' "col": 3\n' &&
' },\n' &&
' "end": {\n' &&
' "new": 1,\n' && " array insert
* ' "row": 4,\n' && " array delete
' "col": 26\n' &&
' },\n' &&
' "filename": "./zxxx.prog.abap"\n' &&
' },\n' &&
' {\n' &&
' "message": "Remove space before XXX",\n' &&
' "key": "space_before_dot",\n' &&
' "start": {\n' &&
' "row": 3,\n' &&
' "col": 21\n' &&
' },\n' &&
' "end": {\n' &&
' "row": 3,\n' &&
' "col": 22\n' &&
' },\n' &&
' "filename": "./zxxx.prog.abap"\n' &&
' }\n' &&
' ]\n' &&
'}'.
REPLACE ALL OCCURRENCES OF '\n' IN lv_json WITH cl_abap_char_utilities=>newline.
CREATE OBJECT lo_insert_exp.
lo_insert_exp->add( ' | |object | |0|3' ).
lo_insert_exp->add( '/ |boolean |str |true |0|0' ). " changed type (insert new)
lo_insert_exp->add( '/ |issues |array | |0|1' ).
lo_insert_exp->add( '/ |true |bool |true |0|0' ). " insert
lo_insert_exp->add( '/issues/ |1 |object | |1|1' ).
lo_insert_exp->add( '/issues/1/ |end |object | |0|1' ).
lo_insert_exp->add( '/issues/1/end/ |new |num |1 |0|0' ). " array insert
CREATE OBJECT lo_delete_exp.
lo_delete_exp->add( ' | |object | |0|3' ).
lo_delete_exp->add( '/ |boolean |bool |true |0|0' ). " changed type (delete old)
lo_delete_exp->add( '/ |false |bool |false |0|0' ). " delete
lo_delete_exp->add( '/ |issues |array | |0|1' ).
lo_delete_exp->add( '/issues/ |1 |object | |1|1' ).
lo_delete_exp->add( '/issues/1/ |end |object | |0|1' ).
lo_delete_exp->add( '/issues/1/end/ |row |num |4 |0|0' ). " array delete
CREATE OBJECT lo_change_exp.
lo_change_exp->add( ' | |object | |0|2' ).
lo_change_exp->add( '/ |issues |array | |0|1' ).
lo_change_exp->add( '/ |number |num |789 |0|0' ). " changed value
lo_change_exp->add( '/issues/ |1 |object | |1|1' ).
lo_change_exp->add( '/issues/1/ |start |object | |0|1' ).
lo_change_exp->add( '/issues/1/start/|row |num |5 |0|0' ). " array change
CREATE OBJECT lo_util.
lo_util->diff(
EXPORTING
iv_json_a = ltcl_parser_test=>sample_json( )
iv_json_b = lv_json
IMPORTING
eo_insert = lo_insert
eo_delete = lo_delete
eo_change = lo_change ).
cl_abap_unit_assert=>assert_equals(
act = lo_insert->mt_json_tree
exp = lo_insert_exp->mt_nodes ).
cl_abap_unit_assert=>assert_equals(
act = lo_delete->mt_json_tree
exp = lo_delete_exp->mt_nodes ).
cl_abap_unit_assert=>assert_equals(
act = lo_change->mt_json_tree
exp = lo_change_exp->mt_nodes ).
ENDMETHOD.
METHOD json_diff_types.
DATA:
lv_json_a TYPE string,
lv_json_b TYPE string,
lo_util TYPE REF TO zcl_abapgit_ajson_utilities,
lo_insert TYPE REF TO zif_abapgit_ajson,
lo_delete TYPE REF TO zif_abapgit_ajson,
lo_change TYPE REF TO zif_abapgit_ajson,
lo_insert_exp TYPE REF TO lcl_nodes_helper,
lo_delete_exp TYPE REF TO lcl_nodes_helper.
" Change single value to array
lv_json_a =
'{\n' &&
' "string": "abc",\n' &&
' "number": 123\n' &&
'}'.
lv_json_b =
'{\n' &&
' "string": [\n' &&
' "a",\n' &&
' "b",\n' &&
' "c"\n' &&
' ],\n' &&
' "number": 123\n' &&
'}'.
REPLACE ALL OCCURRENCES OF '\n' IN lv_json_a WITH cl_abap_char_utilities=>newline.
REPLACE ALL OCCURRENCES OF '\n' IN lv_json_b WITH cl_abap_char_utilities=>newline.
CREATE OBJECT lo_insert_exp.
lo_insert_exp->add( ' | |object | |0|1' ).
lo_insert_exp->add( '/ |string |array | |0|3' ).
lo_insert_exp->add( '/string/ |1 |str |a |1|0' ).
lo_insert_exp->add( '/string/ |2 |str |b |2|0' ).
lo_insert_exp->add( '/string/ |3 |str |c |3|0' ).
CREATE OBJECT lo_delete_exp.
lo_delete_exp->add( ' | |object | |0|1' ).
lo_delete_exp->add( '/ |string |str |abc |0|0' ).
CREATE OBJECT lo_util.
lo_util->diff(
EXPORTING
iv_json_a = lv_json_a
iv_json_b = lv_json_b
IMPORTING
eo_insert = lo_insert
eo_delete = lo_delete
eo_change = lo_change ).
cl_abap_unit_assert=>assert_equals(
act = lo_insert->mt_json_tree
exp = lo_insert_exp->mt_nodes ).
cl_abap_unit_assert=>assert_equals(
act = lo_delete->mt_json_tree
exp = lo_delete_exp->mt_nodes ).
cl_abap_unit_assert=>assert_equals(
act = lines( lo_change->mt_json_tree )
exp = 0 ).
" Change array to single value
lo_util->diff(
EXPORTING
iv_json_a = lv_json_b
iv_json_b = lv_json_a
IMPORTING
eo_insert = lo_insert
eo_delete = lo_delete
eo_change = lo_change ).
cl_abap_unit_assert=>assert_equals(
act = lo_insert->mt_json_tree
exp = lo_delete_exp->mt_nodes ).
cl_abap_unit_assert=>assert_equals(
act = lo_delete->mt_json_tree
exp = lo_insert_exp->mt_nodes ).
cl_abap_unit_assert=>assert_equals(
act = lines( lo_change->mt_json_tree )
exp = 0 ).
ENDMETHOD.
METHOD json_sort.
DATA:
lv_json TYPE string,
lo_util TYPE REF TO zcl_abapgit_ajson_utilities,
lv_sorted TYPE string,
lv_sorted_exp TYPE string.
lv_json =
'{\n' &&
' "string": "abc",\n' &&
' "number": 789,\n' &&
' "float": 123.45,\n' &&
' "boolean": "true",\n' &&
' "true": true,\n' &&
' "false": false,\n' &&
' "null": null,\n' &&
' "date": "2020-03-15"\n' &&
'}'.
REPLACE ALL OCCURRENCES OF '\n' IN lv_json WITH cl_abap_char_utilities=>newline.
lv_sorted_exp =
'{\n' &&
' "boolean": "true",\n' &&
' "date": "2020-03-15",\n' &&
' "false": false,\n' &&
' "float": 123.45,\n' &&
' "null": null,\n' &&
' "number": 789,\n' &&
' "string": "abc",\n' &&
' "true": true\n' &&
'}'.
REPLACE ALL OCCURRENCES OF '\n' IN lv_sorted_exp WITH cl_abap_char_utilities=>newline.
CREATE OBJECT lo_util.
lv_sorted = lo_util->sort( iv_json = lv_json ).
cl_abap_unit_assert=>assert_equals(
act = lv_sorted
exp = lv_sorted_exp ).
ENDMETHOD.
ENDCLASS. | 29.739474 | 103 | 0.488275 | {
"alnum_ratio": 0.4565486726,
"alpha_token_ratio": 1.2307692308,
"avg_line_length": 29.8153034301,
"char_rep_ratio": 0.1944911877,
"max_line_length": 103,
"num_words": 745,
"text_len": 11300,
"word_rep_ratio": 0.2078804348
} | 17,384,895,059,216,132,000 |
9138c0342cbe11963d93af6ee71f0df1a9f54b22 | 578 | abap | ABAP | src/repo/zif_abapgit_repo_checksums.intf.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/repo/zif_abapgit_repo_checksums.intf.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/repo/zif_abapgit_repo_checksums.intf.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | INTERFACE zif_abapgit_repo_checksums
PUBLIC.
METHODS get
RETURNING
VALUE(rt_checksums) TYPE zif_abapgit_persistence=>ty_local_checksum_tt.
METHODS get_checksums_per_file
RETURNING
VALUE(rt_checksums) TYPE zif_abapgit_definitions=>ty_file_signatures_tt .
METHODS rebuild
IMPORTING
iv_branches_equal TYPE abap_bool DEFAULT abap_false
RAISING
zcx_abapgit_exception.
METHODS update
IMPORTING
!it_updated_files TYPE zif_abapgit_definitions=>ty_file_signatures_tt
RAISING
zcx_abapgit_exception.
ENDINTERFACE. | 23.12 | 79 | 0.780277 | {
"alnum_ratio": 0.7244367418,
"alpha_token_ratio": 2.0693069307,
"avg_line_length": 24.0416666667,
"char_rep_ratio": 0.1214788732,
"max_line_length": 79,
"num_words": 34,
"text_len": 577,
"word_rep_ratio": 0
} | 1,950,560,501,916,718,000 |
9145ef6948d605d8b2c988f74915f19ea6c1d703 | 4,865 | abap | ABAP | src/objects/zcl_abapgit_object_type.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/objects/zcl_abapgit_object_type.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/objects/zcl_abapgit_object_type.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_object_type DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS: c_prefix TYPE c LENGTH 3 VALUE '%_C'.
METHODS read
EXPORTING ev_ddtext TYPE ddtypet-ddtext
et_source TYPE abaptxt255_tab
RAISING zcx_abapgit_exception.
METHODS create
IMPORTING iv_ddtext TYPE ddtypet-ddtext
it_source TYPE abaptxt255_tab
iv_devclass TYPE devclass
RAISING zcx_abapgit_exception.
ENDCLASS.
CLASS zcl_abapgit_object_type IMPLEMENTATION.
METHOD create.
DATA: lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
CALL FUNCTION 'RS_DD_TYGR_INSERT_SOURCES'
EXPORTING
typegroupname = lv_typegroup
ddtext = iv_ddtext
corrnum = ''
devclass = iv_devclass
TABLES
source = it_source
EXCEPTIONS
already_exists = 1
not_executed = 2
permission_failure = 3
object_not_specified = 4
illegal_name = 5
OTHERS = 6.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
UPDATE progdir SET uccheck = abap_true
WHERE name = lv_progname.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error setting uccheck' ).
ENDIF.
ENDMETHOD.
METHOD read.
DATA: lv_typdname TYPE rsedd0-typegroup,
lt_psmodisrc TYPE TABLE OF smodisrc,
lt_psmodilog TYPE TABLE OF smodilog,
lt_ptrdir TYPE TABLE OF trdir.
SELECT SINGLE ddtext FROM ddtypet
INTO ev_ddtext
WHERE typegroup = ms_item-obj_name
AND ddlanguage = mv_language.
lv_typdname = ms_item-obj_name.
" Active version
CALL FUNCTION 'TYPD_GET_OBJECT'
EXPORTING
typdname = lv_typdname
TABLES
psmodisrc = lt_psmodisrc
psmodilog = lt_psmodilog
psource = et_source
ptrdir = lt_ptrdir
EXCEPTIONS
version_not_found = 1
reps_not_exist = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |No active version found for { ms_item-obj_type } { ms_item-obj_name }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD zif_abapgit_object~delete.
IF zif_abapgit_object~exists( ) = abap_false.
RETURN.
ENDIF.
delete_ddic( 'G' ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab,
lv_progname TYPE reposrc-progname,
lv_typegroup TYPE rsedd0-typegroup.
lv_typegroup = ms_item-obj_name.
io_xml->read( EXPORTING iv_name = 'DDTEXT'
CHANGING cg_data = lv_ddtext ).
lt_source = mo_files->read_abap( ).
IF zif_abapgit_object~exists( ) = abap_false.
create( iv_ddtext = lv_ddtext
it_source = lt_source
iv_devclass = iv_package ).
ELSE.
CONCATENATE c_prefix lv_typegroup INTO lv_progname.
INSERT REPORT lv_progname FROM lt_source STATE 'I'.
ENDIF.
zcl_abapgit_objects_activation=>add_item( ms_item ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_progname TYPE progname,
lv_state TYPE r3state.
lv_progname = |%_C{ ms_item-obj_name }|.
SELECT SINGLE state
FROM progdir
INTO lv_state
WHERE name = lv_progname.
IF lv_state IS NOT INITIAL.
rv_bool = abap_true.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
" Covered by ZCL_ABAPGIT_OBJECT=>JUMP
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_ddtext TYPE ddtypet-ddtext,
lt_source TYPE abaptxt255_tab.
read( IMPORTING ev_ddtext = lv_ddtext
et_source = lt_source ).
io_xml->add( iv_name = 'DDTEXT'
ig_data = lv_ddtext ).
mo_files->add_abap( lt_source ).
ENDMETHOD.
ENDCLASS. | 23.166667 | 110 | 0.646249 | {
"alnum_ratio": 0.6064967105,
"alpha_token_ratio": 1.7379392496,
"avg_line_length": 23.2727272727,
"char_rep_ratio": 0.1546858908,
"max_line_length": 110,
"num_words": 338,
"text_len": 4864,
"word_rep_ratio": 0
} | 5,589,607,589,284,114,000 |
915cc01ce742391f7e89bbfeb10d0d73a9ee095e | 30,566 | abap | ABAP | src/ui/zcl_abapgit_popups.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/ui/zcl_abapgit_popups.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/ui/zcl_abapgit_popups.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_popups DEFINITION
PUBLIC
FINAL
CREATE PRIVATE
GLOBAL FRIENDS zcl_abapgit_ui_factory .
PUBLIC SECTION.
INTERFACES zif_abapgit_popups .
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS c_default_column TYPE abap_componentdescr-name VALUE `DEFAULT_COLUMN` ##NO_TEXT.
TYPES:
ty_lt_fields TYPE STANDARD TABLE OF sval WITH DEFAULT KEY .
CONSTANTS c_fieldname_selected TYPE abap_componentdescr-name VALUE `SELECTED` ##NO_TEXT.
CONSTANTS c_answer_cancel TYPE c LENGTH 1 VALUE 'A' ##NO_TEXT.
DATA mo_select_list_popup TYPE REF TO cl_salv_table .
DATA mr_table TYPE REF TO data .
DATA mv_cancel TYPE abap_bool VALUE abap_false.
DATA mo_table_descr TYPE REF TO cl_abap_tabledescr .
METHODS add_field
IMPORTING
!iv_tabname TYPE sval-tabname
!iv_fieldname TYPE sval-fieldname
!iv_fieldtext TYPE sval-fieldtext
!iv_value TYPE clike DEFAULT ''
!iv_field_attr TYPE sval-field_attr DEFAULT ''
!iv_obligatory TYPE spo_obl OPTIONAL
CHANGING
!ct_fields TYPE zif_abapgit_popups=>ty_sval_tt .
METHODS create_new_table
IMPORTING
!it_list TYPE STANDARD TABLE .
METHODS get_selected_rows
EXPORTING
!et_list TYPE INDEX TABLE .
METHODS on_select_list_link_click
FOR EVENT link_click OF cl_salv_events_table
IMPORTING
!row
!column .
METHODS on_select_list_function_click
FOR EVENT added_function OF cl_salv_events_table
IMPORTING
!e_salv_function .
METHODS on_double_click
FOR EVENT double_click OF cl_salv_events_table
IMPORTING
!row
!column .
METHODS _popup_3_get_values
IMPORTING
!iv_popup_title TYPE string
!iv_no_value_check TYPE abap_bool DEFAULT abap_false
EXPORTING
!ev_value_1 TYPE spo_value
!ev_value_2 TYPE spo_value
!ev_value_3 TYPE spo_value
CHANGING
!ct_fields TYPE ty_lt_fields
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS zcl_abapgit_popups IMPLEMENTATION.
METHOD add_field.
FIELD-SYMBOLS: <ls_field> LIKE LINE OF ct_fields.
APPEND INITIAL LINE TO ct_fields ASSIGNING <ls_field>.
<ls_field>-tabname = iv_tabname.
<ls_field>-fieldname = iv_fieldname.
<ls_field>-fieldtext = iv_fieldtext.
<ls_field>-value = iv_value.
<ls_field>-field_attr = iv_field_attr.
<ls_field>-field_obl = iv_obligatory.
ENDMETHOD.
METHOD create_new_table.
" create and populate a table on the fly derived from
" it_data with a select column
DATA: lr_struct TYPE REF TO data,
lt_components TYPE cl_abap_structdescr=>component_table,
lo_data_descr TYPE REF TO cl_abap_datadescr,
lo_elem_descr TYPE REF TO cl_abap_elemdescr,
lo_struct_descr TYPE REF TO cl_abap_structdescr,
lo_struct_descr2 TYPE REF TO cl_abap_structdescr.
FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE,
<ls_component> TYPE abap_componentdescr,
<lg_line> TYPE data,
<lg_data> TYPE any,
<lg_value> TYPE any.
mo_table_descr ?= cl_abap_tabledescr=>describe_by_data( it_list ).
lo_data_descr = mo_table_descr->get_table_line_type( ).
CASE lo_data_descr->kind.
WHEN cl_abap_elemdescr=>kind_elem.
lo_elem_descr ?= mo_table_descr->get_table_line_type( ).
INSERT INITIAL LINE INTO lt_components ASSIGNING <ls_component> INDEX 1.
<ls_component>-name = c_default_column.
<ls_component>-type = lo_elem_descr.
WHEN cl_abap_elemdescr=>kind_struct.
lo_struct_descr ?= mo_table_descr->get_table_line_type( ).
lt_components = lo_struct_descr->get_components( ).
ENDCASE.
IF lt_components IS INITIAL.
RETURN.
ENDIF.
INSERT INITIAL LINE INTO lt_components ASSIGNING <ls_component> INDEX 1.
<ls_component>-name = c_fieldname_selected.
<ls_component>-type ?= cl_abap_datadescr=>describe_by_name( 'FLAG' ).
lo_struct_descr2 = cl_abap_structdescr=>create( lt_components ).
mo_table_descr = cl_abap_tabledescr=>create( lo_struct_descr2 ).
CREATE DATA mr_table TYPE HANDLE mo_table_descr.
ASSIGN mr_table->* TO <lt_table>.
ASSERT sy-subrc = 0.
CREATE DATA lr_struct TYPE HANDLE lo_struct_descr2.
ASSIGN lr_struct->* TO <lg_line>.
ASSERT sy-subrc = 0.
LOOP AT it_list ASSIGNING <lg_data>.
CLEAR <lg_line>.
CASE lo_data_descr->kind.
WHEN cl_abap_elemdescr=>kind_elem.
ASSIGN COMPONENT c_default_column OF STRUCTURE <lg_data> TO <lg_value>.
ASSERT <lg_value> IS ASSIGNED.
<lg_line> = <lg_value>.
WHEN OTHERS.
MOVE-CORRESPONDING <lg_data> TO <lg_line>.
ENDCASE.
INSERT <lg_line> INTO TABLE <lt_table>.
ENDLOOP.
ENDMETHOD.
METHOD get_selected_rows.
DATA: lv_condition TYPE string,
lr_exporting TYPE REF TO data.
FIELD-SYMBOLS: <lg_exporting> TYPE any,
<lt_table> TYPE STANDARD TABLE,
<lg_line> TYPE any,
<lg_value> TYPE any,
<lv_selected> TYPE abap_bool,
<lv_selected_row> TYPE LINE OF salv_t_row.
DATA: lo_data_descr TYPE REF TO cl_abap_datadescr,
lo_selections TYPE REF TO cl_salv_selections,
lt_selected_rows TYPE salv_t_row.
ASSIGN mr_table->* TO <lt_table>.
ASSERT sy-subrc = 0.
lo_selections = mo_select_list_popup->get_selections( ).
IF lo_selections->get_selection_mode( ) = if_salv_c_selection_mode=>single.
lt_selected_rows = lo_selections->get_selected_rows( ).
LOOP AT lt_selected_rows ASSIGNING <lv_selected_row>.
READ TABLE <lt_table>
ASSIGNING <lg_line>
INDEX <lv_selected_row>.
CHECK <lg_line> IS ASSIGNED.
ASSIGN COMPONENT c_fieldname_selected
OF STRUCTURE <lg_line>
TO <lv_selected>.
CHECK <lv_selected> IS ASSIGNED.
<lv_selected> = abap_true.
ENDLOOP.
ENDIF.
lv_condition = |{ c_fieldname_selected } = ABAP_TRUE|.
CREATE DATA lr_exporting LIKE LINE OF et_list.
ASSIGN lr_exporting->* TO <lg_exporting>.
mo_table_descr ?= cl_abap_tabledescr=>describe_by_data( et_list ).
lo_data_descr = mo_table_descr->get_table_line_type( ).
LOOP AT <lt_table> ASSIGNING <lg_line> WHERE (lv_condition).
CLEAR <lg_exporting>.
CASE lo_data_descr->kind.
WHEN cl_abap_elemdescr=>kind_elem.
ASSIGN COMPONENT c_default_column OF STRUCTURE <lg_line> TO <lg_value>.
ASSERT <lg_value> IS ASSIGNED.
<lg_exporting> = <lg_value>.
WHEN OTHERS.
MOVE-CORRESPONDING <lg_line> TO <lg_exporting>.
ENDCASE.
APPEND <lg_exporting> TO et_list.
ENDLOOP.
ENDMETHOD.
METHOD on_double_click.
DATA: lo_selections TYPE REF TO cl_salv_selections.
lo_selections = mo_select_list_popup->get_selections( ).
IF lo_selections->get_selection_mode( ) = if_salv_c_selection_mode=>single.
mo_select_list_popup->close_screen( ).
ENDIF.
ENDMETHOD.
METHOD on_select_list_function_click.
FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE,
<lg_line> TYPE any,
<lv_selected> TYPE abap_bool.
ASSIGN mr_table->* TO <lt_table>.
ASSERT sy-subrc = 0.
CASE e_salv_function.
WHEN 'O.K.'.
mv_cancel = abap_false.
mo_select_list_popup->close_screen( ).
WHEN 'ABR'.
"Canceled: clear list to overwrite nothing
CLEAR <lt_table>.
mv_cancel = abap_true.
mo_select_list_popup->close_screen( ).
WHEN 'SALL'.
LOOP AT <lt_table> ASSIGNING <lg_line>.
ASSIGN COMPONENT c_fieldname_selected
OF STRUCTURE <lg_line>
TO <lv_selected>.
ASSERT sy-subrc = 0.
<lv_selected> = abap_true.
ENDLOOP.
mo_select_list_popup->refresh( ).
WHEN 'DSEL'.
LOOP AT <lt_table> ASSIGNING <lg_line>.
ASSIGN COMPONENT c_fieldname_selected
OF STRUCTURE <lg_line>
TO <lv_selected>.
ASSERT sy-subrc = 0.
<lv_selected> = abap_false.
ENDLOOP.
mo_select_list_popup->refresh( ).
WHEN OTHERS.
CLEAR <lt_table>.
mo_select_list_popup->close_screen( ).
ENDCASE.
ENDMETHOD.
METHOD on_select_list_link_click.
FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE,
<lg_line> TYPE any,
<lv_selected> TYPE abap_bool.
ASSIGN mr_table->* TO <lt_table>.
ASSERT sy-subrc = 0.
READ TABLE <lt_table> ASSIGNING <lg_line> INDEX row.
IF sy-subrc = 0.
ASSIGN COMPONENT c_fieldname_selected
OF STRUCTURE <lg_line>
TO <lv_selected>.
ASSERT sy-subrc = 0.
IF <lv_selected> = abap_true.
<lv_selected> = abap_false.
ELSE.
<lv_selected> = abap_true.
ENDIF.
ENDIF.
mo_select_list_popup->refresh( ).
ENDMETHOD.
METHOD zif_abapgit_popups~branch_list_popup.
DATA: lo_branches TYPE REF TO zcl_abapgit_git_branch_list,
lt_branches TYPE zif_abapgit_definitions=>ty_git_branch_list_tt,
lv_answer TYPE c LENGTH 1,
lv_default TYPE i,
lv_head_suffix TYPE string,
lv_head_symref TYPE string,
lv_text TYPE string,
lt_selection TYPE TABLE OF spopli.
FIELD-SYMBOLS: <ls_sel> LIKE LINE OF lt_selection,
<ls_branch> LIKE LINE OF lt_branches.
lo_branches = zcl_abapgit_git_transport=>branches( iv_url ).
lt_branches = lo_branches->get_branches_only( ).
lv_head_suffix = | ({ zif_abapgit_definitions=>c_head_name })|.
lv_head_symref = lo_branches->get_head_symref( ).
IF iv_hide_branch IS NOT INITIAL.
DELETE lt_branches WHERE name = iv_hide_branch.
ENDIF.
IF iv_hide_head IS NOT INITIAL.
DELETE lt_branches WHERE name = zif_abapgit_definitions=>c_head_name
OR is_head = abap_true.
ENDIF.
IF lt_branches IS INITIAL.
IF iv_hide_head IS NOT INITIAL.
lv_text = 'main'.
ENDIF.
IF iv_hide_branch IS NOT INITIAL AND iv_hide_branch <> zif_abapgit_definitions=>c_git_branch-main.
IF lv_text IS INITIAL.
lv_text = iv_hide_branch && ' is'.
ELSE.
CONCATENATE lv_text 'and' iv_hide_branch 'are' INTO lv_text SEPARATED BY space.
ENDIF.
ELSE.
lv_text = lv_text && ' is'.
ENDIF.
IF lv_text IS NOT INITIAL.
zcx_abapgit_exception=>raise( 'No branches available to select (' && lv_text && ' hidden)' ).
ELSE.
zcx_abapgit_exception=>raise( 'No branches are available to select' ).
ENDIF.
ENDIF.
LOOP AT lt_branches ASSIGNING <ls_branch>.
CHECK <ls_branch>-name IS NOT INITIAL. " To ensure some below ifs
IF <ls_branch>-is_head = abap_true.
IF <ls_branch>-name = zif_abapgit_definitions=>c_head_name. " HEAD
IF <ls_branch>-name <> lv_head_symref AND lv_head_symref IS NOT INITIAL.
" HEAD but other HEAD symref exists - ignore
CONTINUE.
ELSE.
INSERT INITIAL LINE INTO lt_selection INDEX 1 ASSIGNING <ls_sel>.
<ls_sel>-varoption = <ls_branch>-name.
ENDIF.
ELSE.
INSERT INITIAL LINE INTO lt_selection INDEX 1 ASSIGNING <ls_sel>.
<ls_sel>-varoption = <ls_branch>-display_name && lv_head_suffix.
ENDIF.
IF lv_default > 0. " Shift down default if set
lv_default = lv_default + 1.
ENDIF.
ELSE.
APPEND INITIAL LINE TO lt_selection ASSIGNING <ls_sel>.
<ls_sel>-varoption = <ls_branch>-display_name.
ENDIF.
IF <ls_branch>-name = iv_default_branch.
IF <ls_branch>-is_head = abap_true.
lv_default = 1.
ELSE.
lv_default = sy-tabix.
ENDIF.
ENDIF.
ENDLOOP.
IF iv_show_new_option = abap_true.
APPEND INITIAL LINE TO lt_selection ASSIGNING <ls_sel>.
<ls_sel>-varoption = zif_abapgit_popups=>c_new_branch_label.
ENDIF.
CALL FUNCTION 'POPUP_TO_DECIDE_LIST'
EXPORTING
textline1 = 'Select branch'
titel = 'Select branch'
start_col = 30
start_row = 5
cursorline = lv_default
IMPORTING
answer = lv_answer
TABLES
t_spopli = lt_selection
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from POPUP_TO_DECIDE_LIST' ).
ENDIF.
IF lv_answer = c_answer_cancel.
RETURN.
ENDIF.
READ TABLE lt_selection ASSIGNING <ls_sel> WITH KEY selflag = abap_true.
ASSERT sy-subrc = 0.
IF iv_show_new_option = abap_true AND <ls_sel>-varoption = zif_abapgit_popups=>c_new_branch_label.
rs_branch-name = zif_abapgit_popups=>c_new_branch_label.
ELSE.
REPLACE FIRST OCCURRENCE OF lv_head_suffix IN <ls_sel>-varoption WITH ''.
READ TABLE lt_branches WITH KEY display_name = <ls_sel>-varoption ASSIGNING <ls_branch>.
IF sy-subrc <> 0.
* branch name longer than 65 characters
LOOP AT lt_branches ASSIGNING <ls_branch> WHERE display_name CS <ls_sel>-varoption.
EXIT. " current loop
ENDLOOP.
ENDIF.
ASSERT <ls_branch> IS ASSIGNED.
rs_branch = lo_branches->find_by_name( <ls_branch>-name ).
lv_text = |Branch switched from { zcl_abapgit_git_branch_list=>get_display_name( iv_default_branch ) } to {
zcl_abapgit_git_branch_list=>get_display_name( rs_branch-name ) } |.
MESSAGE lv_text TYPE 'S'.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~branch_popup_callback.
DATA: lv_url TYPE string,
ls_package_data TYPE scompkdtln,
ls_branch TYPE zif_abapgit_definitions=>ty_git_branch,
lv_create TYPE abap_bool,
lv_text TYPE string.
FIELD-SYMBOLS: <ls_furl> LIKE LINE OF ct_fields,
<ls_fbranch> LIKE LINE OF ct_fields,
<ls_fpackage> LIKE LINE OF ct_fields.
CLEAR cs_error.
IF iv_code = 'COD1'.
cv_show_popup = abap_true.
READ TABLE ct_fields ASSIGNING <ls_furl> WITH KEY tabname = 'ABAPTXT255'.
IF sy-subrc <> 0 OR <ls_furl>-value IS INITIAL.
MESSAGE 'Fill URL' TYPE 'S' DISPLAY LIKE 'E'.
RETURN.
ENDIF.
lv_url = <ls_furl>-value.
ls_branch = zif_abapgit_popups~branch_list_popup( lv_url ).
IF ls_branch IS INITIAL.
RETURN.
ENDIF.
READ TABLE ct_fields ASSIGNING <ls_fbranch> WITH KEY tabname = 'TEXTL'.
ASSERT sy-subrc = 0.
<ls_fbranch>-value = ls_branch-name.
ELSEIF iv_code = 'COD2'.
cv_show_popup = abap_true.
READ TABLE ct_fields ASSIGNING <ls_fpackage> WITH KEY fieldname = 'DEVCLASS'.
ASSERT sy-subrc = 0.
ls_package_data-devclass = <ls_fpackage>-value.
IF zcl_abapgit_factory=>get_sap_package( ls_package_data-devclass )->exists( ) = abap_true.
lv_text = |Package { ls_package_data-devclass } already exists|.
MESSAGE lv_text TYPE 'I' DISPLAY LIKE 'E'.
RETURN.
ENDIF.
zif_abapgit_popups~popup_to_create_package(
IMPORTING
es_package_data = ls_package_data
ev_create = lv_create ).
IF lv_create = abap_false.
RETURN.
ENDIF.
zcl_abapgit_factory=>get_sap_package( ls_package_data-devclass )->create( ls_package_data ).
COMMIT WORK.
<ls_fpackage>-value = ls_package_data-devclass.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~choose_pr_popup.
DATA lv_answer TYPE c LENGTH 1.
DATA lt_selection TYPE TABLE OF spopli.
FIELD-SYMBOLS <ls_sel> LIKE LINE OF lt_selection.
FIELD-SYMBOLS <ls_pull> LIKE LINE OF it_pulls.
IF lines( it_pulls ) = 0.
zcx_abapgit_exception=>raise( 'No pull requests to select from' ).
ENDIF.
LOOP AT it_pulls ASSIGNING <ls_pull>.
APPEND INITIAL LINE TO lt_selection ASSIGNING <ls_sel>.
<ls_sel>-varoption = |{ <ls_pull>-number } - { <ls_pull>-title } @{ <ls_pull>-user }|.
ENDLOOP.
CALL FUNCTION 'POPUP_TO_DECIDE_LIST'
EXPORTING
textline1 = 'Select pull request'
titel = 'Select pull request'
start_col = 30
start_row = 5
IMPORTING
answer = lv_answer
TABLES
t_spopli = lt_selection
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from POPUP_TO_DECIDE_LIST' ).
ENDIF.
IF lv_answer = c_answer_cancel.
RETURN.
ENDIF.
READ TABLE lt_selection ASSIGNING <ls_sel> WITH KEY selflag = abap_true.
ASSERT sy-subrc = 0.
READ TABLE it_pulls INTO rs_pull INDEX sy-tabix.
ASSERT sy-subrc = 0.
ENDMETHOD.
METHOD zif_abapgit_popups~create_branch_popup.
DATA: lt_fields TYPE TABLE OF sval.
DATA: lv_name TYPE spo_value.
CLEAR: ev_name, ev_cancel.
add_field( EXPORTING iv_tabname = 'TEXTL'
iv_fieldname = 'LINE'
iv_fieldtext = 'Name'
iv_value = 'new-branch-name'
CHANGING ct_fields = lt_fields ).
TRY.
_popup_3_get_values(
EXPORTING iv_popup_title = |Create branch from {
zcl_abapgit_git_branch_list=>get_display_name( iv_source_branch_name ) }|
IMPORTING ev_value_1 = lv_name
CHANGING ct_fields = lt_fields ).
ev_name = zcl_abapgit_git_branch_list=>complete_heads_branch_name(
zcl_abapgit_git_branch_list=>normalize_branch_name( lv_name ) ).
CATCH zcx_abapgit_cancel.
ev_cancel = abap_true.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_folder_logic.
DATA: lt_fields TYPE TABLE OF sval.
DATA: lv_folder_logic TYPE spo_value.
CLEAR: rv_folder_logic.
add_field( EXPORTING iv_tabname = 'TDEVC'
iv_fieldname = 'INTSYS'
iv_fieldtext = 'Folder logic'
iv_value = 'PREFIX'
CHANGING ct_fields = lt_fields ).
TRY.
_popup_3_get_values( EXPORTING iv_popup_title = 'Export package'
iv_no_value_check = abap_true
IMPORTING ev_value_1 = lv_folder_logic
CHANGING ct_fields = lt_fields ).
rv_folder_logic = to_upper( lv_folder_logic ).
CATCH zcx_abapgit_cancel.
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_search_help.
DATA lt_ret TYPE TABLE OF ddshretval.
DATA ls_ret LIKE LINE OF lt_ret.
DATA lv_tabname TYPE dfies-tabname.
DATA lv_fieldname TYPE dfies-fieldname.
SPLIT iv_tab_field AT '-' INTO lv_tabname lv_fieldname.
lv_tabname = to_upper( lv_tabname ).
lv_fieldname = to_upper( lv_fieldname ).
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = lv_tabname
fieldname = lv_fieldname
TABLES
return_tab = lt_ret
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |F4IF_FIELD_VALUE_REQUEST error [{ iv_tab_field }]| ).
ENDIF.
IF lines( lt_ret ) > 0.
READ TABLE lt_ret WITH KEY fieldname = lv_fieldname INTO ls_ret.
IF sy-subrc = 0.
rv_value = ls_ret-fieldval.
ELSE.
READ TABLE lt_ret INDEX 1 INTO ls_ret.
ASSERT sy-subrc = 0.
rv_value = ls_ret-fieldval.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_to_confirm.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = iv_titlebar
text_question = iv_text_question
text_button_1 = iv_text_button_1
icon_button_1 = iv_icon_button_1
text_button_2 = iv_text_button_2
icon_button_2 = iv_icon_button_2
default_button = iv_default_button
display_cancel_button = iv_display_cancel_button
IMPORTING
answer = rv_answer
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from POPUP_TO_CONFIRM' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_to_create_package.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = 'PB_POPUP_PACKAGE_CREATE'
EXCEPTIONS
function_not_exist = 1
OTHERS = 2.
IF sy-subrc = 1.
* looks like the function module used does not exist on all
* versions since 702, so show an error
zcx_abapgit_exception=>raise( 'Your system does not support automatic creation of packages.' &&
'Please, create the package manually.' ).
ENDIF.
CALL FUNCTION 'PB_POPUP_PACKAGE_CREATE'
CHANGING
p_object_data = es_package_data
EXCEPTIONS
action_cancelled = 1.
ev_create = boolc( sy-subrc = 0 ).
ENDMETHOD.
METHOD zif_abapgit_popups~popup_to_create_transp_branch.
DATA: lt_fields TYPE TABLE OF sval,
lv_transports_as_text TYPE string,
lv_desc_as_text TYPE string,
ls_transport_header LIKE LINE OF it_transport_headers.
DATA: lv_branch_name TYPE spo_value.
DATA: lv_commit_text TYPE spo_value.
CLEAR: rs_transport_branch-branch_name, rs_transport_branch-commit_text.
" If we only have one transport selected set branch name to Transport
" name and commit description to transport description.
IF lines( it_transport_headers ) = 1.
READ TABLE it_transport_headers INDEX 1 INTO ls_transport_header.
lv_transports_as_text = ls_transport_header-trkorr.
SELECT SINGLE as4text FROM e07t INTO lv_desc_as_text WHERE
trkorr = ls_transport_header-trkorr AND
langu = sy-langu.
ELSE. " Else set branch name and commit message to 'Transport(s)_TRXXXXXX_TRXXXXX'
lv_transports_as_text = 'Transport(s)'.
LOOP AT it_transport_headers INTO ls_transport_header.
CONCATENATE lv_transports_as_text '_' ls_transport_header-trkorr INTO lv_transports_as_text.
ENDLOOP.
lv_desc_as_text = lv_transports_as_text.
ENDIF.
add_field( EXPORTING iv_tabname = 'TEXTL'
iv_fieldname = 'LINE'
iv_fieldtext = 'Branch name'
iv_value = lv_transports_as_text
CHANGING ct_fields = lt_fields ).
add_field( EXPORTING iv_tabname = 'ABAPTXT255'
iv_fieldname = 'LINE'
iv_fieldtext = 'Commit text'
iv_value = lv_desc_as_text
CHANGING ct_fields = lt_fields ).
_popup_3_get_values( EXPORTING iv_popup_title = 'Transport to new Branch'
IMPORTING ev_value_1 = lv_branch_name
ev_value_2 = lv_commit_text
CHANGING ct_fields = lt_fields ).
rs_transport_branch-branch_name = lv_branch_name.
rs_transport_branch-commit_text = lv_commit_text.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_to_select_from_list.
DATA: lv_pfstatus TYPE sypfkey,
lo_events TYPE REF TO cl_salv_events_table,
lo_columns TYPE REF TO cl_salv_columns_table,
lt_columns TYPE salv_t_column_ref,
ls_column TYPE salv_s_column_ref,
lo_column TYPE REF TO cl_salv_column_list,
lo_table_header TYPE REF TO cl_salv_form_text.
FIELD-SYMBOLS: <lt_table> TYPE STANDARD TABLE,
<ls_column_to_display> TYPE zif_abapgit_definitions=>ty_alv_column.
CLEAR: et_list.
create_new_table( it_list ).
ASSIGN mr_table->* TO <lt_table>.
ASSERT sy-subrc = 0.
TRY.
cl_salv_table=>factory( IMPORTING r_salv_table = mo_select_list_popup
CHANGING t_table = <lt_table> ).
CASE iv_selection_mode.
WHEN if_salv_c_selection_mode=>single.
lv_pfstatus = '110'.
WHEN OTHERS.
lv_pfstatus = '102'.
ENDCASE.
mo_select_list_popup->set_screen_status( pfstatus = lv_pfstatus
report = 'SAPMSVIM' ).
mo_select_list_popup->set_screen_popup( start_column = iv_start_column
end_column = iv_end_column
start_line = iv_start_line
end_line = iv_end_line ).
lo_events = mo_select_list_popup->get_event( ).
SET HANDLER on_select_list_link_click FOR lo_events.
SET HANDLER on_select_list_function_click FOR lo_events.
SET HANDLER on_double_click FOR lo_events.
IF iv_title CN ' _0'.
mo_select_list_popup->get_display_settings( )->set_list_header( iv_title ).
ENDIF.
IF iv_header_text CN ' _0'.
CREATE OBJECT lo_table_header
EXPORTING
text = iv_header_text.
mo_select_list_popup->set_top_of_list( lo_table_header ).
ENDIF.
mo_select_list_popup->get_display_settings( )->set_striped_pattern( iv_striped_pattern ).
mo_select_list_popup->get_selections( )->set_selection_mode( iv_selection_mode ).
lo_columns = mo_select_list_popup->get_columns( ).
lt_columns = lo_columns->get( ).
lo_columns->set_optimize( iv_optimize_col_width ).
LOOP AT lt_columns INTO ls_column.
lo_column ?= ls_column-r_column.
IF iv_selection_mode = if_salv_c_selection_mode=>multiple
AND ls_column-columnname = c_fieldname_selected.
lo_column->set_cell_type( if_salv_c_cell_type=>checkbox_hotspot ).
lo_column->set_output_length( 20 ).
lo_column->set_short_text( |{ iv_select_column_text }| ).
lo_column->set_medium_text( |{ iv_select_column_text }| ).
lo_column->set_long_text( |{ iv_select_column_text }| ).
CONTINUE.
ENDIF.
READ TABLE it_columns_to_display
ASSIGNING <ls_column_to_display>
WITH KEY name = ls_column-columnname.
CASE sy-subrc.
WHEN 0.
IF <ls_column_to_display>-text CN ' _0'.
lo_column->set_short_text( |{ <ls_column_to_display>-text }| ).
lo_column->set_medium_text( |{ <ls_column_to_display>-text }| ).
lo_column->set_long_text( |{ <ls_column_to_display>-text }| ).
ENDIF.
IF <ls_column_to_display>-length > 0.
lo_column->set_output_length( <ls_column_to_display>-length ).
ENDIF.
IF <ls_column_to_display>-show_icon = abap_true.
lo_column->set_icon( abap_true ).
ENDIF.
WHEN OTHERS.
" Hide column
lo_column->set_technical( abap_true ).
ENDCASE.
ENDLOOP.
mo_select_list_popup->display( ).
CATCH cx_salv_msg.
zcx_abapgit_exception=>raise( 'Error from POPUP_TO_SELECT_FROM_LIST' ).
ENDTRY.
IF mv_cancel = abap_true.
mv_cancel = abap_false.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
get_selected_rows( IMPORTING et_list = et_list ).
CLEAR: mo_select_list_popup,
mr_table,
mo_table_descr.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_to_select_transports.
* todo, method to be renamed, it only returns one transport
DATA: lv_trkorr TYPE e070-trkorr,
ls_trkorr LIKE LINE OF rt_trkorr.
CALL FUNCTION 'TR_F4_REQUESTS'
IMPORTING
ev_selected_request = lv_trkorr.
IF NOT lv_trkorr IS INITIAL.
ls_trkorr-trkorr = lv_trkorr.
APPEND ls_trkorr TO rt_trkorr.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_popups~popup_transport_request.
DATA: lt_e071 TYPE STANDARD TABLE OF e071,
lt_e071k TYPE STANDARD TABLE OF e071k.
CALL FUNCTION 'TRINT_ORDER_CHOICE'
EXPORTING
wi_order_type = is_transport_type-request
wi_task_type = is_transport_type-task
IMPORTING
we_order = rv_transport
TABLES
wt_e071 = lt_e071
wt_e071k = lt_e071k
EXCEPTIONS
no_correction_selected = 1
display_mode = 2
object_append_error = 3
recursive_call = 4
wrong_order_type = 5
OTHERS = 6.
IF sy-subrc = 1.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ELSEIF sy-subrc > 1.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD _popup_3_get_values.
DATA lv_answer TYPE c LENGTH 1.
FIELD-SYMBOLS: <ls_field> TYPE sval.
CALL FUNCTION 'POPUP_GET_VALUES'
EXPORTING
no_value_check = iv_no_value_check
popup_title = iv_popup_title
IMPORTING
returncode = lv_answer
TABLES
fields = ct_fields
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'Error from POPUP_GET_VALUES' ).
ENDIF.
IF lv_answer = c_answer_cancel.
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
ENDIF.
IF ev_value_1 IS SUPPLIED.
READ TABLE ct_fields INDEX 1 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_value_1 = <ls_field>-value.
ENDIF.
IF ev_value_2 IS SUPPLIED.
READ TABLE ct_fields INDEX 2 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_value_2 = <ls_field>-value.
ENDIF.
IF ev_value_3 IS SUPPLIED.
READ TABLE ct_fields INDEX 3 ASSIGNING <ls_field>.
ASSERT sy-subrc = 0.
ev_value_3 = <ls_field>-value.
ENDIF.
ENDMETHOD.
ENDCLASS. | 30.937247 | 113 | 0.632369 | {
"alnum_ratio": 0.583445117,
"alpha_token_ratio": 1.7393187635,
"avg_line_length": 30.9675785208,
"char_rep_ratio": 0.1304162849,
"max_line_length": 113,
"num_words": 2140,
"text_len": 30565,
"word_rep_ratio": 0.0553730643
} | 13,915,170,545,299,562,000 |
9191d6cab97c96a43886366b3e73b98dd2a0c6c9 | 2,291 | abap | ABAP | src/zdemo_excel46.prog.abap | AndreaBorgia-Abo/demos | 2f89e63babc3590ea44773873b7b78db549f4c7b | [
"MIT"
] | 251 | 2019-02-23T03:36:38.000Z | 2021-12-10T21:39:23.000Z | src/demos/zdemo_excel46.prog.abap | gregorwolf/abap2xlsx | 5110f924b435e23f4474381d0e43f0686b9d0421 | [
"Apache-2.0"
] | 278 | 2019-02-17T10:42:59.000Z | 2021-12-10T20:24:56.000Z | src/demos/zdemo_excel46.prog.abap | gregorwolf/abap2xlsx | 5110f924b435e23f4474381d0e43f0686b9d0421 | [
"Apache-2.0"
] | 130 | 2019-02-20T13:25:30.000Z | 2021-12-09T03:20:31.000Z | *&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL46
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel46.
CONSTANTS:
gc_ws_title_validation TYPE zexcel_sheet_title VALUE 'Validation'.
DATA:
lo_excel TYPE REF TO zcl_excel,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_range TYPE REF TO zcl_excel_range,
lv_validation_string TYPE string,
lo_data_validation TYPE REF TO zcl_excel_data_validation,
lv_row TYPE zexcel_cell_row.
CONSTANTS:
gc_save_file_name TYPE string VALUE '46_ValidationWarning.xlsx'.
INCLUDE zdemo_excel_outputopt_incl.
START-OF-SELECTION.
*** Sheet Validation
* Creates active sheet
CREATE OBJECT lo_excel.
* Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
* Set sheet name "Validation"
lo_worksheet->set_title( gc_ws_title_validation ).
* short validations can be entered as string (<254Char)
lv_validation_string = '"New York, Rio, Tokyo"'.
* create validation object
lo_data_validation = lo_worksheet->add_new_data_validation( ).
* create new validation from validation string
lo_data_validation->type = zcl_excel_data_validation=>c_type_list.
lo_data_validation->formula1 = lv_validation_string.
lo_data_validation->cell_row = 2.
lo_data_validation->cell_row_to = 4.
lo_data_validation->cell_column = 'A'.
lo_data_validation->cell_column_to = 'A'.
lo_data_validation->allowblank = 'X'.
lo_data_validation->showdropdown = 'X'.
lo_data_validation->prompttitle = 'Value list available'.
lo_data_validation->prompt = 'Please select a value from the value list'.
lo_data_validation->errorstyle = zcl_excel_data_validation=>c_style_warning.
lo_data_validation->errortitle = 'Warning'.
lo_data_validation->error = 'This value does not exist in current value list.'.
* add some fields with validation
lv_row = 2.
WHILE lv_row <= 4.
lo_worksheet->set_cell( ip_row = lv_row ip_column = 'A' ip_value = 'Select' ).
lv_row = lv_row + 1.
ENDWHILE.
*** Create output
lcl_output=>output( lo_excel ). | 31.819444 | 90 | 0.657355 | {
"alnum_ratio": 0.6113537118,
"alpha_token_ratio": 1.9050894085,
"avg_line_length": 32.2535211268,
"char_rep_ratio": 0.2463831653,
"max_line_length": 90,
"num_words": 152,
"text_len": 2290,
"word_rep_ratio": 0
} | 7,039,340,111,847,766,000 |
91a5612cbc92a969a0e4121dada7ffbfecebd271 | 2,217 | abap | ABAP | src/repo/zif_abapgit_repo.intf.abap | ed-holland/abapGit | 380508d72c02f37f15344165411fc5a145f73e72 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/repo/zif_abapgit_repo.intf.abap | ed-holland/abapGit | 380508d72c02f37f15344165411fc5a145f73e72 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/repo/zif_abapgit_repo.intf.abap | ed-holland/abapGit | 380508d72c02f37f15344165411fc5a145f73e72 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | INTERFACE zif_abapgit_repo
PUBLIC .
DATA ms_data TYPE zif_abapgit_persistence=>ty_repo READ-ONLY.
METHODS get_key
RETURNING
VALUE(rv_key) TYPE zif_abapgit_persistence=>ty_value .
METHODS get_name
RETURNING
VALUE(rv_name) TYPE string
RAISING
zcx_abapgit_exception .
METHODS is_offline
RETURNING
VALUE(rv_offline) TYPE abap_bool .
METHODS get_package
RETURNING
VALUE(rv_package) TYPE zif_abapgit_persistence=>ty_repo-package .
METHODS get_local_settings
RETURNING
VALUE(rs_settings) TYPE zif_abapgit_persistence=>ty_repo-local_settings .
METHODS get_files_local
IMPORTING
!ii_log TYPE REF TO zif_abapgit_log OPTIONAL
!ii_obj_filter TYPE REF TO zif_abapgit_object_filter OPTIONAL
RETURNING
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_item_tt
RAISING
zcx_abapgit_exception .
METHODS get_files_remote
IMPORTING
!ii_obj_filter TYPE REF TO zif_abapgit_object_filter OPTIONAL
!iv_ignore_files TYPE abap_bool DEFAULT abap_false
PREFERRED PARAMETER ii_obj_filter
RETURNING
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt
RAISING
zcx_abapgit_exception .
METHODS refresh
IMPORTING
!iv_drop_cache TYPE abap_bool DEFAULT abap_false
!iv_drop_log TYPE abap_bool DEFAULT abap_true
PREFERRED PARAMETER iv_drop_cache
RAISING
zcx_abapgit_exception .
METHODS get_dot_abapgit
RETURNING
VALUE(ro_dot_abapgit) TYPE REF TO zcl_abapgit_dot_abapgit .
METHODS set_dot_abapgit
IMPORTING
!io_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit
RAISING
zcx_abapgit_exception .
METHODS deserialize
IMPORTING
!is_checks TYPE zif_abapgit_definitions=>ty_deserialize_checks
!ii_log TYPE REF TO zif_abapgit_log
RAISING
zcx_abapgit_exception .
METHODS deserialize_checks
RETURNING
VALUE(rs_checks) TYPE zif_abapgit_definitions=>ty_deserialize_checks
RAISING
zcx_abapgit_exception .
METHODS checksums
RETURNING
VALUE(ri_checksums) TYPE REF TO zif_abapgit_repo_checksums
RAISING
zcx_abapgit_exception .
ENDINTERFACE. | 29.56 | 79 | 0.751015 | {
"alnum_ratio": 0.6972021661,
"alpha_token_ratio": 1.9581749049,
"avg_line_length": 29.9459459459,
"char_rep_ratio": 0.1567739012,
"max_line_length": 79,
"num_words": 152,
"text_len": 2216,
"word_rep_ratio": 0
} | 3,429,340,617,020,181,000 |
91b8c4dd3551c3c81b5562a0e0f052ef898b0390 | 6,178 | abap | ABAP | src/objects/zcl_abapgit_object_susc.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/objects/zcl_abapgit_object_susc.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/objects/zcl_abapgit_object_susc.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_object_susc DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
PROTECTED SECTION.
CONSTANTS transobjecttype_class TYPE c LENGTH 1 VALUE 'C' ##NO_TEXT.
METHODS has_authorization
IMPORTING
!iv_class TYPE tobc-oclss
!iv_activity TYPE activ_auth
RAISING
zcx_abapgit_exception .
METHODS is_used
IMPORTING
!iv_auth_object_class TYPE tobc-oclss
RAISING
zcx_abapgit_exception .
PRIVATE SECTION.
METHODS delete_class
IMPORTING
!iv_auth_object_class TYPE tobc-oclss .
METHODS put_delete_to_transport
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS zcl_abapgit_object_susc IMPLEMENTATION.
METHOD delete_class.
DELETE FROM tobc WHERE oclss = iv_auth_object_class.
DELETE FROM tobct WHERE oclss = iv_auth_object_class.
ENDMETHOD.
METHOD has_authorization.
AUTHORITY-CHECK OBJECT 'S_DEVELOP'
ID 'DEVCLASS' DUMMY
ID 'OBJTYPE' FIELD 'SUSC'
ID 'OBJNAME' FIELD iv_class
ID 'P_GROUP' DUMMY
ID 'ACTVT' FIELD iv_activity.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( iv_msgid = '01'
iv_msgno = '467' ).
ENDIF.
ENDMETHOD.
METHOD is_used.
DATA: lv_used_auth_object_class TYPE tobc-oclss.
SELECT SINGLE oclss
FROM tobj
INTO lv_used_auth_object_class
WHERE oclss = iv_auth_object_class ##WARN_OK.
IF sy-subrc = 0.
zcx_abapgit_exception=>raise_t100( iv_msgid = '01'
iv_msgno = '212'
iv_msgv1 = |{ iv_auth_object_class }| ).
ENDIF.
ENDMETHOD.
METHOD put_delete_to_transport.
DATA: lv_tr_object_name TYPE e071-obj_name,
lv_tr_return TYPE char1,
ls_package_info TYPE tdevc,
lv_tadir_object TYPE tadir-object,
lv_tadir_obj_name TYPE tadir-obj_name.
lv_tr_object_name = ms_item-obj_name.
CALL FUNCTION 'SUSR_COMMEDITCHECK'
EXPORTING
objectname = lv_tr_object_name
transobjecttype = transobjecttype_class
IMPORTING
return_from_korr = lv_tr_return.
IF lv_tr_return <> 'M'.
zcx_abapgit_exception=>raise( |error in SUSC delete at SUSR_COMMEDITCHECK| ).
ENDIF.
CALL FUNCTION 'TR_DEVCLASS_GET'
EXPORTING
iv_devclass = ms_item-devclass
IMPORTING
es_tdevc = ls_package_info
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0 AND ls_package_info-korrflag IS INITIAL.
lv_tadir_object = ms_item-obj_type.
lv_tadir_obj_name = lv_tr_object_name.
CALL FUNCTION 'TR_TADIR_INTERFACE'
EXPORTING
wi_delete_tadir_entry = abap_true
wi_test_modus = space
wi_tadir_pgmid = 'R3TR'
wi_tadir_object = lv_tadir_object
wi_tadir_obj_name = lv_tadir_obj_name
EXCEPTIONS
OTHERS = 0.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD zif_abapgit_object~delete.
CONSTANTS lc_activity_delete_06 TYPE activ_auth VALUE '06'.
DATA: lv_auth_object_class TYPE tobc-oclss.
lv_auth_object_class = ms_item-obj_name.
TRY.
IF zif_abapgit_object~exists( ) = abap_false.
RETURN.
ENDIF.
CATCH zcx_abapgit_exception.
RETURN.
ENDTRY.
has_authorization( iv_class = lv_auth_object_class
iv_activity = lc_activity_delete_06 ).
is_used( lv_auth_object_class ).
delete_class( lv_auth_object_class ).
put_delete_to_transport( ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
* see function group SUSA
DATA: ls_tobc TYPE tobc,
lv_objectname TYPE e071-obj_name,
ls_tobct TYPE tobct.
io_xml->read( EXPORTING iv_name = 'TOBC'
CHANGING cg_data = ls_tobc ).
io_xml->read( EXPORTING iv_name = 'TOBCT'
CHANGING cg_data = ls_tobct ).
tadir_insert( iv_package ).
lv_objectname = ms_item-obj_name.
CALL FUNCTION 'SUSR_COMMEDITCHECK'
EXPORTING
objectname = lv_objectname
transobjecttype = transobjecttype_class.
INSERT tobc FROM ls_tobc. "#EC CI_SUBRC
* ignore sy-subrc as all fields are key fields
MODIFY tobct FROM ls_tobct. "#EC CI_SUBRC
ASSERT sy-subrc = 0.
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_oclss TYPE tobc-oclss.
SELECT SINGLE oclss FROM tobc INTO lv_oclss
WHERE oclss = ms_item-obj_name.
rv_bool = boolc( sy-subrc = 0 ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
rs_metadata-delete_tadir = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
DATA: lv_objclass TYPE tobc-oclss.
lv_objclass = ms_item-obj_name.
CALL FUNCTION 'SUSR_SHOW_OBJECT_CLASS'
EXPORTING
objclass = lv_objclass.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: ls_tobc TYPE tobc,
ls_tobct TYPE tobct.
SELECT SINGLE * FROM tobc INTO ls_tobc
WHERE oclss = ms_item-obj_name.
IF sy-subrc <> 0.
RETURN.
ENDIF.
SELECT SINGLE * FROM tobct INTO ls_tobct
WHERE oclss = ms_item-obj_name
AND langu = mv_language.
io_xml->add( iv_name = 'TOBC'
ig_data = ls_tobc ).
io_xml->add( iv_name = 'TOBCT'
ig_data = ls_tobct ).
ENDMETHOD.
ENDCLASS. | 23.670498 | 96 | 0.649887 | {
"alnum_ratio": 0.6030435486,
"alpha_token_ratio": 1.691142726,
"avg_line_length": 23.7576923077,
"char_rep_ratio": 0.1605058366,
"max_line_length": 96,
"num_words": 427,
"text_len": 6177,
"word_rep_ratio": 0
} | 16,158,078,642,340,758,000 |
91ec5fbee3c1b005579bc94aa276d063d171bbed | 2,496 | abap | ABAP | src/checks/zcl_aoc_check_63.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_63.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_63.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | CLASS zcl_aoc_check_63 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super_root
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor .
METHODS run
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_AOC_CHECK_63 IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
version = '001'.
position = '063'.
has_documentation = abap_true.
has_attributes = abap_true.
attributes_ok = abap_true.
add_obj_type( 'CLAS' ).
add_obj_type( 'INTF' ).
insert_scimessage(
iv_code = '003'
iv_text = '&1'(m01) ).
ENDMETHOD.
METHOD run.
* abapOpenChecks
*
* MIT License
DATA: lo_instance TYPE REF TO object,
lr_data TYPE REF TO data.
FIELD-SYMBOLS: <lt_log> TYPE STANDARD TABLE,
<lv_type> TYPE string,
<lv_text> TYPE string,
<lg_log> TYPE any.
IF object_type <> 'CLAS' AND object_type <> 'INTF'.
RETURN.
ENDIF.
TRY.
CREATE DATA lr_data TYPE ('CL_SEDI_ABAP_DOC_LOGGER=>TY_LOG_TAB').
ASSIGN lr_data->* TO <lt_log>.
CATCH cx_root ##CATCH_ALL.
RETURN.
ENDTRY.
CALL METHOD ('CL_SEDI_ABAP_DOC_READ_ELEMINFO')=>('CREATE_INSTANCE')
RECEIVING
result = lo_instance.
CASE object_type.
WHEN 'INTF'.
CALL METHOD lo_instance->('READ_EI_GLOBAL_INTERFACE')
EXPORTING
interface_name = object_name
IMPORTING
read_log = <lt_log>.
WHEN 'CLAS'.
CALL METHOD lo_instance->('READ_EI_GLOBAL_CLASS')
EXPORTING
class_name = object_name
IMPORTING
read_log = <lt_log>.
WHEN OTHERS.
ASSERT 0 = 1.
ENDCASE.
LOOP AT <lt_log> ASSIGNING <lg_log>.
ASSIGN COMPONENT 'TYPE' OF STRUCTURE <lg_log> TO <lv_type>.
ASSERT sy-subrc = 0.
IF <lv_type> = 'E'.
ASSIGN COMPONENT 'TEXT' OF STRUCTURE <lg_log> TO <lv_text>.
ASSERT sy-subrc = 0.
IF <lv_text> CP 'active version cannot be read*'.
CONTINUE.
ENDIF.
inform( p_sub_obj_type = object_type
p_sub_obj_name = object_name
p_kind = mv_errty
p_test = myname
p_code = '001'
p_param_1 = <lv_text> ).
ENDIF.
ENDLOOP.
ENDMETHOD.
ENDCLASS. | 22.486486 | 73 | 0.576923 | {
"alnum_ratio": 0.5368635438,
"alpha_token_ratio": 1.5590361446,
"avg_line_length": 22.3181818182,
"char_rep_ratio": 0.1099754702,
"max_line_length": 73,
"num_words": 185,
"text_len": 2455,
"word_rep_ratio": 0
} | 5,173,988,245,629,611,000 |
623da8f34373d280f78b1e07389e5916610dc5dc | 12,242 | abap | ABAP | src/zcx_abapgit_exception.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/zcx_abapgit_exception.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/zcx_abapgit_exception.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | "! abapGit general error
CLASS zcx_abapgit_exception DEFINITION
PUBLIC
INHERITING FROM cx_static_check
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_t100_message .
CONSTANTS:
BEGIN OF c_section_text,
cause TYPE string VALUE `Cause`,
system_response TYPE string VALUE `System response`,
what_to_do TYPE string VALUE `Procedure`,
sys_admin TYPE string VALUE `System administration`,
END OF c_section_text .
CONSTANTS:
BEGIN OF c_section_token,
cause TYPE string VALUE `&CAUSE&`,
system_response TYPE string VALUE `&SYSTEM_RESPONSE&`,
what_to_do TYPE string VALUE `&WHAT_TO_DO&`,
sys_admin TYPE string VALUE `&SYS_ADMIN&`,
END OF c_section_token .
DATA msgv1 TYPE symsgv READ-ONLY .
DATA msgv2 TYPE symsgv READ-ONLY .
DATA msgv3 TYPE symsgv READ-ONLY .
DATA msgv4 TYPE symsgv READ-ONLY .
DATA mt_callstack TYPE abap_callstack READ-ONLY .
DATA mi_log TYPE REF TO zif_abapgit_log READ-ONLY.
"! Raise exception with text
"! @parameter iv_text | Text
"! @parameter ix_previous | Previous exception
"! @raising zcx_abapgit_exception | Exception
CLASS-METHODS raise
IMPORTING
!iv_text TYPE clike
!ix_previous TYPE REF TO cx_root OPTIONAL
!ii_log TYPE REF TO zif_abapgit_log OPTIONAL
RAISING
zcx_abapgit_exception .
"! Raise exception with T100 message
"! <p>
"! Will default to sy-msg* variables. These need to be set right before calling this method.
"! </p>
"! @parameter iv_msgid | Message ID
"! @parameter iv_msgno | Message number
"! @parameter iv_msgv1 | Message variable 1
"! @parameter iv_msgv2 | Message variable 2
"! @parameter iv_msgv3 | Message variable 3
"! @parameter iv_msgv4 | Message variable 4
"! @raising zcx_abapgit_exception | Exception
CLASS-METHODS raise_t100
IMPORTING
VALUE(iv_msgid) TYPE symsgid DEFAULT sy-msgid
VALUE(iv_msgno) TYPE symsgno DEFAULT sy-msgno
VALUE(iv_msgv1) TYPE symsgv DEFAULT sy-msgv1
VALUE(iv_msgv2) TYPE symsgv DEFAULT sy-msgv2
VALUE(iv_msgv3) TYPE symsgv DEFAULT sy-msgv3
VALUE(iv_msgv4) TYPE symsgv DEFAULT sy-msgv4
!ii_log TYPE REF TO zif_abapgit_log OPTIONAL
!ix_previous TYPE REF TO cx_root OPTIONAL
RAISING
zcx_abapgit_exception .
CLASS-METHODS raise_with_text
IMPORTING
!ix_previous TYPE REF TO cx_root
RAISING
zcx_abapgit_exception .
METHODS constructor
IMPORTING
!textid LIKE if_t100_message=>t100key OPTIONAL
!previous LIKE previous OPTIONAL
!ii_log TYPE REF TO zif_abapgit_log OPTIONAL
!msgv1 TYPE symsgv OPTIONAL
!msgv2 TYPE symsgv OPTIONAL
!msgv3 TYPE symsgv OPTIONAL
!msgv4 TYPE symsgv OPTIONAL .
METHODS get_source_position
REDEFINITION .
METHODS if_message~get_longtext
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS c_generic_error_msg TYPE string VALUE `An error occured (ZCX_ABAPGIT_EXCEPTION)` ##NO_TEXT.
CLASS-METHODS split_text_to_symsg
IMPORTING
!iv_text TYPE string
RETURNING
VALUE(rs_msg) TYPE symsg .
METHODS save_callstack .
METHODS itf_to_string
IMPORTING
!it_itf TYPE tline_tab
RETURNING
VALUE(rv_result) TYPE string .
METHODS get_t100_longtext_itf
RETURNING
VALUE(rt_itf) TYPE tline_tab .
METHODS remove_empty_section
IMPORTING
!iv_tabix_from TYPE i
!iv_tabix_to TYPE i
CHANGING
!ct_itf TYPE tline_tab .
METHODS replace_section_head_with_text
CHANGING
!cs_itf TYPE tline .
ENDCLASS.
CLASS ZCX_ABAPGIT_EXCEPTION IMPLEMENTATION.
METHOD constructor ##ADT_SUPPRESS_GENERATION.
super->constructor( previous = previous ).
me->msgv1 = msgv1.
me->msgv2 = msgv2.
me->msgv3 = msgv3.
me->msgv4 = msgv4.
me->mi_log = ii_log.
CLEAR me->textid.
IF textid IS INITIAL.
if_t100_message~t100key = if_t100_message=>default_textid.
ELSE.
if_t100_message~t100key = textid.
ENDIF.
save_callstack( ).
ENDMETHOD.
METHOD get_source_position.
FIELD-SYMBOLS: <ls_callstack> TYPE abap_callstack_line.
READ TABLE mt_callstack ASSIGNING <ls_callstack>
INDEX 1.
IF sy-subrc = 0.
program_name = <ls_callstack>-mainprogram.
include_name = <ls_callstack>-include.
source_line = <ls_callstack>-line.
ELSE.
super->get_source_position(
IMPORTING
program_name = program_name
include_name = include_name
source_line = source_line ).
ENDIF.
ENDMETHOD.
METHOD get_t100_longtext_itf.
DATA: lv_docu_key TYPE doku_obj.
FIELD-SYMBOLS <lv_msgv> TYPE any.
lv_docu_key = if_t100_message~t100key-msgid && if_t100_message~t100key-msgno.
CALL FUNCTION 'DOCU_GET'
EXPORTING
id = 'NA'
langu = sy-langu
object = lv_docu_key
typ = 'E'
TABLES
line = rt_itf
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
ASSIGN me->(if_t100_message~t100key-attr1) TO <lv_msgv>.
IF sy-subrc = 0.
REPLACE ALL OCCURRENCES OF '&V1&' IN TABLE rt_itf WITH <lv_msgv>.
ENDIF.
ASSIGN me->(if_t100_message~t100key-attr2) TO <lv_msgv>.
IF sy-subrc = 0.
REPLACE ALL OCCURRENCES OF '&V2&' IN TABLE rt_itf WITH <lv_msgv>.
ENDIF.
ASSIGN me->(if_t100_message~t100key-attr3) TO <lv_msgv>.
IF sy-subrc = 0.
REPLACE ALL OCCURRENCES OF '&V3&' IN TABLE rt_itf WITH <lv_msgv>.
ENDIF.
ASSIGN me->(if_t100_message~t100key-attr4) TO <lv_msgv>.
IF sy-subrc = 0.
REPLACE ALL OCCURRENCES OF '&V4&' IN TABLE rt_itf WITH <lv_msgv>.
ENDIF.
ENDIF.
ENDMETHOD.
METHOD if_message~get_longtext.
result = super->get_longtext( ).
IF if_t100_message~t100key IS NOT INITIAL.
result = itf_to_string( get_t100_longtext_itf( ) ).
ENDIF.
ENDMETHOD.
METHOD itf_to_string.
CONSTANTS: lc_format_section TYPE string VALUE 'U1'.
DATA:
lt_stream TYPE TABLE OF tdline,
lt_string TYPE TABLE OF string,
lv_string LIKE LINE OF lt_string,
lt_itf TYPE tline_tab,
lv_has_content TYPE abap_bool,
lv_tabix_from TYPE syst-tabix,
lv_tabix_to TYPE syst-tabix.
FIELD-SYMBOLS: <ls_itf_section> TYPE tline,
<ls_itf_section_item> TYPE tline.
lt_itf = it_itf.
" You should remember that we replace the U1 format because
" that preserves the section header of longtexts.
LOOP AT lt_itf ASSIGNING <ls_itf_section>
WHERE tdformat = lc_format_section.
CLEAR:
lv_has_content,
lv_tabix_to.
lv_tabix_from = sy-tabix.
LOOP AT lt_itf ASSIGNING <ls_itf_section_item>
FROM sy-tabix + 1.
IF <ls_itf_section_item>-tdformat = lc_format_section.
lv_tabix_to = sy-tabix.
EXIT.
ELSEIF <ls_itf_section_item>-tdline IS NOT INITIAL.
lv_has_content = abap_true.
ENDIF.
ENDLOOP.
IF lv_has_content = abap_false.
remove_empty_section(
EXPORTING
iv_tabix_from = lv_tabix_from
iv_tabix_to = lv_tabix_to
CHANGING
ct_itf = lt_itf ).
CONTINUE.
ENDIF.
replace_section_head_with_text( CHANGING cs_itf = <ls_itf_section> ).
ENDLOOP.
CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
EXPORTING
lf = 'X'
IMPORTING
stream_lines = lt_string
TABLES
itf_text = lt_itf
text_stream = lt_stream.
LOOP AT lt_string INTO lv_string.
IF sy-tabix = 1.
rv_result = lv_string.
ELSE.
CONCATENATE rv_result lv_string
INTO rv_result
SEPARATED BY cl_abap_char_utilities=>newline.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD raise.
DATA lv_text TYPE string.
IF iv_text IS INITIAL.
lv_text = c_generic_error_msg.
ELSE.
lv_text = iv_text.
ENDIF.
split_text_to_symsg( lv_text ).
raise_t100(
ii_log = ii_log
ix_previous = ix_previous ).
ENDMETHOD.
METHOD raise_t100.
DATA: ls_t100_key TYPE scx_t100key.
ls_t100_key-msgid = iv_msgid.
ls_t100_key-msgno = iv_msgno.
ls_t100_key-attr1 = 'MSGV1'.
ls_t100_key-attr2 = 'MSGV2'.
ls_t100_key-attr3 = 'MSGV3'.
ls_t100_key-attr4 = 'MSGV4'.
IF iv_msgid IS INITIAL.
CLEAR ls_t100_key.
ENDIF.
RAISE EXCEPTION TYPE zcx_abapgit_exception
EXPORTING
textid = ls_t100_key
ii_log = ii_log
msgv1 = iv_msgv1
msgv2 = iv_msgv2
msgv3 = iv_msgv3
msgv4 = iv_msgv4
previous = ix_previous.
ENDMETHOD.
METHOD raise_with_text.
raise(
iv_text = ix_previous->get_text( )
ix_previous = ix_previous ).
ENDMETHOD.
METHOD remove_empty_section.
IF iv_tabix_to BETWEEN iv_tabix_from AND lines( ct_itf ).
DELETE ct_itf FROM iv_tabix_from TO iv_tabix_to.
ELSE.
DELETE ct_itf FROM iv_tabix_from.
ENDIF.
ENDMETHOD.
METHOD replace_section_head_with_text.
CASE cs_itf-tdline.
WHEN c_section_token-cause.
cs_itf-tdline = c_section_text-cause.
WHEN c_section_token-system_response.
cs_itf-tdline = c_section_text-system_response.
WHEN c_section_token-what_to_do.
cs_itf-tdline = c_section_text-what_to_do.
WHEN c_section_token-sys_admin.
cs_itf-tdline = c_section_text-sys_admin.
ENDCASE.
ENDMETHOD.
METHOD save_callstack.
FIELD-SYMBOLS: <ls_callstack> TYPE abap_callstack_line.
CALL FUNCTION 'SYSTEM_CALLSTACK'
IMPORTING
callstack = mt_callstack.
" You should remember that the first lines are from zcx_abapgit_exception
" and are removed so that highest level in the callstack is the position where
" the exception is raised.
"
" For the merged report it's hard to do that, because zcx_abapgit_exception
" isn't visible in the callstack. Therefore we have to check the Events.
LOOP AT mt_callstack ASSIGNING <ls_callstack>.
IF <ls_callstack>-mainprogram CP |ZCX_ABAPGIT_EXCEPTION*| " full
OR <ls_callstack>-blockname = `SAVE_CALLSTACK` " merged
OR <ls_callstack>-blockname = `CONSTRUCTOR` " merged
OR <ls_callstack>-blockname CP `RAISE*`. "merged
DELETE TABLE mt_callstack FROM <ls_callstack>.
ELSE.
EXIT.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD split_text_to_symsg.
CONSTANTS:
lc_length_of_msgv TYPE i VALUE 50,
lc_offset_of_last_character TYPE i VALUE 49.
DATA:
lv_text TYPE c LENGTH 200,
lv_rest TYPE c LENGTH 200,
ls_msg TYPE symsg,
lv_msg_var TYPE c LENGTH lc_length_of_msgv,
lv_index TYPE sy-index.
lv_text = iv_text.
DO 4 TIMES.
lv_index = sy-index.
CALL FUNCTION 'TEXT_SPLIT'
EXPORTING
length = lc_length_of_msgv
text = lv_text
IMPORTING
line = lv_msg_var
rest = lv_rest.
IF lv_msg_var+lc_offset_of_last_character(1) = space OR
lv_text+lc_length_of_msgv(1) = space.
" keep the space at the beginning of the rest
" because otherwise it's lost
lv_rest = | { lv_rest }|.
ENDIF.
lv_text = lv_rest.
CASE lv_index.
WHEN 1.
ls_msg-msgv1 = lv_msg_var.
WHEN 2.
ls_msg-msgv2 = lv_msg_var.
WHEN 3.
ls_msg-msgv3 = lv_msg_var.
WHEN 4.
ls_msg-msgv4 = lv_msg_var.
ENDCASE.
ENDDO.
" Set syst using generic error message
MESSAGE e001(00) WITH ls_msg-msgv1 ls_msg-msgv2 ls_msg-msgv3 ls_msg-msgv4 INTO sy-lisel.
rs_msg = ls_msg.
ENDMETHOD.
ENDCLASS. | 26.729258 | 105 | 0.641889 | {
"alnum_ratio": 0.6028102279,
"alpha_token_ratio": 1.6641114983,
"avg_line_length": 26.7855579869,
"char_rep_ratio": 0.0961412688,
"max_line_length": 105,
"num_words": 1002,
"text_len": 12241,
"word_rep_ratio": 0.0966767372
} | 3,726,131,499,137,994,000 |
627a1892c3614e04cae691279f68295d346edf76 | 403 | abap | ABAP | src/ui/zif_abapgit_services_git.intf.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/ui/zif_abapgit_services_git.intf.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/ui/zif_abapgit_services_git.intf.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | INTERFACE zif_abapgit_services_git PUBLIC.
TYPES:
BEGIN OF ty_commit_fields,
repo_key TYPE zif_abapgit_persistence=>ty_repo-key,
committer_name TYPE string,
committer_email TYPE string,
author_name TYPE string,
author_email TYPE string,
comment TYPE string,
body TYPE string,
END OF ty_commit_fields.
ENDINTERFACE. | 26.866667 | 64 | 0.665012 | {
"alnum_ratio": 0.6293532338,
"alpha_token_ratio": 2.1083333333,
"avg_line_length": 28.7142857143,
"char_rep_ratio": 0.213740458,
"max_line_length": 64,
"num_words": 32,
"text_len": 402,
"word_rep_ratio": 0
} | 13,985,593,617,943,566,000 |
628b85a0b5cc9f0e0530f74c8db6324ec99de694 | 691 | abap | ABAP | src/zif_abapgit_auth.intf.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/zif_abapgit_auth.intf.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/zif_abapgit_auth.intf.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | INTERFACE zif_abapgit_auth PUBLIC.
TYPES: ty_authorization TYPE string.
CONSTANTS: BEGIN OF c_authorization,
uninstall TYPE ty_authorization VALUE 'UNINSTALL',
create_repo TYPE ty_authorization VALUE 'CREATE_REPO',
transport_to_branch TYPE ty_authorization VALUE 'TRANSPORT_TO_BRANCH',
update_local_checksum TYPE ty_authorization VALUE 'UPDATE_LOCAL_CHECKSUM',
END OF c_authorization.
METHODS:
is_allowed
IMPORTING iv_authorization TYPE ty_authorization
iv_param TYPE string OPTIONAL
RETURNING VALUE(rv_allowed) TYPE abap_bool.
ENDINTERFACE. | 36.368421 | 89 | 0.680174 | {
"alnum_ratio": 0.6449275362,
"alpha_token_ratio": 2.3298429319,
"avg_line_length": 38.3333333333,
"char_rep_ratio": 0.2452276065,
"max_line_length": 89,
"num_words": 49,
"text_len": 690,
"word_rep_ratio": 0
} | 2,940,562,873,273,869,000 |
62aff69b0023e0d0ff6f8437ecd6d71b6a8876de | 3,700 | abap | ABAP | src/checks/zcl_aoc_check_07.clas.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_07.clas.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_07.clas.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | CLASS zcl_aoc_check_07 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super
CREATE PUBLIC.
PUBLIC SECTION.
METHODS constructor.
METHODS check
REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_aoc_check_07 IMPLEMENTATION.
METHOD check.
* abapOpenChecks
*
* MIT License
DATA: lv_position TYPE i,
lv_token LIKE sy-tabix,
lv_include TYPE sobj_name.
FIELD-SYMBOLS: <ls_token> LIKE LINE OF io_scan->tokens,
<ls_token1> LIKE LINE OF io_scan->tokens,
<ls_token2> LIKE LINE OF io_scan->tokens,
<ls_token3> LIKE LINE OF io_scan->tokens,
<ls_statement> LIKE LINE OF io_scan->statements.
LOOP AT io_scan->statements ASSIGNING <ls_statement>
WHERE type = io_scan->gc_statement-standard
OR type = io_scan->gc_statement-method_direct.
lv_position = sy-tabix.
lv_token = <ls_statement>-from.
READ TABLE io_scan->tokens ASSIGNING <ls_token1> INDEX lv_token.
IF sy-subrc <> 0.
CONTINUE. " current loop
ENDIF.
lv_token = lv_token + 1.
READ TABLE io_scan->tokens ASSIGNING <ls_token2> INDEX lv_token.
IF sy-subrc <> 0.
CONTINUE. " current loop
ENDIF.
lv_token = lv_token + 1.
READ TABLE io_scan->tokens ASSIGNING <ls_token3> INDEX lv_token.
IF sy-subrc <> 0.
CONTINUE. " current loop
ENDIF.
IF <ls_token3>-str CP '*>(*'
OR <ls_token3>-str CP '*)=>*'
OR <ls_token3>-str CP '*)->*'
OR <ls_token3>-str CP '(*'
OR <ls_token3>-str = 'OF'.
* allow dynamic calls and OLE interaction
CONTINUE.
ENDIF.
LOOP AT io_scan->tokens ASSIGNING <ls_token>
FROM <ls_statement>-from TO <ls_statement>-to
WHERE str = 'RECEIVING'
AND type = io_scan->gc_token-identifier.
IF <ls_token1>-str = 'CALL' OR <ls_token2>-str = 'BADI'.
EXIT.
ENDIF.
* allow if old style exceptions are part of method
LOOP AT io_scan->tokens TRANSPORTING NO FIELDS
FROM <ls_statement>-from TO <ls_statement>-to
WHERE str = 'EXCEPTIONS'
AND type = io_scan->gc_token-identifier.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
EXIT. " current loop
ENDIF.
lv_include = io_scan->get_include( <ls_statement>-level ).
inform( p_sub_obj_name = lv_include
p_position = lv_position
p_line = <ls_token>-row
p_kind = mv_errty
p_test = myname
p_code = '002' ).
ENDLOOP.
IF <ls_token1>-str <> 'CALL' OR <ls_token2>-str <> 'METHOD'.
CONTINUE. " current loop
ENDIF.
lv_include = io_scan->get_include( <ls_statement>-level ).
inform( p_sub_obj_name = lv_include
p_position = lv_position
p_line = <ls_token1>-row
p_kind = mv_errty
p_test = myname
p_code = '001' ).
ENDLOOP.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
version = '001'.
position = '007'.
has_attributes = abap_true.
attributes_ok = abap_true.
enable_rfc( ).
enable_checksum( ).
insert_scimessage(
iv_code = '001'
iv_text = 'Use functional writing style'(m01) ).
insert_scimessage(
iv_code = '002'
iv_text = 'Use functional writing style instead of RECEIVING'(m02) ).
ENDMETHOD.
ENDCLASS. | 27.205882 | 77 | 0.576216 | {
"alnum_ratio": 0.5435911451,
"alpha_token_ratio": 1.6365935919,
"avg_line_length": 27.1037037037,
"char_rep_ratio": 0.1331506849,
"max_line_length": 77,
"num_words": 275,
"text_len": 3659,
"word_rep_ratio": 0.1992481203
} | 4,890,243,343,940,433,000 |
62e925b386e7b1af4f341aac930aa72003a69293 | 2,289 | abap | ABAP | src/checks/zcl_aoc_check_18.clas.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_18.clas.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_18.clas.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | CLASS zcl_aoc_check_18 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super
CREATE PUBLIC.
PUBLIC SECTION.
METHODS constructor.
METHODS check
REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_aoc_check_18 IMPLEMENTATION.
METHOD check.
* abapOpenChecks
*
* MIT License
DATA: lv_include TYPE program,
lv_found TYPE abap_bool.
FIELD-SYMBOLS: <ls_structure> LIKE LINE OF io_scan->structures,
<ls_token> LIKE LINE OF io_scan->tokens,
<ls_statement> LIKE LINE OF io_scan->statements.
LOOP AT io_scan->structures ASSIGNING <ls_structure>
WHERE type = io_scan->gc_structure-condition.
lv_found = abap_false.
LOOP AT io_scan->statements ASSIGNING <ls_statement>
FROM <ls_structure>-stmnt_from TO <ls_structure>-stmnt_to.
READ TABLE io_scan->tokens ASSIGNING <ls_token> INDEX <ls_statement>-from.
IF sy-subrc <> 0 OR <ls_token>-type = io_scan->gc_token-comment.
CONTINUE.
ENDIF.
CASE <ls_token>-str.
WHEN 'WHEN' OR 'ELSEIF' OR 'ELSE'.
CONTINUE.
WHEN OTHERS.
lv_found = abap_true.
EXIT.
ENDCASE.
ENDLOOP.
IF lv_found = abap_false.
READ TABLE io_scan->statements ASSIGNING <ls_statement> INDEX <ls_structure>-stmnt_from.
CHECK sy-subrc = 0.
READ TABLE io_scan->tokens ASSIGNING <ls_token> INDEX <ls_statement>-from.
CHECK sy-subrc = 0.
lv_include = io_scan->get_include( <ls_statement>-level ).
inform( p_sub_obj_name = lv_include
p_position = <ls_structure>-stmnt_from
p_line = <ls_token>-row
p_kind = mv_errty
p_test = myname
p_code = '001' ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
version = '001'.
position = '018'.
has_attributes = abap_true.
attributes_ok = abap_true.
enable_rfc( ).
enable_checksum( ).
insert_scimessage(
iv_code = '001'
iv_text = 'Empty branch'(m01) ).
ENDMETHOD.
ENDCLASS. | 23.84375 | 96 | 0.606815 | {
"alnum_ratio": 0.5702846975,
"alpha_token_ratio": 1.7297668038,
"avg_line_length": 23.6631578947,
"char_rep_ratio": 0.1290754801,
"max_line_length": 96,
"num_words": 158,
"text_len": 2248,
"word_rep_ratio": 0
} | 1,195,441,154,507,682,800 |
1a0a9d15d1aede8a1bf4c7493b2738883aa0fb30 | 1,451 | abap | ABAP | src/data/zif_abapgit_data_config.intf.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/data/zif_abapgit_data_config.intf.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/data/zif_abapgit_data_config.intf.abap | wangdongcheng/abapGit | 7cf4e4b5fe718cb95d12d0a439aa9f2cfb128eab | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | INTERFACE zif_abapgit_data_config
PUBLIC .
TYPES:
ty_data_type TYPE c LENGTH 4 .
TYPES:
BEGIN OF ty_config,
type TYPE ty_data_type,
name TYPE tadir-obj_name,
where TYPE string_table,
END OF ty_config .
TYPES:
ty_config_tt TYPE SORTED TABLE OF ty_config WITH UNIQUE KEY type name .
CONSTANTS c_default_path TYPE string VALUE '/data/' ##NO_TEXT.
CONSTANTS c_default_format TYPE string VALUE 'json' ##NO_TEXT.
CONSTANTS c_config TYPE string VALUE 'conf' ##NO_TEXT.
CONSTANTS:
BEGIN OF c_data_type,
tabu TYPE ty_data_type VALUE 'TABU',
vdat TYPE ty_data_type VALUE 'VDAT',
cdat TYPE ty_data_type VALUE 'CDAT',
tdat TYPE ty_data_type VALUE 'TDAT',
END OF c_data_type .
METHODS add_config
IMPORTING
!is_config TYPE ty_config
RAISING
zcx_abapgit_exception .
METHODS from_json
IMPORTING
!it_files TYPE zif_abapgit_definitions=>ty_files_tt
RAISING
zcx_abapgit_exception .
METHODS get_configs
RETURNING
VALUE(rt_configs) TYPE ty_config_tt .
METHODS remove_config
IMPORTING
!is_config TYPE ty_config
RAISING
zcx_abapgit_exception .
METHODS to_json
RETURNING
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt
RAISING
zcx_abapgit_exception .
METHODS update_config
IMPORTING
!is_config TYPE ty_config
RAISING
zcx_abapgit_exception .
ENDINTERFACE. | 25.910714 | 75 | 0.713301 | {
"alnum_ratio": 0.6662068966,
"alpha_token_ratio": 1.8665377176,
"avg_line_length": 26.3636363636,
"char_rep_ratio": 0.1158917418,
"max_line_length": 75,
"num_words": 131,
"text_len": 1450,
"word_rep_ratio": 0
} | 7,405,431,368,770,448,000 |
1a39478100b54087ff06f8eaf10609905d2e795e | 1,440 | abap | ABAP | src/zcl_excel_style.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 251 | 2019-02-23T03:36:38.000Z | 2021-12-10T21:39:23.000Z | src/zcl_excel_style.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 278 | 2019-02-17T10:42:59.000Z | 2021-12-10T20:24:56.000Z | src/zcl_excel_style.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 130 | 2019-02-20T13:25:30.000Z | 2021-12-09T03:20:31.000Z | CLASS zcl_excel_style DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
*"* public components of class ZCL_EXCEL_STYLE
*"* do not include other source files here!!!
PUBLIC SECTION.
DATA font TYPE REF TO zcl_excel_style_font .
DATA fill TYPE REF TO zcl_excel_style_fill .
DATA borders TYPE REF TO zcl_excel_style_borders .
DATA alignment TYPE REF TO zcl_excel_style_alignment .
DATA number_format TYPE REF TO zcl_excel_style_number_format .
DATA protection TYPE REF TO zcl_excel_style_protection .
METHODS constructor
IMPORTING
!ip_guid TYPE zexcel_cell_style OPTIONAL .
METHODS get_guid
RETURNING
VALUE(ep_guid) TYPE zexcel_cell_style .
*"* protected components of class ZABAP_EXCEL_STYLE
*"* do not include other source files here!!!
PROTECTED SECTION.
*"* private components of class ZCL_EXCEL_STYLE
*"* do not include other source files here!!!
PRIVATE SECTION.
DATA guid TYPE zexcel_cell_style .
ENDCLASS.
CLASS zcl_excel_style IMPLEMENTATION.
METHOD constructor.
CREATE OBJECT font.
CREATE OBJECT fill.
CREATE OBJECT borders.
CREATE OBJECT alignment.
CREATE OBJECT number_format.
CREATE OBJECT protection.
IF ip_guid IS NOT INITIAL.
me->guid = ip_guid.
ELSE.
me->guid = zcl_excel_obsolete_func_wrap=>guid_create( ).
ENDIF.
ENDMETHOD.
METHOD get_guid.
ep_guid = me->guid.
ENDMETHOD.
ENDCLASS. | 22.857143 | 66 | 0.727778 | {
"alnum_ratio": 0.6942321056,
"alpha_token_ratio": 2.143776824,
"avg_line_length": 23.2096774194,
"char_rep_ratio": 0.141958042,
"max_line_length": 66,
"num_words": 144,
"text_len": 1439,
"word_rep_ratio": 0.0296296296
} | 11,014,137,576,456,616,000 |
1a4b013053c3dea9cb3e44f2f6bbf2a04461c79e | 3,943 | abap | ABAP | src/checks/zcl_aoc_check_28.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_28.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_28.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | *----------------------------------------------------------------------*
* CLASS lcl_Test DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS
FINAL.
PRIVATE SECTION.
* ================
DATA: mt_code TYPE string_table,
ms_result TYPE scirest_ad,
mo_check TYPE REF TO zcl_aoc_check_28.
METHODS:
setup,
export_import FOR TESTING,
test001_01 FOR TESTING,
test001_02 FOR TESTING,
test001_03 FOR TESTING,
test001_04 FOR TESTING,
test001_05 FOR TESTING,
test001_06 FOR TESTING,
test001_07 FOR TESTING,
test001_08 FOR TESTING,
test001_09 FOR TESTING,
test001_10 FOR TESTING.
ENDCLASS. "lcl_Test
*----------------------------------------------------------------------*
* CLASS lcl_Test IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test IMPLEMENTATION.
* ==============================
DEFINE _code.
APPEND &1 TO mt_code.
END-OF-DEFINITION.
METHOD setup.
CREATE OBJECT mo_check.
zcl_aoc_unit_test=>set_check( mo_check ).
ENDMETHOD. "setup
METHOD export_import.
zcl_aoc_unit_test=>export_import( mo_check ).
ENDMETHOD.
METHOD test001_01.
* ===========
_code 'lv_foo = lv_bar .'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD. "test1
METHOD test001_02.
* ===========
_code 'lv_foo = lv_bar.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD. "test2
METHOD test001_03.
* ===========
_code '.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test001_04.
* ===========
_code 'DATA: lv_foo TYPE i ,'.
_code ' lv_bar TYPE i.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD.
METHOD test001_05.
* ===========
_code '* comment'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test001_06.
* ===========
_code 'DEFINE _code.'.
_code ' append &1 to mt_code.'.
_code 'END-OF-DEFINITION.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test001_07.
* ===========
_code 'super->constructor( ).'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test001_08.
* ===========
_code 'TRY.'.
_code ' CATCH cx_root ##CATCH_ALL.'.
_code 'ENDTRY.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
METHOD test001_09.
* ===========
_code 'lv_foo = lv_bar .'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD.
METHOD test001_10.
* ===========
_code 'CONSTANTS:'.
_code ' lc_begin TYPE string VALUE ''* <SIGNATURE>-------------------'''.
_code ' & ''----------------------------------+''.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD.
ENDCLASS. "lcl_Test | 22.403409 | 78 | 0.526756 | {
"alnum_ratio": 0.4814814815,
"alpha_token_ratio": 1.4390637611,
"avg_line_length": 22.5257142857,
"char_rep_ratio": 0.2601067887,
"max_line_length": 78,
"num_words": 230,
"text_len": 3942,
"word_rep_ratio": 0.1674208145
} | 10,972,877,551,983,946,000 |
1a57b1c68e457b81fd011fab8395948790482924 | 14,911 | abap | ABAP | src/utils/zcl_abapgit_diff.clas.testclasses.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/utils/zcl_abapgit_diff.clas.testclasses.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/utils/zcl_abapgit_diff.clas.testclasses.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS ltcl_diff DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
DATA: mt_new TYPE TABLE OF string,
mt_old TYPE TABLE OF string,
mt_expected TYPE zif_abapgit_definitions=>ty_diffs_tt.
METHODS:
add_new IMPORTING iv_new TYPE string,
add_old IMPORTING iv_old TYPE string,
add_expected IMPORTING iv_new_num TYPE zif_abapgit_definitions=>ty_diff-new_num
iv_new TYPE zif_abapgit_definitions=>ty_diff-new
iv_result TYPE zif_abapgit_definitions=>ty_diff-result
iv_old_num TYPE zif_abapgit_definitions=>ty_diff-old_num
iv_old TYPE zif_abapgit_definitions=>ty_diff-old
iv_beacon TYPE zif_abapgit_definitions=>ty_diff-beacon
DEFAULT zcl_abapgit_diff=>co_starting_beacon.
METHODS: setup.
METHODS: test
IMPORTING
!iv_ignore_indentation TYPE abap_bool DEFAULT abap_false
!iv_ignore_comments TYPE abap_bool DEFAULT abap_false
!iv_ignore_case TYPE abap_bool DEFAULT abap_false.
METHODS:
diff01 FOR TESTING,
diff02 FOR TESTING,
diff03 FOR TESTING,
diff04 FOR TESTING,
diff05 FOR TESTING,
diff06 FOR TESTING,
diff07 FOR TESTING,
diff08 FOR TESTING,
diff09 FOR TESTING,
diff10 FOR TESTING,
diff11 FOR TESTING,
diff12 FOR TESTING,
diff13 FOR TESTING.
ENDCLASS.
CLASS ltcl_diff IMPLEMENTATION.
METHOD add_new.
DATA lv_new LIKE LINE OF mt_new.
lv_new = iv_new.
APPEND lv_new TO mt_new.
ENDMETHOD.
METHOD add_old.
DATA lv_old LIKE LINE OF mt_old.
lv_old = iv_old.
APPEND lv_old TO mt_old.
ENDMETHOD.
METHOD add_expected.
DATA ls_expected LIKE LINE OF mt_expected.
ls_expected-new_num = iv_new_num.
ls_expected-new = iv_new.
ls_expected-result = iv_result.
ls_expected-old_num = iv_old_num.
ls_expected-old = iv_old.
ls_expected-beacon = iv_beacon.
APPEND ls_expected TO mt_expected.
ENDMETHOD.
METHOD setup.
CLEAR mt_new.
CLEAR mt_old.
CLEAR mt_expected.
ENDMETHOD.
METHOD test.
DATA: lv_new TYPE string,
lv_xnew TYPE xstring,
lv_old TYPE string,
lv_xold TYPE xstring,
lo_diff TYPE REF TO zcl_abapgit_diff,
lt_diff TYPE zif_abapgit_definitions=>ty_diffs_tt.
FIELD-SYMBOLS: <ls_diff> LIKE LINE OF lt_diff.
CONCATENATE LINES OF mt_new INTO lv_new SEPARATED BY zif_abapgit_definitions=>c_newline.
CONCATENATE LINES OF mt_old INTO lv_old SEPARATED BY zif_abapgit_definitions=>c_newline.
lv_xnew = zcl_abapgit_convert=>string_to_xstring_utf8( lv_new ).
lv_xold = zcl_abapgit_convert=>string_to_xstring_utf8( lv_old ).
CREATE OBJECT lo_diff
EXPORTING
iv_new = lv_xnew
iv_old = lv_xold
iv_ignore_indentation = iv_ignore_indentation
iv_ignore_comments = iv_ignore_comments
iv_ignore_case = iv_ignore_case.
lt_diff = lo_diff->get( ).
LOOP AT lt_diff ASSIGNING <ls_diff>.
CLEAR <ls_diff>-short.
ENDLOOP.
cl_abap_unit_assert=>assert_equals( act = lt_diff
exp = mt_expected ).
ENDMETHOD.
METHOD diff01.
"insert
add_new( iv_new = 'A' ).
add_expected( iv_new_num = ' 1'
iv_new = 'A'
iv_result = zif_abapgit_definitions=>c_diff-insert
iv_old_num = ''
iv_old = '' ).
test( ).
ENDMETHOD.
METHOD diff02.
" identical
add_new( iv_new = 'A' ).
add_old( iv_old = 'A' ).
add_expected( iv_new_num = ' 1'
iv_new = 'A'
iv_result = ''
iv_old_num = ' 1'
iv_old = 'A' ).
test( ).
ENDMETHOD.
METHOD diff03.
" delete
add_old( iv_old = 'A' ).
add_expected( iv_new_num = ''
iv_new = ''
iv_result = zif_abapgit_definitions=>c_diff-delete
iv_old_num = ' 1'
iv_old = 'A' ).
test( ).
ENDMETHOD.
METHOD diff04.
" update
add_new( iv_new = 'A+' ).
add_old( iv_old = 'A' ).
add_expected( iv_new_num = ' 1'
iv_new = 'A+'
iv_result = zif_abapgit_definitions=>c_diff-update
iv_old_num = ' 1'
iv_old = 'A' ).
test( ).
ENDMETHOD.
METHOD diff05.
" identical
add_new( iv_new = 'A' ).
add_new( iv_new = 'B' ).
add_old( iv_old = 'A' ).
add_old( iv_old = 'B' ).
add_expected( iv_new_num = ' 1'
iv_new = 'A'
iv_result = ''
iv_old_num = ' 1'
iv_old = 'A' ).
add_expected( iv_new_num = ' 2'
iv_new = 'B'
iv_result = ''
iv_old_num = ' 2'
iv_old = 'B' ).
test( ).
ENDMETHOD.
METHOD diff06.
" mixed
add_new( iv_new = 'A' ).
add_new( iv_new = 'B' ).
add_new( iv_new = 'inserted' ).
add_new( iv_new = 'C' ).
add_new( iv_new = 'D update' ).
add_old( iv_old = 'A' ).
add_old( iv_old = 'B' ).
add_old( iv_old = 'C' ).
add_old( iv_old = 'D' ).
add_expected( iv_new_num = ' 1'
iv_new = 'A'
iv_result = ''
iv_old_num = ' 1'
iv_old = 'A' ).
add_expected( iv_new_num = ' 2'
iv_new = 'B'
iv_result = ''
iv_old_num = ' 2'
iv_old = 'B' ).
add_expected( iv_new_num = ' 3'
iv_new = 'inserted'
iv_result = zif_abapgit_definitions=>c_diff-insert
iv_old_num = ''
iv_old = '' ).
add_expected( iv_new_num = ' 4'
iv_new = 'C'
iv_result = ''
iv_old_num = ' 3'
iv_old = 'C' ).
add_expected( iv_new_num = ' 5'
iv_new = 'D update'
iv_result = zif_abapgit_definitions=>c_diff-update
iv_old_num = ' 4'
iv_old = 'D' ).
test( ).
ENDMETHOD.
METHOD diff07.
" ignore indentation
add_new( iv_new = 'A' ).
add_new( iv_new = ' B' ). " changed indent
add_new( iv_new = 'C' ).
add_new( iv_new = ' D' ). " changed indent
add_old( iv_old = 'A' ).
add_old( iv_old = 'B' ).
add_old( iv_old = 'C' ).
add_old( iv_old = 'D' ).
add_expected( iv_new_num = ' 1'
iv_new = 'A'
iv_result = ''
iv_old_num = ' 1'
iv_old = 'A' ).
add_expected( iv_new_num = ' 2'
iv_new = ' B'
iv_result = '' " no diff!
iv_old_num = ' 2'
iv_old = 'B' ).
add_expected( iv_new_num = ' 3'
iv_new = 'C'
iv_result = ''
iv_old_num = ' 3'
iv_old = 'C' ).
add_expected( iv_new_num = ' 4'
iv_new = ' D'
iv_result = '' " no diff!
iv_old_num = ' 4'
iv_old = 'D' ).
test( iv_ignore_indentation = abap_true ).
ENDMETHOD.
METHOD diff08.
" ignore comments
add_new( iv_new = 'A' ).
add_new( iv_new = '* X' ). " changed comment
add_new( iv_new = 'C' ).
add_new( iv_new = 'D " new' ). " changed comment
add_old( iv_old = 'A' ).
add_old( iv_old = '* B' ).
add_old( iv_old = 'C' ).
add_old( iv_old = 'D " old' ).
add_expected( iv_new_num = ' 1'
iv_new = 'A'
iv_result = ''
iv_old_num = ' 1'
iv_old = 'A' ).
add_expected( iv_new_num = ' 2'
iv_new = '* X'
iv_result = '' " no diff!
iv_old_num = ' 2'
iv_old = '* B' ).
add_expected( iv_new_num = ' 3'
iv_new = 'C'
iv_result = ''
iv_old_num = ' 3'
iv_old = 'C' ).
add_expected( iv_new_num = ' 4'
iv_new = 'D " new'
iv_result = '' " no diff!
iv_old_num = ' 4'
iv_old = 'D " old' ).
test( iv_ignore_comments = abap_true ).
ENDMETHOD.
METHOD diff09.
" ignore case
add_new( iv_new = 'A' ).
add_new( iv_new = 'b' ). " changed case
add_new( iv_new = 'c' ).
add_new( iv_new = 'D' ). " changed case
add_old( iv_old = 'A' ).
add_old( iv_old = 'B' ).
add_old( iv_old = 'c' ).
add_old( iv_old = 'd' ).
add_expected( iv_new_num = ' 1'
iv_new = 'A'
iv_result = ''
iv_old_num = ' 1'
iv_old = 'A' ).
add_expected( iv_new_num = ' 2'
iv_new = 'b'
iv_result = '' " no diff!
iv_old_num = ' 2'
iv_old = 'B' ).
add_expected( iv_new_num = ' 3'
iv_new = 'c'
iv_result = ''
iv_old_num = ' 3'
iv_old = 'c' ).
add_expected( iv_new_num = ' 4'
iv_new = 'D'
iv_result = '' " no diff!
iv_old_num = ' 4'
iv_old = 'd' ).
test( iv_ignore_case = abap_true ).
ENDMETHOD.
METHOD diff10.
" ignore case should NOT ignore changed literals
add_new( iv_new = `WRITE 'TEST'` ).
add_old( iv_old = `WRITE 'test'` ).
add_expected( iv_new_num = ' 1'
iv_new = `WRITE 'TEST'`
iv_result = 'U'
iv_old_num = ' 1'
iv_old = `WRITE 'test'` ).
test( iv_ignore_case = abap_true ).
ENDMETHOD.
METHOD diff11.
" ignore case should ignore changed keywords, variables, types
add_new( iv_new = `write 'test'` ).
add_new( iv_new = `DATA FOO TYPE I.` ).
add_old( iv_old = `WRITE 'test'` ).
add_old( iv_old = `DATA foo TYPE i.` ).
add_expected( iv_new_num = ' 1'
iv_new = `write 'test'`
iv_result = '' " no diff!
iv_old_num = ' 1'
iv_old = `WRITE 'test'` ).
add_expected( iv_new_num = ' 2'
iv_new = `DATA FOO TYPE I.`
iv_result = '' " no diff!
iv_old_num = ' 2'
iv_old = `DATA foo TYPE i.` ).
test( iv_ignore_case = abap_true ).
ENDMETHOD.
METHOD diff12.
" adjusted diffs for insert (workaround for kernel issue)
add_new( iv_new = `REPORT zprog_diff.` ).
add_new( iv_new = `*` ).
add_new( iv_new = `FORM t_1.` ).
add_new( iv_new = `ENDFORM.` ).
add_new( iv_new = `FORM t_2.` ).
add_new( iv_new = `ENDFORM.` ).
add_old( iv_old = `REPORT zprog_diff.` ).
add_old( iv_old = `FORM t_1.` ).
add_old( iv_old = `ENDFORM.` ).
add_expected( iv_new_num = ' 1'
iv_new = `REPORT zprog_diff.`
iv_result = '' " no diff!
iv_old_num = ' 1'
iv_old = `REPORT zprog_diff.`
iv_beacon = 1 ).
add_expected( iv_new_num = ' 2'
iv_new = `*`
iv_result = 'I'
iv_old_num = ' '
iv_old = ``
iv_beacon = 1 ).
add_expected( iv_new_num = ' 3'
iv_new = `FORM t_1.`
iv_result = '' " no diff!
iv_old_num = ' 2'
iv_old = `FORM t_1.`
iv_beacon = 2 ).
add_expected( iv_new_num = ' 4'
iv_new = `ENDFORM.`
iv_result = '' " no diff!
iv_old_num = ' 3'
iv_old = `ENDFORM.`
iv_beacon = 2 ).
add_expected( iv_new_num = ' 5'
iv_new = `FORM t_2.`
iv_result = 'I'
iv_old_num = ' '
iv_old = ``
iv_beacon = 3 ).
add_expected( iv_new_num = ' 6'
iv_new = `ENDFORM.`
iv_result = 'I'
iv_old_num = ' '
iv_old = ``
iv_beacon = 3 ).
test( ).
ENDMETHOD.
METHOD diff13.
" adjusted diffs for delete (workaround for kernel issue)
add_old( iv_old = `REPORT zprog_diff.` ).
add_old( iv_old = `*` ).
add_old( iv_old = `FORM t_1.` ).
add_old( iv_old = `ENDFORM.` ).
add_old( iv_old = `FORM t_2.` ).
add_old( iv_old = `ENDFORM.` ).
add_new( iv_new = `REPORT zprog_diff.` ).
add_new( iv_new = `FORM t_1.` ).
add_new( iv_new = `ENDFORM.` ).
add_expected( iv_old_num = ' 1'
iv_old = `REPORT zprog_diff.`
iv_result = '' " no diff!
iv_new_num = ' 1'
iv_new = `REPORT zprog_diff.`
iv_beacon = 1 ).
add_expected( iv_old_num = ' 2'
iv_old = `*`
iv_result = 'D'
iv_new_num = ' '
iv_new = ``
iv_beacon = 1 ).
add_expected( iv_old_num = ' 3'
iv_old = `FORM t_1.`
iv_result = '' " no diff!
iv_new_num = ' 2'
iv_new = `FORM t_1.`
iv_beacon = 2 ).
add_expected( iv_old_num = ' 4'
iv_old = `ENDFORM.`
iv_result = '' " no diff!
iv_new_num = ' 3'
iv_new = `ENDFORM.`
iv_beacon = 2 ).
add_expected( iv_old_num = ' 5'
iv_old = `FORM t_2.`
iv_result = 'D'
iv_new_num = ' '
iv_new = ``
iv_beacon = 2 ).
add_expected( iv_old_num = ' 6'
iv_old = `ENDFORM.`
iv_result = 'D'
iv_new_num = ' '
iv_new = ``
iv_beacon = 2 ).
test( ).
ENDMETHOD.
ENDCLASS. | 29.123047 | 92 | 0.463483 | {
"alnum_ratio": 0.4191427997,
"alpha_token_ratio": 1.2161785216,
"avg_line_length": 29.2333333333,
"char_rep_ratio": 0.3255704698,
"max_line_length": 92,
"num_words": 978,
"text_len": 14909,
"word_rep_ratio": 0.1620227038
} | 16,831,151,841,671,068,000 |
1a68eb03dbd6d0b3f53f06ca34b70c36c57b01cb | 4,803 | abap | ABAP | src/checks/zcl_aoc_check_62.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_62.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_62.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | *----------------------------------------------------------------------*
* CLASS lcl_Test DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL.
PRIVATE SECTION.
* ================
DATA: mt_code TYPE string_table,
ms_result TYPE scirest_ad,
mo_check TYPE REF TO zcl_aoc_check_62.
METHODS:
setup,
export_import FOR TESTING,
test001_01 FOR TESTING,
test001_02 FOR TESTING,
test001_03 FOR TESTING,
test001_04 FOR TESTING,
test001_05 FOR TESTING,
test002_01 FOR TESTING,
test002_02 FOR TESTING,
test002_03 FOR TESTING,
test003_01 FOR TESTING,
test003_02 FOR TESTING,
test003_03 FOR TESTING.
ENDCLASS. "lcl_Test
*----------------------------------------------------------------------*
* CLASS lcl_Test IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test IMPLEMENTATION.
* ==============================
DEFINE _code.
APPEND &1 TO mt_code.
END-OF-DEFINITION.
METHOD setup.
CREATE OBJECT mo_check.
zcl_aoc_unit_test=>set_check( mo_check ).
ENDMETHOD. "setup
METHOD export_import.
zcl_aoc_unit_test=>export_import( mo_check ).
ENDMETHOD.
METHOD test001_01.
* ===========
_code 'LOOP AT lt_tab ASSIGNING <fs> WHERE foo = ''ABC''.'.
_code ' DELETE lt_tab FROM <fs>.'.
_code 'ENDLOOP.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD. "test1
METHOD test001_02.
* ===========
_code 'DELETE lt_tab WHERE foo = ''ABC''.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result-code ).
ENDMETHOD.
METHOD test001_03.
* ===========
_code 'LOOP AT lt_tab INTO bar WHERE foo = ''ABC''.'.
_code ' DELETE lt_tab FROM bar.'.
_code 'ENDLOOP.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD. "test1
METHOD test001_04.
* ===========
_code 'LOOP AT lt_tab INTO DATA(bar) WHERE foo = ''ABC''.'.
_code ' DELETE lt_tab FROM bar.'.
_code 'ENDLOOP.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD.
METHOD test001_05.
* ===========
_code 'LOOP AT lt_tab ASSIGNING FIELD-SYMBOL(<bar>) WHERE foo = ''ABC''.'.
_code ' DELETE lt_tab FROM <bar>.'.
_code 'ENDLOOP.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD.
METHOD test002_01.
_code 'LOOP AT lt_tab.'.
_code ' CONTINUE.'.
_code 'ENDLOOP.'.
_code 'WRITE hello.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '002'
act = ms_result-code ).
ENDMETHOD.
METHOD test002_02.
_code 'LOOP AT lt_tab.'.
_code 'ENDLOOP.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result-code ).
ENDMETHOD.
METHOD test002_03.
_code 'WRITE hello.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result-code ).
ENDMETHOD.
METHOD test003_01.
_code 'IF lt_table IS NOT INITIAL.'.
_code 'LOOP AT lt_table INTO ls_data.'.
_code 'ENDLOOP.'.
_code 'ENDIF.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '003'
act = ms_result-code ).
ENDMETHOD.
METHOD test003_02.
_code 'IF lines( lt_messages ) > 0.'.
_code 'LOOP AT lt_messages INTO ls_message WHERE foo = ''A''.'.
_code 'ENDLOOP.'.
_code 'ENDIF.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '003'
act = ms_result-code ).
ENDMETHOD.
METHOD test003_03.
_code 'LOOP AT lt_table INTO ls_data.'.
_code 'ENDLOOP.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result-code ).
ENDMETHOD.
ENDCLASS. | 24.630769 | 80 | 0.546117 | {
"alnum_ratio": 0.5027072053,
"alpha_token_ratio": 1.4728331177,
"avg_line_length": 24.7525773196,
"char_rep_ratio": 0.2503651158,
"max_line_length": 80,
"num_words": 330,
"text_len": 4802,
"word_rep_ratio": 0.2959501558
} | 4,949,263,341,097,755,000 |
1a78235c577ba47aebf52363195a569fb0e283bc | 14,592 | abap | ABAP | src/cts/zcl_abapgit_transport_objects.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/cts/zcl_abapgit_transport_objects.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/cts/zcl_abapgit_transport_objects.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS ltcl_transport_objects DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS:
add_new_to_local_files FOR TESTING RAISING cx_static_check,
modified_to_new_local_files FOR TESTING RAISING cx_static_check,
transport_not_in_repository FOR TESTING RAISING cx_static_check,
object_not_in_local_files FOR TESTING RAISING cx_static_check,
cant_be_added_with_del_flag FOR TESTING RAISING cx_static_check,
cant_be_modified_with_del_flag FOR TESTING RAISING cx_static_check,
deleted_to_removed_files FOR TESTING RAISING cx_static_check,
should_remove_no_delflag_iwmo FOR TESTING RAISING cx_static_check,
should_remove_no_delflag_iwom FOR TESTING RAISING cx_static_check,
should_remove_no_delflag_iwsg FOR TESTING RAISING cx_static_check,
should_remove_no_delflag_iwsv FOR TESTING RAISING cx_static_check,
should_remove_no_delflag_susc FOR TESTING RAISING cx_static_check,
shouldnt_remove_no_delflag FOR TESTING RAISING cx_static_check,
should_add_all_local_files FOR TESTING RAISING cx_static_check,
should_delete_all_related FOR TESTING RAISING cx_static_check,
setup,
given_the_transport_object
IMPORTING iv_obj_name TYPE string
iv_obj_type TYPE string
iv_delflag TYPE abap_bool OPTIONAL,
given_the_object_status
IMPORTING
iv_obj_name TYPE string OPTIONAL
iv_obj_type TYPE string OPTIONAL
iv_filename TYPE string OPTIONAL
iv_path TYPE string OPTIONAL
iv_lstate TYPE char1,
given_the_local_file
IMPORTING iv_obj_name TYPE string
iv_obj_type TYPE string
iv_filename TYPE string
iv_path TYPE string
iv_data TYPE string
RETURNING VALUE(rs_local_file) TYPE zif_abapgit_definitions=>ty_file_item,
when_staging
RAISING zcx_abapgit_exception,
then_file_should_be_added
IMPORTING
is_local_file TYPE zif_abapgit_definitions=>ty_file_item,
then_it_should_raise_exception
IMPORTING
iv_with_text TYPE string,
then_it_should_remove_at_stage
IMPORTING
iv_filename TYPE string
iv_path TYPE string,
then_it_should_not_raise_excpt.
DATA: mo_transport_objects TYPE REF TO zcl_abapgit_transport_objects,
mt_transport_objects TYPE zif_abapgit_definitions=>ty_tadir_tt,
mt_object_statuses TYPE zif_abapgit_definitions=>ty_results_tt,
ms_stage_objects TYPE zif_abapgit_definitions=>ty_stage_files,
mo_stage TYPE REF TO zcl_abapgit_stage.
ENDCLASS.
CLASS ltcl_transport_objects IMPLEMENTATION.
METHOD setup.
CREATE OBJECT mo_stage.
ENDMETHOD.
METHOD add_new_to_local_files.
DATA ls_local_file TYPE zif_abapgit_definitions=>ty_file_item.
given_the_transport_object(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS' ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.abap'
iv_lstate = zif_abapgit_definitions=>c_state-added ).
ls_local_file = given_the_local_file(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.abap'
iv_path = '/path'
iv_data = 'data' ).
when_staging( ).
then_file_should_be_added( ls_local_file ).
ENDMETHOD.
METHOD modified_to_new_local_files.
DATA ls_local_file TYPE zif_abapgit_definitions=>ty_file_item.
given_the_transport_object(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS' ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.abap'
iv_lstate = zif_abapgit_definitions=>c_state-modified ).
ls_local_file = given_the_local_file(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.abap'
iv_path = '/path'
iv_data = 'data' ).
when_staging( ).
then_file_should_be_added( ls_local_file ).
ENDMETHOD.
METHOD should_add_all_local_files.
"Not only .abap, but also .xml and other includes
DATA ls_abap_local_file TYPE zif_abapgit_definitions=>ty_file_item.
DATA ls_xml_local_file TYPE zif_abapgit_definitions=>ty_file_item.
given_the_transport_object(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS' ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.abap'
iv_lstate = zif_abapgit_definitions=>c_state-modified ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.xml'
iv_lstate = zif_abapgit_definitions=>c_state-modified ).
ls_abap_local_file = given_the_local_file(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.abap'
iv_path = '/path'
iv_data = 'data' ).
ls_xml_local_file = given_the_local_file(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.xml'
iv_path = '/path'
iv_data = 'data' ).
when_staging( ).
then_file_should_be_added( ls_abap_local_file ).
then_file_should_be_added( ls_xml_local_file ).
ENDMETHOD.
METHOD transport_not_in_repository.
given_the_transport_object(
iv_obj_name = 'CL_A_CLASS_NOT_IN_REPO'
iv_obj_type = 'CLAS' ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_lstate = zif_abapgit_definitions=>c_state-added ).
then_it_should_not_raise_excpt( ).
ENDMETHOD.
METHOD object_not_in_local_files.
given_the_transport_object(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS' ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_lstate = zif_abapgit_definitions=>c_state-added ).
given_the_local_file(
iv_obj_name = 'CL_ANOTHER_LOCAL_FILE'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.abap'
iv_path = '/path'
iv_data = 'data' ).
then_it_should_raise_exception( 'Object CL_FOO not found in the local repository files' ).
ENDMETHOD.
METHOD cant_be_added_with_del_flag.
given_the_transport_object(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_delflag = abap_true ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_lstate = zif_abapgit_definitions=>c_state-added ).
then_it_should_raise_exception( 'Object CL_FOO should be added/modified, but has deletion flag in transport' ).
ENDMETHOD.
METHOD cant_be_modified_with_del_flag.
given_the_transport_object(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_delflag = abap_true ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_lstate = zif_abapgit_definitions=>c_state-modified ).
then_it_should_raise_exception( 'Object CL_FOO should be added/modified, but has deletion flag in transport' ).
ENDMETHOD.
METHOD deleted_to_removed_files.
given_the_transport_object(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_delflag = abap_true ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.abap'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
when_staging( ).
then_it_should_remove_at_stage(
iv_filename = 'CL_FOO.abap'
iv_path = '/a_path' ).
ENDMETHOD.
METHOD should_delete_all_related.
"i.e. Should also delete the XMLs related to the transport objects
given_the_transport_object(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_delflag = abap_true ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.abap'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.xml'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
when_staging( ).
then_it_should_remove_at_stage(
iv_filename = 'CL_FOO.abap'
iv_path = '/a_path' ).
then_it_should_remove_at_stage(
iv_filename = 'CL_FOO.xml'
iv_path = '/a_path' ).
ENDMETHOD.
METHOD should_remove_no_delflag_iwmo.
given_the_transport_object(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWMO'
iv_delflag = abap_false ).
given_the_object_status(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWMO'
iv_filename = 'zfoo.iwmo.xml'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
then_it_should_not_raise_excpt( ).
ENDMETHOD.
METHOD should_remove_no_delflag_iwom.
given_the_transport_object(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWOM'
iv_delflag = abap_false ).
given_the_object_status(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWOM'
iv_filename = 'zfoo.iwom.xml'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
then_it_should_not_raise_excpt( ).
ENDMETHOD.
METHOD should_remove_no_delflag_iwsg.
given_the_transport_object(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWSG'
iv_delflag = abap_false ).
given_the_object_status(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWSG'
iv_filename = 'zfoo.iwsg.xml'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
then_it_should_not_raise_excpt( ).
ENDMETHOD.
METHOD should_remove_no_delflag_iwsv.
given_the_transport_object(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWSV'
iv_delflag = abap_false ).
given_the_object_status(
iv_obj_name = 'ZFOO'
iv_obj_type = 'IWSV'
iv_filename = 'zfoo.iwsv.xml'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
then_it_should_not_raise_excpt( ).
ENDMETHOD.
METHOD should_remove_no_delflag_susc.
given_the_transport_object(
iv_obj_name = 'ZFOO'
iv_obj_type = 'SUSC'
iv_delflag = abap_false ).
given_the_object_status(
iv_obj_name = 'ZFOO'
iv_obj_type = 'SUSC'
iv_filename = 'zfoo.susc.xml'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
then_it_should_not_raise_excpt( ).
ENDMETHOD.
METHOD shouldnt_remove_no_delflag.
given_the_transport_object(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_delflag = abap_false ).
given_the_object_status(
iv_obj_name = 'CL_FOO'
iv_obj_type = 'CLAS'
iv_filename = 'CL_FOO.abap'
iv_path = '/a_path'
iv_lstate = zif_abapgit_definitions=>c_state-deleted ).
then_it_should_raise_exception( 'Object CL_FOO should be removed, but has NO deletion flag in transport' ).
ENDMETHOD.
METHOD given_the_transport_object.
DATA ls_transport_object TYPE zif_abapgit_definitions=>ty_tadir.
ls_transport_object-obj_name = iv_obj_name.
ls_transport_object-object = iv_obj_type.
ls_transport_object-delflag = iv_delflag.
APPEND ls_transport_object TO mt_transport_objects.
ENDMETHOD.
METHOD given_the_object_status.
DATA ls_object_status TYPE zif_abapgit_definitions=>ty_result.
ls_object_status-obj_name = iv_obj_name.
ls_object_status-obj_type = iv_obj_type.
ls_object_status-filename = iv_filename.
ls_object_status-path = iv_path.
ls_object_status-lstate = iv_lstate.
APPEND ls_object_status TO mt_object_statuses.
ENDMETHOD.
METHOD given_the_local_file.
rs_local_file-item-obj_name = iv_obj_name.
rs_local_file-item-obj_type = iv_obj_type.
rs_local_file-file-filename = iv_filename.
rs_local_file-file-path = iv_path.
rs_local_file-file-data = iv_data.
APPEND rs_local_file TO ms_stage_objects-local.
ENDMETHOD.
METHOD when_staging.
CREATE OBJECT mo_transport_objects
EXPORTING
it_transport_objects = mt_transport_objects.
mo_transport_objects->to_stage(
io_stage = mo_stage
is_stage_objects = ms_stage_objects
it_object_statuses = mt_object_statuses ).
ENDMETHOD.
METHOD then_file_should_be_added.
DATA: lt_staged_objects TYPE zif_abapgit_definitions=>ty_stage_tt.
lt_staged_objects = mo_stage->get_all( ).
READ TABLE lt_staged_objects TRANSPORTING NO FIELDS
WITH KEY
file-filename = is_local_file-file-filename
file-path = is_local_file-file-path
file-data = is_local_file-file-data
method = zif_abapgit_definitions=>c_method-add.
IF sy-subrc <> 0.
cl_abap_unit_assert=>fail( |Object { is_local_file-file-filename } not added to stage| ).
ENDIF.
ENDMETHOD.
METHOD then_it_should_raise_exception.
DATA: lx_exception TYPE REF TO zcx_abapgit_exception.
TRY.
when_staging( ).
cl_abap_unit_assert=>fail( 'Should have raised exception' ).
CATCH zcx_abapgit_exception INTO lx_exception.
cl_abap_unit_assert=>assert_equals(
act = lx_exception->get_text( )
exp = iv_with_text ).
ENDTRY.
ENDMETHOD.
METHOD then_it_should_remove_at_stage.
DATA: lt_staged_objects TYPE zif_abapgit_definitions=>ty_stage_tt.
lt_staged_objects = mo_stage->get_all( ).
READ TABLE lt_staged_objects TRANSPORTING NO FIELDS
WITH KEY
file-filename = iv_filename
file-path = iv_path.
IF sy-subrc <> 0.
cl_abap_unit_assert=>fail( |Object { iv_filename } not removed in stage| ).
ENDIF.
ENDMETHOD.
METHOD then_it_should_not_raise_excpt.
DATA: lx_exception TYPE REF TO zcx_abapgit_exception.
TRY.
when_staging( ).
CATCH zcx_abapgit_exception INTO lx_exception.
cl_abap_unit_assert=>fail( 'Should not have raised exception' ).
ENDTRY.
ENDMETHOD.
ENDCLASS. | 31.929978 | 115 | 0.679345 | {
"alnum_ratio": 0.6097326936,
"alpha_token_ratio": 1.6697333834,
"avg_line_length": 32.0659340659,
"char_rep_ratio": 0.172416158,
"max_line_length": 115,
"num_words": 860,
"text_len": 14590,
"word_rep_ratio": 0.1116333725
} | 4,485,207,260,628,947,500 |
1a912a5d9e317755bb6af893ff0716b8b3f5ad3f | 27,063 | abap | ABAP | src/ui/zcl_abapgit_html_form.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/ui/zcl_abapgit_html_form.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/ui/zcl_abapgit_html_form.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_html_form DEFINITION
PUBLIC
FINAL
CREATE PRIVATE .
PUBLIC SECTION.
INTERFACES zif_abapgit_html_form .
INTERFACES zif_abapgit_gui_hotkeys .
CLASS-METHODS create
IMPORTING
!iv_form_id TYPE csequence OPTIONAL
!iv_help_page TYPE csequence OPTIONAL
RETURNING
VALUE(ro_form) TYPE REF TO zcl_abapgit_html_form .
METHODS render
IMPORTING
!iv_form_class TYPE csequence DEFAULT 'dialog-form'
!io_values TYPE REF TO zcl_abapgit_string_map
!io_validation_log TYPE REF TO zcl_abapgit_string_map OPTIONAL
RETURNING
VALUE(ri_html) TYPE REF TO zif_abapgit_html
RAISING
zcx_abapgit_exception .
METHODS command
IMPORTING
!iv_label TYPE csequence
!iv_action TYPE csequence
!iv_cmd_type TYPE i DEFAULT zif_abapgit_html_form=>c_cmd_type-input
RETURNING
VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form .
METHODS text
IMPORTING
!iv_label TYPE csequence
!iv_name TYPE csequence
!iv_hint TYPE csequence OPTIONAL
!iv_required TYPE abap_bool DEFAULT abap_false
!iv_upper_case TYPE abap_bool DEFAULT abap_false
!iv_readonly TYPE abap_bool DEFAULT abap_false
!iv_password TYPE abap_bool DEFAULT abap_false
!iv_condense TYPE abap_bool OPTIONAL
!iv_placeholder TYPE csequence OPTIONAL
!iv_side_action TYPE csequence OPTIONAL
!iv_min TYPE i DEFAULT cl_abap_math=>min_int4
!iv_max TYPE i DEFAULT cl_abap_math=>max_int4
RETURNING
VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form .
METHODS textarea
IMPORTING
!iv_label TYPE csequence
!iv_name TYPE csequence
!iv_hint TYPE csequence OPTIONAL
!iv_required TYPE abap_bool DEFAULT abap_false
!iv_readonly TYPE abap_bool DEFAULT abap_false
!iv_placeholder TYPE csequence OPTIONAL
!iv_rows TYPE i OPTIONAL
!iv_cols TYPE i OPTIONAL
RETURNING
VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form .
METHODS number
IMPORTING
!iv_label TYPE csequence
!iv_name TYPE csequence
!iv_hint TYPE csequence OPTIONAL
!iv_required TYPE abap_bool DEFAULT abap_false
!iv_readonly TYPE abap_bool DEFAULT abap_false
!iv_min TYPE i DEFAULT cl_abap_math=>min_int4
!iv_max TYPE i DEFAULT cl_abap_math=>max_int4
RETURNING
VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form .
METHODS checkbox
IMPORTING
!iv_label TYPE csequence
!iv_name TYPE csequence
!iv_hint TYPE csequence OPTIONAL
RETURNING
VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form .
METHODS radio
IMPORTING
!iv_label TYPE csequence
!iv_name TYPE csequence
!iv_default_value TYPE csequence OPTIONAL
!iv_hint TYPE csequence OPTIONAL
RETURNING
VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form .
METHODS option
IMPORTING
!iv_label TYPE csequence
!iv_value TYPE csequence
RETURNING
VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form .
METHODS table
IMPORTING
!iv_label TYPE csequence
!iv_name TYPE csequence
!iv_hint TYPE csequence OPTIONAL
RETURNING
VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form .
METHODS column
IMPORTING
!iv_label TYPE csequence
!iv_width TYPE csequence OPTIONAL
!iv_readonly TYPE abap_bool DEFAULT abap_false
RETURNING
VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form .
METHODS start_group
IMPORTING
!iv_label TYPE csequence
!iv_name TYPE csequence
!iv_hint TYPE csequence OPTIONAL
RETURNING
VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form .
METHODS hidden
IMPORTING
!iv_name TYPE csequence
RETURNING
VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form .
METHODS get_fields
RETURNING
VALUE(rt_fields) TYPE zif_abapgit_html_form=>ty_fields .
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_attr,
value TYPE string,
error TYPE string,
hint TYPE string,
readonly TYPE string,
placeholder TYPE string,
required TYPE string,
autofocus TYPE string,
END OF ty_attr .
DATA mt_fields TYPE zif_abapgit_html_form=>ty_fields .
DATA:
mt_commands TYPE STANDARD TABLE OF zif_abapgit_html_form=>ty_command .
DATA mv_form_id TYPE string .
DATA mv_help_page TYPE string .
METHODS render_field
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html
!io_values TYPE REF TO zcl_abapgit_string_map
!io_validation_log TYPE REF TO zcl_abapgit_string_map
!is_field TYPE zif_abapgit_html_form=>ty_field
!iv_autofocus TYPE abap_bool .
METHODS render_field_text
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html
!is_field TYPE zif_abapgit_html_form=>ty_field
!is_attr TYPE ty_attr .
METHODS render_field_textarea
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html
!is_field TYPE zif_abapgit_html_form=>ty_field
!is_attr TYPE ty_attr .
METHODS render_field_checkbox
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html
!is_field TYPE zif_abapgit_html_form=>ty_field
!is_attr TYPE ty_attr .
METHODS render_field_radio
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html
!is_field TYPE zif_abapgit_html_form=>ty_field
!is_attr TYPE ty_attr .
METHODS render_field_table
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html
!is_field TYPE zif_abapgit_html_form=>ty_field
!is_attr TYPE ty_attr
!io_values TYPE REF TO zcl_abapgit_string_map .
METHODS render_command
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html
!is_cmd TYPE zif_abapgit_html_form=>ty_command .
METHODS render_field_hidden
IMPORTING
!ii_html TYPE REF TO zif_abapgit_html
!is_field TYPE zif_abapgit_html_form=>ty_field
!is_attr TYPE ty_attr .
ENDCLASS.
CLASS zcl_abapgit_html_form IMPLEMENTATION.
METHOD checkbox.
DATA ls_field LIKE LINE OF mt_fields.
ls_field-type = zif_abapgit_html_form=>c_field_type-checkbox.
ls_field-name = iv_name.
ls_field-label = iv_label.
ls_field-hint = iv_hint.
APPEND ls_field TO mt_fields.
ro_self = me.
ENDMETHOD.
METHOD column.
FIELD-SYMBOLS <ls_last> LIKE LINE OF mt_fields.
DATA ls_column LIKE LINE OF <ls_last>-subitems.
DATA lv_size TYPE i.
lv_size = lines( mt_fields ).
ASSERT lv_size > 0. " Exception ? Maybe add zcx_no_check ?
READ TABLE mt_fields INDEX lv_size ASSIGNING <ls_last>.
ASSERT sy-subrc = 0.
ASSERT <ls_last>-type = zif_abapgit_html_form=>c_field_type-table.
ls_column-label = iv_label.
ls_column-value = iv_width.
ls_column-readonly = iv_readonly.
APPEND ls_column TO <ls_last>-subitems.
ro_self = me.
ENDMETHOD.
METHOD command.
DATA ls_cmd LIKE LINE OF mt_commands.
ASSERT iv_cmd_type BETWEEN 1 AND 4.
ls_cmd-label = iv_label.
ls_cmd-action = iv_action.
ls_cmd-cmd_type = iv_cmd_type.
APPEND ls_cmd TO mt_commands.
ro_self = me.
ENDMETHOD.
METHOD create.
DATA lv_ts TYPE timestampl.
CREATE OBJECT ro_form.
ro_form->mv_form_id = iv_form_id.
ro_form->mv_help_page = iv_help_page.
IF ro_form->mv_form_id IS INITIAL.
GET TIME STAMP FIELD lv_ts.
ro_form->mv_form_id = |form_{ lv_ts }|.
ENDIF.
ENDMETHOD.
METHOD get_fields.
rt_fields = mt_fields.
ENDMETHOD.
METHOD hidden.
DATA ls_field LIKE LINE OF mt_fields.
ls_field-type = zif_abapgit_html_form=>c_field_type-hidden.
ls_field-name = iv_name.
APPEND ls_field TO mt_fields.
ro_self = me.
ENDMETHOD.
METHOD number.
DATA ls_field LIKE LINE OF mt_fields.
ls_field-type = zif_abapgit_html_form=>c_field_type-number.
ls_field-name = iv_name.
ls_field-label = iv_label.
ls_field-readonly = iv_readonly.
ls_field-min = iv_min.
ls_field-max = iv_max.
ls_field-hint = iv_hint.
ls_field-required = iv_required.
APPEND ls_field TO mt_fields.
ro_self = me.
ENDMETHOD.
METHOD option.
FIELD-SYMBOLS <ls_last> LIKE LINE OF mt_fields.
DATA ls_option LIKE LINE OF <ls_last>-subitems.
DATA lv_size TYPE i.
lv_size = lines( mt_fields ).
ASSERT lv_size > 0. " Exception ? Maybe add zcx_no_check ?
READ TABLE mt_fields INDEX lv_size ASSIGNING <ls_last>.
ASSERT sy-subrc = 0.
ASSERT <ls_last>-type = zif_abapgit_html_form=>c_field_type-radio. " Or dropdown - TODO in future
ls_option-label = iv_label.
ls_option-value = iv_value.
APPEND ls_option TO <ls_last>-subitems.
ro_self = me.
ENDMETHOD.
METHOD radio.
DATA ls_field LIKE LINE OF mt_fields.
ls_field-type = zif_abapgit_html_form=>c_field_type-radio.
ls_field-name = iv_name.
ls_field-label = iv_label.
ls_field-default_value = iv_default_value.
ls_field-hint = iv_hint.
APPEND ls_field TO mt_fields.
ro_self = me.
ENDMETHOD.
METHOD render.
FIELD-SYMBOLS <ls_field> LIKE LINE OF mt_fields.
FIELD-SYMBOLS <ls_cmd> LIKE LINE OF mt_commands.
DATA lv_hint TYPE string.
DATA ls_form_id TYPE string.
DATA ls_form_action TYPE string.
DATA lv_cur_group TYPE string.
DATA lv_url TYPE string.
DATA lv_autofocus TYPE abap_bool.
IF mv_form_id IS NOT INITIAL.
ls_form_id = | id="{ mv_form_id }"|.
ENDIF.
LOOP AT mt_commands ASSIGNING <ls_cmd> WHERE cmd_type = zif_abapgit_html_form=>c_cmd_type-input_main.
ls_form_action = | action="sapevent:{ <ls_cmd>-action }"|.
EXIT.
ENDLOOP.
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
ri_html->add( |<div class="dialog { iv_form_class }">| ). " to center use 'dialog-form-center'
ri_html->add( |<form method="post"{ ls_form_id }{ ls_form_action }>| ).
" Add hidden button that triggers main command when pressing enter
LOOP AT mt_commands ASSIGNING <ls_cmd> WHERE cmd_type = zif_abapgit_html_form=>c_cmd_type-input_main.
ri_html->add( |<button type="submit" formaction="sapevent:{ <ls_cmd>-action }" class="hidden-submit"|
&& | aria-hidden="true" tabindex="-1"></button>| ).
EXIT.
ENDLOOP.
lv_autofocus = abap_true.
LOOP AT mt_fields ASSIGNING <ls_field>.
AT FIRST.
IF <ls_field>-type <> zif_abapgit_html_form=>c_field_type-field_group.
ri_html->add( |<ul>| ).
ENDIF.
ENDAT.
IF <ls_field>-type = zif_abapgit_html_form=>c_field_type-field_group.
IF lv_cur_group IS NOT INITIAL AND lv_cur_group <> <ls_field>-name.
ri_html->add( |</ul>| ).
ri_html->add( |</fieldset>| ).
ENDIF.
IF <ls_field>-hint IS NOT INITIAL.
lv_hint = | title="{ <ls_field>-hint }"|.
ELSE.
lv_hint = ''.
ENDIF.
lv_cur_group = <ls_field>-name.
ri_html->add( |<fieldset name="{ <ls_field>-name }">| ).
ri_html->add( |<legend{ lv_hint }>{ <ls_field>-label }</legend>| ).
ri_html->add( |<ul>| ).
CONTINUE.
ENDIF.
render_field(
ii_html = ri_html
io_values = io_values
io_validation_log = io_validation_log
is_field = <ls_field>
iv_autofocus = lv_autofocus ).
lv_autofocus = abap_false.
AT LAST.
ri_html->add( |</ul>| ).
IF lv_cur_group IS NOT INITIAL.
ri_html->add( |</fieldset>| ).
ENDIF.
ENDAT.
ENDLOOP.
ri_html->add( |<ul>| ).
ri_html->add( |<li class="dialog-commands">| ).
IF mv_help_page IS NOT INITIAL.
lv_url = escape( val = mv_help_page
format = cl_abap_format=>e_url ).
ri_html->add_a(
iv_txt = zcl_abapgit_gui_buttons=>help( )
iv_act = |{ zif_abapgit_definitions=>c_action-url }?url={ lv_url }|
iv_class = 'dialog-help'
iv_title = 'Help' ).
ENDIF.
LOOP AT mt_commands ASSIGNING <ls_cmd>.
render_command(
ii_html = ri_html
is_cmd = <ls_cmd> ).
ENDLOOP.
ri_html->add( |</li>| ).
ri_html->add( |</ul>| ).
ri_html->add( |</form>| ).
ri_html->add( |</div>| ).
zcl_abapgit_ui_factory=>get_gui_services(
)->get_hotkeys_ctl(
)->register_hotkeys( zif_abapgit_gui_hotkeys~get_hotkey_actions( ) ).
ENDMETHOD.
METHOD render_command.
CASE is_cmd-cmd_type.
WHEN zif_abapgit_html_form=>c_cmd_type-link.
ii_html->add_a(
iv_txt = is_cmd-label
iv_act = is_cmd-action
iv_class = 'dialog-commands' ).
WHEN zif_abapgit_html_form=>c_cmd_type-button.
ii_html->add( |<button type="submit" name="action" value="{ is_cmd-action }"|
&& | class="action-commands">{ is_cmd-label }</button>| ).
WHEN zif_abapgit_html_form=>c_cmd_type-input.
ii_html->add( |<input type="submit" value="{ is_cmd-label }" formaction="sapevent:{ is_cmd-action }">| ).
WHEN zif_abapgit_html_form=>c_cmd_type-input_main.
ii_html->add( |<input type="submit" value="{ is_cmd-label }" class="main">| ).
WHEN OTHERS.
ASSERT 0 = 1.
ENDCASE.
ENDMETHOD.
METHOD render_field.
DATA:
ls_attr TYPE ty_attr,
lv_item_class TYPE string.
" Get value and validation error
ls_attr-value = escape( val = io_values->get( is_field-name )
format = cl_abap_format=>e_html_attr ).
IF io_validation_log IS BOUND.
ls_attr-error = io_validation_log->get( is_field-name ).
IF ls_attr-error IS NOT INITIAL.
ls_attr-error = escape( val = ls_attr-error
format = cl_abap_format=>e_html_text ).
ls_attr-error = |<small>{ ls_attr-error }</small>|.
ENDIF.
ENDIF.
" Prepare field attributes
IF is_field-required = abap_true.
ls_attr-required = ' <em>*</em>'.
ENDIF.
IF is_field-hint IS NOT INITIAL.
ls_attr-hint = escape( val = is_field-hint
format = cl_abap_format=>e_html_attr ).
ls_attr-hint = | title="{ ls_attr-hint }"|.
ENDIF.
IF is_field-placeholder IS NOT INITIAL.
ls_attr-placeholder = escape( val = is_field-placeholder
format = cl_abap_format=>e_html_attr ).
ls_attr-placeholder = | placeholder="{ ls_attr-placeholder }"|.
ENDIF.
IF is_field-readonly = abap_true.
ls_attr-readonly = ' readonly'.
ENDIF.
IF iv_autofocus = abap_true.
ls_attr-autofocus = ' autofocus'.
ENDIF.
" Prepare item class
lv_item_class = is_field-item_class.
IF ls_attr-error IS NOT INITIAL.
lv_item_class = condense( lv_item_class && ' error' ).
ENDIF.
IF is_field-type = zif_abapgit_html_form=>c_field_type-text AND is_field-max BETWEEN 1 AND 20.
" Reduced width for short fields
lv_item_class = lv_item_class && ' w40'.
ENDIF.
IF lv_item_class IS NOT INITIAL.
lv_item_class = | class="{ lv_item_class }"|.
ENDIF.
" Render field
ii_html->add( |<li{ lv_item_class }>| ).
CASE is_field-type.
WHEN zif_abapgit_html_form=>c_field_type-text OR zif_abapgit_html_form=>c_field_type-number.
render_field_text(
ii_html = ii_html
is_field = is_field
is_attr = ls_attr ).
WHEN zif_abapgit_html_form=>c_field_type-textarea.
render_field_textarea(
ii_html = ii_html
is_field = is_field
is_attr = ls_attr ).
WHEN zif_abapgit_html_form=>c_field_type-checkbox.
render_field_checkbox(
ii_html = ii_html
is_field = is_field
is_attr = ls_attr ).
WHEN zif_abapgit_html_form=>c_field_type-radio.
render_field_radio(
ii_html = ii_html
is_field = is_field
is_attr = ls_attr ).
WHEN zif_abapgit_html_form=>c_field_type-table.
render_field_table(
ii_html = ii_html
is_field = is_field
is_attr = ls_attr
io_values = io_values ).
WHEN zif_abapgit_html_form=>c_field_type-hidden.
render_field_hidden(
ii_html = ii_html
is_field = is_field
is_attr = ls_attr ).
WHEN OTHERS.
ASSERT 1 = 0.
ENDCASE.
ii_html->add( '</li>' ).
ENDMETHOD.
METHOD render_field_checkbox.
DATA lv_checked TYPE string.
IF is_attr-error IS NOT INITIAL.
ii_html->add( is_attr-error ).
ENDIF.
IF is_attr-value = abap_true OR is_attr-value = 'on'.
" boolc return ` ` which is not initial -> bug after 1st validation
lv_checked = ' checked'.
ENDIF.
ii_html->add( |<input type="checkbox" name="{ is_field-name }" id="{ is_field-name }"| &&
|{ lv_checked }{ is_attr-readonly }{ is_attr-autofocus }>| ).
ii_html->add( |<label for="{ is_field-name }"{ is_attr-hint }>{ is_field-label }</label>| ).
ENDMETHOD.
METHOD render_field_hidden.
ii_html->add( |<input type="hidden" name="{ is_field-name }" id="{ is_field-name }" value="{ is_attr-value }">| ).
ENDMETHOD.
METHOD render_field_radio.
DATA:
lv_checked TYPE string,
lv_opt_id TYPE string,
lv_opt_value TYPE string.
FIELD-SYMBOLS <ls_opt> LIKE LINE OF is_field-subitems.
ii_html->add( |<label{ is_attr-hint }>{ is_field-label }</label>| ).
IF is_attr-error IS NOT INITIAL.
ii_html->add( is_attr-error ).
ENDIF.
ii_html->add( |<div class="radio-container">| ).
LOOP AT is_field-subitems ASSIGNING <ls_opt>.
lv_opt_value = escape( val = <ls_opt>-value
format = cl_abap_format=>e_html_attr ).
CLEAR lv_checked.
IF is_attr-value = lv_opt_value OR ( is_attr-value IS INITIAL AND lv_opt_value = is_field-default_value ).
lv_checked = ' checked'.
ENDIF.
lv_opt_id = |{ is_field-name }{ sy-tabix }|.
ii_html->add( |<input type="radio" name="{ is_field-name }" id="{ lv_opt_id }"|
&& | value="{ lv_opt_value }"{ lv_checked }{ is_attr-autofocus }>| ).
ii_html->add( |<label for="{ lv_opt_id }">{ <ls_opt>-label }</label>| ).
ENDLOOP.
ii_html->add( '</div>' ).
ENDMETHOD.
METHOD render_field_table.
DATA:
lv_value TYPE string,
lv_readonly TYPE string,
lv_rows TYPE i,
lv_cell_id TYPE string.
FIELD-SYMBOLS <ls_subitem> LIKE LINE OF is_field-subitems.
ii_html->add( |<label for="{ is_field-name }"{ is_attr-hint }>{ is_field-label }</label>| ).
IF is_attr-error IS NOT INITIAL.
ii_html->add( is_attr-error ).
ENDIF.
lv_rows = io_values->get( |{ is_field-name }-{ zif_abapgit_html_form=>c_rows }| ).
" Render table only if there are some data rows
IF lv_rows > 0.
ii_html->add( |<table name="{ is_field-name }" id="{ is_field-name }" class="table-container">| ).
ii_html->add( |<thead>| ).
ii_html->add( |<tr>| ).
LOOP AT is_field-subitems ASSIGNING <ls_subitem>.
CLEAR lv_value.
IF <ls_subitem>-value IS NOT INITIAL.
lv_value = escape( val = <ls_subitem>-value
format = cl_abap_format=>e_html_attr ).
lv_value = | width="{ lv_value }"|.
ENDIF.
ii_html->add( |<td{ lv_value }>{ <ls_subitem>-label }</td>| ).
ENDLOOP.
ii_html->add( |</tr>| ).
ii_html->add( |</thead>| ).
ii_html->add( |<tbody>| ).
DO lv_rows TIMES.
lv_rows = sy-index.
ii_html->add( |<tr>| ).
LOOP AT is_field-subitems ASSIGNING <ls_subitem>.
lv_cell_id = |{ is_field-name }-{ lv_rows }-{ sy-tabix }|.
lv_value = escape( val = io_values->get( lv_cell_id )
format = cl_abap_format=>e_html_attr ).
CLEAR lv_readonly.
IF <ls_subitem>-readonly = abap_true.
lv_readonly = | readonly|.
ENDIF.
ii_html->add( |<td><input type="text" name="{ lv_cell_id }" id="{
lv_cell_id }" value="{ lv_value }"{ lv_readonly }></td>| ).
ENDLOOP.
ii_html->add( |</tr>| ).
ENDDO.
ii_html->add( |</tbody>| ).
ii_html->add( |</table>| ).
ELSE.
ii_html->add( |<input type="text" name="{ is_field-name }" id="{
is_field-name }" value="Not available" readonly>| ).
ENDIF.
" Hidden field with number of rows to simplify getting values from form
lv_value = |{ is_field-name }-{ zif_abapgit_html_form=>c_rows }|.
ii_html->add( |<input type="number" name="{ lv_value }" id="{ lv_value }"|
&& | value="{ lv_rows }" style="">| ).
ENDMETHOD.
METHOD render_field_text.
DATA:
lv_type TYPE string,
lv_maxlength TYPE string.
ii_html->add( |<label for="{ is_field-name }"{ is_attr-hint }>{ is_field-label }{ is_attr-required }</label>| ).
IF is_attr-error IS NOT INITIAL.
ii_html->add( is_attr-error ).
ENDIF.
IF is_field-side_action IS NOT INITIAL.
ii_html->add( '<div class="input-container">' ). " Ugly :(
ENDIF.
IF is_field-type = zif_abapgit_html_form=>c_field_type-number.
lv_type = 'number'.
ELSEIF is_field-password = abap_true.
lv_type = 'password'.
ELSE.
lv_type = 'text'.
ENDIF.
IF is_field-max > 0.
lv_maxlength = |maxlength={ is_field-max }|.
ENDIF.
ii_html->add( |<input type="{ lv_type }" name="{ is_field-name }" id="{ is_field-name }"|
&& | value="{ is_attr-value }" { is_field-dblclick }{ is_attr-placeholder }|
&& |{ is_attr-readonly }{ is_attr-autofocus } { lv_maxlength }>| ).
IF is_field-side_action IS NOT INITIAL.
ii_html->add( '</div>' ).
ii_html->add( '<div class="command-container">' ).
ii_html->add( |<input type="submit" value="…" formaction="sapevent:{ is_field-side_action }"|
&& | title="{ is_field-label }">| ).
ii_html->add( '</div>' ).
ENDIF.
ENDMETHOD.
METHOD render_field_textarea.
DATA lv_rows TYPE string.
DATA lv_cols TYPE string.
DATA lv_html TYPE string.
ii_html->add( |<label for="{ is_field-name }"{ is_attr-hint }>{ is_field-label }{ is_attr-required }</label>| ).
IF is_attr-error IS NOT INITIAL.
ii_html->add( is_attr-error ).
ENDIF.
IF is_field-rows > 0.
lv_rows = | rows="{ is_field-rows }"|.
ELSE.
lv_rows = lines( zcl_abapgit_convert=>split_string( is_attr-value ) ).
ENDIF.
IF is_field-cols > 0.
lv_cols = | cols="{ is_field-cols }"|.
ENDIF.
" Avoid adding line-breaks inside textarea tag (except for the actual value)
lv_html = |<textarea name="{ is_field-name }" id="{ is_field-name }"{ lv_rows }{ lv_cols }|
&& |{ is_attr-readonly }{ is_attr-autofocus }{ is_attr-placeholder }>|.
lv_html = lv_html && escape( val = is_attr-value
format = cl_abap_format=>e_html_attr ).
lv_html = lv_html && |</textarea>|.
ii_html->add( lv_html ).
ENDMETHOD.
METHOD start_group.
DATA ls_field LIKE LINE OF mt_fields.
ls_field-type = zif_abapgit_html_form=>c_field_type-field_group.
ls_field-label = iv_label.
ls_field-name = iv_name.
ls_field-hint = iv_hint.
APPEND ls_field TO mt_fields.
ro_self = me.
ENDMETHOD.
METHOD table.
DATA ls_field LIKE LINE OF mt_fields.
ls_field-type = zif_abapgit_html_form=>c_field_type-table.
ls_field-name = iv_name.
ls_field-label = iv_label.
ls_field-hint = iv_hint.
APPEND ls_field TO mt_fields.
ro_self = me.
ENDMETHOD.
METHOD text.
DATA ls_field LIKE LINE OF mt_fields.
ls_field-type = zif_abapgit_html_form=>c_field_type-text.
ls_field-name = iv_name.
ls_field-label = iv_label.
ls_field-upper_case = iv_upper_case.
ls_field-readonly = iv_readonly.
ls_field-min = iv_min.
ls_field-max = iv_max.
ls_field-password = iv_password.
ls_field-condense = iv_condense.
ls_field-hint = iv_hint.
ls_field-required = iv_required.
ls_field-placeholder = iv_placeholder.
IF iv_side_action IS NOT INITIAL AND mv_form_id IS NOT INITIAL.
ls_field-item_class = 'with-command'.
ls_field-side_action = iv_side_action.
ls_field-dblclick = | ondblclick="document.getElementById('{ mv_form_id }').action = 'sapevent:|
&& |{ iv_side_action }'; document.getElementById('{ mv_form_id }').submit()"|.
ENDIF.
APPEND ls_field TO mt_fields.
ro_self = me.
ENDMETHOD.
METHOD textarea.
DATA ls_field LIKE LINE OF mt_fields.
ls_field-type = zif_abapgit_html_form=>c_field_type-textarea.
ls_field-name = iv_name.
ls_field-label = iv_label.
ls_field-readonly = iv_readonly.
ls_field-hint = iv_hint.
ls_field-required = iv_required.
ls_field-placeholder = iv_placeholder.
ls_field-rows = iv_rows.
ls_field-cols = iv_cols.
APPEND ls_field TO mt_fields.
ro_self = me.
ENDMETHOD.
METHOD zif_abapgit_gui_hotkeys~get_hotkey_actions.
DATA: ls_hotkey_action LIKE LINE OF rt_hotkey_actions.
FIELD-SYMBOLS: <ls_command> TYPE zif_abapgit_html_form=>ty_command.
ls_hotkey_action-ui_component = 'Form'.
READ TABLE mt_commands WITH KEY cmd_type = zif_abapgit_html_form=>c_cmd_type-input_main
ASSIGNING <ls_command>.
IF sy-subrc = 0.
ls_hotkey_action-description = <ls_command>-label.
ls_hotkey_action-action = <ls_command>-action.
ls_hotkey_action-hotkey = |Enter|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ENDIF.
READ TABLE mt_commands WITH KEY action = zif_abapgit_definitions=>c_action-go_back
ASSIGNING <ls_command>.
IF sy-subrc = 0.
ls_hotkey_action-description = <ls_command>-label.
ls_hotkey_action-action = <ls_command>-action.
ls_hotkey_action-hotkey = |F3|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ENDIF.
ENDMETHOD.
ENDCLASS. | 29.609409 | 118 | 0.627942 | {
"alnum_ratio": 0.5811090573,
"alpha_token_ratio": 1.6605271515,
"avg_line_length": 29.6276013143,
"char_rep_ratio": 0.15617026,
"max_line_length": 118,
"num_words": 1999,
"text_len": 27050,
"word_rep_ratio": 0.0874371859
} | 7,214,147,197,899,520,000 |
1a91f6a7900926d2421e36970e8067650d14db73 | 792 | abap | ABAP | src/objects/zcl_abapgit_object_ecat.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/zcl_abapgit_object_ecat.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/zcl_abapgit_object_ecat.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_object_ecat DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_object_ecatt_super
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
PROTECTED SECTION.
METHODS:
get_object_type REDEFINITION,
get_upload REDEFINITION,
get_download REDEFINITION,
get_lock_object REDEFINITION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_abapgit_object_ecat IMPLEMENTATION.
METHOD get_download.
CREATE OBJECT ro_download TYPE zcl_abapgit_ecatt_script_downl.
ENDMETHOD.
METHOD get_lock_object.
rv_lock_object = 'E_ECATT'.
ENDMETHOD.
METHOD get_object_type.
rv_object_type = cl_apl_ecatt_const=>obj_type_test_script.
ENDMETHOD.
METHOD get_upload.
CREATE OBJECT ro_upload TYPE zcl_abapgit_ecatt_script_upl.
ENDMETHOD.
ENDCLASS. | 15.84 | 66 | 0.767677 | {
"alnum_ratio": 0.7142857143,
"alpha_token_ratio": 1.9755244755,
"avg_line_length": 16.1428571429,
"char_rep_ratio": 0.1240409207,
"max_line_length": 66,
"num_words": 56,
"text_len": 791,
"word_rep_ratio": 0
} | 1,469,195,569,355,717,600 |
1af1d936a70de656dc8ef5c78a4535b10abc8bbd | 13,797 | abap | ABAP | src/objects/core/zcl_abapgit_objects_activation.clas.abap | larshp/abapGit | 143f7d4d3b938bdbb418fef5f94665ba1f150fb6 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/core/zcl_abapgit_objects_activation.clas.abap | larshp/abapGit | 143f7d4d3b938bdbb418fef5f94665ba1f150fb6 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/core/zcl_abapgit_objects_activation.clas.abap | larshp/abapGit | 143f7d4d3b938bdbb418fef5f94665ba1f150fb6 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_objects_activation DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS add
IMPORTING
!iv_type TYPE trobjtype
!iv_name TYPE clike
!iv_delete TYPE abap_bool DEFAULT abap_false
RAISING
zcx_abapgit_exception .
CLASS-METHODS add_item
IMPORTING
!is_item TYPE zif_abapgit_definitions=>ty_item
RAISING
zcx_abapgit_exception .
CLASS-METHODS activate
IMPORTING
!iv_ddic TYPE abap_bool DEFAULT abap_false
!ii_log TYPE REF TO zif_abapgit_log
RAISING
zcx_abapgit_exception .
CLASS-METHODS clear .
CLASS-METHODS is_ddic_type
IMPORTING
!iv_obj_type TYPE trobjtype
RETURNING
VALUE(rv_result) TYPE abap_bool .
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
BEGIN OF ty_classes,
object TYPE trobjtype,
clsname TYPE seoclsname,
END OF ty_classes.
CLASS-DATA:
gt_classes TYPE STANDARD TABLE OF ty_classes WITH DEFAULT KEY .
CLASS-DATA:
gt_objects TYPE TABLE OF dwinactiv .
CLASS-METHODS update_where_used
IMPORTING
!ii_log TYPE REF TO zif_abapgit_log.
CLASS-METHODS use_new_activation_logic
RETURNING
VALUE(rv_use_new_activation_logic) TYPE abap_bool .
CLASS-METHODS activate_new
IMPORTING
!iv_ddic TYPE abap_bool DEFAULT abap_false
!ii_log TYPE REF TO zif_abapgit_log
RAISING
zcx_abapgit_exception .
CLASS-METHODS activate_old
IMPORTING
!iv_ddic TYPE abap_bool DEFAULT abap_false
!ii_log TYPE REF TO zif_abapgit_log
RAISING
zcx_abapgit_exception .
CLASS-METHODS activate_ddic
IMPORTING
!ii_log TYPE REF TO zif_abapgit_log
RAISING
zcx_abapgit_exception .
CLASS-METHODS add_errors_and_warnings_to_log
IMPORTING
!iv_logname TYPE ddmass-logname
!ii_log TYPE REF TO zif_abapgit_log
RAISING
zcx_abapgit_exception .
CLASS-METHODS add_activation_errors_to_log
IMPORTING
!io_checklist TYPE REF TO cl_wb_checklist
!ii_log TYPE REF TO zif_abapgit_log
RETURNING
VALUE(rv_try_again) TYPE abap_bool
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS zcl_abapgit_objects_activation IMPLEMENTATION.
METHOD activate.
" Make sure that all changes are committed since any activation error will lead to a rollback
COMMIT WORK AND WAIT.
IF use_new_activation_logic( ) = abap_true.
activate_new(
iv_ddic = iv_ddic
ii_log = ii_log ).
ELSE.
activate_old(
iv_ddic = iv_ddic
ii_log = ii_log ).
ENDIF.
update_where_used( ii_log ).
ENDMETHOD.
METHOD activate_ddic.
DATA: lt_gentab TYPE STANDARD TABLE OF dcgentb,
lv_rc TYPE sy-subrc,
ls_gentab LIKE LINE OF lt_gentab,
lt_deltab TYPE STANDARD TABLE OF dcdeltb,
lt_action_tab TYPE STANDARD TABLE OF dctablres,
lv_logname TYPE ddmass-logname.
FIELD-SYMBOLS: <ls_object> LIKE LINE OF gt_objects.
LOOP AT gt_objects ASSIGNING <ls_object>.
" Filter types supported by mass activation
IF is_ddic_type( <ls_object>-object ) = abap_false.
CONTINUE.
ENDIF.
ls_gentab-tabix = sy-tabix.
ls_gentab-type = <ls_object>-object.
ls_gentab-name = <ls_object>-obj_name.
IF ls_gentab-type = 'INDX' OR ls_gentab-type = 'XINX' OR ls_gentab-type = 'MCID'.
CALL FUNCTION 'DD_E071_TO_DD'
EXPORTING
object = <ls_object>-object
obj_name = <ls_object>-obj_name
IMPORTING
name = ls_gentab-name
id = ls_gentab-indx.
ENDIF.
INSERT ls_gentab INTO TABLE lt_gentab.
ENDLOOP.
IF lt_gentab IS NOT INITIAL.
lv_logname = |ABAPGIT_{ sy-datum }_{ sy-uzeit }|.
CALL FUNCTION 'DD_MASS_ACT_C3'
EXPORTING
ddmode = 'O' " activate changes in Original System
frcact = abap_true " force Activation
medium = 'T' " transport order
device = 'T' " saves to table DDRPH?
version = 'M' " activate newest version
logname = lv_logname
write_log = abap_true
log_head_tail = abap_true
t_on = space
prid = 1
IMPORTING
act_rc = lv_rc
TABLES
gentab = lt_gentab
deltab = lt_deltab
cnvtab = lt_action_tab
EXCEPTIONS
access_failure = 1
no_objects = 2
locked = 3
internal_error = 4
OTHERS = 5.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
IF lv_rc > 0.
add_errors_and_warnings_to_log(
iv_logname = lv_logname
ii_log = ii_log ).
ENDIF.
IF lv_rc > 4.
zcx_abapgit_exception=>raise( 'Activation cancelled. Check the inactive objects.' ).
ENDIF.
" Remove objects from activation queue to avoid double activation in activate_old
LOOP AT lt_gentab INTO ls_gentab.
DELETE gt_objects WHERE object = ls_gentab-type AND obj_name = ls_gentab-name.
ENDLOOP.
DELETE gt_objects WHERE object = 'INDX' OR object = 'XINX' OR object = 'MCID'.
ENDIF.
ENDMETHOD.
METHOD activate_new.
IF gt_objects IS INITIAL.
RETURN.
ENDIF.
IF iv_ddic = abap_true.
activate_ddic( ii_log ).
ELSE.
activate_old( ii_log ).
ENDIF.
ENDMETHOD.
METHOD activate_old.
DATA:
lv_popup TYPE abap_bool,
lv_no_ui TYPE abap_bool,
lv_try_again TYPE abap_bool,
lv_msg TYPE string,
lo_checklist TYPE REF TO cl_wb_checklist.
IF gt_objects IS NOT INITIAL.
IF zcl_abapgit_ui_factory=>get_frontend_services( )->gui_is_available( ) = abap_true.
IF zcl_abapgit_persist_factory=>get_settings( )->read( )->get_activate_wo_popup( ) = abap_true.
lv_popup = abap_false.
ELSE.
lv_popup = abap_true.
ENDIF.
ELSE.
lv_popup = abap_false.
ENDIF.
lv_no_ui = boolc( lv_popup = abap_false ).
TRY.
CALL FUNCTION 'RS_WORKING_OBJECTS_ACTIVATE'
EXPORTING
activate_ddic_objects = iv_ddic
with_popup = lv_popup
ui_decoupled = lv_no_ui
IMPORTING
p_checklist = lo_checklist
TABLES
objects = gt_objects
EXCEPTIONS
excecution_error = 1
cancelled = 2
insert_into_corr_error = 3
OTHERS = 4 ##SUBRC_OK.
CATCH cx_sy_dyn_call_param_not_found.
CALL FUNCTION 'RS_WORKING_OBJECTS_ACTIVATE'
EXPORTING
activate_ddic_objects = iv_ddic
with_popup = lv_popup
IMPORTING
p_checklist = lo_checklist
TABLES
objects = gt_objects
EXCEPTIONS
excecution_error = 1
cancelled = 2
insert_into_corr_error = 3
OTHERS = 4 ##SUBRC_OK.
ENDTRY.
CASE sy-subrc.
WHEN 1 OR 3 OR 4.
zcx_abapgit_exception=>raise_t100( ).
WHEN 2.
lv_msg = 'Check the log and inactive objects.'.
IF lv_popup = abap_false.
lv_try_again = add_activation_errors_to_log(
ii_log = ii_log
io_checklist = lo_checklist ).
IF lv_try_again = abap_true.
lv_msg = 'Turn on "Activation Popup" in "Personal Settings" and try again'.
ENDIF.
ENDIF.
zcx_abapgit_exception=>raise( |Activation cancelled. { lv_msg }| ).
ENDCASE.
ENDIF.
ENDMETHOD.
METHOD add.
* function group SEWORKINGAREA
* function module RS_INSERT_INTO_WORKING_AREA
* class CL_WB_ACTIVATION_WORK_AREA
FIELD-SYMBOLS: <ls_object> TYPE dwinactiv,
<ls_classes> LIKE LINE OF gt_classes.
IF iv_type = 'CLAS' OR iv_type = 'INTF'.
APPEND INITIAL LINE TO gt_classes ASSIGNING <ls_classes>.
<ls_classes>-object = iv_type.
<ls_classes>-clsname = iv_name.
ELSE.
APPEND INITIAL LINE TO gt_objects ASSIGNING <ls_object>.
<ls_object>-object = iv_type.
<ls_object>-obj_name = iv_name.
<ls_object>-delet_flag = iv_delete.
ENDIF.
ENDMETHOD.
METHOD add_activation_errors_to_log.
DATA:
ls_item TYPE zif_abapgit_definitions=>ty_item,
lt_message TYPE swbme_error_tab.
FIELD-SYMBOLS:
<lv_msg> TYPE string,
<ls_message> LIKE LINE OF lt_message.
io_checklist->get_error_messages( IMPORTING p_error_tab = lt_message ).
LOOP AT lt_message ASSIGNING <ls_message> WHERE mtype = 'E'.
" When activting without popup, includes used in multiple main programs cause error
" Run again WITH activation popup (see abapGit, Personal Settings)
IF <ls_message>-message-msgid = 'EU' AND <ls_message>-message-msgno = '404'.
rv_try_again = abap_true.
ENDIF.
CLEAR ls_item.
IF strlen( <ls_message>-object_text ) > 5.
ls_item-obj_type = <ls_message>-object_text(4).
ls_item-obj_name = <ls_message>-object_text+5(*).
ENDIF.
LOOP AT <ls_message>-mtext ASSIGNING <lv_msg>.
ii_log->add_error(
iv_msg = <lv_msg>
is_item = ls_item ).
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD add_errors_and_warnings_to_log.
DATA: lt_lines TYPE STANDARD TABLE OF trlog,
lv_logname_db TYPE ddprh-protname.
FIELD-SYMBOLS: <ls_line> LIKE LINE OF lt_lines.
lv_logname_db = iv_logname.
CALL FUNCTION 'TR_READ_LOG'
EXPORTING
iv_log_type = 'DB'
iv_logname_db = lv_logname_db
TABLES
et_lines = lt_lines
EXCEPTIONS
invalid_input = 1
access_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
" Only error messsages
DELETE lt_lines WHERE severity <> 'E'
AND severity <> 'W'.
" Remove "Return code..." message
DELETE lt_lines WHERE class = 'D0' AND number = '319'.
LOOP AT lt_lines ASSIGNING <ls_line>.
ii_log->add( iv_msg = <ls_line>-line
iv_type = <ls_line>-severity ).
ENDLOOP.
ENDMETHOD.
METHOD add_item.
add( iv_type = is_item-obj_type
iv_name = is_item-obj_name ).
ENDMETHOD.
METHOD clear.
CLEAR gt_objects.
CLEAR gt_classes.
ENDMETHOD.
METHOD is_ddic_type.
" Determine if object can be handled by mass activation (see RADMASUTC form ma_tab_check)
CONSTANTS:
lc_domain TYPE c LENGTH 9 VALUE 'DOMA DOMD',
lc_types TYPE c LENGTH 50 VALUE 'DTEL DTED TABL TABD SQLT SQLD TTYP TTYD VIEW VIED',
lc_technset TYPE c LENGTH 24 VALUE 'TABT VIET SQTT INDX XINX',
lc_f4_objects TYPE c LENGTH 35 VALUE 'SHLP SHLD MCOB MCOD MACO MACD MCID',
lc_enqueue TYPE c LENGTH 9 VALUE 'ENQU ENQD',
lc_sqsc TYPE c LENGTH 4 VALUE 'SQSC',
lc_stob TYPE c LENGTH 4 VALUE 'STOB',
lc_ntab TYPE c LENGTH 14 VALUE 'NTTT NTTB NTDT',
lc_ddls TYPE c LENGTH 14 VALUE 'DDLS DRUL DTDC',
lc_switches TYPE c LENGTH 24 VALUE 'SF01 SF02 SFSW SFBS SFBF',
lc_para TYPE c LENGTH 4 VALUE 'PARA', " can be referenced by DTEL
lc_enhd TYPE c LENGTH 4 VALUE 'ENHD'.
rv_result = abap_true.
IF lc_domain NS iv_obj_type AND lc_types NS iv_obj_type AND
lc_technset NS iv_obj_type AND lc_f4_objects NS iv_obj_type AND
lc_enqueue NS iv_obj_type AND lc_sqsc NS iv_obj_type AND
lc_stob NS iv_obj_type AND lc_ntab NS iv_obj_type AND
lc_ddls NS iv_obj_type AND lc_para NS iv_obj_type AND
lc_switches NS iv_obj_type AND iv_obj_type <> lc_enhd.
rv_result = abap_false.
ENDIF.
ENDMETHOD.
METHOD update_where_used.
DATA: ls_class LIKE LINE OF gt_classes,
lo_cross TYPE REF TO cl_wb_crossreference,
ls_item TYPE zif_abapgit_definitions=>ty_item,
lv_error TYPE c LENGTH 1,
lv_include TYPE programm.
LOOP AT gt_classes INTO ls_class.
CASE ls_class-object.
WHEN 'CLAS'.
lv_include = cl_oo_classname_service=>get_classpool_name( ls_class-clsname ).
WHEN 'INTF'.
lv_include = cl_oo_classname_service=>get_interfacepool_name( ls_class-clsname ).
ENDCASE.
CREATE OBJECT lo_cross
EXPORTING
p_name = lv_include
p_include = lv_include.
lo_cross->index_actualize( IMPORTING p_error = lv_error ).
IF lv_error = abap_true.
ls_item-obj_type = ls_class-object.
ls_item-obj_name = ls_class-clsname.
ii_log->add(
iv_msg = 'Error updating where-used list'
is_item = ls_item ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD use_new_activation_logic.
CALL FUNCTION 'FUNCTION_EXISTS'
EXPORTING
funcname = 'DD_MASS_ACT_C3'
EXCEPTIONS
function_not_exist = 1
OTHERS = 2.
IF sy-subrc = 0.
rv_use_new_activation_logic = abap_true.
ENDIF.
ENDMETHOD.
ENDCLASS. | 28.985294 | 103 | 0.61006 | {
"alnum_ratio": 0.5695129023,
"alpha_token_ratio": 1.7046450482,
"avg_line_length": 29.0442105263,
"char_rep_ratio": 0.1198230217,
"max_line_length": 103,
"num_words": 1080,
"text_len": 13796,
"word_rep_ratio": 0.0196078431
} | 1,271,454,410,330,031,000 |
2110966d2169aca1999165c532c84684e113af98 | 2,026 | abap | ABAP | src/checks/zcl_aoc_check_98.clas.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_98.clas.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_98.clas.abap | D072189/abapOpenChecks | 03b3ddd245b44e2409540057ca92dd036ec7b726 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | CLASS zcl_aoc_check_98 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor .
METHODS check
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_AOC_CHECK_98 IMPLEMENTATION.
METHOD check.
DATA lt_structures TYPE ty_structures_tt.
DATA lv_empty_catch_count TYPE i.
FIELD-SYMBOLS <ls_structure_try> LIKE LINE OF io_scan->structures.
FIELD-SYMBOLS <ls_structure_catch> LIKE LINE OF io_scan->structures.
FIELD-SYMBOLS <ls_statement> LIKE LINE OF io_scan->statements.
lt_structures = io_scan->structures.
LOOP AT io_scan->structures ASSIGNING <ls_structure_try>
WHERE stmnt_type = zcl_aoc_scan=>gc_structure_statement-try.
CLEAR lv_empty_catch_count.
LOOP AT lt_structures ASSIGNING <ls_structure_catch>
FROM <ls_structure_try>-struc_from TO <ls_structure_try>-struc_to
WHERE stmnt_type = zcl_aoc_scan=>gc_structure_statement-catch.
IF <ls_structure_catch>-struc_to < <ls_structure_catch>-struc_from. "Empty catch.
lv_empty_catch_count = lv_empty_catch_count + 1.
ENDIF.
IF lv_empty_catch_count = 2.
READ TABLE io_scan->statements ASSIGNING <ls_statement> INDEX <ls_structure_catch>-stmnt_from.
inform( p_sub_obj_name = program_name
p_line = <ls_statement>-trow
p_kind = mv_errty
p_test = myname
p_code = '001' ).
ENDIF.
ENDLOOP.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
version = '001'.
position = '098'.
has_attributes = abap_true.
attributes_ok = abap_true.
add_obj_type( 'PROG' ).
add_obj_type( 'CLAS' ).
add_obj_type( 'FUGR' ).
enable_rfc( ).
insert_scimessage(
iv_code = '001'
iv_text = 'Empty catches should be combined'(m01) ).
ENDMETHOD.
ENDCLASS. | 24.409639 | 104 | 0.654492 | {
"alnum_ratio": 0.6088888889,
"alpha_token_ratio": 1.8131539611,
"avg_line_length": 24.6951219512,
"char_rep_ratio": 0.1299603175,
"max_line_length": 104,
"num_words": 133,
"text_len": 2025,
"word_rep_ratio": 0
} | 10,578,966,720,400,210,000 |
211b6a8f21a857e59e6b3bf3541459c7fe917026 | 2,034 | abap | ABAP | src/checks/y_check_comment_type.clas.testclasses.abap | steve192/code-pal-for-abap | 5f701f5239036cbb724756a86e805fdbae377ab7 | [
"Apache-2.0"
] | 202 | 2020-05-05T13:41:12.000Z | 2022-03-26T15:18:13.000Z | src/checks/y_check_comment_type.clas.testclasses.abap | steve192/code-pal-for-abap | 5f701f5239036cbb724756a86e805fdbae377ab7 | [
"Apache-2.0"
] | 322 | 2020-05-05T19:14:35.000Z | 2022-03-22T14:48:44.000Z | src/checks/y_check_comment_type.clas.testclasses.abap | lucasborin/code-pal-for-abap | 4e1247693457e7687648806b18b63cb8968f927a | [
"Apache-2.0"
] | 59 | 2020-05-05T18:59:19.000Z | 2022-03-20T11:24:48.000Z | CLASS ltc_asterisk DEFINITION INHERITING FROM y_unit_test_base FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
PROTECTED SECTION.
METHODS get_cut REDEFINITION.
METHODS get_code_with_issue REDEFINITION.
METHODS get_code_without_issue REDEFINITION.
METHODS get_code_with_exemption REDEFINITION.
ENDCLASS.
CLASS ltc_asterisk IMPLEMENTATION.
METHOD get_cut.
result ?= NEW y_check_comment_type( ).
ENDMETHOD.
METHOD get_code_with_issue.
result = VALUE #(
( 'REPORT y_example. ' )
( ' CLASS y_example_class DEFINITION. ' )
( ' PROTECTED SECTION. ' )
( ' METHODS test. ' )
( ' ENDCLASS. ' )
( ' CLASS y_example_class IMPLEMENTATION. ' )
( ' METHOD test. ' )
( '* anti-pattern ' )
( ' DATA(variable) = 1. ' )
( ' ENDMETHOD. ' )
( ' ENDCLASS. ' )
).
ENDMETHOD.
METHOD get_code_without_issue.
result = VALUE #(
( 'REPORT y_example. ' )
( ' CLASS y_example_class DEFINITION. ' )
( ' PROTECTED SECTION. ' )
( ' METHODS test. ' )
( ' ENDCLASS. ' )
( ' CLASS y_example_class IMPLEMENTATION. ' )
( ' METHOD test. ' )
( ' " Example Comment ' )
( ' DATA(variable) = 1. ' )
( ' ENDMETHOD. ' )
( ' ENDCLASS. ' )
).
ENDMETHOD.
METHOD get_code_with_exemption.
result = VALUE #( ).
ENDMETHOD.
ENDCLASS.
CLASS ltc_generated_include DEFINITION INHERITING FROM ltc_asterisk FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
PROTECTED SECTION.
METHODS get_code_without_issue REDEFINITION.
ENDCLASS.
CLASS ltc_generated_include IMPLEMENTATION.
METHOD get_code_without_issue.
result = VALUE #(
( 'REPORT y_example. ' )
( '*&---------------------------------------------------------------------* ' )
( '*& Include y_example ' )
( '*&---------------------------------------------------------------------* ' )
).
ENDMETHOD.
ENDCLASS. | 27.486486 | 115 | 0.554081 | {
"alnum_ratio": 0.529267093,
"alpha_token_ratio": 1.6297420334,
"avg_line_length": 27.8493150685,
"char_rep_ratio": 0.2144268775,
"max_line_length": 115,
"num_words": 124,
"text_len": 2033,
"word_rep_ratio": 0.1565217391
} | 1,209,674,011,378,790,400 |
217030e7bafa1055611114bb274e06a9ad1a8f0d | 1,027 | abap | ABAP | src/data/zcl_abapgit_data_factory.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/data/zcl_abapgit_data_factory.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/data/zcl_abapgit_data_factory.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_data_factory DEFINITION
PUBLIC
CREATE PUBLIC
GLOBAL FRIENDS zcl_abapgit_data_injector .
PUBLIC SECTION.
CLASS-METHODS get_serializer
RETURNING
VALUE(ri_serializer) TYPE REF TO zif_abapgit_data_serializer .
CLASS-METHODS get_deserializer
RETURNING
VALUE(ri_deserializer) TYPE REF TO zif_abapgit_data_deserializer .
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-DATA gi_serializer TYPE REF TO zif_abapgit_data_serializer .
CLASS-DATA gi_deserializer TYPE REF TO zif_abapgit_data_deserializer .
ENDCLASS.
CLASS ZCL_ABAPGIT_DATA_FACTORY IMPLEMENTATION.
METHOD get_deserializer.
IF gi_deserializer IS INITIAL.
CREATE OBJECT gi_deserializer TYPE zcl_abapgit_data_deserializer.
ENDIF.
ri_deserializer = gi_deserializer.
ENDMETHOD.
METHOD get_serializer.
IF gi_serializer IS INITIAL.
CREATE OBJECT gi_serializer TYPE zcl_abapgit_data_serializer.
ENDIF.
ri_serializer = gi_serializer.
ENDMETHOD.
ENDCLASS. | 21.851064 | 74 | 0.772152 | {
"alnum_ratio": 0.730994152,
"alpha_token_ratio": 2.0833333333,
"avg_line_length": 22.3043478261,
"char_rep_ratio": 0.1710914454,
"max_line_length": 74,
"num_words": 78,
"text_len": 1026,
"word_rep_ratio": 0
} | 321,312,722,415,519,100 |
218355d552775b3fa43b7bb9cf1205f106974c84 | 7,929 | abap | ABAP | src/objects/zcl_abapgit_object_shma.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/objects/zcl_abapgit_object_shma.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/objects/zcl_abapgit_object_shma.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_object_shma DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_abapgit_object_shma IMPLEMENTATION.
METHOD zif_abapgit_object~changed_by.
SELECT SINGLE chg_user
FROM shma_attributes
INTO rv_user
WHERE area_name = ms_item-obj_name.
IF sy-subrc <> 0.
rv_user = c_user_unknown.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
" We can't use FM SHMA_DELETE_AREA because it depends
" on the corresponding class, but in abapGit it has its own
" lifecycle. Therefore we have to reimplement most of the
" FMs logic
CONSTANTS: lc_request_delete TYPE i VALUE 4.
DATA: lv_request TYPE i,
lv_area_name TYPE shm_area_name,
lv_order TYPE e070-trkorr,
lv_korrnum TYPE tadir-korrnum,
lv_objname TYPE tadir-obj_name,
lv_task TYPE e070-trkorr,
lv_append TYPE abap_bool,
ls_tadir TYPE tadir,
ls_tdevc TYPE tdevc,
lo_cts_if TYPE REF TO object.
lv_area_name = ms_item-obj_name.
TRY.
CALL FUNCTION 'ENQUEUE_E_SHM_AREA'
EXPORTING
mode_shma_attributes = 'E'
area_name = lv_area_name
x_area_name = ' '
_scope = '2'
_wait = ' '
_collect = ' '
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
CALL METHOD ('\PROGRAM=SAPMSHM_MONITOR\CLASS=LCL_SHMM')=>('FREE_AREA_BY_NAME')
EXPORTING
area_name = lv_area_name
affect_server = cl_shm_area=>affect_all_servers.
CREATE OBJECT lo_cts_if TYPE ('\FUNCTION-POOL=SHMA\CLASS=LCL_CTS_INTERFACE')
EXPORTING
area = lv_area_name.
CALL METHOD lo_cts_if->('CHECK_AREA')
EXPORTING
request = lc_request_delete
IMPORTING
access_mode = lv_request
appendable = lv_append.
IF lv_request <> lc_request_delete.
zcx_abapgit_exception=>raise( |Error deleting SHMA { ms_item-obj_name }| ).
ENDIF.
CALL METHOD lo_cts_if->('INSERT_AREA')
EXPORTING
request = lc_request_delete
IMPORTING
order = lv_order
task = lv_task.
DELETE FROM shma_attributes WHERE area_name = lv_area_name.
DELETE FROM shma_start WHERE area_name = lv_area_name.
lv_korrnum = lv_order.
lv_objname = lv_area_name.
CALL FUNCTION 'TR_TADIR_INTERFACE'
EXPORTING
wi_read_only = abap_true
wi_tadir_pgmid = 'R3TR'
wi_tadir_object = 'SHMA'
wi_tadir_obj_name = lv_objname
IMPORTING
new_tadir_entry = ls_tadir
EXCEPTIONS
OTHERS = 0.
CALL FUNCTION 'TR_DEVCLASS_GET'
EXPORTING
iv_devclass = ls_tadir-devclass
IMPORTING
es_tdevc = ls_tdevc
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0 AND ls_tdevc-korrflag IS INITIAL.
" TADIR entries for local objects must be deleted 'by hand'
CALL FUNCTION 'TR_TADIR_INTERFACE'
EXPORTING
wi_test_modus = abap_false
wi_delete_tadir_entry = abap_true
wi_tadir_pgmid = 'R3TR'
wi_tadir_object = 'SHMA'
wi_tadir_obj_name = lv_objname
wi_tadir_korrnum = lv_korrnum
EXCEPTIONS
OTHERS = 0.
ENDIF.
CALL METHOD ('\PROGRAM=SAPLSHMA\CLASS=LCL_SHMA_HELPER')=>('DELETE_RUNTIME_SETTINGS')
EXPORTING
area_name = lv_area_name.
CALL FUNCTION 'DEQUEUE_E_SHM_AREA'
EXPORTING
mode_shma_attributes = 'E'
area_name = lv_area_name
x_area_name = ' '
_scope = '3'
_synchron = ' '
_collect = ' '.
CATCH cx_root.
zcx_abapgit_exception=>raise( |Error deleting SHMA { ms_item-obj_name }| ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lv_area_name TYPE shm_area_name,
ls_area_attributes TYPE shma_attributes.
lv_area_name = ms_item-obj_name.
io_xml->read(
EXPORTING
iv_name = 'AREA_ATTRIBUTES'
CHANGING
cg_data = ls_area_attributes ).
tadir_insert( iv_package ).
TRY.
CALL METHOD ('\PROGRAM=SAPLSHMA\CLASS=LCL_SHMA_HELPER')=>('INSERT_AREA')
EXPORTING
area_name = lv_area_name
attributes = ls_area_attributes
force_overwrite = abap_true
no_class_generation = abap_false
silent_mode = abap_true.
CATCH cx_root.
zcx_abapgit_exception=>raise( |Error serializing SHMA { ms_item-obj_name }| ).
ENDTRY.
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_area_name TYPE shm_area_name.
SELECT SINGLE area_name
FROM shma_attributes
INTO lv_area_name
WHERE area_name = ms_item-obj_name.
rv_bool = boolc( sy-subrc = 0 ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
DATA: ls_bcdata TYPE bdcdata,
lt_bcdata TYPE STANDARD TABLE OF bdcdata.
ls_bcdata-program = 'SAPLSHMA'.
ls_bcdata-dynpro = '0100'.
ls_bcdata-dynbegin = 'X'.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'SHMA_ATTRIBUTES-AREA_NAME'.
ls_bcdata-fval = ms_item-obj_name.
APPEND ls_bcdata TO lt_bcdata.
CLEAR ls_bcdata.
ls_bcdata-fnam = 'BDC_OKCODE'.
ls_bcdata-fval = '=SHOW'.
APPEND ls_bcdata TO lt_bcdata.
CALL FUNCTION 'ABAP4_CALL_TRANSACTION'
STARTING NEW TASK 'GIT'
EXPORTING
tcode = 'SHMA'
mode_val = 'E'
TABLES
using_tab = lt_bcdata
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from ABAP4_CALL_TRANSACTION, SHMA' ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_area_name TYPE shm_area_name,
ls_area_attributes TYPE shma_attributes.
lv_area_name = ms_item-obj_name.
TRY.
CALL METHOD ('\PROGRAM=SAPLSHMA\CLASS=LCL_SHMA_HELPER')=>('READ_AREA_ATTRIBUTES_ALL')
EXPORTING
area_name = lv_area_name
IMPORTING
area_attributes = ls_area_attributes.
CLEAR: ls_area_attributes-chg_user,
ls_area_attributes-chg_date,
ls_area_attributes-chg_time,
ls_area_attributes-cls_gen_user,
ls_area_attributes-cls_gen_date,
ls_area_attributes-cls_gen_time.
io_xml->add( iv_name = 'AREA_ATTRIBUTES'
ig_data = ls_area_attributes ).
CATCH cx_root.
zcx_abapgit_exception=>raise( |Error serializing SHMA { ms_item-obj_name }| ).
ENDTRY.
ENDMETHOD.
ENDCLASS. | 26.787162 | 96 | 0.599067 | {
"alnum_ratio": 0.5536074672,
"alpha_token_ratio": 1.6422917452,
"avg_line_length": 26.8745762712,
"char_rep_ratio": 0.1679504988,
"max_line_length": 96,
"num_words": 484,
"text_len": 7928,
"word_rep_ratio": 0
} | 16,404,645,762,064,345,000 |
2189fdc2dbb0d7c06d85673de93de71f13be562b | 1,578 | abap | ABAP | src/utils/zcl_abapgit_login_manager.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/utils/zcl_abapgit_login_manager.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/utils/zcl_abapgit_login_manager.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS ltcl_login_manager DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
PRIVATE SECTION.
CONSTANTS: c_username TYPE string VALUE 'Aladdin' ,
c_password TYPE string VALUE 'OpenSesame' .
METHODS:
setup,
teardown,
encoding FOR TESTING
RAISING zcx_abapgit_exception,
same_server FOR TESTING
RAISING zcx_abapgit_exception.
ENDCLASS.
CLASS ltcl_login_manager IMPLEMENTATION.
METHOD setup.
zcl_abapgit_login_manager=>clear( ).
ENDMETHOD.
METHOD teardown.
zcl_abapgit_login_manager=>clear( ).
ENDMETHOD.
METHOD encoding.
DATA: lv_auth TYPE string.
lv_auth = zcl_abapgit_login_manager=>set(
iv_uri = ''
iv_username = c_username
iv_password = c_password ).
cl_abap_unit_assert=>assert_equals(
act = lv_auth
exp = 'Basic QWxhZGRpbjpPcGVuU2VzYW1l' ).
ENDMETHOD.
METHOD same_server.
CONSTANTS: lc_github1 TYPE string VALUE '',
lc_github2 TYPE string VALUE ''.
DATA: lv_auth1 TYPE string,
lv_auth2 TYPE string.
zcl_abapgit_login_manager=>set(
iv_uri = lc_github1
iv_username = c_username
iv_password = c_password ).
lv_auth1 = zcl_abapgit_login_manager=>load( lc_github1 ).
lv_auth2 = zcl_abapgit_login_manager=>load( lc_github2 ).
cl_abap_unit_assert=>assert_equals(
act = lv_auth1
exp = lv_auth2 ).
ENDMETHOD.
ENDCLASS. | 23.909091 | 89 | 0.690748 | {
"alnum_ratio": 0.6395904437,
"alpha_token_ratio": 1.7906976744,
"avg_line_length": 22.5384615385,
"char_rep_ratio": 0.1304945055,
"max_line_length": 89,
"num_words": 107,
"text_len": 1465,
"word_rep_ratio": 0
} | 1,305,861,140,631,482,600 |
21ce83dbc397c848abc1d14c85777547c3fb9ca2 | 2,390 | abap | ABAP | src/ui/core/zcl_abapgit_html_parts.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/ui/core/zcl_abapgit_html_parts.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/ui/core/zcl_abapgit_html_parts.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS ltcl_part_collections DEFINITION
FOR TESTING
RISK LEVEL HARMLESS
DURATION SHORT
FINAL.
PUBLIC SECTION.
PRIVATE SECTION.
METHODS test FOR TESTING.
ENDCLASS.
CLASS ltcl_part_collections IMPLEMENTATION.
METHOD test.
DATA lo_html1 TYPE REF TO zcl_abapgit_html.
DATA lo_html2 TYPE REF TO zcl_abapgit_html.
DATA lo_html3 TYPE REF TO zcl_abapgit_html.
DATA lo_html_tmp TYPE REF TO zif_abapgit_html.
DATA lo_parts TYPE REF TO zcl_abapgit_html_parts.
DATA lt_col_exp TYPE string_table.
DATA lt_parts_act TYPE zif_abapgit_html=>ty_table_of.
CREATE OBJECT lo_html1.
CREATE OBJECT lo_html2.
CREATE OBJECT lo_html3.
CREATE OBJECT lo_parts.
lo_parts->add_part(
iv_collection = 'ABC'
ii_part = lo_html1 ).
lo_parts->add_part(
iv_collection = 'ABC'
ii_part = lo_html2 ).
lo_parts->add_part(
iv_collection = 'XYZ'
ii_part = lo_html3 ).
cl_abap_unit_assert=>assert_equals(
act = lo_parts->get_collection_size( 'ABC' )
exp = 2 ).
cl_abap_unit_assert=>assert_equals(
act = lo_parts->get_collection_size( 'XYZ' )
exp = 1 ).
cl_abap_unit_assert=>assert_equals(
act = lo_parts->get_collection_size( '123' )
exp = 0 ).
APPEND 'ABC' TO lt_col_exp.
APPEND 'XYZ' TO lt_col_exp.
cl_abap_unit_assert=>assert_equals(
act = lo_parts->get_collection_names( )
exp = lt_col_exp ).
lt_parts_act = lo_parts->get_parts( 'ABC' ).
cl_abap_unit_assert=>assert_equals(
act = lines( lt_parts_act )
exp = 2 ).
READ TABLE lt_parts_act INTO lo_html_tmp INDEX 1.
cl_abap_unit_assert=>assert_equals(
act = lo_html_tmp
exp = lo_html1 ).
READ TABLE lt_parts_act INTO lo_html_tmp INDEX 2.
cl_abap_unit_assert=>assert_equals(
act = lo_html_tmp
exp = lo_html2 ).
lt_parts_act = lo_parts->get_parts( 'XYZ' ).
cl_abap_unit_assert=>assert_equals(
act = lines( lt_parts_act )
exp = 1 ).
READ TABLE lt_parts_act INTO lo_html_tmp INDEX 1.
cl_abap_unit_assert=>assert_equals(
act = lo_html_tmp
exp = lo_html3 ).
lt_parts_act = lo_parts->get_parts( '123' ).
cl_abap_unit_assert=>assert_initial( lt_parts_act ).
lo_parts->clear( ).
cl_abap_unit_assert=>assert_initial( lo_parts->get_collection_names( ) ).
ENDMETHOD.
ENDCLASS. | 26.555556 | 77 | 0.688285 | {
"alnum_ratio": 0.6241105065,
"alpha_token_ratio": 1.640537514,
"avg_line_length": 26.8426966292,
"char_rep_ratio": 0.1462184874,
"max_line_length": 77,
"num_words": 175,
"text_len": 2389,
"word_rep_ratio": 0.1686746988
} | 537,712,189,732,812,740 |
21cfdb75458fe55d4ab0d0c979ea64f1636e4035 | 6,128 | abap | ABAP | src/demos/zdemo_excel15.prog.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 251 | 2019-02-23T03:36:38.000Z | 2021-12-10T21:39:23.000Z | src/demos/zdemo_excel15.prog.abap | gregorwolf/abap2xlsx | 5110f924b435e23f4474381d0e43f0686b9d0421 | [
"Apache-2.0"
] | 278 | 2019-02-17T10:42:59.000Z | 2021-12-10T20:24:56.000Z | src/demos/zdemo_excel15.prog.abap | gregorwolf/abap2xlsx | 5110f924b435e23f4474381d0e43f0686b9d0421 | [
"Apache-2.0"
] | 130 | 2019-02-20T13:25:30.000Z | 2021-12-09T03:20:31.000Z | *&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL15
*&
*&---------------------------------------------------------------------*
*& 2010-10-30, Gregor Wolf:
*& Added the functionality to ouput the read table content
*& 2011-12-19, Shahrin Shahrulzaman:
*& Added the functionality to have multiple input and output files
*&---------------------------------------------------------------------*
REPORT zdemo_excel15.
TYPE-POOLS: abap.
TYPES:
BEGIN OF t_demo_excel15,
input TYPE string,
END OF t_demo_excel15.
CONSTANTS: sheet_with_date_formats TYPE string VALUE '24_Sheets_with_different_default_date_formats.xlsx'.
DATA: excel TYPE REF TO zcl_excel,
lo_excel_writer TYPE REF TO zif_excel_writer,
reader TYPE REF TO zif_excel_reader.
DATA: ex TYPE REF TO zcx_excel,
msg TYPE string.
DATA: lv_file TYPE xstring,
lv_bytecount TYPE i,
lt_file_tab TYPE solix_tab.
DATA: lv_workdir TYPE string,
output_file_path TYPE string,
input_file_path TYPE string,
lv_file_separator TYPE c.
DATA: worksheet TYPE REF TO zcl_excel_worksheet,
highest_column TYPE zexcel_cell_column,
highest_row TYPE int4,
column TYPE zexcel_cell_column VALUE 1,
col_str TYPE zexcel_cell_column_alpha,
row TYPE int4 VALUE 1,
value TYPE zexcel_cell_value,
converted_date TYPE d.
DATA:
lt_files TYPE TABLE OF t_demo_excel15.
FIELD-SYMBOLS: <wa_files> TYPE t_demo_excel15.
PARAMETERS: p_path TYPE zexcel_export_dir,
p_noout TYPE abap_bool DEFAULT abap_true.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
lv_workdir = p_path.
cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir
CHANGING selected_folder = lv_workdir ).
p_path = lv_workdir.
INITIALIZATION.
cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ).
cl_gui_cfw=>flush( ).
p_path = lv_workdir.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '01_HelloWorld.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '02_Styles.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '03_iTab.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '04_Sheets.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '05_Conditional.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '07_ConditionalAll.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '08_Range.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '13_MergedCells.xlsx'.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = sheet_with_date_formats.
APPEND INITIAL LINE TO lt_files ASSIGNING <wa_files>.
<wa_files>-input = '31_AutosizeWithDifferentFontSizes.xlsx'.
START-OF-SELECTION.
IF p_path IS INITIAL.
p_path = lv_workdir.
ENDIF.
cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ).
LOOP AT lt_files ASSIGNING <wa_files>.
CONCATENATE p_path lv_file_separator <wa_files>-input INTO input_file_path.
CONCATENATE p_path lv_file_separator '15_' <wa_files>-input INTO output_file_path.
REPLACE '.xlsx' IN output_file_path WITH 'FromReader.xlsx'.
TRY.
CREATE OBJECT reader TYPE zcl_excel_reader_2007.
excel = reader->load_file( input_file_path ).
IF p_noout EQ abap_false.
worksheet = excel->get_active_worksheet( ).
highest_column = worksheet->get_highest_column( ).
highest_row = worksheet->get_highest_row( ).
WRITE: / 'Filename ', <wa_files>-input.
WRITE: / 'Highest column: ', highest_column, 'Highest row: ', highest_row.
WRITE: /.
WHILE row <= highest_row.
WHILE column <= highest_column.
col_str = zcl_excel_common=>convert_column2alpha( column ).
worksheet->get_cell(
EXPORTING
ip_column = col_str
ip_row = row
IMPORTING
ep_value = value
).
WRITE: value.
column = column + 1.
ENDWHILE.
WRITE: /.
column = 1.
row = row + 1.
ENDWHILE.
IF <wa_files>-input = sheet_with_date_formats.
worksheet->get_cell(
EXPORTING
ip_column = 'A'
ip_row = 4
IMPORTING
ep_value = value
).
WRITE: / 'Date value using get_cell: ', value.
converted_date = zcl_excel_common=>excel_string_to_date( ip_value = value ).
WRITE: / 'Converted date: ', converted_date.
ENDIF.
ENDIF.
CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007.
lv_file = lo_excel_writer->write_file( excel ).
" Convert to binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_file
IMPORTING
output_length = lv_bytecount
TABLES
binary_tab = lt_file_tab.
* " This method is only available on AS ABAP > 6.40
* lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ).
* lv_bytecount = xstrlen( lv_file ).
" Save the file
cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount
filename = output_file_path
filetype = 'BIN'
CHANGING data_tab = lt_file_tab ).
CATCH zcx_excel INTO ex. " Exceptions for ABAP2XLSX
msg = ex->get_text( ).
WRITE: / msg.
ENDTRY.
ENDLOOP. | 36.260355 | 106 | 0.609824 | {
"alnum_ratio": 0.5702627713,
"alpha_token_ratio": 1.733164557,
"avg_line_length": 36.4702380952,
"char_rep_ratio": 0.2003922851,
"max_line_length": 106,
"num_words": 441,
"text_len": 6127,
"word_rep_ratio": 0
} | 5,324,187,455,355,329,000 |
1d0a171f11a5a3bfd9cdfa975c02b4b694836b07 | 3,852 | abap | ABAP | src/zcl_excel_data_validation.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 251 | 2019-02-23T03:36:38.000Z | 2021-12-10T21:39:23.000Z | src/zcl_excel_data_validation.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 278 | 2019-02-17T10:42:59.000Z | 2021-12-10T20:24:56.000Z | src/zcl_excel_data_validation.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 130 | 2019-02-20T13:25:30.000Z | 2021-12-09T03:20:31.000Z | CLASS zcl_excel_data_validation DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
*"* public components of class ZCL_EXCEL_DATA_VALIDATION
*"* do not include other source files here!!!
TYPE-POOLS abap .
DATA errorstyle TYPE zexcel_data_val_error_style .
DATA operator TYPE zexcel_data_val_operator .
DATA allowblank TYPE flag VALUE 'X'. "#EC NOTEXT . . . . . . . . . . " .
DATA cell_column TYPE zexcel_cell_column_alpha .
DATA cell_column_to TYPE zexcel_cell_column_alpha .
DATA cell_row TYPE zexcel_cell_row .
DATA cell_row_to TYPE zexcel_cell_row .
CONSTANTS c_type_custom TYPE zexcel_data_val_type VALUE 'custom'. "#EC NOTEXT
CONSTANTS c_type_list TYPE zexcel_data_val_type VALUE 'list'. "#EC NOTEXT
DATA showerrormessage TYPE abap_bool VALUE 'X'. "#EC NOTEXT . . . . . . . . . . " .
DATA showinputmessage TYPE abap_bool VALUE 'X'. "#EC NOTEXT . . . . . . . . . . " .
DATA type TYPE zexcel_data_val_type .
DATA formula1 TYPE zexcel_validation_formula1 .
DATA formula2 TYPE zexcel_validation_formula1 .
CONSTANTS c_type_none TYPE zexcel_data_val_type VALUE 'none'. "#EC NOTEXT
CONSTANTS c_type_date TYPE zexcel_data_val_type VALUE 'date'. "#EC NOTEXT
CONSTANTS c_type_decimal TYPE zexcel_data_val_type VALUE 'decimal'. "#EC NOTEXT
CONSTANTS c_type_textlength TYPE zexcel_data_val_type VALUE 'textLength'. "#EC NOTEXT
CONSTANTS c_type_time TYPE zexcel_data_val_type VALUE 'time'. "#EC NOTEXT
CONSTANTS c_type_whole TYPE zexcel_data_val_type VALUE 'whole'. "#EC NOTEXT
CONSTANTS c_style_stop TYPE zexcel_data_val_error_style VALUE 'stop'. "#EC NOTEXT
CONSTANTS c_style_warning TYPE zexcel_data_val_error_style VALUE 'warning'. "#EC NOTEXT
CONSTANTS c_style_information TYPE zexcel_data_val_error_style VALUE 'information'. "#EC NOTEXT
CONSTANTS c_operator_between TYPE zexcel_data_val_operator VALUE 'between'. "#EC NOTEXT
CONSTANTS c_operator_equal TYPE zexcel_data_val_operator VALUE 'equal'. "#EC NOTEXT
CONSTANTS c_operator_greaterthan TYPE zexcel_data_val_operator VALUE 'greaterThan'. "#EC NOTEXT
CONSTANTS c_operator_greaterthanorequal TYPE zexcel_data_val_operator VALUE 'greaterThanOrEqual'. "#EC NOTEXT
CONSTANTS c_operator_lessthan TYPE zexcel_data_val_operator VALUE 'lessThan'. "#EC NOTEXT
CONSTANTS c_operator_lessthanorequal TYPE zexcel_data_val_operator VALUE 'lessThanOrEqual'. "#EC NOTEXT
CONSTANTS c_operator_notbetween TYPE zexcel_data_val_operator VALUE 'notBetween'. "#EC NOTEXT
CONSTANTS c_operator_notequal TYPE zexcel_data_val_operator VALUE 'notEqual'. "#EC NOTEXT
DATA showdropdown TYPE abap_bool .
DATA errortitle TYPE string .
DATA error TYPE string .
DATA prompttitle TYPE string .
DATA prompt TYPE string .
METHODS constructor .
*"* protected components of class ZCL_EXCEL_DATA_VALIDATION
*"* do not include other source files here!!!
*"* protected components of class ZCL_EXCEL_DATA_VALIDATION
*"* do not include other source files here!!!
PROTECTED SECTION.
PRIVATE SECTION.
*"* private components of class ZCL_EXCEL_DATA_VALIDATION
*"* do not include other source files here!!!
ENDCLASS.
CLASS zcl_excel_data_validation IMPLEMENTATION.
METHOD constructor.
" Initialise instance variables
formula1 = ''.
formula2 = ''.
type = me->c_type_none.
errorstyle = me->c_style_stop.
operator = ''.
allowblank = abap_false.
showdropdown = abap_false.
showinputmessage = abap_true.
showerrormessage = abap_true.
errortitle = ''.
error = ''.
prompttitle = ''.
prompt = ''.
* inizialize dimension range
cell_row = 1.
cell_column = 'A'.
ENDMETHOD.
ENDCLASS. | 45.857143 | 113 | 0.727934 | {
"alnum_ratio": 0.6868345884,
"alpha_token_ratio": 2.0820836622,
"avg_line_length": 46.3975903614,
"char_rep_ratio": 0.2259239979,
"max_line_length": 113,
"num_words": 333,
"text_len": 3851,
"word_rep_ratio": 0.037037037
} | 18,043,174,795,530,234,000 |
1d3b9c8b2700580e8c5019aad5af0c975f39f248 | 1,721 | abap | ABAP | src/objects/zcl_abapgit_object_asfc.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/objects/zcl_abapgit_object_asfc.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/objects/zcl_abapgit_object_asfc.clas.abap | wangdongcheng/abapGit | 7cf4e4b5fe718cb95d12d0a439aa9f2cfb128eab | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_object_asfc DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_objects_super
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_abapgit_object .
PROTECTED SECTION.
PRIVATE SECTION.
METHODS get_generic
RETURNING
VALUE(ro_generic) TYPE REF TO zcl_abapgit_objects_generic
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS zcl_abapgit_object_asfc IMPLEMENTATION.
METHOD get_generic.
CREATE OBJECT ro_generic
EXPORTING
is_item = ms_item
iv_language = mv_language.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = zcl_abapgit_objects_super=>c_user_unknown.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
get_generic( )->delete( ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
get_generic( )->deserialize(
iv_package = iv_package
io_xml = io_xml ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
rv_bool = get_generic( )->exists( ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
rs_metadata-delete_tadir = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
zcx_abapgit_exception=>raise( |TODO: Jump| ).
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
get_generic( )->serialize( io_xml ).
ENDMETHOD.
ENDCLASS. | 16.390476 | 65 | 0.724579 | {
"alnum_ratio": 0.675,
"alpha_token_ratio": 1.8695652174,
"avg_line_length": 16.5384615385,
"char_rep_ratio": 0.2472238457,
"max_line_length": 65,
"num_words": 108,
"text_len": 1720,
"word_rep_ratio": 0
} | 15,211,225,635,678,560,000 |
1d6997d51586b310fdad0fe1a3e20d0dc9d5646a | 1,115 | abap | ABAP | src/zcl_excel_security.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 251 | 2019-02-23T03:36:38.000Z | 2021-12-10T21:39:23.000Z | src/zcl_excel_security.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 278 | 2019-02-17T10:42:59.000Z | 2021-12-10T20:24:56.000Z | src/zcl_excel_security.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 130 | 2019-02-20T13:25:30.000Z | 2021-12-09T03:20:31.000Z | CLASS zcl_excel_security DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
*"* public components of class ZCL_EXCEL_SECURITY
*"* do not include other source files here!!!
PUBLIC SECTION.
TYPE-POOLS abap .
DATA lockrevision TYPE flag .
DATA lockstructure TYPE flag .
DATA lockwindows TYPE flag .
DATA revisionspassword TYPE zexcel_revisionspassword .
DATA workbookpassword TYPE zexcel_workbookpassword .
METHODS is_security_enabled
RETURNING
VALUE(ep_security_enabled) TYPE flag .
*"* protected components of class ZABAP_EXCEL_SECURITY
*"* do not include other source files here!!!
*"* protected components of class ZABAP_EXCEL_SECURITY
*"* do not include other source files here!!!
PROTECTED SECTION.
*"* private components of class ZABAP_EXCEL_SECURITY
*"* do not include other source files here!!!
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_excel_security IMPLEMENTATION.
METHOD is_security_enabled.
IF lockrevision EQ abap_true OR lockstructure EQ abap_true OR lockwindows EQ abap_true.
ep_security_enabled = abap_true.
ENDIF.
ENDMETHOD.
ENDCLASS. | 27.195122 | 91 | 0.759641 | {
"alnum_ratio": 0.736983842,
"alpha_token_ratio": 2.4507462687,
"avg_line_length": 27.85,
"char_rep_ratio": 0.0950226244,
"max_line_length": 91,
"num_words": 112,
"text_len": 1114,
"word_rep_ratio": 0.0970873786
} | 13,436,609,788,878,942,000 |
1d823b90686ef0d437eca0874433b6a2078c82dc | 4,212 | abap | ABAP | src/objects/zcl_abapgit_object_acid.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/zcl_abapgit_object_acid.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/zcl_abapgit_object_acid.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_object_acid DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
PROTECTED SECTION.
PRIVATE SECTION.
METHODS: create_object
RETURNING VALUE(ro_aab) TYPE REF TO cl_aab_id
RAISING zcx_abapgit_exception.
ENDCLASS.
CLASS zcl_abapgit_object_acid IMPLEMENTATION.
METHOD create_object.
DATA: lv_name TYPE aab_id_name.
lv_name = ms_item-obj_name.
CREATE OBJECT ro_aab
EXPORTING
im_name = lv_name
EXCEPTIONS
name_not_allowed = 1
OTHERS = 2.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
* looks like "changed by user" is not stored in the database
rv_user = c_user_unknown.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lo_aab TYPE REF TO cl_aab_id.
lo_aab = create_object( ).
lo_aab->enqueue(
EXCEPTIONS
foreign_lock = 1
system_error = 2
cts_error = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
lo_aab->delete(
EXCEPTIONS
prop_error = 1
propt_error = 2
act_error = 3
cts_error = 4
cts_devclass = 5
id_not_found = 6
no_authorization = 7
id_still_used = 8
where_used_error = 9
OTHERS = 10 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
lo_aab->dequeue( ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lv_description TYPE aab_id_descript,
lo_aab TYPE REF TO cl_aab_id.
io_xml->read( EXPORTING iv_name = 'DESCRIPTION'
CHANGING cg_data = lv_description ).
lo_aab = create_object( ).
lo_aab->enqueue(
EXCEPTIONS
foreign_lock = 1
system_error = 2
cts_error = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
lo_aab->set_descript(
EXPORTING
im_descript = lv_description
EXCEPTIONS
no_authorization = 1
OTHERS = 2 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
tadir_insert( iv_package ).
lo_aab->save(
EXCEPTIONS
no_descript_specified = 1
no_changes_found = 2
prop_error = 3
propt_error = 4
act_error = 5
cts_error = 6
sync_attributes_error = 7
action_canceled = 8
OTHERS = 9 ).
IF sy-subrc >= 3.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
lo_aab->dequeue( ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_state TYPE abap_bool,
lo_aab TYPE REF TO cl_aab_id.
lo_aab = create_object( ).
lo_aab->get_state( IMPORTING ex_state = lv_state ).
rv_bool = boolc( lv_state = abap_true ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
" Covered by ZCL_ABAPGIT_OBJECTS=>JUMP
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lo_aab TYPE REF TO cl_aab_id,
lv_description TYPE aab_id_descript.
IF zif_abapgit_object~exists( ) = abap_false.
RETURN.
ENDIF.
lo_aab = create_object( ).
lo_aab->get_descript(
IMPORTING ex_descript = lv_description
EXCEPTIONS no_description_found = 1 ).
io_xml->add( iv_name = 'DESCRIPTION'
ig_data = lv_description ).
ENDMETHOD.
ENDCLASS. | 20.955224 | 96 | 0.620133 | {
"alnum_ratio": 0.5749228212,
"alpha_token_ratio": 1.5887096774,
"avg_line_length": 21.055,
"char_rep_ratio": 0.145644931,
"max_line_length": 96,
"num_words": 255,
"text_len": 4211,
"word_rep_ratio": 0.0243902439
} | 15,987,245,743,515,010,000 |
1d9bfbbe04b2d4969b4303fcf9f43c76b1ef37c1 | 3,204 | abap | ABAP | src/checks/y_check_check_stmnt_position.clas.abap | pokrakam/code-pal-for-abap | 65c008f75d4d2453c6994c57dc03741862c1d510 | [
"Apache-2.0"
] | 202 | 2020-05-05T13:41:12.000Z | 2022-03-26T15:18:13.000Z | src/checks/y_check_check_stmnt_position.clas.abap | pokrakam/code-pal-for-abap | 65c008f75d4d2453c6994c57dc03741862c1d510 | [
"Apache-2.0"
] | 322 | 2020-05-05T19:14:35.000Z | 2022-03-22T14:48:44.000Z | src/checks/y_check_check_stmnt_position.clas.abap | lucasborin/code-pal-for-abap | 4e1247693457e7687648806b18b63cb8968f927a | [
"Apache-2.0"
] | 59 | 2020-05-05T18:59:19.000Z | 2022-03-20T11:24:48.000Z | CLASS y_check_check_stmnt_position DEFINITION PUBLIC INHERITING FROM y_check_base CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor .
PROTECTED SECTION.
METHODS inspect_tokens REDEFINITION.
PRIVATE SECTION.
METHODS is_not_relevant_token IMPORTING token TYPE string
RETURNING VALUE(result) TYPE abap_bool.
METHODS has_wrong_position IMPORTING structure TYPE sstruc
check TYPE sstmnt
RETURNING VALUE(result) TYPE abap_bool.
METHODS is_check_in_loop IMPORTING structure TYPE sstruc
check TYPE sstmnt
RETURNING VALUE(result) TYPE abap_bool.
ENDCLASS.
CLASS y_check_check_stmnt_position IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
settings-pseudo_comment = '"#EC CHECK_POSITION' ##NO_TEXT.
settings-disable_threshold_selection = abap_true.
settings-threshold = 0.
settings-documentation = |{ c_docs_path-checks }check-statement-position.md|.
set_check_message( 'Do not use CHECK outside of the initialization section!' ).
ENDMETHOD.
METHOD inspect_tokens.
CHECK get_token_abs( statement-from ) = 'CHECK'.
CHECK has_wrong_position( structure = structure
check = statement ) = abap_true.
CHECK is_check_in_loop( structure = structure
check = statement ) = abap_false.
DATA(check_configuration) = detect_check_configuration( statement ).
IF check_configuration IS INITIAL.
RETURN.
ENDIF.
raise_error( statement_level = statement-level
statement_index = index
statement_from = statement-from
error_priority = check_configuration-prio ).
ENDMETHOD.
METHOD is_not_relevant_token.
result = xsdbool( token = 'METHOD'
OR token = 'FORM'
OR token = 'FUNCTION'
OR token = 'MODULE'
OR token = 'DATA'
OR token = 'TYPES'
OR token = 'CHECK'
OR token = 'FIELD-SYMBOLS'
OR token = 'CONSTANTS' ).
ENDMETHOD.
METHOD has_wrong_position.
LOOP AT ref_scan_manager->statements ASSIGNING FIELD-SYMBOL(<statement>)
FROM structure-stmnt_from TO structure-stmnt_to.
IF <statement>-type = scan_stmnt_type-empty
OR <statement>-type = scan_stmnt_type-comment
OR <statement>-type = scan_stmnt_type-comment_in_stmnt.
CONTINUE.
ENDIF.
IF <statement>-number = check-number.
RETURN.
ENDIF.
IF is_not_relevant_token( get_token_abs( <statement>-from ) ) = abap_false.
result = abap_true.
RETURN.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD is_check_in_loop.
LOOP AT ref_scan_manager->tokens ASSIGNING FIELD-SYMBOL(<token>)
FROM structure-stmnt_from TO check-from
WHERE str = 'LOOP'
OR str = 'ENDLOOP'.
result = xsdbool( <token>-str = 'LOOP' ).
ENDLOOP.
ENDMETHOD.
ENDCLASS. | 30.514286 | 97 | 0.611423 | {
"alnum_ratio": 0.5860131127,
"alpha_token_ratio": 2.1031390135,
"avg_line_length": 30.7980769231,
"char_rep_ratio": 0.180651221,
"max_line_length": 97,
"num_words": 216,
"text_len": 3203,
"word_rep_ratio": 0.0193236715
} | 9,122,177,447,408,991,000 |
1dbe3b1d8035c15b0b08fbb03587a4861a1237ba | 3,623 | abap | ABAP | src/git/zcl_abapgit_git_porcelain.clas.testclasses.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/git/zcl_abapgit_git_porcelain.clas.testclasses.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/git/zcl_abapgit_git_porcelain.clas.testclasses.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS ltcl_git_porcelain DEFINITION DEFERRED.
CLASS zcl_abapgit_git_porcelain DEFINITION LOCAL FRIENDS ltcl_git_porcelain.
CLASS ltcl_git_porcelain DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
PRIVATE SECTION.
METHODS:
setup,
append
IMPORTING iv_path TYPE string
iv_name TYPE string,
single_file FOR TESTING
RAISING zcx_abapgit_exception,
two_files_same_path FOR TESTING
RAISING zcx_abapgit_exception,
root_empty FOR TESTING
RAISING zcx_abapgit_exception,
namespaces FOR TESTING
RAISING zcx_abapgit_exception,
more_sub FOR TESTING
RAISING zcx_abapgit_exception,
sub FOR TESTING
RAISING zcx_abapgit_exception.
DATA: mt_expanded TYPE zif_abapgit_definitions=>ty_expanded_tt,
mt_trees TYPE zcl_abapgit_git_porcelain=>ty_trees_tt.
ENDCLASS.
CLASS ltcl_git_porcelain IMPLEMENTATION.
METHOD setup.
CLEAR mt_expanded.
CLEAR mt_trees.
ENDMETHOD.
METHOD append.
FIELD-SYMBOLS: <ls_expanded> LIKE LINE OF mt_expanded.
APPEND INITIAL LINE TO mt_expanded ASSIGNING <ls_expanded>.
<ls_expanded>-path = iv_path.
<ls_expanded>-name = iv_name.
<ls_expanded>-sha1 = 'a'.
<ls_expanded>-chmod = zif_abapgit_definitions=>c_chmod-file.
ENDMETHOD.
METHOD single_file.
append( iv_path = '/'
iv_name = 'foobar.txt' ).
mt_trees = zcl_abapgit_git_porcelain=>build_trees( mt_expanded ).
cl_abap_unit_assert=>assert_equals(
act = lines( mt_trees )
exp = 1 ).
ENDMETHOD.
METHOD two_files_same_path.
append( iv_path = '/'
iv_name = 'foo.txt' ).
append( iv_path = '/'
iv_name = 'bar.txt' ).
mt_trees = zcl_abapgit_git_porcelain=>build_trees( mt_expanded ).
cl_abap_unit_assert=>assert_equals(
act = lines( mt_trees )
exp = 1 ).
ENDMETHOD.
METHOD sub.
append( iv_path = '/'
iv_name = 'foo.txt' ).
append( iv_path = '/sub/'
iv_name = 'bar.txt' ).
mt_trees = zcl_abapgit_git_porcelain=>build_trees( mt_expanded ).
cl_abap_unit_assert=>assert_equals(
act = lines( mt_trees )
exp = 2 ).
ENDMETHOD.
METHOD more_sub.
FIELD-SYMBOLS: <ls_tree> LIKE LINE OF mt_trees.
append( iv_path = '/src/foo_a/foo_a1/'
iv_name = 'a1.txt' ).
append( iv_path = '/src/foo_a/foo_a2/'
iv_name = 'a2.txt' ).
mt_trees = zcl_abapgit_git_porcelain=>build_trees( mt_expanded ).
cl_abap_unit_assert=>assert_equals(
act = lines( mt_trees )
exp = 5 ).
LOOP AT mt_trees ASSIGNING <ls_tree>.
cl_abap_unit_assert=>assert_not_initial( <ls_tree>-data ).
ENDLOOP.
ENDMETHOD.
METHOD namespaces.
FIELD-SYMBOLS: <ls_tree> LIKE LINE OF mt_trees.
append( iv_path = '/src/#foo#a/#foo#a1/'
iv_name = 'a1.txt' ).
append( iv_path = '/src/#foo#a/#foo#a2/'
iv_name = 'a2.txt' ).
mt_trees = zcl_abapgit_git_porcelain=>build_trees( mt_expanded ).
cl_abap_unit_assert=>assert_equals(
act = lines( mt_trees )
exp = 5 ).
LOOP AT mt_trees ASSIGNING <ls_tree>.
cl_abap_unit_assert=>assert_not_initial( <ls_tree>-data ).
ENDLOOP.
ENDMETHOD.
METHOD root_empty.
append( iv_path = '/sub/'
iv_name = 'bar.txt' ).
mt_trees = zcl_abapgit_git_porcelain=>build_trees( mt_expanded ).
* so 2 total trees are expected: '/' and '/sub/'
cl_abap_unit_assert=>assert_equals(
act = lines( mt_trees )
exp = 2 ).
ENDMETHOD.
ENDCLASS. | 23.525974 | 89 | 0.653602 | {
"alnum_ratio": 0.6060187742,
"alpha_token_ratio": 1.6520090978,
"avg_line_length": 23.6732026144,
"char_rep_ratio": 0.1206753391,
"max_line_length": 89,
"num_words": 253,
"text_len": 3622,
"word_rep_ratio": 0.118852459
} | 6,609,150,029,689,500,000 |
1de1e7af5ef4d0e36c0acdba85ece824ee8c756b | 8,382 | abap | ABAP | src/zcl_abapgit_news.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/zcl_abapgit_news.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/zcl_abapgit_news.clas.testclasses.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | **********************************************************************
* Helper classed
CLASS lcl_string_buffer DEFINITION FINAL.
PUBLIC SECTION.
DATA mt_buffer TYPE string_table.
METHODS add
IMPORTING
iv_str TYPE string.
ENDCLASS.
CLASS lcl_string_buffer IMPLEMENTATION.
METHOD add.
APPEND iv_str TO mt_buffer.
ENDMETHOD.
ENDCLASS.
CLASS lcl_log_entries DEFINITION FINAL.
PUBLIC SECTION.
DATA mt_log_entries TYPE zcl_abapgit_news=>ty_logs.
METHODS add
IMPORTING
iv_str TYPE string.
ENDCLASS.
CLASS lcl_log_entries IMPLEMENTATION.
METHOD add.
DATA ls_log LIKE LINE OF mt_log_entries.
DATA lv_pos_to_cur_str TYPE string.
SPLIT iv_str AT '/' INTO
ls_log-version
ls_log-is_header
ls_log-is_important
lv_pos_to_cur_str
ls_log-text.
CONDENSE ls_log-version.
CONDENSE ls_log-is_header.
CONDENSE ls_log-is_important.
CONDENSE ls_log-text.
ls_log-pos_to_cur = lv_pos_to_cur_str.
APPEND ls_log TO mt_log_entries.
ENDMETHOD.
ENDCLASS.
**********************************************************************
CLASS ltcl_news DEFINITION DEFERRED.
CLASS zcl_abapgit_news DEFINITION LOCAL FRIENDS ltcl_news.
*----------------------------------------------------------------------*
* CLASS ltcl_news DEFINITION
*----------------------------------------------------------------------*
* Definition of test class for news announcement
*----------------------------------------------------------------------*
CLASS ltcl_news DEFINITION FINAL FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
PRIVATE SECTION.
METHODS:
parse_line FOR TESTING,
parse FOR TESTING.
ENDCLASS.
*----------------------------------------------------------------------*
* CLASS ltcl_news IMPLEMENTATION
*----------------------------------------------------------------------*
* Implementation of test class for news announcement
*----------------------------------------------------------------------*
CLASS ltcl_news IMPLEMENTATION.
METHOD parse_line.
DATA: ls_log TYPE zcl_abapgit_news=>ty_log.
ls_log = zcl_abapgit_news=>parse_line(
iv_line = '======'
iv_current_version = '1.26.01' ).
cl_abap_unit_assert=>assert_initial( ls_log ).
ls_log = zcl_abapgit_news=>parse_line(
iv_line = ''
iv_current_version = '1.26.01' ).
cl_abap_unit_assert=>assert_initial( ls_log ).
ls_log = zcl_abapgit_news=>parse_line(
iv_line = '------'
iv_current_version = '1.26.01' ).
cl_abap_unit_assert=>assert_initial( ls_log ).
CLEAR ls_log.
ls_log = zcl_abapgit_news=>parse_line(
iv_line = '2017-02-13 v1.28.0'
iv_current_version = '1.26.01' ).
cl_abap_unit_assert=>assert_equals( act = ls_log-version
exp = '1.28.0' ).
cl_abap_unit_assert=>assert_equals( act = ls_log-is_header
exp = abap_true ).
cl_abap_unit_assert=>assert_equals( act = ls_log-pos_to_cur
exp = 1 ).
CLEAR ls_log.
ls_log = zcl_abapgit_news=>parse_line(
iv_line = '2017-02-13 v1.26.0'
iv_current_version = '1.26.01' ).
cl_abap_unit_assert=>assert_equals( act = ls_log-version
exp = '1.26.0' ).
cl_abap_unit_assert=>assert_equals( act = ls_log-is_header
exp = abap_true ).
cl_abap_unit_assert=>assert_equals( act = ls_log-pos_to_cur
exp = -1 ).
CLEAR ls_log.
ls_log = zcl_abapgit_news=>parse_line(
iv_line = 'news'
iv_current_version = '1.26.01' ).
cl_abap_unit_assert=>assert_equals( act = ls_log-version
exp = '' ).
cl_abap_unit_assert=>assert_equals( act = ls_log-is_header
exp = abap_false ).
cl_abap_unit_assert=>assert_equals( act = ls_log-pos_to_cur
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = ls_log-is_important
exp = abap_false ).
cl_abap_unit_assert=>assert_equals( act = ls_log-text
exp = 'news' ).
CLEAR ls_log.
ls_log = zcl_abapgit_news=>parse_line(
iv_line = ' ! important news'
iv_current_version = '1.26.01' ).
cl_abap_unit_assert=>assert_equals( act = ls_log-version
exp = '' ).
cl_abap_unit_assert=>assert_equals( act = ls_log-is_header
exp = abap_false ).
cl_abap_unit_assert=>assert_equals( act = ls_log-pos_to_cur
exp = 0 ).
cl_abap_unit_assert=>assert_equals( act = ls_log-is_important
exp = abap_true ).
cl_abap_unit_assert=>assert_equals( act = ls_log-text
exp = ' ! important news' ).
ENDMETHOD.
METHOD parse.
DATA lt_log_act TYPE zcl_abapgit_news=>ty_logs.
DATA lo_src_text_buf TYPE REF TO lcl_string_buffer.
DATA lo_log_entries TYPE REF TO lcl_log_entries.
" Generate test data
CREATE OBJECT lo_src_text_buf.
lo_src_text_buf->add( '======' ).
lo_src_text_buf->add( '------' ).
lo_src_text_buf->add( ` ` ).
lo_src_text_buf->add( 'abapGit changelog' ).
lo_src_text_buf->add( '2017-02-13 v1.28.0' ).
lo_src_text_buf->add( '------------------' ).
lo_src_text_buf->add( '+ Staging page redesigned' ).
lo_src_text_buf->add( '! Support for core data services' ).
lo_src_text_buf->add( ` ` ).
lo_src_text_buf->add( '2017-01-25 v1.27.0' ).
lo_src_text_buf->add( '------------------' ).
lo_src_text_buf->add( '+ Two factor authentication with github.com' ).
lo_src_text_buf->add( '2017-01-25 v1.26.0' ).
" Case 1
" Generate expected results
CREATE OBJECT lo_log_entries.
" VERSION HEAD IMP POS TEXT
lo_log_entries->add( '1.28.0 /X / /1 /2017-02-13 v1.28.0' ).
lo_log_entries->add( '1.28.0 / / /0 /+ Staging page redesigned' ).
lo_log_entries->add( '1.28.0 / /X /0 /! Support for core data services' ).
lo_log_entries->add( '1.27.0 /X / /1 /2017-01-25 v1.27.0' ).
lo_log_entries->add( '1.27.0 / / /0 /+ Two factor authentication with github.com' ).
lt_log_act = zcl_abapgit_news=>parse(
it_lines = lo_src_text_buf->mt_buffer
iv_current_version = '1.26.01' ).
cl_abap_unit_assert=>assert_equals(
exp = lo_log_entries->mt_log_entries
act = lt_log_act
msg = ' Error during parsing: Case 1.' ).
" Case 2 (exect version match)
CREATE OBJECT lo_log_entries.
" VERSION HEAD IMP UPD TEXT
lo_log_entries->add( '1.28.0 /X / /1 /2017-02-13 v1.28.0' ).
lo_log_entries->add( '1.28.0 / / /0 /+ Staging page redesigned' ).
lo_log_entries->add( '1.28.0 / /X /0 /! Support for core data services' ).
lt_log_act = zcl_abapgit_news=>parse(
it_lines = lo_src_text_buf->mt_buffer
iv_current_version = '1.27.00' ).
cl_abap_unit_assert=>assert_equals(
exp = lo_log_entries->mt_log_entries
act = lt_log_act
msg = ' Error during parsing: Case 2.' ).
" Case 3 (display tail)
CREATE OBJECT lo_log_entries.
" VERSION HEAD IMP UPD TEXT
lo_log_entries->add( '1.28.0 /X / /0 /2017-02-13 v1.28.0' ).
lo_log_entries->add( '1.28.0 / / /0 /+ Staging page redesigned' ).
lo_log_entries->add( '1.28.0 / /X /0 /! Support for core data services' ).
lo_log_entries->add( '1.27.0 /X / /-1 /2017-01-25 v1.27.0' ).
lo_log_entries->add( '1.27.0 / / /0 /+ Two factor authentication with github.com' ).
lo_log_entries->add( '1.26.0 /X / /-1 /2017-01-25 v1.26.0' ).
lt_log_act = zcl_abapgit_news=>parse(
it_lines = lo_src_text_buf->mt_buffer
iv_current_version = '1.28.00' ).
cl_abap_unit_assert=>assert_equals(
exp = lo_log_entries->mt_log_entries
act = lt_log_act
msg = ' Error during parsing: Case 3.' ).
ENDMETHOD.
ENDCLASS. | 37.253333 | 95 | 0.557862 | {
"alnum_ratio": 0.5116334566,
"alpha_token_ratio": 1.4411764706,
"avg_line_length": 37.4151785714,
"char_rep_ratio": 0.2462971811,
"max_line_length": 95,
"num_words": 468,
"text_len": 8381,
"word_rep_ratio": 0.2788671024
} | 4,788,651,406,073,752,000 |
1dfd818dd6b97a03709978b9254e61d5e3927f43 | 1,425 | abap | ABAP | src/zcl_excel_style_protection.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 251 | 2019-02-23T03:36:38.000Z | 2021-12-10T21:39:23.000Z | src/zcl_excel_style_protection.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 278 | 2019-02-17T10:42:59.000Z | 2021-12-10T20:24:56.000Z | src/zcl_excel_style_protection.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 130 | 2019-02-20T13:25:30.000Z | 2021-12-09T03:20:31.000Z | CLASS zcl_excel_style_protection DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
*"* public components of class ZCL_EXCEL_STYLE_PROTECTION
*"* do not include other source files here!!!
PUBLIC SECTION.
CONSTANTS c_protection_hidden TYPE zexcel_cell_protection VALUE '1'. "#EC NOTEXT
CONSTANTS c_protection_locked TYPE zexcel_cell_protection VALUE '1'. "#EC NOTEXT
CONSTANTS c_protection_unhidden TYPE zexcel_cell_protection VALUE '0'. "#EC NOTEXT
CONSTANTS c_protection_unlocked TYPE zexcel_cell_protection VALUE '0'. "#EC NOTEXT
DATA hidden TYPE zexcel_cell_protection .
DATA locked TYPE zexcel_cell_protection .
METHODS constructor .
METHODS get_structure
RETURNING
VALUE(ep_protection) TYPE zexcel_s_style_protection .
*"* protected components of class ZABAP_EXCEL_STYLE_FONT
*"* do not include other source files here!!!
*"* protected components of class ZABAP_EXCEL_STYLE_FONT
*"* do not include other source files here!!!
PROTECTED SECTION.
*"* private components of class ZCL_EXCEL_STYLE_PROTECTION
*"* do not include other source files here!!!
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_excel_style_protection IMPLEMENTATION.
METHOD constructor.
locked = me->c_protection_locked.
hidden = me->c_protection_unhidden.
ENDMETHOD.
METHOD get_structure.
ep_protection-locked = me->locked.
ep_protection-hidden = me->hidden.
ENDMETHOD.
ENDCLASS. | 30.319149 | 86 | 0.769825 | {
"alnum_ratio": 0.735252809,
"alpha_token_ratio": 2.3758542141,
"avg_line_length": 30.9565217391,
"char_rep_ratio": 0.1293286219,
"max_line_length": 86,
"num_words": 124,
"text_len": 1424,
"word_rep_ratio": 0.1043478261
} | 11,149,036,695,682,777,000 |
3822b6253bdd868a06a11661e61d588ba60bcaf9 | 506 | abap | ABAP | src/syntax/zcl_abapgit_syntax_txt.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/syntax/zcl_abapgit_syntax_txt.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/syntax/zcl_abapgit_syntax_txt.clas.abap | amit3kumar/ABAP_ALL | 67822ae13ffda6597a91bb5b39e428c39bc445a3 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_syntax_txt DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_syntax_highlighter
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor .
METHODS process_line
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_abapgit_syntax_txt IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
" No rules for plain text files
ENDMETHOD.
METHOD process_line.
rv_line = show_hidden_chars( iv_line ).
ENDMETHOD.
ENDCLASS. | 14.055556 | 48 | 0.735178 | {
"alnum_ratio": 0.7069306931,
"alpha_token_ratio": 2.1768292683,
"avg_line_length": 14.4285714286,
"char_rep_ratio": 0.1088709677,
"max_line_length": 48,
"num_words": 41,
"text_len": 505,
"word_rep_ratio": 0
} | 2,684,052,178,762,945,000 |
385aa8c53aa518ce4c66bccd3f86cdcc58a46ec1 | 6,405 | abap | ABAP | src/objects/zcl_abapgit_object_area.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/zcl_abapgit_object_area.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/zcl_abapgit_object_area.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_object_area DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_objects_super
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_abapgit_object .
ALIASES mo_files
FOR zif_abapgit_object~mo_files .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_abapgit_object_area IMPLEMENTATION.
METHOD zif_abapgit_object~changed_by.
DATA: lv_user TYPE string.
SELECT SINGLE tstpnm FROM ('RSDAREA') INTO lv_user.
rv_user = lv_user.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA:
lr_area TYPE REF TO object.
CREATE OBJECT lr_area TYPE ('CL_NEW_AWB_AREA').
CALL METHOD lr_area->('IF_RSAWBN_FOLDER_TREE~DELETE_NODE')
EXPORTING
i_nodename = ms_item-obj_name
i_with_dialog = ''.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error while deleting AREA: { ms_item-obj_name }| ).
ENDIF.
corr_insert( iv_package ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA:
lv_nodename TYPE c LENGTH 40,
lv_parentname TYPE c LENGTH 40,
lv_txtsh TYPE c LENGTH 20,
lv_txtlg TYPE c LENGTH 60,
lr_area TYPE REF TO object.
io_xml->read( EXPORTING iv_name = 'NODENAME'
CHANGING cg_data = lv_nodename ).
io_xml->read( EXPORTING iv_name = 'PARENTNAME'
CHANGING cg_data = lv_parentname ).
io_xml->read( EXPORTING iv_name = 'TXTSH'
CHANGING cg_data = lv_txtsh ).
io_xml->read( EXPORTING iv_name = 'TXTLG'
CHANGING cg_data = lv_txtlg ).
CREATE OBJECT lr_area TYPE ('CL_NEW_AWB_AREA').
CALL METHOD lr_area->('IF_RSAWBN_FOLDER_TREE~CREATE_NODE')
EXPORTING
i_parentname = lv_parentname
i_nodename = lv_nodename
i_txtsh = lv_txtsh
i_txtlg = lv_txtlg.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error while creating AREA: { ms_item-obj_name }| ).
ENDIF.
tadir_insert( iv_package ).
corr_insert( iv_package ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA:
lr_area TYPE REF TO object,
lr_tab_tree TYPE REF TO data,
lr_str_tee TYPE REF TO data.
FIELD-SYMBOLS:
<lt_tree> TYPE STANDARD TABLE,
<ls_tree> TYPE any.
CREATE OBJECT lr_area TYPE ('CL_NEW_AWB_AREA').
CREATE DATA lr_tab_tree TYPE STANDARD TABLE OF ('RSAWBN_S_TREEORG').
ASSIGN lr_tab_tree->* TO <lt_tree>.
CREATE DATA lr_str_tee TYPE STANDARD TABLE OF ('RSAWBN_S_TREEORG').
ASSIGN lr_str_tee->* TO <ls_tree>.
CALL METHOD lr_area->('IF_RSAWBN_FOLDER_TREE~GET_TREE')
EXPORTING
i_objvers = ''
i_langu = ''
IMPORTING
e_t_tree = <lt_tree>.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error while read AREA tree| ).
ENDIF.
READ TABLE <lt_tree> WITH KEY ('NODENAME') = ms_item-obj_name ASSIGNING <ls_tree>.
IF sy-subrc = 0.
rv_bool = abap_true.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
DATA:
lr_area TYPE REF TO object,
lr_tab_tree TYPE REF TO data,
lr_str_tee TYPE REF TO data.
FIELD-SYMBOLS:
<lt_tree> TYPE STANDARD TABLE,
<ls_tree> TYPE any.
CREATE OBJECT lr_area TYPE ('CL_NEW_AWB_AREA').
CREATE DATA lr_tab_tree TYPE STANDARD TABLE OF ('RSAWBN_S_TREEORG').
ASSIGN lr_tab_tree->* TO <lt_tree>.
CREATE DATA lr_str_tee TYPE STANDARD TABLE OF ('RSAWBN_S_TREEORG').
ASSIGN lr_str_tee->* TO <ls_tree>.
CALL METHOD lr_area->('IF_RSAWBN_FOLDER_TREE~GET_TREE')
EXPORTING
i_objvers = 'A'
i_langu = mv_language
IMPORTING
e_t_tree = <lt_tree>.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error while read AREA tree| ).
ENDIF.
READ TABLE <lt_tree> WITH KEY ('NODENAME') = ms_item-obj_name ASSIGNING <ls_tree>.
IF sy-subrc = 0.
rv_active = abap_true.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'ERSDAREA' ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA:
lr_area TYPE REF TO object,
lr_tab_tree TYPE REF TO data,
lr_str_tee TYPE REF TO data,
lr_rsdareat TYPE REF TO data,
lv_select TYPE string.
FIELD-SYMBOLS:
<lt_tree> TYPE STANDARD TABLE,
<ls_tree> TYPE any,
<lv_parentname> TYPE any,
<ls_rsdareat> TYPE any,
<lv_txtlg> TYPE any,
<lv_txtsh> TYPE any.
CREATE OBJECT lr_area TYPE ('CL_NEW_AWB_AREA').
CREATE DATA lr_tab_tree TYPE STANDARD TABLE OF ('RSAWBN_S_TREEORG').
ASSIGN lr_tab_tree->* TO <lt_tree>.
CREATE DATA lr_str_tee TYPE STANDARD TABLE OF ('RSAWBN_S_TREEORG').
ASSIGN lr_str_tee->* TO <ls_tree>.
CREATE DATA lr_rsdareat TYPE ('RSDAREAT').
ASSIGN lr_rsdareat->* TO <ls_rsdareat>.
CALL METHOD lr_area->('IF_RSAWBN_FOLDER_TREE~GET_TREE')
EXPORTING
i_objvers = 'A'
i_langu = mv_language
IMPORTING
e_t_tree = <lt_tree>.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error while read AREA tree| ).
ENDIF.
READ TABLE <lt_tree> WITH KEY ('NODENAME') = ms_item-obj_name ASSIGNING <ls_tree>.
lv_select = |INFOAREA = '{ ms_item-obj_name }'|.
SELECT SINGLE * FROM ('RSDAREAT')
INTO <ls_rsdareat>
WHERE infoarea = ms_item-obj_name.
ASSIGN COMPONENT 'TXTSH' OF STRUCTURE <ls_rsdareat> TO <lv_txtsh>.
ASSIGN COMPONENT 'TXTLG' OF STRUCTURE <ls_rsdareat> TO <lv_txtlg>.
ASSIGN COMPONENT 'PARENTNAME' OF STRUCTURE <ls_tree> TO <lv_parentname>.
io_xml->add( iv_name = 'NODENAME'
ig_data = ms_item-obj_name ).
io_xml->add( iv_name = 'PARENTNAME'
ig_data = <lv_parentname> ).
io_xml->add( iv_name = 'TXTSH'
ig_data = <lv_txtsh> ).
io_xml->add( iv_name = 'TXTLG'
ig_data = <lv_txtlg> ).
ENDMETHOD.
ENDCLASS. | 24.169811 | 88 | 0.651678 | {
"alnum_ratio": 0.6054028732,
"alpha_token_ratio": 1.5879934211,
"avg_line_length": 24.2575757576,
"char_rep_ratio": 0.1050820954,
"max_line_length": 88,
"num_words": 532,
"text_len": 6404,
"word_rep_ratio": 0.3499043977
} | 5,135,004,765,677,322,000 |
38b7900e7880e77c72c17fcb6567037021b1aa15 | 1,806 | abap | ABAP | src/objects/zcl_abapgit_object_iwpr.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/zcl_abapgit_object_iwpr.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/zcl_abapgit_object_iwpr.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_object_iwpr DEFINITION
PUBLIC
INHERITING FROM zcl_abapgit_objects_super
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_abapgit_object .
PROTECTED SECTION.
METHODS get_generic
RETURNING
VALUE(ro_generic) TYPE REF TO zcl_abapgit_objects_generic
RAISING
zcx_abapgit_exception .
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_abapgit_object_iwpr IMPLEMENTATION.
METHOD get_generic.
CREATE OBJECT ro_generic
EXPORTING
is_item = ms_item
iv_language = mv_language.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = zcl_abapgit_objects_super=>c_user_unknown.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
get_generic( )->delete( iv_package ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
get_generic( )->deserialize(
iv_package = iv_package
io_xml = io_xml ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
rv_bool = get_generic( )->exists( ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
rs_metadata-delete_tadir = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
SUBMIT /iwbep/r_sbui_service_builder
WITH i_prname = ms_item-obj_name
AND RETURN.
rv_exit = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
get_generic( )->serialize( io_xml ).
ENDMETHOD.
ENDCLASS. | 16.568807 | 65 | 0.724252 | {
"alnum_ratio": 0.6731301939,
"alpha_token_ratio": 1.8577981651,
"avg_line_length": 16.712962963,
"char_rep_ratio": 0.2416481069,
"max_line_length": 65,
"num_words": 115,
"text_len": 1805,
"word_rep_ratio": 0
} | 14,202,423,854,811,038,000 |
38dc4bf824f109d36f3edfc477c6fb9f025be5cc | 4,015 | abap | ABAP | src/utils/zaoc_line_length.prog.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/utils/zaoc_line_length.prog.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/utils/zaoc_line_length.prog.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | REPORT zaoc_line_length.
* abapOpenChecks
*
* MIT License
TABLES: tdevc.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: s_devc FOR tdevc-devclass OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT-002.
PARAMETERS: p_split TYPE i DEFAULT 10,
p_mview TYPE c AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b2.
******************************************************************
TYPES: BEGIN OF ty_result,
from TYPE string,
count TYPE i,
END OF ty_result.
TYPES: ty_result_tt TYPE STANDARD TABLE OF ty_result WITH DEFAULT KEY.
CLASS lcl_app DEFINITION FINAL.
PUBLIC SECTION.
CLASS-METHODS:
run RETURNING VALUE(rt_result) TYPE ty_result_tt.
PRIVATE SECTION.
CLASS-DATA:
gt_result TYPE ty_result_tt.
CLASS-METHODS:
init_result,
run_package IMPORTING iv_devclass TYPE devclass,
run_program IMPORTING iv_program TYPE program.
ENDCLASS.
CLASS lcl_app IMPLEMENTATION.
METHOD run.
DATA: lt_packages TYPE STANDARD TABLE OF devclass WITH DEFAULT KEY,
lv_package LIKE LINE OF lt_packages.
init_result( ).
SELECT devclass FROM tdevc INTO TABLE lt_packages
WHERE devclass IN s_devc. "#EC CI_GENBUFF "#EC CI_SUBRC
LOOP AT lt_packages INTO lv_package.
run_package( lv_package ).
ENDLOOP.
rt_result = gt_result.
ENDMETHOD.
METHOD init_result.
DATA: lv_length TYPE i.
FIELD-SYMBOLS: <ls_result> LIKE LINE OF gt_result.
CLEAR gt_result.
WHILE lv_length < 255.
APPEND INITIAL LINE TO gt_result ASSIGNING <ls_result>.
<ls_result>-from = |{ lv_length } to { lv_length + p_split - 1 } characters|.
lv_length = lv_length + p_split.
ENDWHILE.
ENDMETHOD.
METHOD run_package.
DATA: lt_programs TYPE scit_program,
lv_program LIKE LINE OF lt_programs.
lt_programs = zcl_aoc_util_programs=>get_programs_in_package(
iv_devclass = iv_devclass
iv_ignore_mview_fugr = p_mview ).
LOOP AT lt_programs INTO lv_program.
IF sy-tabix MOD 100 = 0.
cl_progress_indicator=>progress_indicate(
i_text = iv_devclass
i_processed = sy-tabix
i_total = lines( lt_programs )
i_output_immediately = abap_true ).
ENDIF.
run_program( lv_program ).
ENDLOOP.
ENDMETHOD.
METHOD run_program.
DATA: lt_source TYPE TABLE OF abaptxt255,
lv_index TYPE i,
ls_source LIKE LINE OF lt_source.
FIELD-SYMBOLS: <ls_result> LIKE LINE OF gt_result.
CALL FUNCTION 'RPY_PROGRAM_READ'
EXPORTING
program_name = iv_program
with_includelist = abap_false
only_source = abap_true
with_lowercase = abap_true
TABLES
source_extended = lt_source
EXCEPTIONS
cancelled = 1
not_found = 2
permission_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
RETURN.
ENDIF.
LOOP AT lt_source INTO ls_source.
lv_index = ( strlen( ls_source-line ) DIV p_split ) + 1.
READ TABLE gt_result INDEX lv_index ASSIGNING <ls_result>. "#EC CI_SUBRC
<ls_result>-count = <ls_result>-count + 1.
ENDLOOP.
ENDMETHOD.
ENDCLASS.
CLASS lcl_gui DEFINITION FINAL.
PUBLIC SECTION.
CLASS-METHODS:
show
IMPORTING VALUE(it_result) TYPE ty_result_tt
RAISING cx_salv_msg.
ENDCLASS.
CLASS lcl_gui IMPLEMENTATION.
METHOD show.
DATA: lo_salv TYPE REF TO cl_salv_table.
cl_salv_table=>factory(
IMPORTING
r_salv_table = lo_salv
CHANGING
t_table = it_result ).
lo_salv->get_columns( )->set_optimize( ).
lo_salv->get_functions( )->set_all( ).
lo_salv->display( ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
lcl_gui=>show( lcl_app=>run( ) ). | 22.942857 | 83 | 0.648319 | {
"alnum_ratio": 0.6104680423,
"alpha_token_ratio": 1.7617647059,
"avg_line_length": 22.8390804598,
"char_rep_ratio": 0.0907944515,
"max_line_length": 83,
"num_words": 340,
"text_len": 3974,
"word_rep_ratio": 0
} | 5,132,844,460,429,369,000 |
ac28d4628aa50b1edbb3cbafe96990eee2cd0283 | 26,368 | abap | ABAP | src/objects/zcl_abapgit_object_devc.clas.abap | D047539/abapGit | cbaf3711b4c41e8376144ad7bd848e6a3d3722bb | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/zcl_abapgit_object_devc.clas.abap | larshp/abapGit | 143f7d4d3b938bdbb418fef5f94665ba1f150fb6 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/zcl_abapgit_object_devc.clas.abap | D047539/abapGit | cbaf3711b4c41e8376144ad7bd848e6a3d3722bb | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_object_devc DEFINITION PUBLIC
INHERITING FROM zcl_abapgit_objects_super
FINAL.
PUBLIC SECTION.
INTERFACES:
zif_abapgit_object.
ALIASES:
mo_files FOR zif_abapgit_object~mo_files.
METHODS:
constructor IMPORTING is_item TYPE zif_abapgit_definitions=>ty_item
iv_language TYPE spras.
PROTECTED SECTION.
PRIVATE SECTION.
DATA mv_local_devclass TYPE devclass .
METHODS get_package
RETURNING
VALUE(ri_package) TYPE REF TO if_package
RAISING
zcx_abapgit_exception .
METHODS update_pinf_usages
IMPORTING
!ii_package TYPE REF TO if_package
!it_usage_data TYPE scomppdata
RAISING
zcx_abapgit_exception .
METHODS set_lock
IMPORTING
!ii_package TYPE REF TO if_package
!iv_lock TYPE abap_bool
RAISING
zcx_abapgit_exception .
METHODS is_empty
IMPORTING
!iv_package_name TYPE devclass
RETURNING
VALUE(rv_is_empty) TYPE abap_bool
RAISING
zcx_abapgit_exception .
METHODS load_package
IMPORTING
!iv_package_name TYPE devclass
RETURNING
VALUE(ri_package) TYPE REF TO if_package
RAISING
zcx_abapgit_exception .
METHODS is_local
IMPORTING
!iv_package_name TYPE devclass
RETURNING
VALUE(rv_is_local) TYPE abap_bool .
METHODS remove_obsolete_tadir
IMPORTING
!iv_package_name TYPE devclass .
ENDCLASS.
CLASS zcl_abapgit_object_devc IMPLEMENTATION.
METHOD constructor.
super->constructor( is_item = is_item
iv_language = iv_language ).
IF is_item-devclass IS NOT INITIAL.
mv_local_devclass = is_item-devclass.
ELSE.
mv_local_devclass = is_item-obj_name.
ENDIF.
ENDMETHOD.
METHOD get_package.
IF zif_abapgit_object~exists( ) = abap_true.
ri_package = load_package( mv_local_devclass ).
ENDIF.
ENDMETHOD.
METHOD is_empty.
DATA: lv_object_name TYPE tadir-obj_name,
lt_subpackages TYPE zif_abapgit_sap_package=>ty_devclass_tt.
lt_subpackages = zcl_abapgit_factory=>get_sap_package( iv_package_name )->list_subpackages( ).
IF lines( lt_subpackages ) > 0.
rv_is_empty = abap_false.
RETURN.
ENDIF.
" Ignore the SOTR if is linked to the current SAP package (DEVC)
SELECT SINGLE obj_name
FROM tadir
INTO lv_object_name
WHERE pgmid = 'R3TR'
AND NOT ( ( object = 'DEVC' OR object = 'SOTR' ) AND obj_name = iv_package_name )
AND devclass = iv_package_name.
rv_is_empty = boolc( sy-subrc <> 0 ).
ENDMETHOD.
METHOD is_local.
DATA lv_dlvunit TYPE tdevc-dlvunit.
SELECT SINGLE dlvunit FROM tdevc INTO lv_dlvunit
WHERE devclass = iv_package_name AND intsys <> 'SAP'.
IF sy-subrc = 0 AND lv_dlvunit = 'LOCAL'.
rv_is_local = abap_true.
ENDIF.
ENDMETHOD.
METHOD load_package.
cl_package_factory=>load_package(
EXPORTING
i_package_name = iv_package_name
i_force_reload = abap_true
IMPORTING
e_package = ri_package
EXCEPTIONS
object_not_existing = 1
unexpected_error = 2
intern_err = 3
no_access = 4
object_locked_and_modified = 5
OTHERS = 6 ).
IF sy-subrc = 1.
RETURN.
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD remove_obsolete_tadir.
DATA:
lv_pack TYPE devclass,
lt_pack TYPE STANDARD TABLE OF devclass,
ls_tadir TYPE zif_abapgit_definitions=>ty_tadir,
lt_tadir TYPE zif_abapgit_definitions=>ty_tadir_tt,
ls_item TYPE zif_abapgit_definitions=>ty_item.
" TADIR entries must remain for transportable packages
IF is_local( iv_package_name ) = abap_false.
RETURN.
ENDIF.
" Clean-up sub packages first
SELECT devclass FROM tdevc INTO TABLE lt_pack WHERE parentcl = iv_package_name.
LOOP AT lt_pack INTO lv_pack.
remove_obsolete_tadir( lv_pack ).
ENDLOOP.
" Remove TADIR entries for objects that do not exist anymore
SELECT * FROM tadir INTO CORRESPONDING FIELDS OF TABLE lt_tadir
WHERE devclass = iv_package_name ##TOO_MANY_ITAB_FIELDS.
LOOP AT lt_tadir INTO ls_tadir.
ls_item-obj_type = ls_tadir-object.
ls_item-obj_name = ls_tadir-obj_name.
IF zcl_abapgit_objects=>exists( ls_item ) = abap_false.
CALL FUNCTION 'TR_TADIR_INTERFACE'
EXPORTING
wi_delete_tadir_entry = abap_true
wi_tadir_pgmid = 'R3TR'
wi_tadir_object = ls_tadir-object
wi_tadir_obj_name = ls_tadir-obj_name
wi_test_modus = abap_false
EXCEPTIONS
OTHERS = 1 ##FM_SUBRC_OK.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD set_lock.
DATA: lv_changeable TYPE abap_bool.
ii_package->get_changeable( IMPORTING e_changeable = lv_changeable ).
IF lv_changeable <> iv_lock.
TRY.
CALL METHOD ii_package->('SET_CHANGEABLE')
EXPORTING
i_changeable = iv_lock
i_suppress_dialog = abap_true " Parameter missing in 702
EXCEPTIONS
object_locked_by_other_user = 1
permission_failure = 2
object_already_changeable = 3
object_already_unlocked = 4
object_just_created = 5
object_deleted = 6
object_modified = 7
object_not_existing = 8
object_invalid = 9
unexpected_error = 10
OTHERS = 11.
CATCH cx_sy_dyn_call_param_not_found.
ii_package->set_changeable(
EXPORTING
i_changeable = iv_lock
EXCEPTIONS
object_locked_by_other_user = 1
permission_failure = 2
object_already_changeable = 3
object_already_unlocked = 4
object_just_created = 5
object_deleted = 6
object_modified = 7
object_not_existing = 8
object_invalid = 9
unexpected_error = 10
OTHERS = 11 ).
ENDTRY.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
TRY.
CALL METHOD ii_package->('SET_PERMISSIONS_CHANGEABLE')
EXPORTING
i_changeable = iv_lock
i_suppress_dialog = abap_true " Parameter missing in 702
EXCEPTIONS
object_already_changeable = 1
object_already_unlocked = 2
object_locked_by_other_user = 3
object_modified = 4
object_just_created = 5
object_deleted = 6
permission_failure = 7
object_invalid = 8
unexpected_error = 9
OTHERS = 10.
CATCH cx_sy_dyn_call_param_not_found.
ii_package->set_permissions_changeable(
EXPORTING
i_changeable = iv_lock
EXCEPTIONS
object_already_changeable = 1
object_already_unlocked = 2
object_locked_by_other_user = 3
object_modified = 4
object_just_created = 5
object_deleted = 6
permission_failure = 7
object_invalid = 8
unexpected_error = 9
OTHERS = 10 ).
ENDTRY.
IF ( sy-subrc = 1 AND iv_lock = abap_true ) OR ( sy-subrc = 2 AND iv_lock = abap_false ).
" There's no getter to find out beforehand...
ELSEIF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDMETHOD.
METHOD update_pinf_usages.
DATA: lt_current_permissions TYPE tpak_permission_to_use_list,
li_usage TYPE REF TO if_package_permission_to_use,
ls_data_sign TYPE scomppsign,
ls_add_permission_data TYPE pkgpermdat,
lt_handled TYPE SORTED TABLE OF i WITH UNIQUE KEY table_line.
FIELD-SYMBOLS: <ls_usage_data> LIKE LINE OF it_usage_data.
" Get the current permissions
ii_package->get_permissions_to_use(
IMPORTING
e_permissions = lt_current_permissions
EXCEPTIONS
object_invalid = 1
unexpected_error = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ls_data_sign-err_sever = abap_true.
" New permissions
LOOP AT it_usage_data ASSIGNING <ls_usage_data>.
READ TABLE lt_current_permissions
WITH KEY table_line->package_interface_name = <ls_usage_data>-intf_name
INTO li_usage.
IF sy-subrc = 0 AND li_usage IS BOUND.
INSERT sy-tabix INTO TABLE lt_handled.
" Permission already exists, update attributes
li_usage->set_all_attributes(
EXPORTING
i_permission_data = <ls_usage_data>
i_data_sign = ls_data_sign
EXCEPTIONS
object_not_changeable = 1
object_invalid = 2
intern_err = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ELSE.
" Permission does not exist yet, add it
MOVE-CORRESPONDING <ls_usage_data> TO ls_add_permission_data.
ii_package->add_permission_to_use(
EXPORTING
i_pkg_permission_data = ls_add_permission_data
EXCEPTIONS
object_not_changeable = 1
object_access_error = 2
object_already_existing = 3
object_invalid = 4
unexpected_error = 5
OTHERS = 6 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
FREE li_usage.
ENDLOOP.
" Delete missing usages
LOOP AT lt_current_permissions INTO li_usage.
READ TABLE lt_handled WITH TABLE KEY table_line = sy-tabix TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
li_usage->delete(
EXCEPTIONS
object_not_changeable = 1
object_invalid = 2
* deletion_not_allowed = 3 downport, does not exist in 7.30
intern_err = 4
OTHERS = 5 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = get_package( )->changed_by.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: li_package TYPE REF TO if_package,
lv_package TYPE devclass.
" Package deletion is a bit tricky. A package can only be deleted if there are no objects
" contained in it. This includes subpackages, so first the leaf packages need to be deleted.
" Unfortunately deleted objects that are still contained in an unreleased transport request
" also count towards the contained objects counter.
" -> Currently we delete only empty packages
"
" If objects are deleted, the TADIR entry is deleted when the transport request is released.
" So before we can delete the package, the transport which deletes the objects
" in the package has to be released.
lv_package = ms_item-obj_name.
" Remove remaining OTR entries
zcl_abapgit_sotr_handler=>delete_sotr_package( iv_package ).
remove_obsolete_tadir( lv_package ).
IF is_empty( lv_package ) = abap_true.
li_package = load_package( lv_package ).
IF li_package IS NOT BOUND.
RETURN.
ENDIF.
IF lv_package(1) = '$'.
zcl_abapgit_persist_packages=>get_instance( )->modify( lv_package ).
ENDIF.
set_lock( ii_package = li_package
iv_lock = abap_true ).
TRY.
CALL METHOD li_package->('DELETE')
EXPORTING
i_suppress_dialog = abap_true " Parameter missing in 702
EXCEPTIONS
object_not_empty = 1
object_not_changeable = 2
object_invalid = 3
intern_err = 4
OTHERS = 5.
CATCH cx_sy_dyn_call_param_not_found.
li_package->delete(
EXCEPTIONS
object_not_empty = 1
object_not_changeable = 2
object_invalid = 3
intern_err = 4
OTHERS = 5 ).
ENDTRY.
IF sy-subrc <> 0.
set_lock( ii_package = li_package
iv_lock = abap_false ).
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
TRY.
CALL METHOD li_package->('SAVE')
EXPORTING
i_suppress_dialog = abap_true
EXCEPTIONS
object_invalid = 1
object_not_changeable = 2
cancelled_in_corr = 3
permission_failure = 4
unexpected_error = 5
intern_err = 6
OTHERS = 7.
CATCH cx_sy_dyn_call_param_not_found.
li_package->save(
EXCEPTIONS
object_invalid = 1
object_not_changeable = 2
cancelled_in_corr = 3
permission_failure = 4
unexpected_error = 5
intern_err = 6
OTHERS = 7 ).
ENDTRY.
IF sy-subrc <> 0.
set_lock( ii_package = li_package
iv_lock = abap_false ).
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: li_package TYPE REF TO if_package,
ls_package_data TYPE scompkdtln,
ls_data_sign TYPE scompksign,
lt_usage_data TYPE scomppdata,
ls_save_sign TYPE paksavsign.
FIELD-SYMBOLS: <ls_usage_data> TYPE scomppdtln.
mv_local_devclass = iv_package.
io_xml->read(
EXPORTING
iv_name = 'DEVC'
CHANGING
cg_data = ls_package_data ).
IF mv_local_devclass(1) = '$'.
IF ls_package_data-mainpack = 'X'.
zcx_abapgit_exception=>raise( |Main package { iv_package } cannot be used in local package| ).
ELSEIF ls_package_data-mainpack = 'S'.
zcx_abapgit_exception=>raise( |Structure package { iv_package } cannot be used in local package| ).
ENDIF.
ENDIF.
li_package = get_package( ).
" Swap out repository package name with the local installation package name
ls_package_data-devclass = mv_local_devclass.
IF li_package IS BOUND.
ls_package_data-pdevclass = li_package->transport_layer.
ENDIF.
" For local packages store application component
IF ls_package_data-devclass(1) = '$'.
zcl_abapgit_persist_packages=>get_instance( )->modify(
iv_package = ls_package_data-devclass
iv_component = ls_package_data-component
iv_comp_posid = ls_package_data-comp_posid ).
ENDIF.
" Parent package is not changed. Assume the folder logic already created the package and set
" the hierarchy before.
CLEAR ls_package_data-parentcl.
* Fields not set:
* korrflag
* dlvunit
* parentcl
* cli_check
* intprefx
ls_data_sign-ctext = abap_true.
ls_data_sign-as4user = abap_true.
ls_data_sign-pdevclass = abap_true.
ls_data_sign-comp_posid = abap_true.
ls_data_sign-component = abap_true.
ls_data_sign-perminher = abap_true.
ls_data_sign-packtype = abap_true.
ls_data_sign-restricted = abap_true.
ls_data_sign-mainpack = abap_true.
ls_data_sign-srv_check = abap_true.
ls_data_sign-ext_alias = abap_true.
ls_data_sign-project_guid = abap_true.
ls_data_sign-project_id = abap_true.
ls_data_sign-project_passdown = abap_true.
IF ls_package_data-ctext IS INITIAL.
ls_package_data-ctext = mv_local_devclass.
ENDIF.
IF ls_package_data-dlvunit IS INITIAL.
ls_package_data-dlvunit = 'HOME'.
ENDIF.
ls_package_data-as4user = cl_abap_syst=>get_user_name( ).
IF li_package IS BOUND.
" Package already exists, change it
set_lock( ii_package = li_package
iv_lock = abap_true ).
li_package->set_all_attributes(
EXPORTING
i_package_data = ls_package_data
i_data_sign = ls_data_sign
EXCEPTIONS
object_not_changeable = 1
object_deleted = 2
object_invalid = 3
short_text_missing = 4
author_not_existing = 5
local_package = 6
software_component_invalid = 7
layer_invalid = 8
korrflag_invalid = 9
component_not_existing = 10
component_missing = 11
authorize_failure = 12
prefix_in_use = 13
unexpected_error = 14
intern_err = 15
* wrong_mainpack_value = 16 downport, does not exist in 7.30
* superpackage_invalid = 17 downport, does not exist in 7.30
OTHERS = 18 ).
IF sy-subrc <> 0.
set_lock( ii_package = li_package
iv_lock = abap_false ).
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ELSE.
" Package does not exist yet, create it
" This shouldn't really happen, because the folder logic initially creates the packages.
cl_package_factory=>create_new_package(
IMPORTING
e_package = li_package
CHANGING
c_package_data = ls_package_data
EXCEPTIONS
object_already_existing = 1
object_just_created = 2
not_authorized = 3
wrong_name_prefix = 4
undefined_name = 5
reserved_local_name = 6
invalid_package_name = 7
short_text_missing = 8
software_component_invalid = 9
layer_invalid = 10
author_not_existing = 11
component_not_existing = 12
component_missing = 13
prefix_in_use = 14
unexpected_error = 15
intern_err = 16
no_access = 17
* invalid_translation_depth = 18 downport, does not exist in 7.30
* wrong_mainpack_value = 19 downport, does not exist in 7.30
* superpackage_invalid = 20 downport, does not exist in 7.30
* error_in_cts_checks = 21 downport, does not exist in 7.31
OTHERS = 22 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
" Load package interface usages
TRY.
io_xml->read(
EXPORTING
iv_name = 'PERMISSION'
CHANGING
cg_data = lt_usage_data ).
CATCH zcx_abapgit_exception ##NO_HANDLER.
" No permissions saved
ENDTRY.
LOOP AT lt_usage_data ASSIGNING <ls_usage_data>.
<ls_usage_data>-client_pak = mv_local_devclass.
ENDLOOP.
update_pinf_usages( ii_package = li_package
it_usage_data = lt_usage_data ).
ls_save_sign-pack = abap_true.
ls_save_sign-permis = abap_true.
ls_save_sign-elems = abap_true.
ls_save_sign-interf = abap_true.
li_package->save_generic(
EXPORTING
i_save_sign = ls_save_sign
i_transport_request = iv_transport
i_suppress_dialog = abap_true
EXCEPTIONS
cancelled_in_corr = 1
permission_failure = 2
object_not_changeable = 3
object_invalid = 4
OTHERS = 5 ).
IF sy-subrc <> 0.
set_lock( ii_package = li_package
iv_lock = abap_false ).
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
set_lock( ii_package = li_package
iv_lock = abap_false ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
" Check remote package if deserialize has not been called before this
IF mv_local_devclass IS INITIAL.
rv_bool = abap_false.
ELSE.
cl_package_helper=>check_package_existence(
EXPORTING
i_package_name = mv_local_devclass
IMPORTING
e_package_exists = rv_bool
EXCEPTIONS
intern_err = 1
OTHERS = 2 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
DATA: lv_object TYPE eqegraarg.
lv_object = |DV{ ms_item-obj_name }|.
OVERLAY lv_object WITH ' '.
lv_object = lv_object && '*'.
rv_is_locked = exists_a_lock_entry_for( iv_lock_object = 'EEUDB'
iv_argument = lv_object ).
ENDMETHOD.
METHOD zif_abapgit_object~jump.
" Covered by ZCL_ABAPGIT_OBJECTS=>JUMP
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: ls_package_data TYPE scompkdtln,
ls_package_comp TYPE zcl_abapgit_persist_packages=>ty_package,
li_package TYPE REF TO if_package,
lt_intf_usages TYPE tpak_permission_to_use_list,
lt_usage_data TYPE scomppdata,
ls_usage_data TYPE scomppdtln,
li_usage TYPE REF TO if_package_permission_to_use.
FIELD-SYMBOLS: <lg_field> TYPE any.
li_package = get_package( ).
IF li_package IS NOT BOUND.
zcx_abapgit_exception=>raise( |Could not find package to serialize.| ).
ENDIF.
li_package->get_all_attributes(
IMPORTING
e_package_data = ls_package_data
EXCEPTIONS
object_invalid = 1
package_deleted = 2
intern_err = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
" For local packages get application component
IF is_local( ls_package_data-devclass ) = abap_true.
ls_package_comp = zcl_abapgit_persist_packages=>get_instance( )->read( ls_package_data-devclass ).
ls_package_data-component = ls_package_comp-component.
ls_package_data-comp_posid = ls_package_comp-comp_posid.
ENDIF.
CLEAR: ls_package_data-devclass,
ls_package_data-parentcl.
" Clear administrative data to prevent diffs
CLEAR: ls_package_data-created_by,
ls_package_data-created_on,
ls_package_data-changed_by,
ls_package_data-changed_on,
ls_package_data-as4user.
" Clear text descriptions that might be localized
CLEAR: ls_package_data-comp_text,
ls_package_data-dlvu_text,
ls_package_data-layer_text.
" Clear obsolete fields
CLEAR: ls_package_data-intfprefx,
ls_package_data-cli_check.
ASSIGN COMPONENT 'TRANSLATION_DEPTH_TEXT'
OF STRUCTURE ls_package_data
TO <lg_field>.
IF sy-subrc = 0.
CLEAR: <lg_field>.
ENDIF.
ASSIGN COMPONENT 'TRANSLATION_GRAPH_DEPTH_TEXT'
OF STRUCTURE ls_package_data
TO <lg_field>.
IF sy-subrc = 0.
CLEAR: <lg_field>.
ENDIF.
" Clear things related to local installation package
CLEAR: ls_package_data-namespace,
ls_package_data-dlvunit,
ls_package_data-pdevclass.
" Not usable on customer systems
ASSIGN COMPONENT 'TRANSLATION_DEPTH'
OF STRUCTURE ls_package_data
TO <lg_field>.
IF sy-subrc = 0.
CLEAR: <lg_field>.
ENDIF.
ASSIGN COMPONENT 'TRANSLATION_GRAPH_DEPTH'
OF STRUCTURE ls_package_data
TO <lg_field>.
IF sy-subrc = 0.
CLEAR: <lg_field>.
ENDIF.
CLEAR: ls_package_data-korrflag.
io_xml->add( iv_name = 'DEVC'
ig_data = ls_package_data ).
" Save package interface usages
li_package->get_permissions_to_use(
IMPORTING
e_permissions = lt_intf_usages
EXCEPTIONS
object_invalid = 1
unexpected_error = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
LOOP AT lt_intf_usages INTO li_usage.
li_usage->get_all_attributes(
IMPORTING
e_permission_data = ls_usage_data
EXCEPTIONS
object_invalid = 1
intern_err = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
CLEAR: ls_usage_data-pack_name, ls_usage_data-client_pak.
APPEND ls_usage_data TO lt_usage_data.
ENDLOOP.
IF lt_usage_data IS NOT INITIAL.
io_xml->add( iv_name = 'PERMISSION'
ig_data = lt_usage_data ).
ENDIF.
ENDMETHOD.
ENDCLASS. | 31.057715 | 107 | 0.593067 | {
"alnum_ratio": 0.5512193272,
"alpha_token_ratio": 1.7827284105,
"avg_line_length": 31.0931603774,
"char_rep_ratio": 0.1747856438,
"max_line_length": 107,
"num_words": 1580,
"text_len": 26367,
"word_rep_ratio": 0.0216422661
} | 4,522,920,154,132,110,000 |
ac43fddf31c14a3255ac1e214b7feb771620ca8e | 7,911 | abap | ABAP | src/objects/zcl_abapgit_object_iamu.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/zcl_abapgit_object_iamu.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/zcl_abapgit_object_iamu.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_object_iamu DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES: BEGIN OF ty_internet_appl_comp_binary,
attributes TYPE w3mimeattr,
source TYPE w3mimetabtype,
length TYPE i,
END OF ty_internet_appl_comp_binary.
DATA: mi_mime_api TYPE REF TO if_w3_api_mime.
METHODS:
load_mime_api
RAISING
zcx_abapgit_exception,
read
RETURNING
VALUE(rs_internet_appl_comp_binary) TYPE ty_internet_appl_comp_binary
RAISING
zcx_abapgit_exception,
save
IMPORTING
is_internet_appl_comp_binary TYPE ty_internet_appl_comp_binary
RAISING
zcx_abapgit_exception,
release_lock
RAISING
zcx_abapgit_exception.
ENDCLASS.
CLASS zcl_abapgit_object_iamu IMPLEMENTATION.
METHOD load_mime_api.
DATA: ls_mime_name TYPE iacikeym.
ls_mime_name = ms_item-obj_name.
cl_w3_api_mime=>if_w3_api_mime~load(
EXPORTING
p_mime_name = ls_mime_name
IMPORTING
p_mime = mi_mime_api
EXCEPTIONS
object_not_existing = 1
permission_failure = 2
data_corrupt = 3
error_occured = 4
OTHERS = 6 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'error from if_w3_api_mime~load' ).
ENDIF.
ENDMETHOD.
METHOD read.
load_mime_api( ).
mi_mime_api->get_attributes(
IMPORTING
p_attributes = rs_internet_appl_comp_binary-attributes
EXCEPTIONS
object_invalid = 1
mime_deleted = 2
error_occured = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from if_w3_api_mime~get_attributes| ).
ENDIF.
CLEAR: rs_internet_appl_comp_binary-attributes-chname,
rs_internet_appl_comp_binary-attributes-tdate,
rs_internet_appl_comp_binary-attributes-ttime,
rs_internet_appl_comp_binary-attributes-devclass.
mi_mime_api->get_source(
IMPORTING
p_source = rs_internet_appl_comp_binary-source
p_datalength = rs_internet_appl_comp_binary-length
EXCEPTIONS
object_invalid = 1
mime_deleted = 2
error_occured = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from if_w3_api_mime~get_source| ).
ENDIF.
ENDMETHOD.
METHOD release_lock.
" As a side effect this method removes also existing locks
mi_mime_api->if_w3_api_object~set_changeable(
EXPORTING
p_changeable = abap_false
EXCEPTIONS
action_cancelled = 1
object_locked_by_other_user = 2
permission_failure = 3
object_already_changeable = 4
object_already_unlocked = 5
object_just_created = 6
object_deleted = 7
object_modified = 8
object_not_existing = 9
object_invalid = 10
error_occured = 11
OTHERS = 12 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from if_w3_api_mime~set_changeable| ).
ENDIF.
ENDMETHOD.
METHOD save.
cl_w3_api_mime=>if_w3_api_mime~create_new(
EXPORTING
p_mime_data = is_internet_appl_comp_binary-attributes
p_mime_content = is_internet_appl_comp_binary-source
p_datalength = is_internet_appl_comp_binary-length
IMPORTING
p_mime = mi_mime_api
EXCEPTIONS
object_already_existing = 1
object_just_created = 2
not_authorized = 3
undefined_name = 4
author_not_existing = 5
action_cancelled = 6
error_occured = 7
OTHERS = 8 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from if_w3_api_mime~create_new| ).
ENDIF.
mi_mime_api->if_w3_api_object~save(
EXCEPTIONS
object_invalid = 1
object_not_changeable = 2
action_cancelled = 3
permission_failure = 4
not_changed = 5
data_invalid = 6
error_occured = 7
OTHERS = 8 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from if_w3_api_mime~save| ).
ENDIF.
release_lock( ).
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
load_mime_api( ).
mi_mime_api->if_w3_api_object~set_changeable(
EXPORTING
p_changeable = abap_true
EXCEPTIONS
action_cancelled = 1
object_locked_by_other_user = 2
permission_failure = 3
object_already_changeable = 4
object_already_unlocked = 5
object_just_created = 6
object_deleted = 7
object_modified = 8
object_not_existing = 9
object_invalid = 10
error_occured = 11
OTHERS = 12 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from if_w3_api_mime~set_changeable| ).
ENDIF.
mi_mime_api->if_w3_api_object~delete(
EXCEPTIONS
object_not_empty = 1
object_not_changeable = 2
object_invalid = 3
error_occured = 4
OTHERS = 5 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from if_w3_api_mime~delete| ).
ENDIF.
mi_mime_api->if_w3_api_object~save(
EXCEPTIONS
object_invalid = 1
object_not_changeable = 2
action_cancelled = 3
permission_failure = 4
not_changed = 5
data_invalid = 6
error_occured = 7
OTHERS = 8 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error from if_w3_api_mime~save| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: ls_internet_appl_comp_binary TYPE ty_internet_appl_comp_binary.
io_xml->read(
EXPORTING
iv_name = 'IAMU'
CHANGING
cg_data = ls_internet_appl_comp_binary ).
ls_internet_appl_comp_binary-attributes-devclass = iv_package.
save( ls_internet_appl_comp_binary ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: ls_mime_name TYPE iacikeym.
ls_mime_name = ms_item-obj_name.
cl_w3_api_mime=>s_check_exist(
EXPORTING
p_mime_name = ls_mime_name
IMPORTING
p_exists = rv_bool ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
" Covered by ZCL_ABAPGIT_OBJECTS=>JUMP
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: ls_internet_appl_comp_binary TYPE ty_internet_appl_comp_binary.
ls_internet_appl_comp_binary = read( ).
io_xml->add( iv_name = 'IAMU'
ig_data = ls_internet_appl_comp_binary ).
ENDMETHOD.
ENDCLASS. | 24.955836 | 96 | 0.61345 | {
"alnum_ratio": 0.5614412137,
"alpha_token_ratio": 1.6872812135,
"avg_line_length": 25.0316455696,
"char_rep_ratio": 0.1708644475,
"max_line_length": 96,
"num_words": 369,
"text_len": 7910,
"word_rep_ratio": 0.1166666667
} | 12,989,619,264,172,843,000 |
ac543040a638a9d436c93eba1944b2f94bd6570b | 1,492 | abap | ABAP | src/ui/zcl_abapgit_ui_injector.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/ui/zcl_abapgit_ui_injector.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/ui/zcl_abapgit_ui_injector.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_ui_injector DEFINITION
PUBLIC
CREATE PRIVATE .
PUBLIC SECTION.
CLASS-METHODS set_popups
IMPORTING
!ii_popups TYPE REF TO zif_abapgit_popups .
CLASS-METHODS set_frontend_services
IMPORTING
!ii_fe_serv TYPE REF TO zif_abapgit_frontend_services .
CLASS-METHODS set_gui_services
IMPORTING
!ii_gui_services TYPE REF TO zif_abapgit_gui_services .
CLASS-METHODS get_dummy_gui_services
RETURNING
VALUE(ri_gui_services) TYPE REF TO zif_abapgit_gui_services .
CLASS-METHODS set_html_viewer
IMPORTING
!ii_html_viewer TYPE REF TO zif_abapgit_html_viewer .
CLASS-METHODS set_gui_jumper
IMPORTING
!ii_gui_jumper TYPE REF TO zif_abapgit_gui_jumper .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_abapgit_ui_injector IMPLEMENTATION.
METHOD get_dummy_gui_services.
ri_gui_services = lcl_gui_services_dummy=>create( ).
ENDMETHOD.
METHOD set_frontend_services.
zcl_abapgit_ui_factory=>gi_fe_services = ii_fe_serv.
ENDMETHOD.
METHOD set_gui_jumper.
zcl_abapgit_ui_factory=>gi_gui_jumper = ii_gui_jumper.
ENDMETHOD.
METHOD set_gui_services.
zcl_abapgit_ui_factory=>gi_gui_services = ii_gui_services.
ENDMETHOD.
METHOD set_html_viewer.
zcl_abapgit_ui_factory=>gi_html_viewer = ii_html_viewer.
ENDMETHOD.
METHOD set_popups.
zcl_abapgit_ui_factory=>gi_popups = ii_popups.
ENDMETHOD.
ENDCLASS. | 19.893333 | 69 | 0.753351 | {
"alnum_ratio": 0.6894701543,
"alpha_token_ratio": 1.8656987296,
"avg_line_length": 20.1486486486,
"char_rep_ratio": 0.1309041835,
"max_line_length": 69,
"num_words": 95,
"text_len": 1491,
"word_rep_ratio": 0
} | 11,270,331,548,665,375,000 |
acc87cb9df50f90d5352c369c9ee1d8fb0e15b7a | 10,152 | abap | ABAP | src/persist/zcl_abapgit_persistence_repo.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/persist/zcl_abapgit_persistence_repo.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/persist/zcl_abapgit_persistence_repo.clas.abap | gepparta/abapGit | 79da4eb38520facea52e1f5a1b2a189f208de4e9 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_persistence_repo DEFINITION
PUBLIC
CREATE PROTECTED
GLOBAL FRIENDS zcl_abapgit_persist_factory .
PUBLIC SECTION.
INTERFACES zif_abapgit_persist_repo .
INTERFACES zif_abapgit_persist_repo_cs .
METHODS constructor .
METHODS rewrite_repo_meta
IMPORTING
!iv_repo_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception
zcx_abapgit_not_found.
PROTECTED SECTION.
PRIVATE SECTION.
DATA mt_meta_fields TYPE STANDARD TABLE OF abap_compname.
DATA mo_db TYPE REF TO zcl_abapgit_persistence_db .
METHODS from_xml
IMPORTING
!iv_repo_xml_string TYPE string
RETURNING
VALUE(rs_repo) TYPE zif_abapgit_persistence=>ty_repo_xml
RAISING
zcx_abapgit_exception .
METHODS to_xml
IMPORTING
!is_repo TYPE zif_abapgit_persistence=>ty_repo
RETURNING
VALUE(rv_repo_xml_string) TYPE string .
METHODS get_next_id
RETURNING
VALUE(rv_next_repo_id) TYPE zif_abapgit_persistence=>ty_content-value
RAISING
zcx_abapgit_exception .
METHODS get_repo_from_content
IMPORTING
is_content TYPE zif_abapgit_persistence=>ty_content
RETURNING
VALUE(rs_result) TYPE zif_abapgit_persistence=>ty_repo
RAISING
zcx_abapgit_exception.
ENDCLASS.
CLASS ZCL_ABAPGIT_PERSISTENCE_REPO IMPLEMENTATION.
METHOD constructor.
DATA ls_dummy_meta_mask TYPE zif_abapgit_persistence=>ty_repo_meta_mask.
DATA ls_dummy_meta TYPE zif_abapgit_persistence=>ty_repo_xml.
DATA lo_type_meta_mask TYPE REF TO cl_abap_structdescr.
DATA lo_type_meta TYPE REF TO cl_abap_structdescr.
FIELD-SYMBOLS <ls_comp> LIKE LINE OF lo_type_meta_mask->components.
" Collect actual list of fields in repo meta data (used in update_meta)
lo_type_meta_mask ?= cl_abap_structdescr=>describe_by_data( ls_dummy_meta_mask ).
lo_type_meta ?= cl_abap_structdescr=>describe_by_data( ls_dummy_meta ).
LOOP AT lo_type_meta_mask->components ASSIGNING <ls_comp>.
APPEND <ls_comp>-name TO mt_meta_fields.
ENDLOOP.
mo_db = zcl_abapgit_persistence_db=>get_instance( ).
ENDMETHOD.
METHOD from_xml.
DATA: lv_xml TYPE string.
lv_xml = iv_repo_xml_string.
* fix downward compatibility
REPLACE ALL OCCURRENCES OF '<_--28C_TYPE_REPO_--29>' IN lv_xml WITH '<REPO>'.
REPLACE ALL OCCURRENCES OF '</_--28C_TYPE_REPO_--29>' IN lv_xml WITH '</REPO>'.
CALL TRANSFORMATION id
OPTIONS value_handling = 'accept_data_loss'
SOURCE XML lv_xml
RESULT repo = rs_repo.
* automatic migration of old fields
* todo, keep for transition period until 2022-12-31, then remove all of these
FIND FIRST OCCURRENCE OF '</HEAD_BRANCH><WRITE_PROTECT>X</WRITE_PROTECT>' IN lv_xml.
IF sy-subrc = 0.
rs_repo-local_settings-write_protected = abap_true.
ENDIF.
FIND FIRST OCCURRENCE OF '<IGNORE_SUBPACKAGES>X</IGNORE_SUBPACKAGES></REPO>' IN lv_xml.
IF sy-subrc = 0.
rs_repo-local_settings-ignore_subpackages = abap_true.
ENDIF.
FIND FIRST OCCURRENCE OF '<SERIALIZE_MASTER_LANG_ONLY>X</SERIALIZE_MASTER_LANG_ONLY>' IN lv_xml.
IF sy-subrc = 0.
rs_repo-local_settings-main_language_only = abap_true.
ENDIF.
IF rs_repo IS INITIAL.
zcx_abapgit_exception=>raise( 'Inconsistent repo metadata' ).
ENDIF.
ENDMETHOD.
METHOD get_next_id.
* todo: Lock the complete persistence in order to prevent concurrent repo-creation
* however the current approach will most likely work in almost all cases
DATA: lt_content TYPE zif_abapgit_persistence=>ty_contents.
FIELD-SYMBOLS: <ls_content> LIKE LINE OF lt_content.
rv_next_repo_id = 1.
lt_content = mo_db->list_by_type( zcl_abapgit_persistence_db=>c_type_repo ).
LOOP AT lt_content ASSIGNING <ls_content>.
IF <ls_content>-value >= rv_next_repo_id.
rv_next_repo_id = <ls_content>-value + 1.
ENDIF.
ENDLOOP.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = rv_next_repo_id
IMPORTING
output = rv_next_repo_id.
ENDMETHOD.
METHOD get_repo_from_content.
MOVE-CORRESPONDING from_xml( is_content-data_str ) TO rs_result.
IF rs_result-local_settings-write_protected = abap_false AND
zcl_abapgit_factory=>get_environment( )->is_repo_object_changes_allowed( ) = abap_false.
rs_result-local_settings-write_protected = abap_true.
ENDIF.
rs_result-key = is_content-value.
ENDMETHOD.
METHOD rewrite_repo_meta.
DATA lv_old_blob TYPE string.
DATA lv_new_blob TYPE string.
DATA ls_repo_meta TYPE zif_abapgit_persistence=>ty_repo.
lv_old_blob = mo_db->read(
iv_type = zcl_abapgit_persistence_db=>c_type_repo
iv_value = iv_repo_key ).
MOVE-CORRESPONDING from_xml( lv_old_blob ) TO ls_repo_meta.
lv_new_blob = to_xml( ls_repo_meta ).
mo_db->update(
iv_type = zcl_abapgit_persistence_db=>c_type_repo
iv_value = iv_repo_key
iv_data = lv_new_blob ).
ENDMETHOD.
METHOD to_xml.
DATA: ls_xml TYPE zif_abapgit_persistence=>ty_repo_xml.
MOVE-CORRESPONDING is_repo TO ls_xml.
CALL TRANSFORMATION id
SOURCE repo = ls_xml
RESULT XML rv_repo_xml_string.
ENDMETHOD.
METHOD zif_abapgit_persist_repo_cs~delete.
mo_db->delete(
iv_type = zcl_abapgit_persistence_db=>c_type_repo_csum
iv_value = iv_key ).
ENDMETHOD.
METHOD zif_abapgit_persist_repo_cs~read.
rv_cs_blob = mo_db->read(
iv_type = zcl_abapgit_persistence_db=>c_type_repo_csum
iv_value = iv_key ).
ENDMETHOD.
METHOD zif_abapgit_persist_repo_cs~update.
mo_db->modify(
iv_type = zcl_abapgit_persistence_db=>c_type_repo_csum
iv_value = iv_key
iv_data = iv_cs_blob ).
ENDMETHOD.
METHOD zif_abapgit_persist_repo~add.
DATA: ls_repo TYPE zif_abapgit_persistence=>ty_repo,
lv_repo_as_xml TYPE string.
ls_repo-url = iv_url.
ls_repo-branch_name = iv_branch_name.
ls_repo-package = iv_package.
ls_repo-offline = iv_offline.
ls_repo-created_by = sy-uname.
GET TIME STAMP FIELD ls_repo-created_at.
ls_repo-dot_abapgit = is_dot_abapgit.
ls_repo-local_settings-display_name = iv_display_name.
lv_repo_as_xml = to_xml( ls_repo ).
rv_key = get_next_id( ).
mo_db->add( iv_type = zcl_abapgit_persistence_db=>c_type_repo
iv_value = rv_key
iv_data = lv_repo_as_xml ).
ENDMETHOD.
METHOD zif_abapgit_persist_repo~delete.
DATA: lo_background TYPE REF TO zcl_abapgit_persist_background.
CREATE OBJECT lo_background.
lo_background->delete( iv_key ).
mo_db->delete( iv_type = zcl_abapgit_persistence_db=>c_type_repo
iv_value = iv_key ).
ENDMETHOD.
METHOD zif_abapgit_persist_repo~exists.
DATA lt_keys TYPE zif_abapgit_persistence=>ty_repo_keys.
DATA lt_content TYPE zif_abapgit_persistence=>ty_contents.
APPEND iv_key TO lt_keys.
lt_content = mo_db->list_by_keys(
it_keys = lt_keys
iv_type = zcl_abapgit_persistence_db=>c_type_repo ).
rv_yes = boolc( lines( lt_content ) > 0 ).
ENDMETHOD.
METHOD zif_abapgit_persist_repo~list.
DATA: lt_content TYPE zif_abapgit_persistence=>ty_contents,
ls_content LIKE LINE OF lt_content,
ls_repo LIKE LINE OF rt_repos.
lt_content = mo_db->list_by_type( zcl_abapgit_persistence_db=>c_type_repo ).
LOOP AT lt_content INTO ls_content.
ls_repo = get_repo_from_content( ls_content ).
INSERT ls_repo INTO TABLE rt_repos.
ENDLOOP.
ENDMETHOD.
METHOD zif_abapgit_persist_repo~list_by_keys.
DATA: lt_content TYPE zif_abapgit_persistence=>ty_contents,
ls_content LIKE LINE OF lt_content,
ls_repo LIKE LINE OF rt_repos.
lt_content = mo_db->list_by_keys(
it_keys = it_keys
iv_type = zcl_abapgit_persistence_db=>c_type_repo ).
LOOP AT lt_content INTO ls_content.
ls_repo = get_repo_from_content( ls_content ).
INSERT ls_repo INTO TABLE rt_repos.
ENDLOOP.
ENDMETHOD.
METHOD zif_abapgit_persist_repo~lock.
mo_db->lock( iv_mode = iv_mode
iv_type = zcl_abapgit_persistence_db=>c_type_repo
iv_value = iv_key ).
ENDMETHOD.
METHOD zif_abapgit_persist_repo~read.
DATA lt_repo TYPE zif_abapgit_persistence=>ty_repos.
lt_repo = zif_abapgit_persist_repo~list( ).
READ TABLE lt_repo INTO rs_repo WITH KEY key = iv_key.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE zcx_abapgit_not_found.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_persist_repo~update_metadata.
DATA:
lv_blob TYPE zif_abapgit_persistence=>ty_content-data_str,
ls_persistent_meta TYPE zif_abapgit_persistence=>ty_repo.
FIELD-SYMBOLS <lv_field> LIKE LINE OF mt_meta_fields.
FIELD-SYMBOLS <lg_dst> TYPE any.
FIELD-SYMBOLS <lg_src> TYPE any.
FIELD-SYMBOLS <lv_changed> TYPE abap_bool.
ASSERT NOT iv_key IS INITIAL.
IF is_change_mask IS INITIAL.
RETURN.
ENDIF.
" Validations
IF is_change_mask-url = abap_true AND is_meta-url IS INITIAL.
zcx_abapgit_exception=>raise( 'update, url empty' ).
ENDIF.
ls_persistent_meta = zcl_abapgit_repo_srv=>get_instance( )->get( iv_key )->ms_data.
" Update
LOOP AT mt_meta_fields ASSIGNING <lv_field>.
ASSIGN COMPONENT <lv_field> OF STRUCTURE is_change_mask TO <lv_changed>.
ASSERT sy-subrc = 0.
CHECK <lv_changed> = abap_true.
ASSIGN COMPONENT <lv_field> OF STRUCTURE ls_persistent_meta TO <lg_dst>.
ASSERT sy-subrc = 0.
ASSIGN COMPONENT <lv_field> OF STRUCTURE is_meta TO <lg_src>.
ASSERT sy-subrc = 0.
<lg_dst> = <lg_src>.
ENDLOOP.
lv_blob = to_xml( ls_persistent_meta ).
mo_db->update( iv_type = zcl_abapgit_persistence_db=>c_type_repo
iv_value = iv_key
iv_data = lv_blob ).
ENDMETHOD.
ENDCLASS. | 27.586957 | 100 | 0.710993 | {
"alnum_ratio": 0.6498867107,
"alpha_token_ratio": 1.7807588076,
"avg_line_length": 27.659400545,
"char_rep_ratio": 0.1576612108,
"max_line_length": 100,
"num_words": 716,
"text_len": 10151,
"word_rep_ratio": 0.0396039604
} | 8,946,807,878,637,954,000 |
acd2b7117b4e3a8ce2d840ec8230ad40fdf1ae81 | 2,040 | abap | ABAP | src/checks/zcl_aoc_check_42.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_42.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_42.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | *----------------------------------------------------------------------*
* CLASS lcl_Test DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS
FINAL.
PRIVATE SECTION.
* ================
DATA: mt_code TYPE string_table,
ms_result TYPE scirest_ad,
mo_check TYPE REF TO zcl_aoc_check_42.
METHODS:
setup,
export_import FOR TESTING,
test001_01 FOR TESTING,
test001_02 FOR TESTING.
ENDCLASS. "lcl_Test
*----------------------------------------------------------------------*
* CLASS lcl_Test IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test IMPLEMENTATION.
* ==============================
DEFINE _code.
APPEND &1 TO mt_code.
END-OF-DEFINITION.
METHOD setup.
CREATE OBJECT mo_check.
zcl_aoc_unit_test=>set_check( mo_check ).
ENDMETHOD. "setup
METHOD export_import.
zcl_aoc_unit_test=>export_import( mo_check ).
ENDMETHOD.
METHOD test001_01.
* ===========
_code 'CASE lv_foo.'.
_code ' WHEN 1.'.
_code ' WRITE lv_bar.'.
_code ' WHEN 2.'.
_code ' WRITE lv_moo.'.
_code 'ENDCASE.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD. "test1
METHOD test001_02.
* ===========
_code 'CASE lv_foo.'.
_code ' WHEN 1.'.
_code ' WRITE lv_bar.'.
_code ' WHEN 2.'.
_code ' WRITE lv_bar.'.
_code 'ENDCASE.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD. "test001_02
ENDCLASS. "lcl_Test | 25.185185 | 72 | 0.457353 | {
"alnum_ratio": 0.4222658166,
"alpha_token_ratio": 1.3888888889,
"avg_line_length": 25.4875,
"char_rep_ratio": 0.3123152709,
"max_line_length": 72,
"num_words": 119,
"text_len": 2039,
"word_rep_ratio": 0.0909090909
} | 2,030,237,046,532,450,600 |
4a16c29947a8be3c852c91d23752b3b856627a9b | 17,846 | abap | ABAP | src/objects/zcl_abapgit_object_wapa.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 317 | 2020-09-25T19:50:59.000Z | 2022-03-29T22:59:01.000Z | src/objects/zcl_abapgit_object_wapa.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 1,114 | 2020-09-24T07:44:36.000Z | 2022-03-31T18:01:19.000Z | src/objects/zcl_abapgit_object_wapa.clas.abap | Manny27nyc/abapGit | dc51247e9b8c0c792193aba857ec31df3a82db4a | [
"MIT"
] | 167 | 2020-09-24T18:31:37.000Z | 2022-03-24T10:07:04.000Z | CLASS zcl_abapgit_object_wapa DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES: BEGIN OF ty_page,
attributes TYPE o2pagattr,
event_handlers TYPE o2pagevh_tabletype,
parameters TYPE o2pagpar_tabletype,
types TYPE rswsourcet,
END OF ty_page.
TYPES: ty_pages_tt TYPE STANDARD TABLE OF ty_page WITH DEFAULT KEY.
CONSTANTS: c_active TYPE so2_version VALUE 'A'.
METHODS:
get_page_content
IMPORTING io_page TYPE REF TO cl_o2_api_pages
RETURNING VALUE(rv_content) TYPE xstring
RAISING zcx_abapgit_exception,
to_page_content
IMPORTING iv_content TYPE xstring
RETURNING VALUE(rt_content) TYPE o2pageline_table,
read_page
IMPORTING is_page TYPE o2pagattr
RETURNING VALUE(rs_page) TYPE ty_page
RAISING zcx_abapgit_exception,
create_new_application
IMPORTING is_attributes TYPE o2applattr
it_nodes TYPE o2applnode_table
it_navgraph TYPE o2applgrap_table
RETURNING VALUE(ro_bsp) TYPE REF TO cl_o2_api_application
RAISING zcx_abapgit_exception,
create_new_page
IMPORTING
is_page_attributes TYPE o2pagattr
RETURNING
VALUE(ro_page) TYPE REF TO cl_o2_api_pages
RAISING
zcx_abapgit_exception,
delete_superfluous_pages
IMPORTING
it_local_pages TYPE o2pagelist
it_remote_pages TYPE ty_pages_tt
RAISING
zcx_abapgit_exception.
ENDCLASS.
CLASS zcl_abapgit_object_wapa IMPLEMENTATION.
METHOD create_new_application.
DATA: ls_item LIKE ms_item,
lv_objkey TYPE seu_objkey.
cl_o2_api_application=>create_new(
EXPORTING
p_application_data = is_attributes
p_nodes = it_nodes
p_navgraph = it_navgraph
IMPORTING
p_application = ro_bsp
EXCEPTIONS
object_already_existing = 1
object_just_created = 2
not_authorized = 3
undefined_name = 4
author_not_existing = 5
action_cancelled = 6
error_occured = 7
invalid_parameter = 8 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |WAPA - error from create_new: { sy-subrc }| ).
ENDIF.
ro_bsp->save( ).
ro_bsp->set_changeable(
p_changeable = abap_false
p_complete_application = abap_true ).
ls_item-obj_type = 'WAPD'.
ls_item-obj_name = ms_item-obj_name.
zcl_abapgit_objects_activation=>add_item( ls_item ).
lv_objkey = ls_item-obj_name.
* todo, hmm, the WAPD is not added to the worklist during activation
cl_o2_api_application=>activate( lv_objkey ).
ENDMETHOD.
METHOD create_new_page.
cl_o2_api_pages=>create_new_page(
EXPORTING
p_pageattrs = is_page_attributes
IMPORTING
p_page = ro_page
EXCEPTIONS
object_already_exists = 1
invalid_name = 2
error_occured = 3
o2appl_not_existing = 4
OTHERS = 5 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error { sy-subrc } from CL_O2_API_PAGES=>CREATE_NEW_PAGE| ).
ENDIF.
ENDMETHOD.
METHOD delete_superfluous_pages.
DATA: ls_pagekey TYPE o2pagkey.
FIELD-SYMBOLS: <ls_local_page> LIKE LINE OF it_local_pages.
" delete local pages which doesn't exists remotely
LOOP AT it_local_pages ASSIGNING <ls_local_page>.
READ TABLE it_remote_pages WITH KEY attributes-pagekey = <ls_local_page>-pagekey
TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
" page exists locally but not remotely -> delete
ls_pagekey-applname = <ls_local_page>-applname.
ls_pagekey-pagekey = <ls_local_page>-pagekey.
cl_o2_page=>delete_page_for_application(
EXPORTING
p_pagekey = ls_pagekey
EXCEPTIONS
object_not_existing = 1
error_occured = 2 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Error { sy-subrc } from CL_O2_PAGE=>DELETE_PAGE_FOR_APPLICATION| ).
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD get_page_content.
DATA: lt_content TYPE o2pageline_table,
lv_string TYPE string.
io_page->get_page(
IMPORTING
p_content = lt_content
EXCEPTIONS
invalid_call = 1
page_deleted = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |WAPA - error from get_page_content| ).
ENDIF.
CONCATENATE LINES OF lt_content INTO lv_string SEPARATED BY zif_abapgit_definitions=>c_newline RESPECTING BLANKS.
rv_content = zcl_abapgit_convert=>string_to_xstring_utf8( lv_string ).
ENDMETHOD.
METHOD read_page.
DATA: lv_name TYPE o2applname,
ls_pagekey TYPE o2pagkey,
lv_content TYPE xstring,
lv_extra TYPE string,
lv_ext TYPE string,
lo_page TYPE REF TO cl_o2_api_pages.
lv_name = ms_item-obj_name.
ls_pagekey-applname = lv_name.
ls_pagekey-pagekey = is_page-pagekey.
cl_o2_api_pages=>load(
EXPORTING
p_pagekey = ls_pagekey
IMPORTING
p_page = lo_page ).
lo_page->get_attrs( IMPORTING p_attrs = rs_page-attributes ).
IF rs_page-attributes-pagetype <> so2_controller.
lo_page->get_event_handlers(
IMPORTING
p_ev_handler = rs_page-event_handlers
EXCEPTIONS
page_deleted = 1
invalid_call = 2 ).
ASSERT sy-subrc = 0.
lo_page->get_parameters(
IMPORTING
p_parameters = rs_page-parameters
EXCEPTIONS
page_deleted = 1
invalid_call = 2
OTHERS = 3 ).
ASSERT sy-subrc = 0.
lo_page->get_type_source(
IMPORTING
p_source = rs_page-types
EXCEPTIONS
page_deleted = 1
invalid_call = 2
OTHERS = 3 ).
ASSERT sy-subrc = 0.
lv_content = get_page_content( lo_page ).
SPLIT is_page-pagename AT '.' INTO lv_extra lv_ext.
REPLACE ALL OCCURRENCES OF '/' IN lv_ext WITH '_-'.
REPLACE ALL OCCURRENCES OF '/' IN lv_extra WITH '_-'.
mo_files->add_raw(
iv_extra = lv_extra
iv_ext = lv_ext
iv_data = lv_content ).
CLEAR: rs_page-attributes-implclass.
ENDIF.
CLEAR: rs_page-attributes-author,
rs_page-attributes-createdon,
rs_page-attributes-changedby,
rs_page-attributes-changedon,
rs_page-attributes-changetime,
rs_page-attributes-gendate,
rs_page-attributes-gentime,
rs_page-attributes-devclass.
ENDMETHOD.
METHOD to_page_content.
DATA: lv_string TYPE string.
lv_string = zcl_abapgit_convert=>xstring_to_string_utf8( iv_content ).
SPLIT lv_string AT zif_abapgit_definitions=>c_newline INTO TABLE rt_content.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
DATA: lv_name TYPE o2applname,
lt_pages TYPE STANDARD TABLE OF o2pagdir WITH DEFAULT KEY,
ls_latest LIKE LINE OF lt_pages.
lv_name = ms_item-obj_name.
SELECT * FROM o2pagdir INTO TABLE lt_pages WHERE applname = lv_name
ORDER BY changedon DESCENDING changetime DESCENDING.
IF sy-subrc <> 0.
rv_user = c_user_unknown.
RETURN.
ENDIF.
READ TABLE lt_pages INDEX 1 INTO ls_latest.
ASSERT sy-subrc = 0.
rv_user = ls_latest-changedby.
ENDMETHOD.
METHOD zif_abapgit_object~delete.
DATA: lv_name TYPE o2applname,
lo_bsp TYPE REF TO cl_o2_api_application,
ls_pagekey TYPE o2pagkey,
lv_object TYPE seu_objkey,
lt_pages TYPE o2pagelist,
lt_local_mimes TYPE o2pagename_table.
FIELD-SYMBOLS: <ls_page> LIKE LINE OF lt_pages,
<ls_local_mime> TYPE o2pagename.
lv_name = ms_item-obj_name.
cl_o2_api_application=>load(
EXPORTING
p_application_name = lv_name
IMPORTING
p_application = lo_bsp
EXCEPTIONS
object_not_existing = 1
permission_failure = 2
error_occured = 3 ).
ASSERT sy-subrc = 0.
lo_bsp->set_changeable(
p_changeable = abap_true
p_complete_application = abap_true ).
cl_o2_api_pages=>get_all_pages(
EXPORTING
p_applname = lv_name
p_version = c_active
IMPORTING
p_pages = lt_pages ).
LOOP AT lt_pages ASSIGNING <ls_page>.
CLEAR ls_pagekey.
ls_pagekey-applname = lv_name.
ls_pagekey-pagekey = <ls_page>-pagekey.
cl_o2_page=>delete_page_for_application(
EXPORTING
p_pagekey = ls_pagekey
EXCEPTIONS
object_not_existing = 1
error_occured = 2 ).
ASSERT sy-subrc = 0.
ENDLOOP.
lo_bsp->get_local_mimes(
IMPORTING
p_local_mimes = lt_local_mimes
EXCEPTIONS
object_invalid = 1
object_deleted = 2
error_occured = 3
OTHERS = 4 ).
LOOP AT lt_local_mimes ASSIGNING <ls_local_mime>.
CLEAR ls_pagekey.
ls_pagekey-applname = <ls_local_mime>-applname.
ls_pagekey-pagekey = <ls_local_mime>-pagekey.
cl_o2_page=>delete_page_for_application(
EXPORTING
p_pagekey = ls_pagekey
EXCEPTIONS
object_not_existing = 1
error_occured = 2 ).
ASSERT sy-subrc = 0.
ENDLOOP.
lo_bsp->delete(
EXCEPTIONS
object_not_empty = 1
object_not_changeable = 2
object_invalid = 3
action_cancelled = 4
permission_failure = 5
error_occured = 6
OTHERS = 7 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |WAPA - error from delete: { sy-subrc }| ).
ENDIF.
* release lock
lv_object = lv_name.
cl_o2_api_application=>call_access_permission(
p_mode = 'FREE'
p_object = lv_object
p_complete_application = abap_true ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
DATA: lo_bsp TYPE REF TO cl_o2_api_application,
ls_attributes TYPE o2applattr,
lt_nodes TYPE o2applnode_table,
lt_navgraph TYPE o2applgrap_table,
lv_obj_name TYPE string,
lv_extra TYPE string,
lv_ext TYPE string,
lo_page TYPE REF TO cl_o2_api_pages,
lt_pages_info TYPE ty_pages_tt,
ls_pagekey TYPE o2pagkey,
ls_local_page TYPE ty_page,
lt_remote_content TYPE o2pageline_table,
lt_local_content TYPE o2pageline_table,
lt_local_pages TYPE o2pagelist.
FIELD-SYMBOLS: <ls_remote_page> LIKE LINE OF lt_pages_info.
io_xml->read( EXPORTING iv_name = 'ATTRIBUTES'
CHANGING cg_data = ls_attributes ).
io_xml->read( EXPORTING iv_name = 'NAVGRAPH'
CHANGING cg_data = lt_navgraph ).
io_xml->read( EXPORTING iv_name = 'PAGES'
CHANGING cg_data = lt_pages_info ).
ls_attributes-devclass = iv_package.
cl_o2_api_application=>load(
EXPORTING
p_application_name = ls_attributes-applname " Application Name
IMPORTING
p_application = lo_bsp " Instance Created
EXCEPTIONS
object_not_existing = 1
permission_failure = 2
error_occured = 3
OTHERS = 4 ).
CASE sy-subrc.
WHEN 0.
cl_o2_api_pages=>get_all_pages(
EXPORTING
p_applname = ls_attributes-applname
p_version = c_active
IMPORTING
p_pages = lt_local_pages ).
WHEN 1.
lo_bsp = create_new_application( is_attributes = ls_attributes
it_nodes = lt_nodes
it_navgraph = lt_navgraph ).
WHEN OTHERS.
zcx_abapgit_exception=>raise( |Error { sy-subrc } from CL_O2_API_APPLICATION=>LOAD| ).
ENDCASE.
LOOP AT lt_pages_info ASSIGNING <ls_remote_page>.
ls_pagekey-applname = <ls_remote_page>-attributes-applname.
ls_pagekey-pagekey = <ls_remote_page>-attributes-pagekey.
cl_o2_api_pages=>load(
EXPORTING
p_pagekey = ls_pagekey
IMPORTING
p_page = lo_page
EXCEPTIONS
object_not_existing = 1
version_not_existing = 2
OTHERS = 3 ).
CASE sy-subrc.
WHEN 0.
ls_local_page = read_page( <ls_remote_page>-attributes ).
WHEN 1.
lo_page = create_new_page( <ls_remote_page>-attributes ).
WHEN 2.
" Do nothing...
WHEN OTHERS.
zcx_abapgit_exception=>raise( |Error { sy-subrc } from CL_O2_API_PAGES=>LOAD| ).
ENDCASE.
SPLIT <ls_remote_page>-attributes-pagename AT '.' INTO lv_extra lv_ext.
REPLACE ALL OCCURRENCES OF '/' IN lv_extra WITH '_-'.
REPLACE ALL OCCURRENCES OF '/' IN lv_ext WITH '_-'.
lt_remote_content = to_page_content( mo_files->read_raw( iv_extra = lv_extra
iv_ext = lv_ext ) ).
lt_local_content = to_page_content( get_page_content( lo_page ) ).
IF ls_local_page = <ls_remote_page> AND lt_local_content = lt_remote_content.
" no changes -> nothing to do
CONTINUE.
ENDIF.
IF <ls_remote_page>-attributes-pagetype <> so2_controller.
lo_page->set_page( lt_remote_content ).
lo_page->set_event_handlers( <ls_remote_page>-event_handlers ).
lo_page->set_parameters( <ls_remote_page>-parameters ).
lo_page->set_type_source( <ls_remote_page>-types ).
ENDIF.
lo_page->save( p_with_all_texts = abap_true ).
lv_obj_name = cl_wb_object_type=>get_concatenated_key_from_id(
p_key_component1 = <ls_remote_page>-attributes-applname
p_key_component2 = <ls_remote_page>-attributes-pagekey
p_external_id = 'WG ' ).
zcl_abapgit_objects_activation=>add( iv_type = 'WAPP'
iv_name = lv_obj_name ).
ENDLOOP.
delete_superfluous_pages( it_local_pages = lt_local_pages
it_remote_pages = lt_pages_info ).
zcl_abapgit_sotr_handler=>create_sotr(
iv_package = iv_package
io_xml = io_xml ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_name TYPE o2applname.
lv_name = ms_item-obj_name.
cl_o2_api_application=>load(
EXPORTING
p_application_name = lv_name
EXCEPTIONS
object_not_existing = 1
permission_failure = 2
error_occured = 3 ).
rv_bool = boolc( sy-subrc = 0 ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
" Covered by ZCL_ABAPGIT_OBJECTS=>JUMP
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: lv_name TYPE o2applname,
ls_attributes TYPE o2applattr,
lt_navgraph TYPE o2applgrap_table,
lt_pages TYPE o2pagelist,
lt_pages_info TYPE ty_pages_tt,
lo_bsp TYPE REF TO cl_o2_api_application.
FIELD-SYMBOLS: <ls_page> LIKE LINE OF lt_pages.
lv_name = ms_item-obj_name.
cl_o2_api_application=>load(
EXPORTING
p_application_name = lv_name
IMPORTING
p_application = lo_bsp
EXCEPTIONS
object_not_existing = 1
permission_failure = 2
error_occured = 3 ).
IF sy-subrc <> 0.
RETURN.
ENDIF.
lo_bsp->get_attributes(
EXPORTING
p_version = c_active
IMPORTING
p_attributes = ls_attributes ).
CLEAR: ls_attributes-author,
ls_attributes-createdon,
ls_attributes-changedby,
ls_attributes-changedon,
ls_attributes-devclass.
io_xml->add( iv_name = 'ATTRIBUTES'
ig_data = ls_attributes ).
lo_bsp->get_navgraph(
EXPORTING
p_version = c_active
IMPORTING
p_navgraph = lt_navgraph ).
io_xml->add( iv_name = 'NAVGRAPH'
ig_data = lt_navgraph ).
cl_o2_api_pages=>get_all_pages(
EXPORTING
p_applname = lv_name
p_version = c_active
IMPORTING
p_pages = lt_pages ).
LOOP AT lt_pages ASSIGNING <ls_page>.
APPEND read_page( <ls_page> ) TO lt_pages_info.
ENDLOOP.
io_xml->add( iv_name = 'PAGES'
ig_data = lt_pages_info ).
zcl_abapgit_sotr_handler=>read_sotr(
iv_pgmid = 'LIMU'
iv_object = 'WAPP'
iv_obj_name = ms_item-obj_name
io_xml = io_xml ).
ENDMETHOD.
ENDCLASS. | 27.32925 | 117 | 0.618066 | {
"alnum_ratio": 0.5712524517,
"alpha_token_ratio": 1.7173875876,
"avg_line_length": 27.3696319018,
"char_rep_ratio": 0.1348396501,
"max_line_length": 117,
"num_words": 1071,
"text_len": 17845,
"word_rep_ratio": 0.0225988701
} | 18,245,230,927,452,301,000 |
4a19cd7399942cf4cb109c97f6d0fede559d9086 | 8,810 | abap | ABAP | src/checks/zcl_aoc_scan.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_scan.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_scan.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | CLASS zcl_aoc_scan DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
CONSTANTS: BEGIN OF gc_token,
comment TYPE c LENGTH 1 VALUE 'C',
identifier TYPE c LENGTH 1 VALUE 'I',
list TYPE c LENGTH 1 VALUE 'L',
literal TYPE c LENGTH 1 VALUE 'S',
pragma TYPE c LENGTH 1 VALUE 'P',
END OF gc_token.
CONSTANTS: BEGIN OF gc_statement,
comment TYPE c LENGTH 1 VALUE 'P',
comment_in_stmnt TYPE c LENGTH 1 VALUE 'S',
compute_direct TYPE c LENGTH 1 VALUE 'C',
empty TYPE c LENGTH 1 VALUE 'N',
macro_call TYPE c LENGTH 1 VALUE 'D',
macro_definition TYPE c LENGTH 1 VALUE 'M',
method_direct TYPE c LENGTH 1 VALUE 'A',
native_sql TYPE c LENGTH 1 VALUE 'E',
pragma TYPE c LENGTH 1 VALUE 'G',
standard TYPE c LENGTH 1 VALUE 'K',
END OF gc_statement.
CONSTANTS: BEGIN OF gc_structure,
condition TYPE c LENGTH 1 VALUE 'C',
routine TYPE c LENGTH 1 VALUE 'R',
sequence TYPE c LENGTH 1 VALUE 'S',
END OF gc_structure.
CONSTANTS: BEGIN OF gc_structure_statement,
case TYPE c LENGTH 1 VALUE 'c',
catch TYPE c LENGTH 1 VALUE '+',
cleanup TYPE c LENGTH 1 VALUE '-',
do TYPE c LENGTH 1 VALUE 'D',
else TYPE c LENGTH 1 VALUE 'e',
elseif TYPE c LENGTH 1 VALUE 'f',
form TYPE c LENGTH 1 VALUE 'O',
function TYPE c LENGTH 1 VALUE 'U',
if TYPE c LENGTH 1 VALUE 'i',
loop TYPE c LENGTH 1 VALUE 'L',
method TYPE c LENGTH 1 VALUE 'H',
module TYPE c LENGTH 1 VALUE 'M',
select TYPE c LENGTH 1 VALUE 'S',
try TYPE c LENGTH 1 VALUE '_',
when TYPE c LENGTH 1 VALUE 'w',
while TYPE c LENGTH 1 VALUE 'W',
END OF gc_structure_statement.
CONSTANTS: BEGIN OF gc_level,
macro_define TYPE c LENGTH 1 VALUE 'D',
macro_trmac TYPE c LENGTH 1 VALUE 'R',
program TYPE c LENGTH 1 VALUE 'P',
END OF gc_level.
TYPES:
BEGIN OF ty_position,
row TYPE token_row,
col TYPE token_col,
END OF ty_position .
TYPES:
BEGIN OF ty_statement,
str TYPE string,
start TYPE ty_position,
end TYPE ty_position,
include TYPE programm,
level TYPE stmnt_levl,
count TYPE i,
terminator TYPE stmnt_term,
index TYPE i,
END OF ty_statement .
TYPES:
ty_statements TYPE STANDARD TABLE OF ty_statement WITH DEFAULT KEY .
TYPES:
ty_structures_tt TYPE STANDARD TABLE OF sstruc WITH NON-UNIQUE DEFAULT KEY .
DATA tokens TYPE stokesx_tab READ-ONLY .
DATA statements TYPE sstmnt_tab READ-ONLY .
DATA levels TYPE slevel_tab READ-ONLY .
DATA structures TYPE ty_structures_tt READ-ONLY .
CLASS-METHODS create_from_ref
IMPORTING
!io_ref TYPE REF TO object
RETURNING
VALUE(ro_scan) TYPE REF TO zcl_aoc_scan .
METHODS build_statements
IMPORTING
!iv_literals TYPE abap_bool DEFAULT abap_false
RETURNING
VALUE(rt_statements) TYPE ty_statements .
METHODS constructor
IMPORTING
!it_tokens TYPE stokesx_tab
!it_statements TYPE sstmnt_tab
!it_levels TYPE slevel_tab
!it_structures TYPE ty_structures_tt .
METHODS get_include
IMPORTING
!iv_level TYPE i
RETURNING
VALUE(rv_program) TYPE program .
METHODS statement_keyword
IMPORTING
!iv_number TYPE stmnt_nr
RETURNING
VALUE(rv_result) TYPE string .
METHODS statement_row
IMPORTING
!iv_number TYPE stmnt_nr
RETURNING
VALUE(rv_result) TYPE token_row .
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-METHODS token_position
IMPORTING
!is_token TYPE stokesx
RETURNING
VALUE(rs_position) TYPE ty_position .
ENDCLASS.
CLASS ZCL_AOC_SCAN IMPLEMENTATION.
METHOD build_statements.
DATA: lv_str TYPE string,
ls_start TYPE ty_position,
ls_end TYPE ty_position,
lt_tokens LIKE tokens,
lv_index TYPE i,
lv_count TYPE i.
FIELD-SYMBOLS: <ls_statement> LIKE LINE OF statements,
<ls_token> LIKE LINE OF tokens,
<ls_add> LIKE LINE OF rt_statements.
lt_tokens = tokens.
IF iv_literals = abap_true.
LOOP AT lt_tokens ASSIGNING <ls_token> WHERE type = gc_token-literal.
<ls_token>-str = 'STR'.
ENDLOOP.
ENDIF.
LOOP AT statements ASSIGNING <ls_statement>
WHERE type <> gc_statement-empty
AND type <> gc_statement-comment
AND type <> gc_statement-comment_in_stmnt
AND type <> gc_statement-pragma.
lv_index = sy-tabix.
CLEAR lv_str.
lv_count = 0.
LOOP AT lt_tokens ASSIGNING <ls_token>
FROM <ls_statement>-from TO <ls_statement>-to.
IF lv_str IS INITIAL.
lv_str = <ls_token>-str.
ls_start = token_position( <ls_token> ).
ELSE.
CONCATENATE lv_str <ls_token>-str INTO lv_str SEPARATED BY space.
ENDIF.
lv_count = lv_count + 1.
ls_end = token_position( <ls_token> ).
ENDLOOP.
IF sy-subrc = 0.
APPEND INITIAL LINE TO rt_statements ASSIGNING <ls_add>.
<ls_add>-str = lv_str.
<ls_add>-include = get_include( <ls_statement>-level ).
<ls_add>-level = <ls_statement>-level.
<ls_add>-start = ls_start.
<ls_add>-end = ls_end.
<ls_add>-count = lv_count.
<ls_add>-index = lv_index.
<ls_add>-terminator = <ls_statement>-terminator.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
tokens = it_tokens.
statements = it_statements.
levels = it_levels.
structures = it_structures.
ENDMETHOD.
METHOD create_from_ref.
FIELD-SYMBOLS: <lt_tokens> TYPE stokesx_tab,
<lt_statements> TYPE sstmnt_tab,
<lt_levels> TYPE slevel_tab,
<lt_structures> TYPE ty_structures_tt.
ASSIGN io_ref->('TOKENS') TO <lt_tokens>.
ASSERT sy-subrc = 0.
ASSIGN io_ref->('STATEMENTS') TO <lt_statements>.
ASSERT sy-subrc = 0.
ASSIGN io_ref->('LEVELS') TO <lt_levels>.
ASSERT sy-subrc = 0.
ASSIGN io_ref->('STRUCTURES') TO <lt_structures>.
ASSERT sy-subrc = 0.
CREATE OBJECT ro_scan
EXPORTING
it_tokens = <lt_tokens>
it_statements = <lt_statements>
it_levels = <lt_levels>
it_structures = <lt_structures>.
ENDMETHOD.
METHOD get_include.
DATA: lv_level TYPE i,
ls_level LIKE LINE OF levels.
CONSTANTS lc_program TYPE c LENGTH 1 VALUE 'P'.
IF iv_level = 0.
* in case INCLUDE doesnt exist in the system
RETURN.
ENDIF.
lv_level = iv_level.
DO.
READ TABLE levels INDEX lv_level INTO ls_level.
IF ls_level-type = lc_program.
rv_program = ls_level-name.
RETURN.
ENDIF.
lv_level = ls_level-level.
ENDDO.
ENDMETHOD.
METHOD statement_keyword.
FIELD-SYMBOLS: <ls_statement> LIKE LINE OF statements,
<ls_token> LIKE LINE OF tokens.
READ TABLE statements ASSIGNING <ls_statement> INDEX iv_number.
ASSERT sy-subrc = 0.
IF <ls_statement>-type = gc_statement-compute_direct.
rv_result = 'COMPUTE'.
RETURN.
ENDIF.
IF <ls_statement>-from <= <ls_statement>-to.
READ TABLE tokens ASSIGNING <ls_token> INDEX <ls_statement>-from.
ASSERT sy-subrc = 0.
rv_result = <ls_token>-str.
ENDIF.
ENDMETHOD.
METHOD statement_row.
FIELD-SYMBOLS: <ls_statement> LIKE LINE OF statements,
<ls_token> LIKE LINE OF tokens.
READ TABLE statements ASSIGNING <ls_statement> INDEX iv_number.
ASSERT sy-subrc = 0.
READ TABLE tokens ASSIGNING <ls_token> INDEX <ls_statement>-from.
ASSERT sy-subrc = 0.
rv_result = <ls_token>-row.
ENDMETHOD.
METHOD token_position.
rs_position-col = is_token-col.
rs_position-row = is_token-row.
ENDMETHOD.
ENDCLASS. | 28.79085 | 82 | 0.579909 | {
"alnum_ratio": 0.5544329663,
"alpha_token_ratio": 1.783105865,
"avg_line_length": 28.8819672131,
"char_rep_ratio": 0.2070454545,
"max_line_length": 82,
"num_words": 776,
"text_len": 8809,
"word_rep_ratio": 0.0338983051
} | 126,633,855,284,467,780 |
4a27bb10220973063b63e0110caa510c8d2a5d48 | 1,415 | abap | ABAP | src/zcl_excel_converter_result.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 251 | 2019-02-23T03:36:38.000Z | 2021-12-10T21:39:23.000Z | src/zcl_excel_converter_result.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 278 | 2019-02-17T10:42:59.000Z | 2021-12-10T20:24:56.000Z | src/zcl_excel_converter_result.clas.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 130 | 2019-02-20T13:25:30.000Z | 2021-12-09T03:20:31.000Z | CLASS zcl_excel_converter_result DEFINITION
PUBLIC
INHERITING FROM zcl_excel_converter_alv
ABSTRACT
CREATE PUBLIC .
*"* public components of class ZCL_EXCEL_CONVERTER_RESULT
*"* do not include other source files here!!!
PUBLIC SECTION.
*"* protected components of class ZCL_EXCEL_CONVERTER_RESULT
*"* do not include other source files here!!!
PROTECTED SECTION.
METHODS get_table
IMPORTING
!io_object TYPE REF TO object
RETURNING
VALUE(ro_data) TYPE REF TO data .
*"* private components of class ZCL_EXCEL_CONVERTER_RESULT
*"* do not include other source files here!!!
*"* private components of class ZCL_EXCEL_CONVERTER_RESULT
*"* do not include other source files here!!!
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_excel_converter_result IMPLEMENTATION.
METHOD get_table.
DATA: lo_object TYPE REF TO object,
ls_seoclass TYPE seoclass,
l_method TYPE string.
SELECT SINGLE * INTO ls_seoclass
FROM seoclass
WHERE clsname = 'IF_SALV_BS_DATA_SOURCE'.
IF sy-subrc = 0.
l_method = 'GET_TABLE_REF'.
lo_object ?= io_object.
CALL METHOD lo_object->(l_method)
RECEIVING
value = ro_data.
ELSE.
l_method = 'GET_REF_TO_TABLE'.
lo_object ?= io_object.
CALL METHOD lo_object->(l_method)
RECEIVING
value = ro_data.
ENDIF.
ENDMETHOD.
ENDCLASS. | 25.267857 | 60 | 0.693993 | {
"alnum_ratio": 0.6591230552,
"alpha_token_ratio": 1.9935760171,
"avg_line_length": 25.7090909091,
"char_rep_ratio": 0.0861209964,
"max_line_length": 60,
"num_words": 131,
"text_len": 1414,
"word_rep_ratio": 0.0983606557
} | 12,347,987,837,811,845,000 |
4a419a04dc0ebec0602527ffa34fff5aa8ba4395 | 3,163 | abap | ABAP | src/checks/zcl_aoc_check_23.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_23.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_23.clas.testclasses.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | *----------------------------------------------------------------------*
* CLASS lcl_Test DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test DEFINITION FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS
FINAL.
PRIVATE SECTION.
* ================
DATA: mt_code TYPE string_table,
ms_result TYPE scirest_ad,
mo_check TYPE REF TO zcl_aoc_check_23.
METHODS:
setup,
export_import FOR TESTING,
test001_01 FOR TESTING,
test001_02 FOR TESTING,
test001_03 FOR TESTING,
test002_01 FOR TESTING,
test002_02 FOR TESTING,
test003_01 FOR TESTING.
ENDCLASS. "lcl_Test
*----------------------------------------------------------------------*
* CLASS lcl_Test IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS ltcl_test IMPLEMENTATION.
* ==============================
DEFINE _code.
APPEND &1 TO mt_code.
END-OF-DEFINITION.
METHOD setup.
CREATE OBJECT mo_check.
zcl_aoc_unit_test=>set_check( mo_check ).
ENDMETHOD. "setup
METHOD export_import.
zcl_aoc_unit_test=>export_import( mo_check ).
ENDMETHOD.
METHOD test001_01.
* ===========
_code 'IF: 1 = 2. '.
_code ' WRITE ''foo''.'.
_code 'ENDIF. '.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD. "test1
METHOD test001_02.
* ===========
_code 'DATA: lv_char TYPE c LENGTH 10.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD. "test001_02
METHOD test001_03.
* ===========
_code 'CATCH: cx_root.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '001'
act = ms_result-code ).
ENDMETHOD. "test1
METHOD test002_01.
* ===========
_code 'DATA : lv_char TYPE c LENGTH 10.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '002'
act = ms_result-code ).
ENDMETHOD. "test002_01
METHOD test002_02.
* ===========
_code 'DATA:'.
_code ' lv_sel_rep_langu TYPE sylangu,'.
_code ' ls_t002 TYPE t002.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_initial( ms_result ).
ENDMETHOD. "test002_02
METHOD test003_01.
* ===========
_code ' TYPE c LENGTH 10.'.
ms_result = zcl_aoc_unit_test=>check( mt_code ).
cl_abap_unit_assert=>assert_equals( exp = '003'
act = ms_result-code ).
ENDMETHOD. "test003_01
ENDCLASS. "lcl_Test | 25.103175 | 72 | 0.487828 | {
"alnum_ratio": 0.4476190476,
"alpha_token_ratio": 1.398277718,
"avg_line_length": 25.2,
"char_rep_ratio": 0.282394142,
"max_line_length": 72,
"num_words": 179,
"text_len": 3150,
"word_rep_ratio": 0.2647058824
} | 11,272,229,824,515,946,000 |
4a54ea6a6416d1ed2437ac999477be8976489e5b | 2,749 | abap | ABAP | src/checks/zcl_aoc_check_35.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 199 | 2015-02-17T07:08:01.000Z | 2022-03-23T09:50:05.000Z | src/checks/zcl_aoc_check_35.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 769 | 2015-01-03T07:09:11.000Z | 2022-03-21T11:59:53.000Z | src/checks/zcl_aoc_check_35.clas.abap | DennstedtB/abapOpenChecks | 551dad876ce09d6b7cca32dd166827f1cdbf33e5 | [
"MIT"
] | 109 | 2015-03-09T10:22:34.000Z | 2022-03-08T08:47:41.000Z | CLASS zcl_aoc_check_35 DEFINITION
PUBLIC
INHERITING FROM zcl_aoc_super_root
CREATE PUBLIC .
PUBLIC SECTION.
METHODS constructor .
METHODS run
REDEFINITION .
PROTECTED SECTION.
PRIVATE SECTION.
TYPES:
ty_t100_tt TYPE STANDARD TABLE OF t100 WITH DEFAULT KEY.
METHODS analyze
IMPORTING
!it_t100 TYPE ty_t100_tt
RETURNING
VALUE(rv_code) TYPE sci_errc.
ENDCLASS.
CLASS ZCL_AOC_CHECK_35 IMPLEMENTATION.
METHOD analyze.
TYPES: BEGIN OF ty_cross,
name TYPE cross-name,
END OF ty_cross.
DATA: lt_cross TYPE TABLE OF ty_cross,
lt_name TYPE TABLE OF cross-name,
lv_name LIKE LINE OF lt_name.
FIELD-SYMBOLS: <ls_t100> LIKE LINE OF it_t100.
LOOP AT it_t100 ASSIGNING <ls_t100>.
CONCATENATE <ls_t100>-arbgb <ls_t100>-msgnr INTO lv_name RESPECTING BLANKS.
APPEND lv_name TO lt_name.
ENDLOOP.
ASSERT lines( lt_name ) > 0.
SELECT name FROM cross INTO TABLE lt_cross
FOR ALL ENTRIES IN lt_name
WHERE ( type = '3' OR type = 'N' )
AND name = lt_name-table_line. "#EC CI_SUBRC
SORT lt_cross BY name ASCENDING.
LOOP AT it_t100 ASSIGNING <ls_t100>.
CONCATENATE <ls_t100>-arbgb <ls_t100>-msgnr
INTO lv_name RESPECTING BLANKS.
READ TABLE lt_cross WITH KEY name = lv_name
BINARY SEARCH TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
SELECT COUNT( * ) FROM dd08l
WHERE arbgb = <ls_t100>-arbgb
AND msgnr = <ls_t100>-msgnr ##WARN_OK.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
rv_code = '001'.
inform( p_sub_obj_type = object_type
p_sub_obj_name = object_name
p_test = myname
p_kind = mv_errty
p_code = rv_code
p_param_1 = <ls_t100>-msgnr ).
ENDLOOP.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
version = '001'.
position = '035'.
has_documentation = abap_true.
has_attributes = abap_true.
attributes_ok = abap_true.
add_obj_type( 'MSAG' ).
insert_scimessage(
iv_code = '001'
iv_text = 'Message not in use, &1'(m01) ).
ENDMETHOD.
METHOD run.
* abapOpenChecks
*
* MIT License
DATA: lt_t100 TYPE ty_t100_tt.
IF object_type <> 'MSAG'.
RETURN.
ENDIF.
SELECT * FROM t100 INTO TABLE lt_t100
WHERE sprsl = sy-langu
AND arbgb = object_name. "#EC CI_GENBUFF
IF sy-subrc <> 0.
RETURN.
ENDIF.
analyze( lt_t100 ).
ENDMETHOD.
ENDCLASS. | 21.476563 | 81 | 0.603856 | {
"alnum_ratio": 0.5690546529,
"alpha_token_ratio": 1.5178197065,
"avg_line_length": 21.3228346457,
"char_rep_ratio": 0.0878103001,
"max_line_length": 81,
"num_words": 242,
"text_len": 2708,
"word_rep_ratio": 0.025751073
} | 4,180,579,857,963,626,000 |
4a573259463703a3e27fded508bd343b4d18c6b7 | 8,941 | abap | ABAP | src/demos/zdemo_excel35.prog.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 251 | 2019-02-23T03:36:38.000Z | 2021-12-10T21:39:23.000Z | src/demos/zdemo_excel35.prog.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 278 | 2019-02-17T10:42:59.000Z | 2021-12-10T20:24:56.000Z | src/demos/zdemo_excel35.prog.abap | chrisaasan/abap2xlsx | cb315c557225928baacbbcfd42087c3a8ed34a12 | [
"Apache-2.0"
] | 130 | 2019-02-20T13:25:30.000Z | 2021-12-09T03:20:31.000Z | *&---------------------------------------------------------------------*
*& Report ZDEMO_EXCEL2
*& Test Styles for ABAP2XLSX
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zdemo_excel35.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_excel_writer TYPE REF TO zif_excel_writer,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
lo_style_bold TYPE REF TO zcl_excel_style,
lo_style_underline TYPE REF TO zcl_excel_style,
lo_style_filled TYPE REF TO zcl_excel_style,
lo_style_border TYPE REF TO zcl_excel_style,
lo_style_button TYPE REF TO zcl_excel_style,
lo_border_dark TYPE REF TO zcl_excel_style_border,
lo_border_light TYPE REF TO zcl_excel_style_border.
DATA: lv_style_bold_guid TYPE zexcel_cell_style,
lv_style_underline_guid TYPE zexcel_cell_style,
lv_style_filled_guid TYPE zexcel_cell_style,
lv_style_filled_green_guid TYPE zexcel_cell_style,
lv_style_border_guid TYPE zexcel_cell_style,
lv_style_button_guid TYPE zexcel_cell_style,
lv_style_filled_turquoise_guid TYPE zexcel_cell_style.
DATA: lv_file TYPE xstring,
lv_bytecount TYPE i,
lt_file_tab TYPE solix_tab.
DATA: lv_full_path TYPE string,
lv_workdir TYPE string,
lv_file_separator TYPE c.
CONSTANTS: lv_default_file_name TYPE string VALUE '35_Static_Styles.xlsx'.
PARAMETERS: p_path TYPE zexcel_export_dir.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
lv_workdir = p_path.
cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir
CHANGING selected_folder = lv_workdir ).
p_path = lv_workdir.
INITIALIZATION.
cl_gui_frontend_services=>get_desktop_directory( CHANGING desktop_directory = lv_workdir ).
cl_gui_cfw=>flush( ).
p_path = lv_workdir.
START-OF-SELECTION.
IF p_path IS INITIAL.
p_path = lv_workdir.
ENDIF.
cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ).
CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path.
" Creates active sheet
CREATE OBJECT lo_excel.
" Create border object
CREATE OBJECT lo_border_dark.
lo_border_dark->border_color-rgb = zcl_excel_style_color=>c_black.
lo_border_dark->border_style = zcl_excel_style_border=>c_border_thin.
CREATE OBJECT lo_border_light.
lo_border_light->border_color-rgb = zcl_excel_style_color=>c_gray.
lo_border_light->border_style = zcl_excel_style_border=>c_border_thin.
" Create a bold / italic style
lo_style_bold = lo_excel->add_new_style( ).
lo_style_bold->font->bold = abap_true.
lo_style_bold->font->italic = abap_true.
lo_style_bold->font->name = zcl_excel_style_font=>c_name_arial.
lo_style_bold->font->scheme = zcl_excel_style_font=>c_scheme_none.
lo_style_bold->font->color-rgb = zcl_excel_style_color=>c_red.
lv_style_bold_guid = lo_style_bold->get_guid( ).
" Create an underline double style
lo_style_underline = lo_excel->add_new_style( ).
lo_style_underline->font->underline = abap_true.
lo_style_underline->font->underline_mode = zcl_excel_style_font=>c_underline_double.
lo_style_underline->font->name = zcl_excel_style_font=>c_name_roman.
lo_style_underline->font->scheme = zcl_excel_style_font=>c_scheme_none.
lo_style_underline->font->family = zcl_excel_style_font=>c_family_roman.
lv_style_underline_guid = lo_style_underline->get_guid( ).
" Create filled style yellow
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_filled->fill->fgcolor-theme = zcl_excel_style_color=>c_theme_accent6.
lv_style_filled_guid = lo_style_filled->get_guid( ).
" Create border with button effects
lo_style_button = lo_excel->add_new_style( ).
lo_style_button->borders->right = lo_border_dark.
lo_style_button->borders->down = lo_border_dark.
lo_style_button->borders->left = lo_border_light.
lo_style_button->borders->top = lo_border_light.
lv_style_button_guid = lo_style_button->get_guid( ).
"Create style with border
lo_style_border = lo_excel->add_new_style( ).
lo_style_border->borders->allborders = lo_border_dark.
lo_style_border->borders->diagonal = lo_border_dark.
lo_style_border->borders->diagonal_mode = zcl_excel_style_borders=>c_diagonal_both.
lv_style_border_guid = lo_style_border->get_guid( ).
" Create filled style green
lo_style_filled = lo_excel->add_new_style( ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_filled->fill->fgcolor-rgb = zcl_excel_style_color=>c_green.
lo_style_filled->font->name = zcl_excel_style_font=>c_name_cambria.
lo_style_filled->font->scheme = zcl_excel_style_font=>c_scheme_major.
lv_style_filled_green_guid = lo_style_filled->get_guid( ).
" Create filled style turquoise using legacy excel ver <= 2003 palette. ()
lo_style_filled = lo_excel->add_new_style( ).
lo_excel->legacy_palette->set_color( "replace built-in color from palette with out custom RGB turquoise
ip_index = 16
ip_color = '0040E0D0' ).
lo_style_filled->fill->filltype = zcl_excel_style_fill=>c_fill_solid.
lo_style_filled->fill->fgcolor-indexed = 16.
lv_style_filled_turquoise_guid = lo_style_filled->get_guid( ).
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( ip_title = 'Styles' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 2 ip_value = 'Hello world' ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 3 ip_value = 'Bold text' ip_style = lv_style_bold_guid ).
lo_worksheet->set_cell( ip_column = 'D' ip_row = 4 ip_value = 'Underlined text' ip_style = lv_style_underline_guid ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 5 ip_value = 'Filled text' ip_style = lv_style_filled_guid ).
lo_worksheet->set_cell( ip_column = 'C' ip_row = 6 ip_value = 'Borders' ip_style = lv_style_border_guid ).
lo_worksheet->set_cell( ip_column = 'D' ip_row = 7 ip_value = 'I''m not a button :)' ip_style = lv_style_button_guid ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 9 ip_value = 'Modified color for Excel 2003' ip_style = lv_style_filled_turquoise_guid ).
" Fill the cell and apply one style
lo_worksheet->set_cell( ip_column = 'B' ip_row = 6 ip_value = 'Filled text' ip_style = lv_style_filled_guid ).
" Change the style
lo_worksheet->set_cell_style( ip_column = 'B' ip_row = 6 ip_style = lv_style_filled_green_guid ).
" Add Style to an empty cell to test Fix for Issue
"#44 Exception ZCX_EXCEL thrown when style is set for an empty cell
"
lo_worksheet->set_cell_style( ip_column = 'E' ip_row = 6 ip_style = lv_style_filled_green_guid ).
* Demonstrate how to retroactivly change the cellstyle
*Filled text and underlinded text
lo_worksheet->change_cell_style( ip_column = 'B'
ip_row = 5
ip_font_bold = abap_true
ip_font_italic = abap_true ).
lo_worksheet->change_cell_style( ip_column = 'D'
ip_row = 4
ip_font_bold = abap_true
ip_font_italic = abap_true ).
CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007.
lv_file = lo_excel_writer->write_file( lo_excel ).
" Convert to binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_file
IMPORTING
output_length = lv_bytecount
TABLES
binary_tab = lt_file_tab.
* " This method is only available on AS ABAP > 6.40
* lt_file_tab = cl_bcs_convert=>xstring_to_solix( iv_xstring = lv_file ).
* lv_bytecount = xstrlen( lv_file ).
" Save the file
cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount
filename = lv_full_path
filetype = 'BIN'
CHANGING data_tab = lt_file_tab ). | 51.091429 | 140 | 0.664355 | {
"alnum_ratio": 0.5980850336,
"alpha_token_ratio": 1.7648456057,
"avg_line_length": 50.4195402299,
"char_rep_ratio": 0.2082382474,
"max_line_length": 140,
"num_words": 509,
"text_len": 8773,
"word_rep_ratio": 0
} | 8,932,685,115,824,364,000 |
4a73b40de50800e7852186e4059bdc8f3598943e | 9,904 | abap | ABAP | src/objects/zcl_abapgit_object_suso.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 797 | 2015-02-06T15:38:41.000Z | 2020-09-23T02:57:02.000Z | src/objects/zcl_abapgit_object_suso.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 2,776 | 2015-01-13T03:59:55.000Z | 2020-09-23T21:46:34.000Z | src/objects/zcl_abapgit_object_suso.clas.abap | IvxLars/abapGit | bcdeebb3ad1432034b5ad1ea40683470956b8e07 | [
"MIT"
] | 499 | 2015-01-13T03:41:36.000Z | 2020-09-22T11:50:54.000Z | CLASS zcl_abapgit_object_suso DEFINITION PUBLIC INHERITING FROM zcl_abapgit_objects_super FINAL.
PUBLIC SECTION.
INTERFACES zif_abapgit_object.
ALIASES mo_files FOR zif_abapgit_object~mo_files.
METHODS:
constructor
IMPORTING
is_item TYPE zif_abapgit_definitions=>ty_item
iv_language TYPE spras.
PROTECTED SECTION.
PRIVATE SECTION.
DATA:
mv_objectname TYPE tobj-objct.
METHODS:
delete_documentation
RAISING
zcx_abapgit_exception,
pre_check
RAISING
zcx_abapgit_exception,
regenerate_sap_all.
ENDCLASS.
CLASS zcl_abapgit_object_suso IMPLEMENTATION.
METHOD constructor.
super->constructor( is_item = is_item
iv_language = iv_language ).
mv_objectname = ms_item-obj_name.
ENDMETHOD.
METHOD delete_documentation.
DATA:
lv_docu_obj TYPE dokhl-object,
lv_dummy TYPE sy-langu.
lv_docu_obj = mv_objectname.
SELECT SINGLE langu
FROM dokil INTO lv_dummy
WHERE id = 'UO' "#EC CI_GENBUFF
AND object = lv_docu_obj.
IF sy-subrc = 0.
CALL FUNCTION 'DOKU_DELETE_ALL'
EXPORTING
doku_id = 'UO'
doku_object = lv_docu_obj
suppress_transport = space
EXCEPTIONS
header_without_text = 1
index_without_header = 2
no_authority_for_devclass_xxxx = 3
no_docu_found = 4
object_is_already_enqueued = 5
object_is_enqueued_by_corr = 6
techn_enqueue_problem = 7
user_break = 8
OTHERS = 9.
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD pre_check.
CONSTANTS:
lc_act_delete TYPE activ_auth VALUE '06'.
DATA:
lv_act_head TYPE activ_auth,
lv_dummy TYPE string,
lo_suso TYPE REF TO object,
lv_failed TYPE abap_bool,
lv_suso_collect_in_cts TYPE i,
ls_clskey TYPE seoclskey.
" Downport: CL_SUSO_GEN doesn't exist in 702
ls_clskey-clsname = |CL_SUSO_GEN|.
CALL FUNCTION 'SEO_CLASS_EXISTENCE_CHECK'
EXPORTING
clskey = ls_clskey
EXCEPTIONS
not_specified = 1
not_existing = 2
is_interface = 3
no_text = 4
inconsistent = 5
OTHERS = 6.
IF sy-subrc = 0.
" so these check are not executed in 702
CREATE OBJECT lo_suso
TYPE
('CL_SUSO_GEN').
CALL METHOD lo_suso->('SUSO_LOAD_FROM_DB')
EXPORTING
id_object = mv_objectname
RECEIVING
ed_failed = lv_failed.
IF lv_failed = abap_true.
" Object & does not exist; choose an existing object
MESSAGE s111(01) WITH mv_objectname INTO lv_dummy.
zcx_abapgit_exception=>raise_t100( ).
ENDIF.
CALL METHOD lo_suso->('GET_SUSO_EDIT_MODE')
EXPORTING
id_object = mv_objectname
id_planed_act = lc_act_delete
IMPORTING
ed_mode_head = lv_act_head.
IF lv_act_head <> lc_act_delete.
zcx_abapgit_exception=>raise( |SUSO { mv_objectname }: Delete not allowed. Check where-used in SU21| ).
ENDIF.
CALL METHOD lo_suso->('SUSO_COLLECT_IN_CTS')
EXPORTING
id_object = mv_objectname
RECEIVING
ed_result = lv_suso_collect_in_cts.
IF lv_suso_collect_in_cts IS NOT INITIAL.
zcx_abapgit_exception=>raise( |SUSO { mv_objectname }: Cannot delete| ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD regenerate_sap_all.
DATA: ls_e071 TYPE e071,
lt_e071 TYPE STANDARD TABLE OF e071,
lt_e071k TYPE STANDARD TABLE OF e071k.
ls_e071-pgmid = 'R3TR'.
ls_e071-object = ms_item-obj_type.
ls_e071-obj_name = ms_item-obj_name.
INSERT ls_e071 INTO TABLE lt_e071.
CALL FUNCTION 'PRGN_AFTER_IMP_SUSO_SAP_ALL'
EXPORTING
iv_tarclient = '000'
iv_is_upgrade = space
TABLES
tt_e071 = lt_e071
tt_e071k = lt_e071k.
ENDMETHOD.
METHOD zif_abapgit_object~changed_by.
rv_user = c_user_unknown. " todo
ENDMETHOD.
METHOD zif_abapgit_object~delete.
" FM SUSR_DELETE_OBJECT calls the UI. Therefore we reimplement it here.
" As the class CL_SUSO_GEN isn't present in 702, we call dynamically and
" skip the pre checks on 702 system. That seems ok.
pre_check( ).
delete_documentation( ).
DELETE FROM tobj WHERE objct = mv_objectname.
DELETE FROM tobjt WHERE object = mv_objectname.
DELETE FROM tactz WHERE brobj = mv_objectname.
CALL FUNCTION 'SUPV_DELETE_OBJECT_ASSIGNMENTS'
EXPORTING
object_name = mv_objectname
all_releases = abap_true.
CALL FUNCTION 'RS_TREE_OBJECT_PLACEMENT'
EXPORTING
object = mv_objectname
type = 'SUSO'
operation = 'DELETE'.
regenerate_sap_all( ).
ENDMETHOD.
METHOD zif_abapgit_object~deserialize.
* see function group SUSA
DATA: lv_objectname TYPE trobj_name,
ls_tobj TYPE tobj,
ls_tobjt TYPE tobjt,
ls_tobjvorflg TYPE tobjvorflg,
lt_tactz TYPE TABLE OF tactz,
lt_tobjvordat TYPE TABLE OF tobjvordat,
lt_tobjvor TYPE TABLE OF tobjvor.
ASSERT NOT ms_item-obj_name IS INITIAL.
io_xml->read( EXPORTING iv_name = 'TOBJ'
CHANGING cg_data = ls_tobj ).
ls_tobj-bname = sy-uname.
io_xml->read( EXPORTING iv_name = 'TOBJT'
CHANGING cg_data = ls_tobjt ).
io_xml->read( EXPORTING iv_name = 'TOBJVORFLG'
CHANGING cg_data = ls_tobjvorflg ).
io_xml->read( EXPORTING iv_name = 'TACTZ'
CHANGING cg_data = lt_tactz ).
io_xml->read( EXPORTING iv_name = 'TOBJVORDAT'
CHANGING cg_data = lt_tobjvordat ).
io_xml->read( EXPORTING iv_name = 'TOBJVOR'
CHANGING cg_data = lt_tobjvor ).
tadir_insert( iv_package ).
lv_objectname = mv_objectname.
CALL FUNCTION 'SUSR_COMMEDITCHECK'
EXPORTING
objectname = lv_objectname
transobjecttype = 'O'.
MODIFY tobj FROM ls_tobj. "#EC CI_SUBRC
MODIFY tobjt FROM ls_tobjt. "#EC CI_SUBRC
MODIFY tobjvorflg FROM ls_tobjvorflg. "#EC CI_SUBRC
DELETE FROM tactz WHERE brobj = ms_item-obj_name. "#EC CI_SUBRC
INSERT tactz FROM TABLE lt_tactz. "#EC CI_SUBRC
DELETE FROM tobjvordat WHERE objct = ms_item-obj_name. "#EC CI_SUBRC
INSERT tobjvordat FROM TABLE lt_tobjvordat. "#EC CI_SUBRC
DELETE FROM tobjvor WHERE objct = ms_item-obj_name. "#EC CI_SUBRC
INSERT tobjvor FROM TABLE lt_tobjvor. "#EC CI_SUBRC
regenerate_sap_all( ).
ENDMETHOD.
METHOD zif_abapgit_object~exists.
DATA: lv_objct TYPE tobj-objct.
SELECT SINGLE objct FROM tobj INTO lv_objct
WHERE objct = ms_item-obj_name.
rv_bool = boolc( sy-subrc = 0 ).
ENDMETHOD.
METHOD zif_abapgit_object~get_comparator.
RETURN.
ENDMETHOD.
METHOD zif_abapgit_object~get_deserialize_steps.
APPEND zif_abapgit_object=>gc_step_id-abap TO rt_steps.
ENDMETHOD.
METHOD zif_abapgit_object~get_metadata.
rs_metadata = get_metadata( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_active.
rv_active = is_active( ).
ENDMETHOD.
METHOD zif_abapgit_object~is_locked.
rv_is_locked = abap_false.
ENDMETHOD.
METHOD zif_abapgit_object~jump.
CALL FUNCTION 'SUSR_SHOW_OBJECT'
EXPORTING
object = mv_objectname.
rv_exit = abap_true.
ENDMETHOD.
METHOD zif_abapgit_object~serialize.
DATA: ls_tobj TYPE tobj,
ls_tobjt TYPE tobjt,
ls_tobjvorflg TYPE tobjvorflg,
lt_tactz TYPE TABLE OF tactz,
lt_tobjvordat TYPE TABLE OF tobjvordat,
lt_tobjvor TYPE TABLE OF tobjvor.
SELECT SINGLE * FROM tobj INTO ls_tobj
WHERE objct = ms_item-obj_name.
IF sy-subrc <> 0.
RETURN.
ENDIF.
CLEAR ls_tobj-bname.
SELECT SINGLE * FROM tobjt INTO ls_tobjt
WHERE object = ms_item-obj_name
AND langu = mv_language. "#EC CI_GENBUFF
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( 'TOBJT no english description'
&& ' for object (' && ms_item-obj_name && ')' ).
ENDIF.
SELECT SINGLE * FROM tobjvorflg INTO ls_tobjvorflg
WHERE objct = ms_item-obj_name. "#EC CI_SUBRC
SELECT * FROM tactz INTO TABLE lt_tactz
WHERE brobj = ms_item-obj_name
ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF
SELECT * FROM tobjvordat INTO TABLE lt_tobjvordat
WHERE objct = ms_item-obj_name
ORDER BY PRIMARY KEY. "#EC CI_SUBRC "#EC CI_GENBUFF
SELECT * FROM tobjvor INTO TABLE lt_tobjvor
WHERE objct = ms_item-obj_name
ORDER BY PRIMARY KEY. "#EC CI_SUBRC
io_xml->add( iv_name = 'TOBJ'
ig_data = ls_tobj ).
io_xml->add( iv_name = 'TOBJT'
ig_data = ls_tobjt ).
io_xml->add( iv_name = 'TOBJVORFLG'
ig_data = ls_tobjvorflg ).
io_xml->add( ig_data = lt_tactz
iv_name = 'TACTZ' ).
io_xml->add( ig_data = lt_tobjvordat
iv_name = 'TOBJVORDAT' ).
io_xml->add( ig_data = lt_tobjvor
iv_name = 'TOBJVOR' ).
ENDMETHOD.
ENDCLASS. | 26.552279 | 111 | 0.612177 | {
"alnum_ratio": 0.5727557306,
"alpha_token_ratio": 1.6392237577,
"avg_line_length": 26.6209677419,
"char_rep_ratio": 0.1485748939,
"max_line_length": 111,
"num_words": 742,
"text_len": 9903,
"word_rep_ratio": 0.0463847203
} | 6,763,286,813,413,933,000 |