act_id_group:存放组信息
act_id_membership:存放用户与组的相关信息
act_id_user:存放用户
act_id_info:存放用户个人信息
act_id_tenant:存放租户信息
act_id_tenant_member:存放租户与用户或者组的相关信息 /**
* 操作用户
*/
public class ZccIdentifuService {
IdentityService identityService;
@Before
public void init(){
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("camunda.cfg.xml");
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
identityService = processEngine.getIdentityService();
System.out.println("identityService:"+identityService);
}
@Test
public void getIdentityService(){
init();
} /**
* insert into ACT_ID_USER (ID_, FIRST_, LAST_, EMAIL_, PWD_, SALT_, REV_) values ( ?, ?, ?, ?, ?, ?, 1 ) Update counts: [1]
* Parameters: zcc1(String), zcc(String), zcc(String), zcc@qq.com(String), 1(String), 1(String)
*/
@Test
public void saveUser(){
UserEntity userEntity=new UserEntity();
userEntity.setId("zcc1");
userEntity.setEmail("zcc@qq.com");
userEntity.setFirstName("zcc");
userEntity.setLastName("zcc");
userEntity.setDbPassword("1");
userEntity.setSalt("1");
identityService.saveUser(userEntity);
}
@Test
public void saveUser2(){
UserEntity userEntity=new UserEntity();
userEntity.setId("zcc2");
userEntity.setEmail("zcc2@qq.com");
userEntity.setFirstName("zcc");
userEntity.setLastName("zcc");
userEntity.setPassword("1");
identityService.saveUser(userEntity);
} /**
* select distinct RES.* from ACT_ID_USER RES order by RES.ID_ asc LIMIT ? OFFSET ?
*/
@Test
public void createUserQuery(){
UserQuery userQuery = identityService.createUserQuery();
List<User> list = userQuery.list();
for (int i=0;i<list.size();i++){
User user = list.get(i);
System.out.println(user.getFirstName());
System.out.println(user.getLastName());
System.out.println(user.getId());
System.out.println(user.getPassword());
System.out.println(user.getEmail());
} } /**
* select distinct RES.* from ACT_ID_USER RES WHERE RES.ID_ in ( ? , ? ) order by RES.ID_ asc LIMIT ? OFFSET ?
*/
@Test
public void createUserQuery2(){
UserQuery userQuery = identityService.createUserQuery();
List<User> list = userQuery.userIdIn("zcc1","zcc2").
list();
for (int i=0;i<list.size();i++){
User user = list.get(i);
System.out.println(user.getFirstName());
System.out.println(user.getLastName());
System.out.println(user.getId());
System.out.println(user.getPassword());
System.out.println(user.getEmail());
} } /**
* select distinct RES.* from ACT_ID_USER RES order by RES.ID_ asc LIMIT ? OFFSET ?
* Parameters: 3(Integer), 0(Integer)
*/
@Test
public void listPage(){
int maxResult=3;
int fistResult=maxResult*(1-1);
UserQuery userQuery = identityService.createUserQuery();
List<User> list = userQuery.listPage(fistResult,maxResult);
for (int i=0;i<list.size();i++){
User user = list.get(i);
System.out.println(user.getFirstName());
System.out.println(user.getLastName());
System.out.println(user.getId());
System.out.println(user.getPassword());
System.out.println(user.getEmail());
} } /**
* delete from ACT_ID_USER where ID_ = ? and REV_ = ?
* delete from ACT_ID_MEMBERSHIP where USER_ID_ = ? Update counts: [0]
* Result 1: delete from ACT_ID_TENANT_MEMBER where USER_ID_ = ? Update counts: [0]
* Result 2: delete from ACT_ID_USER where ID_ = ? and REV_ = ? Update counts: [1]
*/
@Test
public void deleteUser(){
String userId="zcc1";
identityService.deleteUser(userId); } /**
* insert into ACT_ID_GROUP (ID_, NAME_, TYPE_, REV_) values ( ?, ?, ?, 1 )
* Parameters: group1(String), 项目1(String), 工作流(String)
*/
@Test
public void saveGroup(){
GroupEntity groupEntity=new GroupEntity();
groupEntity.setId("group1");
groupEntity.setName("项目1");
groupEntity.setType("工作流");
identityService.saveGroup(groupEntity);
} /**
* select distinct RES.* from ACT_ID_GROUP RES order by RES.ID_ asc LIMIT ? OFFSET ?
* 组查询可以和用户查询一样添加查询条件
*/
@Test
public void createGroupQuery(){ GroupQuery groupQuery = identityService.createGroupQuery();
List<Group> list = groupQuery.list();
for (int i=0;i<list.size();i++){
Group group = list.get(i);
System.out.println(group.getId());
System.out.println(group.getName());
System.out.println(group.getType());
}
} /**
* 创建组和用户的联系
* insert into ACT_ID_MEMBERSHIP (USER_ID_, GROUP_ID_) values ( ?, ? )
*/
@Test
public void createMembership(){
String userId="zcc2";String groupId="group1";
identityService.createMembership(userId,groupId);
} /**
* delete from ACT_ID_GROUP where ID_ = ? and REV_ = ?
* delete from ACT_ID_MEMBERSHIP where GROUP_ID_ = ? Update counts: [1]
* delete from ACT_ID_TENANT_MEMBER where GROUP_ID_ = ? Update counts: [0]
*delete from ACT_ID_GROUP where ID_ = ? and REV_ = ? Update counts: [1]
*/
@Test
public void deleteGroup(){
String groupId="group1";
identityService.deleteGroup(groupId);
} /**
* 租户存在的目的就是区分不同的系统,A系统和B系统的用户是不一样的,所以要区分
* insert into ACT_ID_TENANT (ID_, NAME_, REV_) values ( ?, ?, 1 )
* Parameters: A(String), A系统(String)
*/
@Test
public void saveTenant(){
TenantEntity tenantEntity=new TenantEntity();
tenantEntity.setId("A");
tenantEntity.setName("A系统");
identityService.saveTenant(tenantEntity);
} /**
* 租户和用户
* insert into ACT_ID_TENANT_MEMBER (ID_, TENANT_ID_, USER_ID_, GROUP_ID_) values ( ?, ?, ?, ? )
* Parameters: 101(String), A(String), zcc2(String), null
*/
@Test
public void createTenantUserMembership(){
String tenantId="A";String userId="zcc2";
identityService.createTenantUserMembership(tenantId,userId);
} /**
* 租户和组
* insert into ACT_ID_TENANT_MEMBER (ID_, TENANT_ID_, USER_ID_, GROUP_ID_) values ( ?, ?, ?, ? )
* 201(String), A(String), null, group1(String)
*/
@Test
public void createTenantGroupMembership(){
String tenantId="A";String groupId="group1";
identityService.createTenantGroupMembership(tenantId,groupId);
} /**
* 查询租户下面有哪些用户
* select distinct RES.* from ACT_ID_USER RES inner join ACT_ID_TENANT_MEMBER TM on RES.ID_ = TM.USER_ID_ WHERE TM.TENANT_ID_ = ? order by RES.ID_ asc LIMIT ? OFFSET ?
* Parameters: A(String), 2147483647(Integer), 0(Integer)
*/
@Test
public void createUserQueryMemberOfTenant(){
String tenantId="A";
UserQuery userQuery = identityService.createUserQuery();
List<User> list = userQuery.memberOfTenant(tenantId).list();
for (int i=0;i<list.size();i++){
User user = list.get(i);
System.out.println(user.getFirstName());
System.out.println(user.getLastName());
System.out.println(user.getId());
System.out.println(user.getPassword());
System.out.println(user.getEmail());
}
}
/**
* 查询租户下面有哪些组
*select distinct RES.* from ACT_ID_GROUP RES inner join ACT_ID_TENANT_MEMBER TM on RES.ID_ = TM.GROUP_ID_ WHERE TM.TENANT_ID_ = ? order by RES.ID_ asc LIMIT ? OFFSET ?
* Parameters: A(String), 2147483647(Integer), 0(Integer)
*/
@Test
public void createGroupQueryMemberOfTenant(){
String tenantId="A";
GroupQuery groupQuery = identityService.createGroupQuery();
List<Group> list = groupQuery.memberOfTenant(tenantId).list();
for (int i=0;i<list.size();i++){
Group group = list.get(i);
System.out.println(group.getId());
System.out.println(group.getName());
System.out.println(group.getType());
}
} /**
* 添加用户相关信息
* insert into ACT_ID_INFO (ID_, USER_ID_, TYPE_, KEY_, VALUE_, PASSWORD_, PARENT_ID_, REV_) values ( ?, ?, ?, ?, ?, ?, ?, 1 )
* Parameters: 301(String), zcc2(String), account(String), zccAccountName(String), zccAccountUsername(String), java.io.ByteArrayInputStream@5ef0d29e(ByteArrayInputStream), null
*/
@Test
public void setUserAccount(){
String userId="zcc2";
String userPassword="1";
String accountName="zccAccountName";
String accountUsername="zccAccountUsername";
String accountPassword="zccAccountPassword";
Map<String, String> accountDetails=new HashMap<>();
accountDetails.put("a","a");
identityService.setUserAccount(userId,userPassword,accountName,accountUsername,accountPassword,accountDetails); } /**
* 查询用户相关信息
* select * from ACT_ID_INFO where USER_ID_ = ? and KEY_ = ? and PARENT_ID_ is null
* Parameters: zcc2(String), zccAccountName(String)
*/
@Test
public void getUserAccount(){
String userId="zcc2";
String userPassword="1";
String accountName="zccAccountName";
Account userAccount = identityService.getUserAccount(userId, userPassword, accountName);
System.out.println("@@@@@");
System.out.println(userAccount);
} @Test
public void setUserInfo(){
String userId="zcc2";
String key="b";
String value="b";
// void setUserInfo(String userId, String key, String value);
identityService.setUserInfo(userId,key,value);
} /**
* 添加用户图像信息
* insert into ACT_ID_INFO (ID_, USER_ID_, TYPE_, KEY_, VALUE_, PASSWORD_, PARENT_ID_, REV_) values ( ?, ?, ?, ?, ?, ?, ?, 1 )
* Parameters: 501(String), zcc2(String), null, picture(String), 502(String), null, null
* insert into ACT_GE_BYTEARRAY(ID_, NAME_, BYTES_, DEPLOYMENT_ID_, TENANT_ID_, TYPE_, CREATE_TIME_, ROOT_PROC_INST_ID_, REMOVAL_TIME_, REV_) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, 1 )
* Parameters: 502(String), jpg(String), java.io.ByteArrayInputStream@58bf8650(ByteArrayInputStream), null, null, 1(Integer), 2019-10-07 01:56:06.029(Timestamp), null, null
*/
@Test
public void setUserPicture(){
String userId="zcc2";
/**
* public Picture(byte[] bytes, String mimeType) {
* this.bytes = bytes;
* this.mimeType = mimeType;
* }
*/
byte[] bytes = IoUtil.fileAsByteArray(new File("src/main/resources/2.jpg"));
Picture picture=new Picture(bytes,"jpg");
//void setUserPicture(String userId, Picture picture);
identityService.setUserPicture(userId,picture);
}
}

