variable.mapping.xml 4.9 KB
Newer Older
T
tombaeyens 已提交
1 2
<?xml version="1.0" encoding="UTF-8" ?> 

D
dsyer 已提交
3 4
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

T
tombaeyens 已提交
5
<mapper namespace="org.activiti.persistence">
D
dsyer 已提交
6 7 8

	<!-- RESULTMAP -->

9
	<resultMap id="variableInstanceResultMap" type="org.activiti.engine.impl.variable.VariableInstance">
D
dsyer 已提交
10
		<id property="id" column="ID_" jdbcType="VARCHAR" />
11
		<result property="type" column="TYPE_" javaType="org.activiti.engine.impl.variable.Type" jdbcType="VARCHAR"/>
D
dsyer 已提交
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
		<result property="name" column="NAME_" javaType="String" jdbcType="VARCHAR" />
		<result property="processDefinitionId" column="PROC_DEF_ID_" jdbcType="VARCHAR" />
		<result property="activityId" column="ACTIVITY_ID_" jdbcType="VARCHAR" />
		<result property="isActive" column="IS_ACTIVE_" jdbcType="BOOLEAN" />
		<result property="isConcurrencyScope" column="IS_CONCURRENCY_SCOPE_" jdbcType="BOOLEAN" />
		<result property="byteArrayValueId" column="BYTEARRAY_ID_" />
		<result property="doubleValue" column="DOUBLE_" />
		<result property="textValue" column="TEXT_" />
		<result property="longValue" column="LONG_" />
	</resultMap>

	<!-- SELECT -->

	<select id="selectVariableInstance" parameterType="string" resultMap="variableInstanceResultMap">
		select * from ACT_VARIABLE where ID_ =
		#{id, jdbcType=VARCHAR}
T
tombaeyens 已提交
28
  </select>
D
dsyer 已提交
29 30 31 32 33

	<select id="selectVariablesByExecutionId" parameterType="string" resultMap="variableInstanceResultMap">
		select * from ACT_VARIABLE where
		EXECUTION_ID_ = #{executionId,
		jdbcType=VARCHAR}
T
tombaeyens 已提交
34
  </select>
D
dsyer 已提交
35 36 37 38 39 40 41 42

	<select id="selectVariablesByTaskId" parameterType="string" resultMap="variableInstanceResultMap">
		select * from ACT_VARIABLE where TASK_ID_
		= #{executionId, jdbcType=VARCHAR}
	</select>

	<!-- INSERT -->

43
	<insert id="insertVariableInstance" parameterType="org.activiti.engine.impl.variable.VariableInstance">
D
dsyer 已提交
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
		insert into ACT_VARIABLE (ID_, REV_, TYPE_, NAME_,
		EXECUTION_ID_, TASK_ID_,
		BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_)
		values (
		#{id, jdbcType=VARCHAR},
		#{revision,
		jdbcType=INTEGER},
		#{type, jdbcType=VARCHAR },
		#{name, jdbcType=VARCHAR},
		#{executionId, jdbcType=VARCHAR},
		#{taskId,
		jdbcType=VARCHAR},
		#{byteArrayValueId, jdbcType=VARCHAR},
		#{doubleValue, jdbcType=DOUBLE},
		#{longValue, jdbcType=BIGINT},
		#{textValue, jdbcType=VARCHAR}
		)
T
tombaeyens 已提交
61 62
  </insert>

D
dsyer 已提交
63 64
	<!-- UPDATE -->

65
	<update id="updateVariableInstance" parameterType="org.activiti.engine.impl.variable.VariableInstance">
D
dsyer 已提交
66 67 68 69 70 71 72 73 74
		update ACT_VARIABLE
		set BYTEARRAY_ID_ = #{byteArrayValueId,
		jdbcType=VARCHAR},
		DOUBLE_ = #{doubleValue, jdbcType=DOUBLE},
		LONG_ = #{longValue, jdbcType=BIGINT},
		TEXT_ = #{textValue,
		jdbcType=VARCHAR}
		where ID_ = #{id, jdbcType=VARCHAR}
		and REV_ = #{revision, jdbcType=INTEGER}
T
tombaeyens 已提交
75
  </update>
D
dsyer 已提交
76 77 78 79 80 81 82

	<!-- DELETE -->

	<delete id="deleteVariableInstance" parameterType="string">
		delete from ACT_VARIABLE where ID_ = #{id, jdbcType=VARCHAR}
	</delete>

83
  <!-- ByteArrayImpl -->
84
  
85
  <resultMap id="byteArrayResultMap" type="org.activiti.engine.impl.persistence.runtime.ByteArrayImpl">
86 87 88 89 90
    <id property="id" column="ID_" jdbcType="VARCHAR" />
    <result property="name" column="NAME_" jdbcType="VARCHAR"/>
    <result property="bytes" column="BYTES_" jdbcType="BLOB"/>
  </resultMap>

91
  <insert id="insertByteArray" parameterType="org.activiti.engine.impl.persistence.runtime.ByteArrayImpl">
92 93 94 95
    insert into ACT_BYTEARRAY(ID_, NAME_, BYTES_, DEPLOYMENT_ID_)
    values (#{id, jdbcType=VARCHAR}, #{name, jdbcType=VARCHAR}, #{bytes, jdbcType=BLOB}, #{deploymentId, jdbcType=VARCHAR})  
  </insert>
  
96
  <update id="updateByteArray" parameterType="org.activiti.engine.impl.persistence.runtime.ByteArrayImpl">
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
    update ACT_BYTEARRAY 
    set
      BYTES_ = #{bytes, jdbcType=BLOB}
    where ID_ = #{id}
  </update>
  
  <select id="selectBytesOfByteArray" parameterType="string" resultType="hashmap">
    select BYTES_ from ACT_BYTEARRAY where ID_ = #{id}
  </select>
  
  <delete id="deleteByteArraysForDeployment" parameterType="string">
    delete from ACT_BYTEARRAY where DEPLOYMENT_ID_ = #{id}
  </delete>
  
  <delete id="deleteByteArray" parameterType="string">
    delete from ACT_BYTEARRAY where ID_ = #{id}
  </delete>

  <select id="selectByteArrayById" parameterType="string" resultMap="byteArrayResultMap">
   select * from ACT_BYTEARRAY where ID_ = #{id}
  </select>
  
  <select id="selectByteArraysForDeployment" parameterType="string" resultMap="byteArrayResultMap">
    select * from ACT_BYTEARRAY where DEPLOYMENT_ID_ = #{deploymentId} order by NAME_ asc
  </select>  
  
  <select id="selectResourceNamesForDeployment" parameterType="string" resultType="string">
    select NAME_ from ACT_BYTEARRAY where DEPLOYMENT_ID_ = #{deploymentId} order by NAME_ asc
  </select>
  
  <select id="selectDeploymentResource" parameterType="map" resultMap="byteArrayResultMap">
    select * from ACT_BYTEARRAY 
    where DEPLOYMENT_ID_ = #{deploymentId}
          AND NAME_ = #{resourceName}
  </select>

T
tombaeyens 已提交
133
</mapper>