<commit_before>CLASS zcl_abapgit_object_char DEFINITION
  PUBLIC
  INHERITING FROM zcl_abapgit_objects_super
  FINAL
  CREATE PUBLIC .

  PUBLIC SECTION.

    INTERFACES zif_abapgit_object .

  PRIVATE SECTION.

    TYPES:
      BEGIN OF ty_char,
        cls_attribute   TYPE cls_attribute,
        cls_attributet  TYPE STANDARD TABLE OF cls_attributet WITH DEFAULT KEY,
        cls_attr_value  TYPE STANDARD TABLE OF cls_attr_value WITH DEFAULT KEY,
        cls_attr_valuet TYPE STANDARD TABLE OF cls_attr_valuet WITH DEFAULT KEY,
      END OF ty_char .

    METHODS instantiate_char
      IMPORTING
        !iv_type_group TYPE cls_object_type_group
      RETURNING
        VALUE(ro_char) TYPE REF TO cl_cls_attribute
      RAISING
        zcx_abapgit_exception .
ENDCLASS.



CLASS ZCL_ABAPGIT_OBJECT_CHAR IMPLEMENTATION.


  METHOD instantiate_char.

    DATA: lv_new  TYPE abap_bool,
          lv_name TYPE cls_attribute_name.


    SELECT SINGLE name FROM cls_attribute INTO lv_name WHERE name = ms_item-obj_name.
    lv_new = boolc( sy-subrc <> 0 ).
    lv_name = ms_item-obj_name.

    TRY.
        CREATE OBJECT ro_char
          EXPORTING
            im_name       = lv_name
            im_type_group = iv_type_group
            im_new        = lv_new.
      CATCH cx_pak_invalid_data
          cx_pak_not_authorized
          cx_pak_invalid_state
          cx_pak_wb_object_locked.
        zcx_abapgit_exception=>raise( 'Error while instantiating CL_CLS_ATTRIBUTE' ).
    ENDTRY.

    IF lv_new = abap_false.
      TRY.
          ro_char->if_pak_wb_object~lock_and_refresh( ).
        CATCH cx_pak_wb_object_locked.
          zcx_abapgit_exception=>raise( |Could not aquire lock, CHAR { lv_name }| ).
      ENDTRY.
    ENDIF.

  ENDMETHOD.


  METHOD zif_abapgit_object~changed_by.

    SELECT SINGLE changed_by FROM cls_attribute INTO rv_user
      WHERE name = ms_item-obj_name
      AND activation_state = 'A'.

    IF rv_user IS INITIAL.
      SELECT SINGLE created_by FROM cls_attribute INTO rv_user
        WHERE name = ms_item-obj_name
        AND activation_state = 'A'.
    ENDIF.

    IF rv_user IS INITIAL.
      rv_user = c_user_unknown.
    ENDIF.

  ENDMETHOD.


  METHOD zif_abapgit_object~compare_to_remote_version.
    CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null.
  ENDMETHOD.


  METHOD zif_abapgit_object~delete.

    DATA: lo_char       TYPE REF TO cl_cls_attribute,
          lv_type_group TYPE cls_attribute-type_group.


    SELECT SINGLE type_group FROM cls_attribute INTO lv_type_group
      WHERE name = ms_item-obj_name
      AND activation_state = 'A'.

    lo_char = instantiate_char( lv_type_group ).

    lo_char->if_pak_wb_object~delete( ).

    lo_char->if_pak_wb_object~save( ).

    lo_char->if_pak_wb_object_internal~unlock( ).

  ENDMETHOD.


  METHOD zif_abapgit_object~deserialize.

    DATA: ls_char        TYPE ty_char,
          lv_request     TYPE trkorr,
          ls_description LIKE LINE OF ls_char-cls_attributet,
          lo_char        TYPE REF TO cl_cls_attribute.


    io_xml->read( EXPORTING iv_name = 'CHAR'
                  CHANGING cg_data = ls_char ).

    tadir_insert( iv_package ).

    lo_char = instantiate_char( ls_char-cls_attribute-type_group ).

    lo_char->if_cls_attribute~set_kind( ls_char-cls_attribute-kind ).
    lo_char->if_cls_attribute~set_single_valued( ls_char-cls_attribute-is_single_valued ).
    lo_char->if_cls_attribute~set_aspect(
      im_aspect_for   = ls_char-cls_attribute-is_aspect_for
      im_aspect_value = ls_char-cls_attribute-aspect_value ).
    lo_char->if_cls_attribute~set_default_flag( ls_char-cls_attribute-default_flag ).
    lo_char->if_cls_attribute~set_default_value( ls_char-cls_attribute-default_value ).
    lo_char->if_cls_attribute~set_sub_object_treatment( ls_char-cls_attribute-sub_obj_treatm ).
    lo_char->if_cls_attribute~set_automatic_changes_allowed( ls_char-cls_attribute-automatic_change ).
    lo_char->if_cls_attribute~set_manual_changes_allowed( ls_char-cls_attribute-manu_chag_allow ).
    lo_char->if_cls_attribute~set_implicit_changes_allowed( ls_char-cls_attribute-implicit_change ).
    lo_char->if_cls_attribute~set_expl_values_dominate_links( ls_char-cls_attribute-weak_links ).
    lo_char->if_cls_attribute~set_assignment_package_rule( ls_char-cls_attribute-assignment_devc ).
    lo_char->if_cls_attribute~set_hide_remark( ls_char-cls_attribute-hide_remark ).
    lo_char->if_cls_attribute~set_visible_in_customer_system( ls_char-cls_attribute-visible_for_cust ).
    lo_char->if_cls_attribute~set_value_table( ls_char-cls_attribute-value_table ).
    lo_char->if_cls_attribute~set_vtable_field( ls_char-cls_attribute-vtable_field ).
    lo_char->if_cls_attribute~set_vtable_icon_f( ls_char-cls_attribute-vtable_icon_f ).
    lo_char->if_cls_attribute~set_vtext_langu_f( ls_char-cls_attribute-vtext_langu_f ).
    lo_char->if_cls_attribute~set_vtext_table( ls_char-cls_attribute-vtext_table ).
    lo_char->if_cls_attribute~set_vtext_text_f( ls_char-cls_attribute-vtext_text_f ).
    lo_char->if_cls_attribute~set_vtext_value_f( ls_char-cls_attribute-vtext_value_f ).
    lo_char->if_cls_attribute~set_existing_objects_only( ls_char-cls_attribute-existing_objects ).
    lo_char->if_cls_attribute~set_objs_of_typegr( ls_char-cls_attribute-objs_of_typegr ).
    lo_char->if_cls_attribute~set_obj_values_have_subtypes( ls_char-cls_attribute-objs_w_subtype ).
    lo_char->if_cls_attribute~set_arbtry_val_type( ls_char-cls_attribute-arbtry_val_type ).

    READ TABLE ls_char-cls_attributet INTO ls_description WITH KEY langu = sy-langu.
    IF sy-subrc <> 0.
      READ TABLE ls_char-cls_attributet INTO ls_description INDEX 1.
    ENDIF.
    lo_char->if_cls_attribute~set_description( ls_description-text ).

    lo_char->if_cls_attribute~set_values(
      im_values   = ls_char-cls_attr_value<commit_msg>CHAR: fix dump during pull #1660<commit_after>CLASS zcl_abapgit_object_char DEFINITION
  PUBLIC
  INHERITING FROM zcl_abapgit_objects_super
  FINAL
  CREATE PUBLIC .

  PUBLIC SECTION.

    INTERFACES zif_abapgit_object .

  PRIVATE SECTION.

    TYPES:
      BEGIN OF ty_char,
        cls_attribute   TYPE cls_attribute,
        cls_attributet  TYPE STANDARD TABLE OF cls_attributet WITH DEFAULT KEY,
        cls_attr_value  TYPE STANDARD TABLE OF cls_attr_value WITH DEFAULT KEY,
        cls_attr_valuet TYPE STANDARD TABLE OF cls_attr_valuet WITH DEFAULT KEY,
      END OF ty_char .

    METHODS instantiate_char
      IMPORTING
        !iv_type_group TYPE cls_object_type_group
      RETURNING
        VALUE(ro_char) TYPE REF TO cl_cls_attribute
      RAISING
        zcx_abapgit_exception .
ENDCLASS.



CLASS ZCL_ABAPGIT_OBJECT_CHAR IMPLEMENTATION.


  METHOD instantiate_char.

    DATA: lv_new  TYPE abap_bool,
          lv_name TYPE cls_attribute_name.


    SELECT SINGLE name FROM cls_attribute INTO lv_name WHERE name = ms_item-obj_name.
    lv_new = boolc( sy-subrc <> 0 ).
    lv_name = ms_item-obj_name.

    TRY.
        CREATE OBJECT ro_char
          EXPORTING
            im_name       = lv_name
            im_type_group = iv_type_group
            im_new        = lv_new.
      CATCH cx_pak_invalid_data
          cx_pak_not_authorized
          cx_pak_invalid_state
          cx_pak_wb_object_locked.
        zcx_abapgit_exception=>raise( 'Error while instantiating CL_CLS_ATTRIBUTE' ).
    ENDTRY.

    IF lv_new = abap_false.
      TRY.
          ro_char->if_pak_wb_object~lock_and_refresh( ).
        CATCH cx_pak_wb_object_locked.
          zcx_abapgit_exception=>raise( |Could not aquire lock, CHAR { lv_name }| ).
      ENDTRY.
    ENDIF.

  ENDMETHOD.


  METHOD zif_abapgit_object~changed_by.

    SELECT SINGLE changed_by FROM cls_attribute INTO rv_user
      WHERE name = ms_item-obj_name
      AND activation_state = 'A'.

    IF rv_user IS INITIAL.
      SELECT SINGLE created_by FROM cls_attribute INTO rv_user
        WHERE name = ms_item-obj_name
        AND activation_state = 'A'.
    ENDIF.

    IF rv_user IS INITIAL.
      rv_user = c_user_unknown.
    ENDIF.

  ENDMETHOD.


  METHOD zif_abapgit_object~compare_to_remote_version.
    CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null.
  ENDMETHOD.


  METHOD zif_abapgit_object~delete.

    DATA: lo_char       TYPE REF TO cl_cls_attribute,
          lv_type_group TYPE cls_attribute-type_group.


    SELECT SINGLE type_group FROM cls_attribute INTO lv_type_group
      WHERE name = ms_item-obj_name
      AND activation_state = 'A'.

    lo_char = instantiate_char( lv_type_group ).

    lo_char->if_pak_wb_object~delete( ).

    lo_char->if_pak_wb_object~save( ).

    lo_char->if_pak_wb_object_internal~unlock( ).

  ENDMETHOD.


  METHOD zif_abapgit_object~deserialize.

    DATA: ls_char        TYPE ty_char,
          lv_request     TYPE trkorr,
          ls_description LIKE LINE OF ls_char-cls_attributet,
          lo_char        TYPE REF TO cl_cls_attribute.

    FIELD-SYMBOLS: <ls_value>  LIKE LINE OF ls_char-cls_attr_value,
                   <ls_valuet> LIKE LINE OF ls_char-cls_attr_value.


    io_xml->read( EXPORTING iv_name = 'CHAR'
                  CHANGING cg_data = ls_char ).

    tadir_insert( iv_package ).

    lo_char = instantiate_char( ls_char-cls_attribute-type_group ).

    lo_char->if_cls_attribute~set_kind( ls_char-cls_attribute-kind ).
    lo_char->if_cls_attribute~set_single_valued( ls_char-cls_attribute-is_single_valued ).
    lo_char->if_cls_attribute~set_aspect(
      im_aspect_for   = ls_char-cls_attribute-is_aspect_for
      im_aspect_value = ls_char-cls_attribute-aspect_value ).
    lo_char->if_cls_attribute~set_default_flag( ls_char-cls_attribute-default_flag ).
    lo_char->if_cls_attribute~set_default_value( ls_char-cls_attribute-default_value ).
    lo_char->if_cls_attribute~set_sub_object_treatment( ls_char-cls_attribute-sub_obj_treatm ).
    lo_char->if_cls_attribute~set_automatic_changes_allowed( ls_char-cls_attribute-automatic_change ).
    lo_char->if_cls_attribute~set_manual_changes_allowed( ls_char-cls_attribute-manu_chag_allow ).
    lo_char->if_cls_attribute~set_implicit_changes_allowed( ls_char-cls_attribute-implicit_change ).
    lo_char->if_cls_attribute~set_expl_values_dominate_links( ls_char-cls_attribute-weak_links ).
    lo_char->if_cls_attribute~set_assignment_package_rule( ls_char-cls_attribute-assignment_devc ).
    lo_char->if_cls_attribute~set_hide_remark( ls_char-cls_attribute-hide_remark ).
    lo_char->if_cls_attribute~set_visible_in_customer_system( ls_char-cls_attribute-visible_for_cust ).
    lo_char->if_cls_attribute~set_value_table( ls_char-cls_attribute-value_table ).
    lo_char->if_cls_attribute~set_vtable_field( ls_char-cls_attribute-vtable_field ).
    lo_char->if_cls_attribute~set_vtable_icon_f( ls_char-cls_attribute-vtable_icon_f ).
    lo_char->if_cls_attribute~set_vtext_langu_f( ls_char-cls_attribute-vtext_langu_f ).
    lo_char->if_cls_attribute~set_vtext_table( ls_char-cls_attribute-vtext_table ).
    lo_char->if_cls_attribute~set_vtext_text_f( ls_char-cls_attribute-vtext_text_f ).
    lo_char->if_cls_attribute~set_vtext_value_f( ls_char-cls_attribute-vtext_value_f ).
    lo_char->if_cls_attribute~set_existing_objects_only( ls_char-cls_attribute-existing_objects ).
    lo_char->if_cls_attribute~set_objs_of_typegr( ls_char-cls_attribute-objs_of_typegr ).
    lo_char->if_cls_attribute~set_obj_values_have_subtypes( ls_char-cls_attribute-objs_w_subtype ).
    lo_char->if_cls_attribute~set_arbtry_val_type( ls_char-cls_attribute-arbtry_val_type ).

    READ TABLE ls_char-cls_attributet INTO ls_description WITH KEY langu = sy-langu.
    IF sy-subrc <> 0.
      READ TABLE ls_char-cls_attributet INTO ls_description INDEX 1.
    ENDIF.
    lo_char->if_cls_attribute~set_description( ls_description-text ).

    LOOP AT ls_char-cls_attr_value ASSIGNING <ls_value>.
      <ls_value>-activation_state = 'I'.
    ENDLOOP.
    LOOP AT ls_char-cls_attr_value ASSIGNING <ls_valuet>.
      <ls_value>-activation_state = 'I'.
    ENDLOOP.

    lo_char->if_cls_attribute~set_values(
      im_values   = ls_char-cls_attr_value
{'fraction_non_alphanumeric': 0.06565489937314417, 'fraction_numerical': 0.0008248102936324645, 'mean_word_length': 3.566854990583804, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4503148', 'n_tokens_mistral': 4557, 'n_tokens_neox': 4265, 'n_words': 675}