camunda用户的一些简单操作的更多相关文章

  1. camunda授权的一些简单操作

    /** * 授权操作 */public class ZccAuthorizationService { AuthorizationService authorizationService; @Befo ...

  2. PLSQL命令行创建用户 以及 JDBC简单操作

    目录 PLSQL Developer命令行创建用户以及表 课堂要点 ​ JDBC 主外键约束 踩坑之路 设置ORACLE_HOME环境变量 PLSQL Developer命令行创建用户以及表 打开Co ...

  3. AngularJs学习——模拟用户登录的简单操作

    效果截图:

  4. camunda任务的一些简单操作

    public class ZccTaskService { TaskService taskService; @Before public void init(){ ProcessEngineConf ...

  5. salesforce 零基础学习(五十一)使用 Salesforce.com SOAP API 实现用户登录以及简单的增删改查(JAVA访问salesforce)

    此篇请参看:https://resources.docs.salesforce.com/202/latest/en-us/sfdc/pdf/salesforce_developer_environme ...

  6. Headroom.js – 快速响应用户的页面滚动操作

    Headroom.js 是一个轻量级,高性能的JS插件(无依赖性!),允许你响应用户的滚动行为.Headroom.js 使您能够在适当的时候把元素融入视图,而其它时候让内容成为焦点.Headroom. ...

  7. python(pymysql)之mysql简单操作

    一.mysql简单介绍 说到数据库,我们大多想到的是关系型数据库,比如mysql.oracle.sqlserver等等,这些数据库软件在windows上安装都非常的方便,在Linux上如果要安装数据库 ...

  8. ZooKeeper系列3:ZooKeeper命令、命令行工具及简单操作

    问题导读1.ZooKeeper包含哪些常用命令?2.通过什么命令可以列出服务器 watch 的详细信息?3.ZooKeeper包含哪些操作?4.ZooKeeper如何创建zookeeper? 常用命令 ...

  9. ORACLE的安装与网页版创建表空间的简单操作以及PLsql的简单操作

    1.oracle的安装: 安装简单易学,在这里不做解释.下载看装包后耐心等待,注意安装目录不要有中文字符,尽量按照指定目录进行安装.安装完成后会占用有大约5g的内存. 如果要卸载oracle,需要用其 ...

随机推荐

  1. lr 计算字符串长度

    sizeof求后面的内容or表达式所占用的字节数 strlen求字符串的有效长度,只要遇到'\0'就认为字符串结束 字符串转化为int型变量 Action2() { int j = 0; j = at ...

  2. Spring Boot & Redis 用起来真简单!

    作者:java_老男孩  https://blog.51cto.com/14230003/2368721 Redis 是目前业界使用最广泛的内存数据存储.相比 Memcached,Redis 支持更丰 ...

  3. 什么是Kotlin?Java的替代语言?

    什么是Kotlin Kotlin是一个基于JVM的新的编程语言,2010年由IntelliJ IDEA所在的JetBrains公司开发,自2012年以来一直开源. Kotlin可以编译成Java字节码 ...

  4. 同一台机器上有多个Python版本?

    有关Python网站上的官方文档,如何在Linux上的同一台机器上安装和运行多个版本的Python? 我可以找到大量的博客帖子和答案,但我想知道是否有“标准”官方方式这样做? 或者这完全取决于操作系统 ...

  5. 从零开始做一个Jmeter性能测试

    安装Jmeter 1.下载地址http://jmeter.apache.org/download_jmeter.cgi 2.解压下载文件,然后将bin目录添加到系统环境变量PATH里. 3.确保已安装 ...

  6. 模拟javaWeb责任链的设计

    这篇文章介绍了责任链模式的应用:本文介绍如果自己实现一个责任链 定义请求和响应信息 简单定义请求类Request(封装一个字符串) public class Request { String requ ...

  7. elasticsearch 关联单词查询以及Shingles

    Shingle Token Filter A token filter of type shingle that constructs shingles (token n-grams) from a ...

  8. 彩彩只能变身队团队项目进展记录by后端

    2018.06.03 早上8:00-晚上8:00 后端小组一起在图书馆四楼边学边做: 1.首先搞定了数据库,学会了怎样用命令行来操作数据库,并且建立了一个用户表. 2.然后自己设计了一个简陋的前端页面 ...

  9. Tmux 中开启鼠标选择与复制

    在 tmux.conf 中加入下列设置(tmux 2.1 之前的版本): set -g mode-mouse on set -g mouse-resize-pane on set -g mouse-s ...

  10. 理解Java主函数中的"String[] args"

    public class Understand_String_args { public static void main(String[] args) { System.out.printf(&qu ...