ars.module.people.assist.ActivitiGroupEntityManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ars-module-people Show documentation
Show all versions of ars-module-people Show documentation
Ars framework module people
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) {
if (role.getActive()) {
GroupEntity group = new GroupEntity();
group.setId(role.getCode());
group.setName(role.getName());
group.setType("assignment");
groups.add(group);
}
}
return groups;
}
}