variable.mapping.xml 5.5 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 9
  <!-- VARIABLE INSTANCE INSERT -->
  
  <insert id="insertVariableInstance" parameterType="org.activiti.engine.impl.persistence.runtime.VariableInstanceEntity">
10
    insert into ACT_VARIABLE (ID_, REV_, TYPE_, NAME_, EXECUTION_ID_, TASK_ID_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_)
11
    values (
12 13 14 15 16 17 18 19 20 21
	    #{id, jdbcType=VARCHAR},
	    1,
	    #{type, jdbcType=VARCHAR },
	    #{name, jdbcType=VARCHAR},
	    #{executionId, jdbcType=VARCHAR},
	    #{taskId, jdbcType=VARCHAR},
	    #{byteArrayValueId, jdbcType=VARCHAR},
	    #{doubleValue, jdbcType=DOUBLE},
	    #{longValue, jdbcType=BIGINT},
	    #{textValue, jdbcType=VARCHAR}
22 23 24 25 26 27 28
    )
  </insert>
  
  <!-- VARIABLE INSTANCE UPDATE -->
  
  <update id="updateVariableInstance" parameterType="org.activiti.engine.impl.persistence.runtime.VariableInstanceEntity">
    update ACT_VARIABLE
29
    set 
30
      REV_ = #{revisionNext, jdbcType=INTEGER},
31 32 33 34
	    BYTEARRAY_ID_ = #{byteArrayValueId, jdbcType=VARCHAR},
	    DOUBLE_ = #{doubleValue, jdbcType=DOUBLE},
	    LONG_ = #{longValue, jdbcType=BIGINT},
	    TEXT_ = #{textValue, jdbcType=VARCHAR}
35
    where ID_ = #{id, jdbcType=VARCHAR}
36
      and REV_ = #{revision, jdbcType=INTEGER}
37 38 39 40 41 42 43 44 45
  </update>

  <!-- VARIABLE INSTANCE DELETE -->

  <delete id="deleteVariableInstance" parameterType="string">
    delete from ACT_VARIABLE where ID_ = #{id, jdbcType=VARCHAR}
  </delete>
  
  <!-- VARIABLE INSTANCE RESULTMAP -->
D
dsyer 已提交
46

47
	<resultMap id="variableInstanceResultMap" type="org.activiti.engine.impl.persistence.runtime.VariableInstanceEntity">
D
dsyer 已提交
48
		<id property="id" column="ID_" jdbcType="VARCHAR" />
49
    <result property="revision" column="REV_" jdbcType="INTEGER"/>
50
		<result property="type" column="TYPE_" javaType="org.activiti.engine.impl.variable.Type" jdbcType="VARCHAR"/>
D
dsyer 已提交
51 52 53 54 55 56 57 58 59 60 61
		<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>

62
  <!-- VARIABLE INSTANCE SELECT -->
D
dsyer 已提交
63 64 65 66

	<select id="selectVariableInstance" parameterType="string" resultMap="variableInstanceResultMap">
		select * from ACT_VARIABLE where ID_ =
		#{id, jdbcType=VARCHAR}
T
tombaeyens 已提交
67
  </select>
D
dsyer 已提交
68 69 70 71 72

	<select id="selectVariablesByExecutionId" parameterType="string" resultMap="variableInstanceResultMap">
		select * from ACT_VARIABLE where
		EXECUTION_ID_ = #{executionId,
		jdbcType=VARCHAR}
T
tombaeyens 已提交
73
  </select>
D
dsyer 已提交
74 75 76 77 78 79 80

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


81
  <!-- BYTE ARRAY INSERT -->
82

83
  <insert id="insertByteArray" parameterType="org.activiti.engine.impl.persistence.runtime.ByteArrayEntity">
84 85 86 87 88 89 90 91
    insert into ACT_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_)
    values (
      #{id, jdbcType=VARCHAR},
      1, 
      #{name, jdbcType=VARCHAR}, 
      #{bytes, jdbcType=BLOB}, 
      #{deploymentId, jdbcType=VARCHAR}
    )  
92 93
  </insert>
  
94 95
  <!-- BYTE ARRAY UPDATE -->

96
  <update id="updateByteArray" parameterType="org.activiti.engine.impl.persistence.runtime.ByteArrayEntity">
97 98
    update ACT_BYTEARRAY 
    set
99
      REV_ = #{revisionNext, jdbcType=INTEGER},
100 101
      BYTES_ = #{bytes, jdbcType=BLOB}
    where ID_ = #{id}
102
      and REV_ = #{revision, jdbcType=INTEGER}
103 104
  </update>
  
105 106
  <!-- BYTE ARRAY DELETE -->

107 108 109 110 111 112 113 114 115 116 117 118
  <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>

119 120 121 122
  <!-- BYTE ARRAY RESULTMAP -->
  
  <resultMap id="byteArrayResultMap" type="org.activiti.engine.impl.persistence.runtime.ByteArrayEntity">
    <id property="id" column="ID_" jdbcType="VARCHAR" />
123
    <result property="revision" column="REV_" jdbcType="INTEGER"/>
124 125 126 127 128 129
    <result property="name" column="NAME_" jdbcType="VARCHAR"/>
    <result property="bytes" column="BYTES_" jdbcType="BLOB"/>
  </resultMap>

  <!-- BYTE ARRAY SELECT -->
  
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
  <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 已提交
148
</mapper>