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

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

There is a newer version: 7.22.0-alpha5
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.persistence.entity.UserEntity">

  <!-- USER INSERT -->

  <insert id="insertUser" parameterType="org.camunda.bpm.engine.impl.persistence.entity.UserEntity">
    insert into ${prefix}ACT_ID_USER (ID_, FIRST_, LAST_, EMAIL_, PWD_, SALT_, REV_)
    values (
      #{id ,jdbcType=VARCHAR},
      #{firstName ,jdbcType=VARCHAR},
      #{lastName ,jdbcType=VARCHAR},
      #{email ,jdbcType=VARCHAR},
      #{password ,jdbcType=VARCHAR},
      #{salt ,jdbcType=VARCHAR},
      1
    )
  </insert>

  <!-- USER UPDATE -->

  <update id="updateUser" parameterType="org.camunda.bpm.engine.impl.persistence.entity.UserEntity">
    update ${prefix}ACT_ID_USER set
      REV_ = #{revisionNext ,jdbcType=INTEGER},
      FIRST_ = #{firstName ,jdbcType=VARCHAR},
      LAST_ = #{lastName ,jdbcType=VARCHAR},
      EMAIL_ = #{email ,jdbcType=VARCHAR},
      PWD_ = #{password ,jdbcType=VARCHAR},
      SALT_ = #{salt ,jdbcType=VARCHAR}
    where ID_ = #{id}
      and REV_ = #{revision}
  </update>
  
  <update id="updateUserLock" parameterType="org.camunda.bpm.engine.impl.persistence.entity.UserEntity">
    update ${prefix}ACT_ID_USER set
      REV_ = #{revisionNext ,jdbcType=INTEGER},
      LOCK_EXP_TIME_ = #{lockExpirationTime ,jdbcType=TIMESTAMP},
      ATTEMPTS_ = #{attempts ,jdbcType=INTEGER}
    where ID_ = #{id}
      and REV_ = #{revision}
  </update>
  
  <!-- USER DELETE -->

  <delete id="deleteUser" parameterType="org.camunda.bpm.engine.impl.persistence.entity.UserEntity">
    delete from ${prefix}ACT_ID_USER where ID_ = #{id} and REV_ = #{revision}
  </delete>

  <!-- USER RESULTMAP -->

  <resultMap id="userResultMap" type="org.camunda.bpm.engine.impl.persistence.entity.UserEntity">
    <id property="id" column="ID_" jdbcType="VARCHAR" />
    <result property="revision" column="REV_" jdbcType="INTEGER" />
    <result property="firstName" column="FIRST_" jdbcType="VARCHAR" />
    <result property="lastName" column="LAST_" jdbcType="VARCHAR" />
    <result property="email" column="EMAIL_" jdbcType="VARCHAR" />
    <result property="dbPassword" column="PWD_" jdbcType="VARCHAR" />
    <result property="salt" column="SALT_" jdbcType="VARCHAR" />
    <result property="lockExpirationTime" column="LOCK_EXP_TIME_" jdbcType="TIMESTAMP" />
    <result property="attempts" column="ATTEMPTS_" jdbcType="INTEGER" />
  </resultMap>
  
  <!-- USER SELECT -->

  <select id="selectUser" parameterType="string" resultMap="userResultMap">
    select * from ${prefix}ACT_ID_USER where ID_ = #{id,jdbcType=VARCHAR}
  </select>
    
  <select id="selectUserByQueryCriteria" parameterType="org.camunda.bpm.engine.impl.UserQueryImpl" resultMap="userResultMap">
  	<include refid="org.camunda.bpm.engine.impl.persistence.entity.Commons.bindOrderBy"/>
    ${limitBefore}
    select ${distinct} RES.* 
    ${limitBetween}
    <include refid="selectUserByQueryCriteriaSql" />
    ${orderBy}
    ${limitAfter}
  </select>
  
   <select id="selectUserCountByQueryCriteria" parameterType="org.camunda.bpm.engine.impl.UserQueryImpl" resultType="long">
    ${countDistinctBeforeStart} RES.ID_ ${countDistinctBeforeEnd}
    <include refid="selectUserByQueryCriteriaSql" />
    ${countDistinctAfterEnd}
  </select>
  
  <sql id="selectUserByQueryCriteriaSql">

    from ${prefix}ACT_ID_USER RES 
    <if test="groupId != null">
      inner join ${prefix}ACT_ID_MEMBERSHIP M on RES.ID_ = M.USER_ID_
      inner join ${prefix}ACT_ID_GROUP G on M.GROUP_ID_ = G.ID_
    </if>
    <if test="tenantId != null">
      inner join ${prefix}ACT_ID_TENANT_MEMBER TM on RES.ID_ = TM.USER_ID_
    </if>
    
    <include refid="org.camunda.bpm.engine.impl.persistence.entity.AuthorizationEntity.authCheckJoin" /> 
    
    <where>
      <if test="id != null">
        RES.ID_ = #{id}
      </if>
      <if test="ids != null &amp;&amp; ids.length > 0">
        and RES.ID_ in
        <foreach item="item" index="index" collection="ids"
                 open="(" separator="," close=")">
          #{item}
        </foreach>
      </if>
      <if test="firstName != null">
        and RES.FIRST_ = #{firstName}
      </if>
      <if test="firstNameLike != null">
        and RES.FIRST_ like #{firstNameLike} ESCAPE ${escapeChar}
      </if>
      <if test="lastName != null">
        and RES.LAST_ = #{lastName}
      </if>
      <if test="lastNameLike != null">
        and RES.LAST_ like #{lastNameLike} ESCAPE ${escapeChar}
      </if>
      <if test="email != null">
        and RES.EMAIL_ = #{email}
      </if>
      <if test="emailLike != null">
        and RES.EMAIL_ like #{emailLike} ESCAPE ${escapeChar}
      </if>
      <if test="groupId != null">
        and G.ID_ = #{groupId}
      </if>
      <if test="procDefId != null">
        and exists (select ID_ from ${prefix}ACT_RU_IDENTITYLINK where PROC_DEF_ID_ = #{procDefId} and USER_ID_=RES.ID_ )
      </if>
      <if test="tenantId != null">
        and TM.TENANT_ID_ = #{tenantId}
      </if>      
      
      <include refid="org.camunda.bpm.engine.impl.persistence.entity.AuthorizationEntity.queryAuthorizationCheck" />
      
    </where>
  </sql>

  <select id="selectUserByNativeQuery" parameterType="java.util.Map" resultMap="userResultMap">
    <if test="resultType == 'LIST_PAGE'">
      ${limitBefore}
    </if>
    ${sql}
    <if test="resultType == 'LIST_PAGE'">
      ${limitAfter}
    </if>
  </select>

  <select id="selectUserByNativeQuery_mssql_or_db2" parameterType="java.util.Map" resultMap="userResultMap">
    <if test="resultType == 'LIST_PAGE'">
      ${limitBeforeNativeQuery}
    </if>
    ${sql}
    <if test="resultType == 'LIST_PAGE'">
      ${limitAfter}
    </if>
  </select>

  <select id="selectUserCountByNativeQuery" parameterType="java.util.Map" resultType="long">
    ${sql}
  </select>
  
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy