当前位置: 首页>>代码示例>>Java>>正文


Java Group.setType方法代码示例

本文整理汇总了Java中org.activiti.engine.identity.Group.setType方法的典型用法代码示例。如果您正苦于以下问题:Java Group.setType方法的具体用法?Java Group.setType怎么用?Java Group.setType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.identity.Group的用法示例。


在下文中一共展示了Group.setType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initUserGroupTest

import org.activiti.engine.identity.Group; //导入方法依赖的package包/类
@Test
public void initUserGroupTest() {

	// deptLeader
	Group deptLeader = this.identityService.newGroup("deptLeader");
	deptLeader.setName("部门领导");
	deptLeader.setType("candidate");
	identityService.saveGroup(deptLeader);

	// hr
	Group hr = this.identityService.newGroup("hr");
	hr.setName("人事部领导");
	hr.setType("candidate");
	identityService.saveGroup(hr);

	User admin = this.identityService.newUser("admin");
	admin.setFirstName("xia");
	admin.setLastName("liang");
	admin.setEmail("[email protected]");
	identityService.saveUser(admin);

	identityService.createMembership("admin", "deptLeader");
	identityService.createMembership("admin", "hr");

}
 
开发者ID:KayuraTeam,项目名称:kayura-activiti,代码行数:26,代码来源:InitUserGroupTest.java

示例2: findGroupsByUser

