public static GroupEntity toActivitiGroup(RoleEntity sysRole) { GroupEntity groupEntity = new GroupEntity(); groupEntity.setId(sysRole.getId()); groupEntity.setRevision(1); groupEntity.setType("assignment"); groupEntity.setName(sysRole.getName()); return groupEntity; }
public static List<Group> getGroupsFromIds(List<String> groupIds) { List<Group> groups = new ArrayList<Group>(); for (String groupId : groupIds) { groups.add(new GroupEntity(groupId)); } return groups; }
public Group createNewGroup(String groupId) { GroupEntity groupEntity = groupDataManager.create(); groupEntity.setId(groupId); groupEntity.setRevision(0); // Needed as groups can be transient and not save when they are returned return groupEntity; }
@Override public boolean isNewGroup(Group group) { return ((GroupEntity) group).getRevision() == 0; }
public Group createGroup(String groupId, String groupName) { Group group = _groups.get(groupId); if (group == null) { group = new GroupEntity(groupId); _groups.put(groupId, group); } if (groupName != null) { group.setName(groupName); } return group; }
public Void execute(CommandContext commandContext) { if(group == null) { throw new ActivitiIllegalArgumentException("group is null"); } if (group.getRevision()==0) { commandContext .getGroupEntityManager() .insertGroup(group); } else { commandContext .getGroupEntityManager() .updateGroup(group); } return null; }
@Override public Group findGroupById(String groupId) { String sql = "select id,name,code from tbl_role where id=:id"; Map<String, Object> param = new HashMap<>(); param.put("id", groupId); List<Map<String, Object>> maps = super.findMapBySql(sql, param); if (maps == null || maps.isEmpty()) return null; Map<String, Object> map = maps.get(0); GroupEntity group = new GroupEntity(); group.setId(map.get("id").toString()); group.setName(map.get("name").toString()); group.setType(map.get("code").toString()); return group; }
@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; }
@Override public Group getGroupByCode(String groupCode) { String sql = "select id,name,code from tbl_role where code=:code"; Map<String, Object> param = new HashMap<>(); param.put("code", groupCode); List<Map<String, Object>> maps = super.findMapBySql(sql, param); if (maps == null || maps.isEmpty()) return null; Map<String, Object> map = maps.get(0); GroupEntity group = new GroupEntity(); group.setId(map.get("id").toString()); group.setName(map.get("name").toString()); group.setType(map.get("code").toString()); return group; }
public Group createNewGroup(String groupId) { return new GroupEntity(groupId); }
public static GroupEntity toActivitiGroup(RoleEntity sysRole) { GroupEntity groupEntity = new GroupEntity(); groupEntity.setId(sysRole.getId()); groupEntity.setRevision(1); groupEntity.setType("assignment"); groupEntity.setName(sysRole.getName()); return groupEntity; }
for (final Entry<String, List<String>> groupEntry : this.groups.entrySet()) { if (groupEntry.getValue().contains(user)) { final Group group = new GroupEntity(groupEntry.getKey()); groupsList.add(group);
@Override public List<Group> findGroupsByUser(String code) { User user = Repositories.getRepository(User.class).query().eq("code", code).single(); Set<Role> roles = user.getRoles(); List<Group> groups = new ArrayList<Group>(roles.size()); for (Role role : roles) { if (role.getActive()) { GroupEntity group = new GroupEntity(); group.setId(role.getCode()); group.setName(role.getName()); group.setType("assignment"); groups.add(group); } } return groups; }
@Override public List<Group> findGroupsByUser(String code) { User user = Repositories.getRepository(User.class).query().eq("code", code).single(); Set<Role> roles = user.getRoles(); List<Group> groups = new ArrayList<Group>(roles.size()); for (Role role : roles) { if (role.getActive()) { GroupEntity group = new GroupEntity(); group.setId(role.getCode()); group.setName(role.getName()); group.setType("assignment"); groups.add(group); } } return groups; }