Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.flowable.db.mapping.entity.HistoricDetail.xml Maven / Gradle / Ivy
<?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.HistoricDetailEntityImpl">
<!-- HISTORIC DETAILS INSERT -->
<insert id="insertHistoricFormProperty" parameterType="org.flowable.engine.impl.persistence.entity.HistoricFormPropertyEntityImpl">
insert into ${prefix}ACT_HI_DETAIL (ID_, TYPE_, PROC_INST_ID_, ACT_INST_ID_, EXECUTION_ID_, TASK_ID_, TIME_, NAME_, TEXT_)
values (
#{id, jdbcType=VARCHAR},
'FormProperty',
#{processInstanceId, jdbcType=VARCHAR},
#{activityInstanceId, jdbcType=VARCHAR},
#{executionId, jdbcType=VARCHAR},
#{taskId, jdbcType=VARCHAR},
#{time, jdbcType=TIMESTAMP},
#{propertyId, jdbcType=VARCHAR},
#{propertyValue, jdbcType=VARCHAR}
)
</insert>
<insert id="bulkInsertHistoricFormProperty" parameterType="java.util.List">
insert into ${prefix}ACT_HI_DETAIL (ID_, TYPE_, PROC_INST_ID_, ACT_INST_ID_, EXECUTION_ID_, TASK_ID_, TIME_, NAME_, TEXT_)
values
<foreach collection="list" item="historicFormProperty" index="index" separator=",">
(#{historicFormProperty.id, jdbcType=VARCHAR},
#{historicFormProperty.detailType, jdbcType=VARCHAR},
#{historicFormProperty.processInstanceId, jdbcType=VARCHAR},
#{historicFormProperty.activityInstanceId, jdbcType=VARCHAR},
#{historicFormProperty.executionId, jdbcType=VARCHAR},
#{historicFormProperty.taskId, jdbcType=VARCHAR},
#{historicFormProperty.time, jdbcType=TIMESTAMP},
#{historicFormProperty.propertyId, jdbcType=VARCHAR},
#{historicFormProperty.propertyValue, jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="bulkInsertHistoricFormProperty" databaseId="oracle" parameterType="java.util.List">
INSERT ALL
<foreach collection="list" item="historicFormProperty" index="index">
INTO ${prefix}ACT_HI_DETAIL (ID_, TYPE_, PROC_INST_ID_, ACT_INST_ID_, EXECUTION_ID_, TASK_ID_, TIME_, NAME_, TEXT_) VALUES
(#{historicFormProperty.id, jdbcType=VARCHAR},
#{historicFormProperty.detailType, jdbcType=VARCHAR},
#{historicFormProperty.processInstanceId, jdbcType=VARCHAR},
#{historicFormProperty.activityInstanceId, jdbcType=VARCHAR},
#{historicFormProperty.executionId, jdbcType=VARCHAR},
#{historicFormProperty.taskId, jdbcType=VARCHAR},
#{historicFormProperty.time, jdbcType=TIMESTAMP},
#{historicFormProperty.propertyId, jdbcType=VARCHAR},
#{historicFormProperty.propertyValue, jdbcType=VARCHAR})
</foreach>
SELECT * FROM dual
</insert>
<insert id="insertHistoricDetailVariableInstanceUpdate" parameterType="org.flowable.engine.impl.persistence.entity.HistoricDetailVariableInstanceUpdateEntityImpl">
insert into ${prefix}ACT_HI_DETAIL (ID_, TYPE_, PROC_INST_ID_, EXECUTION_ID_, ACT_INST_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, TIME_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_)
values (
#{id, jdbcType=VARCHAR},
'VariableUpdate',
#{processInstanceId, jdbcType=VARCHAR},
#{executionId, jdbcType=VARCHAR},
#{activityInstanceId, jdbcType=VARCHAR},
#{taskId, jdbcType=VARCHAR},
#{variableName, jdbcType=VARCHAR},
#{revision, jdbcType=VARCHAR},
#{variableType, jdbcType=VARCHAR},
#{time, jdbcType=TIMESTAMP},
#{byteArrayRef, typeHandler=ByteArrayRefTypeHandler},
#{doubleValue, jdbcType=DOUBLE},
#{longValue, jdbcType=BIGINT},
#{textValue, jdbcType=VARCHAR},
#{textValue2, jdbcType=VARCHAR}
)
</insert>
<insert id="bulkInsertHistoricDetailVariableInstanceUpdate" parameterType="java.util.List">
insert into ${prefix}ACT_HI_DETAIL (ID_, TYPE_, PROC_INST_ID_, EXECUTION_ID_, ACT_INST_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, TIME_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_)
values
<foreach collection="list" item="historicDetailVariableInstance" index="index" separator=",">
(#{historicDetailVariableInstance.id, jdbcType=VARCHAR},
#{historicDetailVariableInstance.detailType, jdbcType=VARCHAR},
#{historicDetailVariableInstance.processInstanceId, jdbcType=VARCHAR},
#{historicDetailVariableInstance.executionId, jdbcType=VARCHAR},
#{historicDetailVariableInstance.activityInstanceId, jdbcType=VARCHAR},
#{historicDetailVariableInstance.taskId, jdbcType=VARCHAR},
#{historicDetailVariableInstance.variableName, jdbcType=VARCHAR},
#{historicDetailVariableInstance.revision, jdbcType=VARCHAR},
#{historicDetailVariableInstance.variableType, jdbcType=VARCHAR},
#{historicDetailVariableInstance.time, jdbcType=TIMESTAMP},
#{historicDetailVariableInstance.byteArrayRef, typeHandler=ByteArrayRefTypeHandler},
#{historicDetailVariableInstance.doubleValue, jdbcType=DOUBLE},
#{historicDetailVariableInstance.longValue, jdbcType=BIGINT},
#{historicDetailVariableInstance.textValue, jdbcType=VARCHAR},
#{historicDetailVariableInstance.textValue2, jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="bulkInsertHistoricDetailVariableInstanceUpdate" databaseId="oracle" parameterType="java.util.List">
INSERT ALL
<foreach collection="list" item="historicDetailVariableInstance" index="index">
INTO ${prefix}ACT_HI_DETAIL (ID_, TYPE_, PROC_INST_ID_, EXECUTION_ID_, ACT_INST_ID_, TASK_ID_,
NAME_, REV_, VAR_TYPE_, TIME_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_) VALUES
(#{historicDetailVariableInstance.id, jdbcType=VARCHAR},
#{historicDetailVariableInstance.detailType, jdbcType=VARCHAR},
#{historicDetailVariableInstance.processInstanceId, jdbcType=VARCHAR},
#{historicDetailVariableInstance.executionId, jdbcType=VARCHAR},
#{historicDetailVariableInstance.activityInstanceId, jdbcType=VARCHAR},
#{historicDetailVariableInstance.taskId, jdbcType=VARCHAR},
#{historicDetailVariableInstance.variableName, jdbcType=VARCHAR},
#{historicDetailVariableInstance.revision, jdbcType=VARCHAR},
#{historicDetailVariableInstance.variableType, jdbcType=VARCHAR},
#{historicDetailVariableInstance.time, jdbcType=TIMESTAMP},
#{historicDetailVariableInstance.byteArrayRef, typeHandler=ByteArrayRefTypeHandler},
#{historicDetailVariableInstance.doubleValue, jdbcType=DOUBLE},
#{historicDetailVariableInstance.longValue, jdbcType=BIGINT},
#{historicDetailVariableInstance.textValue, jdbcType=VARCHAR},
#{historicDetailVariableInstance.textValue2, jdbcType=VARCHAR})
</foreach>
SELECT * FROM dual
</insert>
<!-- HISTORIC DETAILS DELETE -->
<delete id="deleteHistoricDetailAssignment">
delete from ${prefix}ACT_HI_DETAIL where ID_ = #{id}
</delete>
<delete id="deleteHistoricDetailTransitionInstance">
delete from ${prefix}ACT_HI_DETAIL where ID_ = #{id}
</delete>
<delete id="deleteHistoricDetailVariableInstanceUpdate">
delete from ${prefix}ACT_HI_DETAIL where ID_ = #{id}
</delete>
<delete id="deleteHistoricFormProperty">
delete from ${prefix}ACT_HI_DETAIL where ID_ = #{id}
</delete>
<delete id="bulkDeleteHistoricDetailForNonExistingProcessInstances" parameterType="java.util.Map">
delete <if test="_databaseId != 'postgres' and _databaseId != 'cockroachdb' and _databaseId != 'db2'"> HIDETAIL </if> from ${prefix}ACT_HI_DETAIL HIDETAIL where HIDETAIL.PROC_INST_ID_ is not null and HIDETAIL.PROC_INST_ID_ != '' and
NOT EXISTS (select PROCINST.ID_ from ${prefix}ACT_HI_PROCINST PROCINST where HIDETAIL.PROC_INST_ID_ = PROCINST.ID_)
</delete>
<delete id="bulkDeleteHistoricDetailForNonExistingProcessInstances" parameterType="java.util.Map" databaseId="oracle">
delete from ${prefix}ACT_HI_DETAIL HIDETAIL where HIDETAIL.PROC_INST_ID_ is not null and
NOT EXISTS (select PROCINST.ID_ from ${prefix}ACT_HI_PROCINST PROCINST where HIDETAIL.PROC_INST_ID_ = PROCINST.ID_)
</delete>
<delete id="bulkDeleteHistoricDetailForNonExistingProcessInstances" databaseId="h2" parameterType="java.util.Map">
delete from ${prefix}ACT_HI_DETAIL where PROC_INST_ID_ is not null and PROC_INST_ID_ != '' and
PROC_INST_ID_ NOT IN (select PROCINST.ID_ from ${prefix}ACT_HI_PROCINST PROCINST)
</delete>
<!-- HISTORIC DETAILS RESULTMAP -->
<resultMap id="historicDetailResultMap" type="org.flowable.engine.impl.persistence.entity.HistoricDetailEntityImpl">
<id property="id" column="ID_" jdbcType="VARCHAR" />
<result property="processInstanceId" column="PROC_INST_ID_" jdbcType="VARCHAR" />
<result property="activityInstanceId" column="ACT_INST_ID_" jdbcType="VARCHAR" />
<result property="executionId" column="EXECUTION_ID_" jdbcType="VARCHAR" />
<result property="taskId" column="TASK_ID_" jdbcType="VARCHAR" />
<result property="time" column="TIME_" jdbcType="TIMESTAMP" />
<discriminator javaType="string" column="TYPE_">
<case value="VariableUpdate" resultMap="historicVariableUpdateResultMap"/>
<case value="FormProperty" resultMap="historicFormPropertyResultMap"/>
</discriminator>
</resultMap>
<resultMap id="historicVariableUpdateResultMap" extends="historicDetailResultMap" type="org.flowable.engine.impl.persistence.entity.HistoricDetailVariableInstanceUpdateEntityImpl">
<result property="name" column="NAME_" javaType="String" jdbcType="VARCHAR" />
<result property="revision" column="REV_" jdbcType="INTEGER" />
<result property="variableType" column="VAR_TYPE_" javaType="org.flowable.variable.api.types.VariableType" jdbcType="VARCHAR"/>
<result property="activityId" column="ACTIVITY_ID_" jdbcType="VARCHAR" />
<result property="byteArrayRef" column="BYTEARRAY_ID_" typeHandler="ByteArrayRefTypeHandler" />
<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" />
</resultMap>
<resultMap id="historicFormPropertyResultMap" extends="historicDetailResultMap" type="org.flowable.engine.impl.persistence.entity.HistoricFormPropertyEntityImpl">
<result property="propertyId" column="NAME_" javaType="String" jdbcType="VARCHAR" />
<result property="propertyValue" column="TEXT_" javaType="String" jdbcType="VARCHAR"/>
</resultMap>
<!-- HISTORIC VARIABLE SELECT -->
<select id="selectHistoricDetailByProcessInstanceId" parameterType="org.flowable.common.engine.impl.db.ListQueryParameterObject" resultMap="historicDetailResultMap">
select * from ${prefix}ACT_HI_DETAIL
where PROC_INST_ID_ = #{parameter}
</select>
<select id="selectHistoricDetailByTaskId" parameterType="org.flowable.common.engine.impl.db.ListQueryParameterObject" resultMap="historicDetailResultMap">
select * from ${prefix}ACT_HI_DETAIL
where TASK_ID_ = #{parameter}
</select>
<select id="selectHistoricDetailsByQueryCriteria" parameterType="org.flowable.engine.impl.HistoricDetailQueryImpl" resultMap="historicDetailResultMap">
<if test="firstResult != null and firstResult >= 0">${limitBefore}</if>
select RES.* <if test="firstResult != null and firstResult >= 0">${limitBetween}</if>
<include refid="selectHistoricDetailsByQueryCriteriaSql"/>
${orderBy}
<if test="firstResult != null and firstResult >= 0">${limitAfter}</if>
</select>
<select id="selectHistoricDetailCountByQueryCriteria" parameterType="org.flowable.engine.impl.HistoricDetailQueryImpl" resultType="long">
select count(RES.ID_)
<include refid="selectHistoricDetailsByQueryCriteriaSql"/>
</select>
<sql id="selectHistoricDetailsByQueryCriteriaSql">
from ${prefix}ACT_HI_DETAIL RES
<where>
<if test="id != null">
RES.ID_ = #{id}
</if>
<if test="processInstanceId != null">
RES.PROC_INST_ID_ = #{processInstanceId}
</if>
<if test="executionId != null">
RES.EXECUTION_ID_ = #{executionId}
</if>
<if test="activityId != null">
and RES.ACT_INST_ID_ = #{activityId}
</if>
<if test="activityInstanceId != null">
and RES.ACT_INST_ID_ = #{activityInstanceId}
</if>
<choose>
<when test="taskId != null">
and RES.TASK_ID_ = #{taskId}
</when>
<otherwise>
<if test="excludeTaskRelated">
and RES.TASK_ID_ is null
</if>
</otherwise>
</choose>
<if test="type != null">
and RES.TYPE_ = #{type}
</if>
</where>
</sql>
<select id="selectHistoricDetailByNativeQuery" parameterType="java.util.Map" resultMap="historicDetailResultMap">
<include refid="org.flowable.engine.db.common.selectByNativeQuery"/>
</select>
<select id="selectHistoricDetailCountByNativeQuery" parameterType="java.util.Map" resultType="long">
${sql}
</select>
</mapper>