<commit_before><?xml version="1.0" encoding="UTF-8" ?>

<!--
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~       http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="org.flowable.engine.impl.persistence.entity.HistoricProcessInstanceEntityImpl">

  <!-- HISTORIC PROCESS INSTANCE INSERT -->
  
  <insert id="insertHistoricProcessInstance" parameterType="org.flowable.engine.impl.persistence.entity.HistoricProcessInstanceEntityImpl">
      insert into ${prefix}ACT_HI_PROCINST (
        ID_,
        REV_,
        PROC_INST_ID_,
        BUSINESS_KEY_,
        PROC_DEF_ID_,
        START_TIME_,
        END_TIME_,
        DURATION_,
        START_USER_ID_,
        START_ACT_ID_,
        END_ACT_ID_,
        SUPER_PROCESS_INSTANCE_ID_,
        DELETE_REASON_,
        TENANT_ID_,
        NAME_,
        CALLBACK_ID_,
        CALLBACK_TYPE_,
        REFERENCE_ID_,
        REFERENCE_TYPE_
      ) values (
        #{id ,jdbcType=VARCHAR},
        1,
        #{processInstanceId, jdbcType=VARCHAR},
        #{businessKey, jdbcType=VARCHAR},
        #{processDefinitionId, jdbcType=VARCHAR},
        #{startTime, jdbcType=TIMESTAMP},
        #{endTime, jdbcType=TIMESTAMP},
        #{durationInMillis ,jdbcType=BIGINT},
        #{startUserId, jdbcType=VARCHAR},
        #{startActivityId, jdbcType=VARCHAR},
        #{endActivityId, jdbcType=VARCHAR},
        #{superProcessInstanceId, jdbcType=VARCHAR},
        #{deleteReason, jdbcType=VARCHAR},
        #{tenantId, jdbcType=VARCHAR},
        #{name, jdbcType=VARCHAR},
        #{callbackId, jdbcType=VARCHAR},
        #{callbackType, jdbcType=VARCHAR},
        #{referenceId, jdbcType=VARCHAR},
        #{referenceType, jdbcType=VARCHAR},
      )
  </insert>
  
  <insert id="bulkInsertHistoricProcessInstance" parameterType="java.util.List">
      insert into ${prefix}ACT_HI_PROCINST (
        ID_,
        REV_,
        PROC_INST_ID_,
        BUSINESS_KEY_,
        PROC_DEF_ID_,
        START_TIME_,
        END_TIME_,
        DURATION_,
        START_USER_ID_,
        START_ACT_ID_,
        END_ACT_ID_,
        SUPER_PROCESS_INSTANCE_ID_,
        DELETE_REASON_,
        TENANT_ID_,
        NAME_,
        CALLBACK_ID_,
        CALLBACK_TYPE_,
        REFERENCE_ID_,
        REFERENCE_TYPE_
      ) values 
        <foreach collection="list" item="historicProcessInstance" index="index" separator=",">
          (
           #{historicProcessInstance.id ,jdbcType=VARCHAR},
           1,
           #{historicProcessInstance.processInstanceId, jdbcType=VARCHAR},
           #{historicProcessInstance.businessKey, jdbcType=VARCHAR},<commit_msg>Fix failing db tests (works on H2)<commit_after><?xml version="1.0" encoding="UTF-8" ?>

<!--
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~       http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="org.flowable.engine.impl.persistence.entity.HistoricProcessInstanceEntityImpl">

  <!-- HISTORIC PROCESS INSTANCE INSERT -->
  
  <insert id="insertHistoricProcessInstance" parameterType="org.flowable.engine.impl.persistence.entity.HistoricProcessInstanceEntityImpl">
      insert into ${prefix}ACT_HI_PROCINST (
        ID_,
        REV_,
        PROC_INST_ID_,
        BUSINESS_KEY_,
        PROC_DEF_ID_,
        START_TIME_,
        END_TIME_,
        DURATION_,
        START_USER_ID_,
        START_ACT_ID_,
        END_ACT_ID_,
        SUPER_PROCESS_INSTANCE_ID_,
        DELETE_REASON_,
        TENANT_ID_,
        NAME_,
        CALLBACK_ID_,
        CALLBACK_TYPE_,
        REFERENCE_ID_,
        REFERENCE_TYPE_
      ) values (
        #{id ,jdbcType=VARCHAR},
        1,
        #{processInstanceId, jdbcType=VARCHAR},
        #{businessKey, jdbcType=VARCHAR},
        #{processDefinitionId, jdbcType=VARCHAR},
        #{startTime, jdbcType=TIMESTAMP},
        #{endTime, jdbcType=TIMESTAMP},
        #{durationInMillis ,jdbcType=BIGINT},
        #{startUserId, jdbcType=VARCHAR},
        #{startActivityId, jdbcType=VARCHAR},
        #{endActivityId, jdbcType=VARCHAR},
        #{superProcessInstanceId, jdbcType=VARCHAR},
        #{deleteReason, jdbcType=VARCHAR},
        #{tenantId, jdbcType=VARCHAR},
        #{name, jdbcType=VARCHAR},
        #{callbackId, jdbcType=VARCHAR},
        #{callbackType, jdbcType=VARCHAR},
        #{referenceId, jdbcType=VARCHAR},
        #{referenceType, jdbcType=VARCHAR}
      )
  </insert>
  
  <insert id="bulkInsertHistoricProcessInstance" parameterType="java.util.List">
      insert into ${prefix}ACT_HI_PROCINST (
        ID_,
        REV_,
        PROC_INST_ID_,
        BUSINESS_KEY_,
        PROC_DEF_ID_,
        START_TIME_,
        END_TIME_,
        DURATION_,
        START_USER_ID_,
        START_ACT_ID_,
        END_ACT_ID_,
        SUPER_PROCESS_INSTANCE_ID_,
        DELETE_REASON_,
        TENANT_ID_,
        NAME_,
        CALLBACK_ID_,
        CALLBACK_TYPE_,
        REFERENCE_ID_,
        REFERENCE_TYPE_
      ) values 
        <foreach collection="list" item="historicProcessInstance" index="index" separator=",">
          (
           #{historicProcessInstance.id ,jdbcType=VARCHAR},
           1,
           #{historicProcessInstance.processInstanceId, jdbcType=VARCHAR},
           #{historicProcessInstance.businessKey, jdbcType=VARCHAR},
{'fraction_non_alphanumeric': 0.10049859769398567, 'fraction_numerical': 0.0038952944842630104, 'mean_word_length': 2.6659051970302685, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 2, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5330882', 'n_tokens_mistral': 2016, 'n_tokens_neox': 1980, 'n_words': 397}