import org.activiti.engine.identity.Group; //导入方法依赖的package包/类
@Override
public List<Group> findGroupsByUser(String userId) {
    String sql = "select r.id id,name,code from tbl_role r" +
            " left join tbl_user_role ur on r.id=ur.roleid" +
            " where ur.userid=:userid";
    Map<String, Object> param = new HashMap<>();
    param.put("userid", userId);
    List<Map<String, Object>> maps = super.findMapBySql(sql, param);
    List<Group> groups = new ArrayList<>();
    for (Map<String, Object> map : maps) {
        Group group = new GroupEntity();
        group.setId(map.get("id").toString());
        group.setName(map.get("name").toString());
        group.setType(map.get("code").toString());
        groups.add(group);
    }
    return groups;
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:19,代码来源:IdentityPageServiceImpl.java

示例3: testGroup

import org.activiti.engine.identity.Group; //导入方法依赖的package包/类
/**
 * 组管理API演示
 */
@Test
public void testGroup() throws Exception {
    // 创建一个组对象
    Group group = identityService.newGroup("deptLeader");
    group.setName("部门领导");
    group.setType("assignment");

    // 保存组
    identityService.saveGroup(group);

    // 验证组是否已保存成功,首先需要创建组查询对象
    List<Group> groupList = identityService.createGroupQuery().groupId("deptLeader").list();
    assertEquals(1, groupList.size());

    // 删除组
    identityService.deleteGroup("deptLeader");

    // 验证是否删除成功
    groupList = identityService.createGroupQuery().groupId("deptLeader").list();
    assertEquals(0, groupList.size());
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:25,代码来源:IdentityServiceTest.java

示例4: setUp

import org.activiti.engine.identity.Group; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {

    // 初始化7大Service实例
    super.setUp();

    // 创建并保存组对象
    Group group = identityService.newGroup("deptLeader");
    group.setName("部门领导");
    group.setType("assignment");
    identityService.saveGroup(group);

    // 创建并保存用户对象
    User user = identityService.newUser("henryyan");
    user.setFirstName("Henry");
    user.setLastName("Yan");
    user.setEmail("[email protected]");
    identityService.saveUser(user);

    // 把用户henryyan加入到组deptLeader中
    identityService.createMembership("henryyan", "deptLeader");
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:23,代码来源:UserAndGroupInUserTaskTest.java

示例5: saveGroup

import org.activiti.engine.identity.Group; //导入方法依赖的package包/类
/**
 * 保存Group
 *
 * @return
 */
@RequestMapping(value = "group/save", method = RequestMethod.POST)
public String saveGroup(@RequestParam("groupId") String groupId,
                        @RequestParam("groupName") String groupName,
                        @RequestParam("type") String type,
                        RedirectAttributes redirectAttributes) {
    Group group = identityService.createGroupQuery().groupId(groupId).singleResult();
    if (group == null) {
        group = identityService.newGroup(groupId);
    }
    group.setName(groupName);
    group.setType(type);
    identityService.saveGroup(group);
    redirectAttributes.addFlashAttribute("message", "成功添加组[" + groupName + "]");
    return "redirect:/chapter14/identity/group/list";
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:21,代码来源:IdentityController.java

示例6: testUserAndGroupMemership

import org.activiti.engine.identity.Group; //导入方法依赖的package包/类
/**
 * 组和用户关联关系API演示
 */
@Test
public void testUserAndGroupMemership() throws Exception {
    // 创建并保存组对象
    Group group = identityService.newGroup("deptLeader");
    group.setName("部门领导");
    group.setType("assignment");
    identityService.saveGroup(group);

    // 创建并保存用户对象
    User user = identityService.newUser("henryyan");
    user.setFirstName("Henry");
    user.setLastName("Yan");
    user.setEmail("[email protected]");
    identityService.saveUser(user);

    // 把用户henryyan加入到组deptLeader中
    identityService.createMembership("henryyan", "deptLeader");

    // 查询属于组deptLeader的用户
    User userInGroup = identityService.createUserQuery().memberOfGroup("deptLeader").singleResult();
    assertNotNull(userInGroup);
    assertEquals("henryyan", userInGroup.getId());

    // 查询henryyan所属组
    Group groupContainsHenryyan = identityService.createGroupQuery().groupMember("henryyan").singleResult();
    assertNotNull(groupContainsHenryyan);
    assertEquals("deptLeader", groupContainsHenryyan.getId());
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:32,代码来源:IdentityServiceTest.java

示例7: createGroup

import org.activiti.engine.identity.Group; //导入方法依赖的package包/类
protected void createGroup(String groupId, String type) {
  if (identityService.createGroupQuery().groupId(groupId).count() == 0) {
    Group newGroup = identityService.newGroup(groupId);
    newGroup.setName(groupId.substring(0, 1).toUpperCase() + groupId.substring(1));
    newGroup.setType(type);
    identityService.saveGroup(newGroup);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:9,代码来源:DemoDataGenerator.java

示例8: createGroup

import org.activiti.engine.identity.Group; //导入方法依赖的package包/类
protected Group createGroup() {
  Group group = identityService.newGroup(form.getField("id").getValue().toString());
  group.setName(form.getField("name").getValue().toString());
  group.setType(form.getField("type").getValue().toString());
  identityService.saveGroup(group);
  return group;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:8,代码来源:NewGroupPopupWindow.java

示例9: createGroup

import org.activiti.engine.identity.Group; //导入方法依赖的package包/类
private Group createGroup(String id, String name, String type) {
  Group group = identityService.newGroup(id);
  group.setName(name);
  group.setType(type);
  identityService.saveGroup(group);
  return group;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:8,代码来源:GroupQueryTest.java

示例10: testFindGroupsByUserAndType

import org.activiti.engine.identity.Group; //导入方法依赖的package包/类
public void testFindGroupsByUserAndType() {
  Group sales = identityService.newGroup("sales");
  sales.setType("hierarchy");
  identityService.saveGroup(sales);

  Group development = identityService.newGroup("development");
  development.setType("hierarchy");
  identityService.saveGroup(development);

  Group admin = identityService.newGroup("admin");
  admin.setType("security-role");
  identityService.saveGroup(admin);

  Group user = identityService.newGroup("user");
  user.setType("security-role");
  identityService.saveGroup(user);

  User johndoe = identityService.newUser("johndoe");
  identityService.saveUser(johndoe);

  User joesmoe = identityService.newUser("joesmoe");
  identityService.saveUser(joesmoe);

  User jackblack = identityService.newUser("jackblack");
  identityService.saveUser(jackblack);

  identityService.createMembership("johndoe", "sales");
  identityService.createMembership("johndoe", "user");
  identityService.createMembership("johndoe", "admin");

  identityService.createMembership("joesmoe", "user");

  List<Group> groups = identityService.createGroupQuery().groupMember("johndoe").groupType("security-role").list();
  Set<String> groupIds = getGroupIds(groups);
  Set<String> expectedGroupIds = new HashSet<String>();
  expectedGroupIds.add("user");
  expectedGroupIds.add("admin");
  assertEquals(expectedGroupIds, groupIds);

  groups = identityService.createGroupQuery().groupMember("joesmoe").groupType("security-role").list();
  groupIds = getGroupIds(groups);
  expectedGroupIds = new HashSet<String>();
  expectedGroupIds.add("user");
  assertEquals(expectedGroupIds, groupIds);

  groups = identityService.createGroupQuery().groupMember("jackblack").groupType("security-role").list();
  assertTrue(groups.isEmpty());

  identityService.deleteGroup("sales");
  identityService.deleteGroup("development");
  identityService.deleteGroup("admin");
  identityService.deleteGroup("user");
  identityService.deleteUser("johndoe");
  identityService.deleteUser("joesmoe");
  identityService.deleteUser("jackblack");
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:57,代码来源:IdentityTest.java


注:本文中的org.activiti.engine.identity.Group.setType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。