All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.camunda.bpm.engine.impl.mapping.entity.HistoricDecisionInputInstance.xml Maven / Gradle / Ivy

There is a newer version: 7.22.0-alpha1
Show newest version
<?xml version="1.0" encoding="UTF-8" ?>
<!--

    Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
    under one or more contributor license agreements. See the NOTICE file
    distributed with this work for additional information regarding copyright
    ownership. Camunda licenses this file to you under the Apache License,
    Version 2.0; 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.camunda.bpm.engine.impl.history.event.HistoricDecisionInputInstanceEntity">

 <!-- insert -->
 
  <insert id="insertHistoricDecisionInputInstance" parameterType="org.camunda.bpm.engine.impl.history.event.HistoricDecisionInputInstanceEntity">
     insert into ${prefix}ACT_HI_DEC_IN(
          ID_, 
          DEC_INST_ID_, 
          CLAUSE_ID_, 
          CLAUSE_NAME_,
          VAR_TYPE_,
          BYTEARRAY_ID_,
          DOUBLE_,
          LONG_,
          TEXT_,
          TEXT2_,
          TENANT_ID_,
          CREATE_TIME_,
          ROOT_PROC_INST_ID_,
          REMOVAL_TIME_
      ) values ( 
          #{id, jdbcType=VARCHAR},
          #{decisionInstanceId, jdbcType=VARCHAR},
          #{clauseId, jdbcType=VARCHAR},
          #{clauseName, jdbcType=VARCHAR},
          #{serializerName, jdbcType=VARCHAR},
          #{byteArrayValueId, jdbcType=VARCHAR},
          #{doubleValue, jdbcType=DOUBLE},
          #{longValue, jdbcType=BIGINT},
          #{textValue, jdbcType=VARCHAR},
          #{textValue2, jdbcType=VARCHAR},
          #{tenantId, jdbcType=VARCHAR},
          #{createTime, jdbcType=TIMESTAMP},
          #{rootProcessInstanceId, jdbcType=VARCHAR},
          #{removalTime, jdbcType=TIMESTAMP}
      )
  </insert>

  <!-- update -->
  <update id="updateHistoricDecisionInputInstancesByRootProcessInstanceId"
          parameterType="java.util.Map">
      update
      <if test="maxResults != null">
        ${limitBeforeWithoutOffset}
      </if>
      ${prefix}ACT_HI_DEC_IN set
      REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}

      where ROOT_PROC_INST_ID_ = #{rootProcessInstanceId, jdbcType=VARCHAR}
      <if test="maxResults != null">
        and (REMOVAL_TIME_ is null or REMOVAL_TIME_ != #{removalTime, jdbcType=TIMESTAMP})
        ${limitAfterWithoutOffset}
      </if>
  </update>

  <update id="updateHistoricDecisionInputInstancesByRootProcessInstanceId_postgres"
          parameterType="java.util.Map">
      update ${prefix}ACT_HI_DEC_IN set
      REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}
      <if test="maxResults != null">
        ${limitBeforeInUpdate} ${prefix}ACT_HI_DEC_IN
      </if>

      where ROOT_PROC_INST_ID_ = #{rootProcessInstanceId, jdbcType=VARCHAR}
      <if test="maxResults != null">
        and (REMOVAL_TIME_ is null or REMOVAL_TIME_ != #{removalTime, jdbcType=TIMESTAMP})
        ${limitAfterInUpdate}
      </if>
  </update>

  <update id="updateHistoricDecisionInputInstancesByRootProcessInstanceId_mysql"
          parameterType="java.util.Map">
      update ${prefix}ACT_HI_DEC_IN
      <choose>
        <when test="maxResults != null">
          ${limitBeforeInUpdate} ${prefix}ACT_HI_DEC_IN
        </when>
        <otherwise>
          set REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}
        </otherwise>
      </choose>

      where ROOT_PROC_INST_ID_ = #{rootProcessInstanceId, jdbcType=VARCHAR}
      <if test="maxResults != null">
        and (REMOVAL_TIME_ is null or REMOVAL_TIME_ != #{removalTime, jdbcType=TIMESTAMP})
        ${limitAfterInUpdate}
        set REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}
      </if>
  </update>

  <update id="updateHistoricDecisionInputInstancesByRootProcessInstanceId_mssql"
          parameterType="java.util.Map">
    update
    <if test="maxResults != null">
      ${limitBeforeWithoutOffset}
    </if>
    RES set
    RES.REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}
    FROM ${prefix}ACT_HI_DEC_IN RES WITH (FORCESEEK)
    where RES.ROOT_PROC_INST_ID_ = #{rootProcessInstanceId, jdbcType=VARCHAR}
    <if test="maxResults != null">
      and (REMOVAL_TIME_ is null or REMOVAL_TIME_ != #{removalTime, jdbcType=TIMESTAMP})
      ${limitAfterWithoutOffset}
    </if>
  </update>

  <update id="updateHistoricDecisionInputInstancesByProcessInstanceId"
          parameterType="java.util.Map">
    update
    <if test="maxResults != null">
      ${limitBeforeWithoutOffset}
    </if>
    ${prefix}ACT_HI_DEC_IN
      set REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}
      where DEC_INST_ID_ IN (
        SELECT ID_
        FROM ${prefix}ACT_HI_DECINST
        WHERE PROC_INST_ID_ = #{processInstanceId, jdbcType=TIMESTAMP}
      )
      <if test="maxResults != null">
        and (REMOVAL_TIME_ is null or REMOVAL_TIME_ != #{removalTime, jdbcType=TIMESTAMP})
        ${limitAfterWithoutOffset}
      </if>
  </update>

  <update id="updateHistoricDecisionInputInstancesByProcessInstanceId_postgres"
          parameterType="java.util.Map">
    update ${prefix}ACT_HI_DEC_IN
      set REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}
      <if test="maxResults != null">
        ${limitBeforeInUpdate} ${prefix}ACT_HI_DEC_IN
      </if>
      where DEC_INST_ID_ IN (
        SELECT ID_
        FROM ${prefix}ACT_HI_DECINST
        WHERE PROC_INST_ID_ = #{processInstanceId, jdbcType=TIMESTAMP}
      )
      <if test="maxResults != null">
        and (REMOVAL_TIME_ is null or REMOVAL_TIME_ != #{removalTime, jdbcType=TIMESTAMP})
        ${limitAfterInUpdate}
      </if>
  </update>

  <update id="updateHistoricDecisionInputInstancesByProcessInstanceId_mysql"
          parameterType="java.util.Map">
    update ${prefix}ACT_HI_DEC_IN
      <choose>
        <when test="maxResults != null">
          ${limitBeforeInUpdate} ${prefix}ACT_HI_DEC_IN
        </when>
        <otherwise>
          set REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}
        </otherwise>
      </choose>
      where DEC_INST_ID_ IN (
        SELECT ID_
        FROM ${prefix}ACT_HI_DECINST
        WHERE PROC_INST_ID_ = #{processInstanceId, jdbcType=TIMESTAMP}
      )
      <if test="maxResults != null">
        and (REMOVAL_TIME_ is null or REMOVAL_TIME_ != #{removalTime, jdbcType=TIMESTAMP})
        ${limitAfterInUpdate}
        set REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}
      </if>
  </update>

  <update id="updateHistoricDecisionInputInstancesByProcessInstanceId_mssql"
          parameterType="java.util.Map">
    update
    <if test="maxResults != null">
      ${limitBeforeWithoutOffset}
    </if>
    RES set
      RES.REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}
      from ${prefix}ACT_HI_DEC_IN RES WITH (FORCESEEK)
      where RES.DEC_INST_ID_ IN (
        SELECT ID_
        FROM ${prefix}ACT_HI_DECINST
        WHERE PROC_INST_ID_ = #{processInstanceId, jdbcType=TIMESTAMP}
      )
      <if test="maxResults != null">
        and (REMOVAL_TIME_ is null or REMOVAL_TIME_ != #{removalTime, jdbcType=TIMESTAMP})
        ${limitAfterWithoutOffset}
      </if>
  </update>

  <update id="updateHistoricDecisionInputInstancesByRootDecisionInstanceId"
          parameterType="java.util.Map">
      update ${prefix}ACT_HI_DEC_IN set
      REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}

      where DEC_INST_ID_ IN (
        SELECT ID_
        FROM ${prefix}ACT_HI_DECINST
        WHERE ROOT_DEC_INST_ID_ = #{rootDecisionInstanceId, jdbcType=VARCHAR}) <!-- null for root dec instances -->
           or DEC_INST_ID_ = #{rootDecisionInstanceId, jdbcType=VARCHAR}
  </update>

  <update id="updateHistoricDecisionInputInstancesByRootDecisionInstanceId_mssql"
          parameterType="java.util.Map">
    update RES set
      RES.REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}
      FROM ${prefix}ACT_HI_DEC_IN RES WITH (FORCESEEK)
      where RES.DEC_INST_ID_ IN (
        SELECT ID_
        FROM ${prefix}ACT_HI_DECINST
        WHERE ROOT_DEC_INST_ID_ = #{rootDecisionInstanceId, jdbcType=VARCHAR}) <!-- null for root dec instances -->
           or DEC_INST_ID_ = #{rootDecisionInstanceId, jdbcType=VARCHAR}
  </update>

  <update id="updateHistoricDecisionInputInstancesByDecisionInstanceId"
          parameterType="java.util.Map">
      update ${prefix}ACT_HI_DEC_IN set
      REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}

      where DEC_INST_ID_ = #{decisionInstanceId, jdbcType=VARCHAR}
  </update>

  <update id="updateHistoricDecisionInputInstancesByDecisionInstanceId_mssql"
          parameterType="java.util.Map">
    update RES set
    RES.REMOVAL_TIME_ = #{removalTime, jdbcType=TIMESTAMP}
    FROM ${prefix}ACT_HI_DEC_IN RES WITH (FORCESEEK)
    where RES.DEC_INST_ID_ = #{decisionInstanceId, jdbcType=VARCHAR}
  </update>

  <!-- delete -->
  
  <delete id="deleteHistoricDecisionInputInstance" parameterType="org.camunda.bpm.engine.impl.history.event.HistoricDecisionInputInstanceEntity">
    delete from ${prefix}ACT_HI_DEC_IN where ID_ = #{id}
  </delete>

  <delete id="deleteHistoricDecisionInputInstanceByDecisionInstanceIds" parameterType="org.camunda.bpm.engine.impl.db.ListQueryParameterObject">
    delete from ${prefix}ACT_HI_DEC_IN
    where
      <bind name="listOfIds" value="list"/>
      <bind name="fieldName" value="'DEC_INST_ID_'"/>
      <include refid="org.camunda.bpm.engine.impl.persistence.entity.Commons.applyInForPaginatedCollection"/>
  </delete>

  <delete id="deleteHistoricDecisionInputInstanceByteArraysByDecisionInstanceIds">
    delete from ${prefix}ACT_GE_BYTEARRAY where ID_ in (
      select BYTEARRAY_ID_
      from ${prefix}ACT_HI_DEC_IN
        where
          <bind name="listOfIds" value="list"/>
          <bind name="fieldName" value="'DEC_INST_ID_'"/>
          <include refid="org.camunda.bpm.engine.impl.persistence.entity.Commons.applyInForPaginatedCollection"/>
          and BYTEARRAY_ID_ is not NULL
    )
  </delete>

  <delete id="deleteHistoricDecisionInputInstanceByteArraysByDecisionInstanceIds_mysql">
    delete B from ${prefix}ACT_GE_BYTEARRAY B
    inner join ${prefix}ACT_HI_DEC_IN D
      on B.ID_ = D.BYTEARRAY_ID_
      and D.DEC_INST_ID_ in
        <foreach item="decisionInstanceId" index="index" collection="list" open="(" separator="," close=")">
          #{decisionInstanceId}
        </foreach>
      and D.BYTEARRAY_ID_ is not NULL
  </delete>

  <sql id="andWhereMinuteInDateBetweenSql">
    <if test="parameter.minuteFrom != null and parameter.minuteTo != null">
      AND ${datepart1}<include refid="org.camunda.bpm.engine.impl.persistence.entity.Commons.periodUnitFunction"/>${datepart2}${date}${datepart3}
      between #{parameter.minuteFrom, jdbcType=INTEGER} and #{parameter.minuteTo, jdbcType=INTEGER}
    </if>
  </sql>

  <sql id="andWhereMinuteInDateBetweenSql_oracle">
    <if test="parameter.minuteFrom != null and parameter.minuteTo != null">
      AND ${datepart1}${date}${datepart2}<include refid="org.camunda.bpm.engine.impl.persistence.entity.Commons.periodUnitFunction"/>${datepart3}
      between #{parameter.minuteFrom, jdbcType=INTEGER} and #{parameter.minuteTo, jdbcType=INTEGER}
    </if>
  </sql>

  <delete id="deleteHistoricDecisionInputInstancesByRemovalTime"
          parameterType="org.camunda.bpm.engine.impl.db.ListQueryParameterObject">
    <bind name="date" value="'REMOVAL_TIME_'"/>
    <bind name="reportPeriodUnitName" value="'MINUTE'"/>
    delete ${limitBeforeWithoutOffset} from ${prefix}ACT_HI_DEC_IN
    where REMOVAL_TIME_ &lt;= #{parameter.removalTime}
    <include refid="andWhereMinuteInDateBetweenSql"/>
    ${limitAfterWithoutOffset}
  </delete>

  <delete id="deleteHistoricDecisionInputInstancesByRemovalTime_oracle"
          parameterType="org.camunda.bpm.engine.impl.db.ListQueryParameterObject">
    <bind name="date" value="'REMOVAL_TIME_'"/>
    <bind name="reportPeriodUnitName" value="'MINUTE'"/>
    delete ${limitBeforeWithoutOffset} from ${prefix}ACT_HI_DEC_IN
    where REMOVAL_TIME_ &lt;= #{parameter.removalTime}
    <include refid="andWhereMinuteInDateBetweenSql_oracle"/>
    ${limitAfterWithoutOffset}
  </delete>

  <delete id="deleteHistoricDecisionInputInstancesByRemovalTime_postgres_or_db2"
          parameterType="org.camunda.bpm.engine.impl.db.ListQueryParameterObject">
    <bind name="date" value="'REMOVAL_TIME_'"/>
    <bind name="reportPeriodUnitName" value="'MINUTE'"/>
    delete ${limitBeforeWithoutOffset} from ${prefix}ACT_HI_DEC_IN
    where ID_ IN
      (SELECT ID_
       FROM ${prefix}ACT_HI_DEC_IN
       WHERE REMOVAL_TIME_ &lt;= #{parameter.removalTime} <include refid="andWhereMinuteInDateBetweenSql"/>
       ${limitAfterWithoutOffset})
  </delete>

  <!-- result map -->

  <resultMap id="historicDecisionInputInstanceResultMap" type="org.camunda.bpm.engine.impl.history.event.HistoricDecisionInputInstanceEntity">
    <id property="id" column="ID_" jdbcType="VARCHAR" />
    <result property="decisionInstanceId" column="DEC_INST_ID_" jdbcType="VARCHAR"/>
    <result property="clauseId" column="CLAUSE_ID_" jdbcType="VARCHAR"/>
    <result property="clauseName" column="CLAUSE_NAME_" jdbcType="VARCHAR"/>
    <result property="serializerName" column="VAR_TYPE_" jdbcType="VARCHAR"/>
    <result property="byteArrayValueId" column="BYTEARRAY_ID_" jdbcType="VARCHAR" />
    <result property="doubleValue" column="DOUBLE_" jdbcType="DOUBLE" />
    <result property="textValue" column="TEXT_" jdbcType="VARCHAR" />
    <result property="textValue2" column="TEXT2_" jdbcType="VARCHAR" />
    <result property="longValue" column="LONG_" jdbcType="BIGINT" />
    <result property="tenantId" column="TENANT_ID_" jdbcType="VARCHAR" />
    <result property="createTime" column="CREATE_TIME_" jdbcType="TIMESTAMP"/>
    <result property="rootProcessInstanceId" column="ROOT_PROC_INST_ID_" jdbcType="VARCHAR" />
    <result property="removalTime" column="REMOVAL_TIME_" jdbcType="TIMESTAMP"/>
  </resultMap>
  
  <!-- select -->

  <select id="selectHistoricDecisionInputInstancesByDecisionInstanceId" parameterType="org.camunda.bpm.engine.impl.db.ListQueryParameterObject" resultMap="historicDecisionInputInstanceResultMap">
    select * from ${prefix}ACT_HI_DEC_IN 
    where DEC_INST_ID_ = #{parameter, jdbcType=VARCHAR}
  </select>

  <select id="selectHistoricDecisionInputInstance" parameterType="org.camunda.bpm.engine.impl.db.ListQueryParameterObject" resultMap="historicDecisionInputInstanceResultMap">
    select * from ${prefix}ACT_HI_DEC_IN
    where ID_ = #{parameter, jdbcType=VARCHAR}
  </select>

  <select id="selectHistoricDecisionInputInstancesByDecisionInstanceIds" parameterType="org.camunda.bpm.engine.impl.db.ListQueryParameterObject" resultMap="historicDecisionInputInstanceResultMap">
    select * from ${prefix}ACT_HI_DEC_IN 
    where
      <bind name="listOfIds" value="parameter"/>
      <bind name="fieldName" value="'DEC_INST_ID_'"/>
      <include refid="org.camunda.bpm.engine.impl.persistence.entity.Commons.applyInForPaginatedCollection"/>
    order by CLAUSE_ID_
  </select>

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy