All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ars.module.people.assist.ActivitiGroupEntityManager Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package ars.module.people.assist;

import java.util.Set;
import java.util.List;
import java.util.ArrayList;

import org.activiti.engine.identity.Group;
import org.activiti.engine.impl.persistence.entity.GroupEntity;
import org.activiti.engine.impl.persistence.entity.GroupEntityManager;

import ars.module.people.model.Role;
import ars.module.people.model.User;
import ars.database.repository.Repositories;

/**
 * Activiti组管理器实现
 * 
 * @author yongqiangwu
 * 
 */
public class ActivitiGroupEntityManager extends GroupEntityManager {

	@Override
	public List findGroupsByUser(String code) {
		User user = Repositories.getRepository(User.class).query().eq("code", code).single();
		Set roles = user.getRoles();
		List groups = new ArrayList(roles.size());
		for (Role role : roles) {
			GroupEntity group = new GroupEntity();
			group.setId(role.getCode());
			group.setName(role.getName());
			group.setType("assignment");
			groups.add(group);
		}
		return groups;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy