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. 算法中时间复杂度概括——o(1)、o(n)、o(logn)、o(nlogn)

    在描述算法复杂度时,经常用到 o(1), o(n), o(logn), o(nlogn) 来表示对应算法的时间复杂度, 这里进行归纳一下它们代表的含义:这是算法的时空复杂度的表示.不仅仅用于表示时间复 ...

  2. appium常见问题02_android内嵌H5页(webview)如何定位

    现在大多数app都是由原生页面和内嵌H5(即webview)组成,app原生页面直接定位即可,那内嵌H5页面要如何定位呢. 相信大多数人用appium做自动化时都有遇到这个问题,小编总结了下工作中该问 ...

  3. 【翻译】Knowledge-Aware Natural Language Understanding(摘要及目录)

    翻译Pradeep Dasigi的一篇长文 Knowledge-Aware Natural Language Understanding 基于知识感知的自然语言理解 摘要 Natural Langua ...

  4. [题解]Crazy Binary String-前缀和(2019牛客多校第三场B题)

    题目链接:https://ac.nowcoder.com/acm/contest/883/B 题意: 给你一段长度为n,且只有 ‘0’ 和 ‘1’ 组成的字符串 a[0,...,n-1].求子串中 ‘ ...

  5. CPU的架构:x86、arm、mips、龙芯等

    在公司经常听其他工程师讲x86,arm平台啥的,作为一个算法工程师,我听过却不知道这是啥!!!(汗颜) 现在偷偷学起: x86,arm,mips等这些都是CPU的架构,不管是手机电脑还是一些嵌入式的设 ...

  6. 记一次CentOS7进单用户模式修改密码的失败经历(faild to load SELinux policy freezing)

    背景:Cent SO7.4root用户密码忘记,根据https://www.linuxidc.com/Linux/2016-08/134034.htm提供的放法修改完密码之后系统启动后一直停留在转圈的 ...

  7. 七、OIDC

    在 OAuth 中,这些授权被称为scope. OpenID-Connect也有自己特殊的scope--openid , 它必须在第一次请求“身份鉴别服务器”(Identity Provider,简称 ...

  8. go语言从例子开始之Example18_1.结构体中定义方法

    Go 支持在结构体类型中定义方法 . Example: package main import "fmt" type product struct{ name string num ...

  9. Python3.5-20190507-廖老师-自我笔记-迭代

    可以使用for x in 数据 的那么 这个数据就是可迭代对象. 通过计算生成下一个值的数据就是生成器 可以使用next(数据) 来计算出下一个值的数据就是迭代器(生成器属于迭代器) -------- ...

  10. jQuery判断checkbox是否选中的4种方法

    方法一: ).checked) { // do something } 方法二: if($('#checkbox-id').is(':checked')) { // do something } 方法 ...