anchor.diff:    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,
  +      lo_object_data        TYPE REF TO if_wb_object_data_model,
  +      lo_object_data_merged TYPE REF TO if_wb_object_data_model,
  +      lo_wb_object_operator TYPE REF TO object,
         lx_error              TYPE REF TO cx_root,
  -      lv_transport_request  TYPE trkorr.
  +      lv_transport_request  TYPE trkorr,
  +      lr_wbobjtype          TYPE REF TO data,
  +      lr_category           TYPE REF TO data.
   
       FIELD-SYMBOLS:
  -      <ls_behaviour_definition> TYPE any,
  -      <lv_source>               TYPE data.
  -
  -    ASSIGN mr_behaviour_definition->* TO <ls_behaviour_definition>.
  -    ASSERT sy-subrc = 0.
  -
  -    io_xml->read(
  -      EXPORTING
  -        iv_name = 'BDEF'
  -      CHANGING
  -        cg_data = <ls_behaviour_definition> ).
  -
  -    li_wb_object_operator = get_wb_object_operator( ).
  +      <ls_wbobjtype> TYPE any,
  +      <lv_category>  TYPE any,
  +      <lv_field>     TYPE any.
   
       TRY.
  -        CREATE OBJECT li_object_data_model TYPE ('CL_BLUE_SOURCE_OBJECT_DATA').
  -
  -        ASSIGN COMPONENT 'CONTENT-SOURCE' OF STRUCTURE <ls_behaviour_definition>
  -               TO <lv_source>.
  -        ASSERT sy-subrc = 0.
  -
  -        <lv_source> = mo_files->read_string( 'asbdef' ).
  +
  +        lo_object_data = get_object_data( io_xml ).
  +        lv_transport_request = get_transport_req_if_needed( iv_package ).
  +
  +        CREATE DATA lr_wbobjtype TYPE ('WBOBJTYPE').
  +        ASSIGN lr_wbobjtype->* TO <ls_wbobjtype>.
  +        ASSIGN COMPONENT 'OBJTYPE_TR' OF STRUCTURE <ls_wbobjtype> TO <lv_field>.
  +        <lv_field> = 'BDEF'.
  +        ASSIGN COMPONENT 'SUBTYPE_WB' OF STRUCTURE <ls_wbobjtype> TO <lv_field>.
  +        <lv_field> = 'BDO'.
  +
  +        CREATE DATA lr_category TYPE ('WBADT_RESOURCE_CATEGORY').
  +        ASSIGN lr_category->* TO <lv_category>.
  +
  +        CALL METHOD ('CL_BLUE_WB_UTILITY')=>('GET_RESOURCE_CATEGORY')
  +          EXPORTING
  +            is_object_type = <ls_wbobjtype>
  +          RECEIVING
  +            result         = <lv_category>.
  +
  +        lo_wb_object_operator = get_wb_object_operator( ).
   
           tadir_insert( iv_package ).
   
  -        lv_transport_request = get_transport_req_if_needed( 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_behaviour_definition = <ls_behaviour_definition> ).
  -          li_object_data_model->set_data( <ls_behaviour_definition> ).
  -
  -          CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE')
  -            EXPORTING
  -              io_object_data    = li_object_data_model
  -              transport_request = lv_transport_request.
  -
  +        IF zif_abapgit_object~exists( ) = abap_false.
  +          CASE <lv_category>.
  +            WHEN '1'. "if_wb_adt_plugin_resource_co=>co_sfs_res_category_atomic.
  +              CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~CREATE')
  +                EXPORTING
  +                  io_object_data    = lo_object_data
  +                  data_selection    = 'AL' " if_wb_object_data_selection_co=>c_all_data
  +                  version           = 'I'
  +                  package           = iv_package
  +                  transport_request = lv_transport_request.
  +            WHEN '2'. "if_wb_adt_plugin_resource_co=>co_sfs_res_category_compound_s.
  +              CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~CREATE')
  +                EXPORTING
  +                  io_object_data    = lo_object_data
  +                  data_selection    = 'P' " if_wb_object_data_selection_co=>c_properties
  +                  version           = 'I'
  +                  package           = iv_package
  +                  transport_request = lv_transport_request.
  +
  +              CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE')
  +                EXPORTING
  +                  io_object_data    = lo_object_data
  +                  data_selection    = 'D' "if_wb_object_data_selection_co=>c_data_content
  +                  version           = 'I'
  +                  transport_request = lv_transport_request.
  +            WHEN OTHERS.
  +          ENDCASE.
           ELSE.
  -
  -          li_object_data_model->set_data( <ls_behaviour_definition> ).
  -
  -          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 = lv_transport_request.
  -
  -          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 = lv_transport_request.
  -
  +          lo_object_data_merged = merge_object_data( lo_object_data ).
  +          CASE <lv_category>.
  +            WHEN '1'. "if_wb_adt_plugin_resource_co=>co_sfs_res_category_atomic.
  +              CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE')
  +                EXPORTING
  +                  io_object_data    = lo_object_data_merged
  +                  data_selection    = 'AL' "if_wb_object_data_selection_co=>c_all_data
  +                  version           = 'I'
  +                  transport_request = lv_transport_request.
  +            WHEN '2'. "if_wb_adt_plugin_resource_co=>co_sfs_res_category_compound_s.
  +              CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE')
  +                EXPORTING
  +                  io_object_data    = lo_object_data_merged
  +                  data_selection    = 'P' "if_wb_object_data_selection_co=>c_properties
  +                  version           = 'I'
  +                  transport_request = lv_transport_request.
  +              CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~UPDATE')
  +                EXPORTING
  +                  io_object_data    = lo_object_data_merged
  +                  data_selection    = 'D' "if_wb_object_data_selection_co=>c_data_content
  +                  version           = 'I'
  +                  transport_request = lv_transport_request.
  +            WHEN OTHERS.
  +          ENDCASE.
           ENDIF.
  -
  -        CALL METHOD li_wb_object_operator->('IF_WB_OBJECT_OPERATOR~ACTIVATE').
   
           corr_insert( iv_package ).
   
  
