flowable 整合 springboot-凯发app官方网站

凯发app官方网站-凯发k8官网下载客户端中心 | | 凯发app官方网站-凯发k8官网下载客户端中心
  • 博客访问: 553802
  • 博文数量: 298
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 3077
  • 用 户 组: 普通用户
  • 注册时间: 2019-06-17 10:57
文章分类

(298)

  • (298)
文章存档

(96)

(201)

(1)

我的朋友
相关博文
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·

分类: java

2021-09-02 15:05:40

 1.pom

点击(此处)折叠或打开

  1. <parent>
  2.         <groupid>org.springframework.boot</groupid>
  3.         <artifactid>spring-boot-starter-parent</artifactid>
  4.         <version>2.5.2</version>
  5.         <relativepath /> <!-- lookup parent from repository -->
  6.     </parent>


  7.     <properties>
  8.         <project.build.sourceencoding>utf-8</project.build.sourceencoding>
  9.         <project.reporting.outputencoding>utf-8</project.reporting.outputencoding>
  10.         <java.version>1.8</java.version>
  11.         <flowable.version>6.6.0</flowable.version>
  12.     </properties>

  13.          <!--flowable工作流依赖-->
  14.         <dependency>
  15.             <groupid>org.flowable</groupid>
  16.             <artifactid>flowable-spring-boot-starter</artifactid>
  17.             <version>${flowable.version}</version>
  18.         </dependency>
  19.          <!-- https://mvnrepository.com/artifact/org.flowable/flowable-json-converter -->
  20.         <dependency>
  21.          <groupid>org.flowable</groupid>
  22.          <artifactid>flowable-json-converter</artifactid>
  23.          <version>${flowable.version}</version>
  24.         </dependency>
  25.         <!-- app 依赖 包含 rest,logic,conf -->
  26.         <dependency>
  27.          <groupid>org.flowable</groupid>
  28.          <artifactid>flowable-ui-modeler-rest</artifactid>
  29.          <version>${flowable.version}</version>
  30.         </dependency>
  31.         <dependency>
  32.          <groupid>org.flowable</groupid>
  33.          <artifactid>flowable-ui-modeler-logic</artifactid>
  34.          <version>${flowable.version}</version>
  35.          <exclusions>
  36.          <exclusion>
  37.          <groupid>org.apache.logging.log4j</groupid>
  38.          <artifactid>log4j-slf4j-impl</artifactid>
  39.          </exclusion>
  40.          </exclusions>
  41.         </dependency>
  42.         <dependency>
  43.          <groupid>org.flowable</groupid>
  44.          <artifactid>flowable-ui-modeler-conf</artifactid>
  45.          <version>${flowable.version}</version>
  46.         </dependency>


2. flowableconfig配置类

点击(此处)折叠或打开

  1. package org.fh.config;

  2. import org.flowable.spring.springprocessengineconfiguration;
  3. import org.flowable.spring.boot.engineconfigurationconfigurer;
  4. import org.springframework.context.annotation.configuration;
  5. import org.springframework.stereotype.controller;

  6. /**
  7.  * 说明:flowable配置
  8.  * 作者:fh admin
  9.  * from:fhadmin.cn
  10.  */
  11. @controller
  12. @configuration
  13. public class flowableconfig implements engineconfigurationconfigurer<springprocessengineconfiguration> {
  14.     
  15.     @override
  16.     public void configure(springprocessengineconfiguration engineconfiguration) {
  17.         engineconfiguration.setactivityfontname("宋体");
  18.         engineconfiguration.setlabelfontname("宋体");
  19.         engineconfiguration.setannotationfontname("宋体");
  20.     }
  21.     
  22. }


3.重写 securityutils 重构流程编辑器获取用户信息

点击(此处)折叠或打开

  1. package org.flowable.ui.common.security;

  2. import org.fh.util.jurisdiction;
  3. import org.flowable.common.engine.api.flowableillegalstateexception;
  4. import org.flowable.idm.api.user;
  5. import org.flowable.ui.common.model.remoteuser;
  6. import org.springframework.security.core.authentication;
  7. import org.springframework.security.core.context.securitycontext;
  8. import org.springframework.security.core.context.securitycontextholder;

  9. import java.util.arraylist;
  10. import java.util.list;

  11. /**
  12.  * 说明:重构流程编辑器获取用户信息
  13.  * 作者:fh admin
  14.  * from:fhadmin.cn
  15.  */
  16. public class securityutils {

  17.     private static user assumeuser;
  18.     
  19.     private static securityscopeprovider securityscopeprovider = new flowablesecurityscopeprovider();

  20.     private securityutils() {
  21.     }

  22.     /**
  23.      * get the login of the current user.
  24.      */
  25.     public static string getcurrentuserid() {
  26.         user user = getcurrentuserobject();
  27.         if (user != null) {
  28.             return user.getid();
  29.         }
  30.         return null;
  31.     }

  32.     /**
  33.      * @return the {@link user} object associated with the current logged in user.
  34.      */
  35.     public static user getcurrentuserobject() {
  36.         if (assumeuser != null) {
  37.             return assumeuser;
  38.         }

  39.         remoteuser user = new remoteuser();
  40.         user.setid(jurisdiction.getusername());
  41.         user.setdisplayname(jurisdiction.getname());
  42.         user.setfirstname(jurisdiction.getname());
  43.         user.setlastname(jurisdiction.getname());
  44.         user.setemail("admin@flowable.com");
  45.         user.setpassword("123456");
  46.         list<string> pris = new arraylist<>();
  47.         pris.add(defaultprivileges.access_modeler);
  48.         pris.add(defaultprivileges.access_idm);
  49.         pris.add(defaultprivileges.access_admin);
  50.         pris.add(defaultprivileges.access_task);
  51.         pris.add(defaultprivileges.access_rest_api);
  52.         user.setprivileges(pris);
  53.         return user;
  54.     }
  55.     
  56.     public static void setsecurityscopeprovider(securityscopeprovider securityscopeprovider) {
  57.         securityutils.securityscopeprovider = securityscopeprovider;
  58.     }

  59.     public static securityscope getcurrentsecurityscope() {
  60.         securitycontext securitycontext = securitycontextholder.getcontext();
  61.         if (securitycontext != null && securitycontext.getauthentication() != null) {
  62.             return getsecurityscope(securitycontext.getauthentication());
  63.         }
  64.         return null;
  65.     }

  66.     public static securityscope getsecurityscope(authentication authentication) {
  67.         return securityscopeprovider.getsecurityscope(authentication);
  68.     }

  69.     public static securityscope getauthenticatedsecurityscope() {
  70.         securityscope currentsecurityscope = getcurrentsecurityscope();
  71.         if (currentsecurityscope != null) {
  72.             return currentsecurityscope;
  73.         }
  74.         throw new flowableillegalstateexception("user is not authenticated");
  75.     }

  76.     public static void assumeuser(user user) {
  77.         assumeuser = user;
  78.     }

  79.     public static void clearassumeuser() {
  80.         assumeuser = null;
  81.     }
  82. }


阅读(5312) | 评论(0) | 转发(0) |
0

上一篇:

下一篇:

给主人留下些什么吧!~~
")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
网站地图