positive.code: 
      FIELD-SYMBOLS:
        <ls_behaviour_definition> TYPE any,
        <lv_source>               TYPE string.
  
      ASSIGN mr_behaviour_definition->* TO <ls_behaviour_definition>.
  
negative.code: 
    ENDMETHOD.
  
  
    METHOD get_object_data.
  
      DATA:
        lo_object_data TYPE REF TO object,
        lr_metadata    TYPE REF TO data,
        lr_data        TYPE REF TO data.
  
      FIELD-SYMBOLS:
        <lv_metadata_node> TYPE any,
        <ls_metadata>      TYPE any,
        <lv_source>        TYPE any,
        <lg_data>          TYPE any.
  
      CREATE DATA lr_data TYPE ('CL_BLUE_SOURCE_OBJECT_DATA=>TY_OBJECT_DATA').
      ASSIGN lr_data->* TO <lg_data>.
      ASSERT sy-subrc = 0.
  
      ASSIGN COMPONENT 'METADATA' OF STRUCTURE <lg_data> TO <lv_metadata_node>.
      ASSERT sy-subrc = 0.
  
      CREATE DATA lr_metadata  TYPE ('IF_ADT_TOOLS_CORE_SOURCE_TYPES=>TY_ABAP_SOURCE_MAIN_OBJECT').
      ASSIGN lr_metadata->* TO <ls_metadata>.
      ASSERT sy-subrc = 0.
  
      io_xml->read(
        EXPORTING
          iv_name = 'BDEF'
        CHANGING
          cg_data = <ls_metadata> ).
  
      <lv_metadata_node> = <ls_metadata>.
  
      ASSIGN COMPONENT 'CONTENT-SOURCE' OF STRUCTURE <lg_data> TO <lv_source>.
      ASSERT sy-subrc = 0.
  
      <lv_source> = mo_files->read_string( 'asbdef' ).
  
      CREATE OBJECT ro_object_data TYPE ('CL_BLUE_SOURCE_OBJECT_DATA').
  
      ro_object_data->set_data(  p_data = <lg_data>  ).
  
    ENDMETHOD.
  
  
    METHOD merge_object_data.
  
      DATA:
        lo_object_data        TYPE REF TO object,
        lo_object_data_old    TYPE REF TO if_wb_object_data_model,
        lr_new                TYPE REF TO data,
        lr_old                TYPE REF TO data,
        lo_wb_object_operator TYPE REF TO object,
        ls_old                TYPE     cl_blue_source_object_data=>ty_object_data.
  
      FIELD-SYMBOLS:
        <ls_new>       TYPE any,
        <ls_old>       TYPE any,
        <lv_field_old> TYPE any,
        <lv_field_new> TYPE any.
  
      CREATE OBJECT lo_object_data TYPE ('CL_BLUE_SOURCE_OBJECT_DATA').
      lo_object_data = io_object_data.
  
      CREATE DATA lr_new TYPE ('CL_BLUE_SOURCE_OBJECT_DATA=>TY_OBJECT_DATA').
      ASSIGN lr_new->* TO <ls_new>.
      ASSERT sy-subrc = 0.
  
      CREATE DATA lr_old TYPE ('CL_BLUE_SOURCE_OBJECT_DATA=>TY_OBJECT_DATA').
      ASSIGN lr_old->* TO <ls_old>.
      ASSERT sy-subrc = 0.
  
      CALL METHOD lo_object_data->('IF_WB_OBJECT_DATA_MODEL~GET_DATA')
        EXPORTING
          p_metadata_only  = abap_false
          p_data_selection = 'AL'
        IMPORTING
          p_data           = <ls_new>.
  
      lo_wb_object_operator = get_wb_object_operator( ).
  
      CALL METHOD lo_wb_object_operator->('IF_WB_OBJECT_OPERATOR~READ')
        EXPORTING
          data_selection = 'AL' " if_wb_object_data_selection_co=>c_all_data
        IMPORTING
          eo_object_data = lo_object_data_old.
  
      CALL METHOD lo_object_data_old->('GET_DATA')
        EXPORTING
          p_metadata_only  = abap_false
          p_data_selection = 'AL' " if_wb_object_data_selection_co=>c_all_data
        IMPORTING
          p_data           = <ls_old>.
  
      ASSIGN COMPONENT 'METADATA-DESCRIPTION' OF STRUCTURE <ls_old> TO <lv_field_old>.
      ASSIGN COMPONENT 'METADATA-DESCRIPTION' OF STRUCTURE <ls_new> TO <lv_field_new>.
      <lv_field_old> = <lv_field_new>.
  
      ASSIGN COMPONENT 'CONTENT-SOURCE' OF STRUCTURE <ls_old> TO <lv_field_old>.
      ASSIGN COMPONENT 'CONTENT-SOURCE' OF STRUCTURE <ls_new> TO <lv_field_new>.
      <lv_field_old> = <lv_field_new>.
  
      CREATE OBJECT ro_object_data_merged TYPE ('CL_BLUE_SOURCE_OBJECT_DATA').
  
      CALL METHOD ro_object_data_merged->('SET_DATA')
        EXPORTING
          p_data = <ls_old>.
    ENDMETHOD.
  ENDCLASS.
  