fe036ec6d47ae4a50c7ef01d9ec0e636912daee7.svn-base
5.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/**
* Copyright © 2015-2018 ODM All rights reserved.
*/
package com.thinkgem.jeesite.modules.act.service.ext;
import java.util.List;
import java.util.Map;
import org.activiti.engine.identity.Group;
import org.activiti.engine.identity.User;
import org.activiti.engine.identity.UserQuery;
import org.activiti.engine.impl.Page;
import org.activiti.engine.impl.UserQueryImpl;
import org.activiti.engine.impl.persistence.entity.IdentityInfoEntity;
import org.activiti.engine.impl.persistence.entity.UserEntity;
import org.activiti.engine.impl.persistence.entity.UserEntityManager;
import org.springframework.stereotype.Service;
import com.google.common.collect.Lists;
import com.thinkgem.jeesite.common.utils.SpringContextHolder;
import com.thinkgem.jeesite.modules.act.utils.ActUtils;
import com.thinkgem.jeesite.modules.sys.entity.Role;
import com.thinkgem.jeesite.modules.sys.service.SystemService;
/**
* Activiti User Entity Service
* @author ThinkGem
* @version 2013-11-03
*/
@Service
public class ActUserEntityService extends UserEntityManager {
private SystemService systemService;
public SystemService getSystemService() {
if (systemService == null){
systemService = SpringContextHolder.getBean(SystemService.class);
}
return systemService;
}
public User createNewUser(String userId) {
return new UserEntity(userId);
}
public void insertUser(User user) {
// getDbSqlSession().insert((PersistentObject) user);
throw new RuntimeException("not implement method.");
}
public void updateUser(UserEntity updatedUser) {
// CommandContext commandContext = Context.getCommandContext();
// DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
// dbSqlSession.update(updatedUser);
throw new RuntimeException("not implement method.");
}
public UserEntity findUserById(String userId) {
// return (UserEntity) getDbSqlSession().selectOne("selectUserById", userId);
return ActUtils.toActivitiUser(getSystemService().getUserByLoginName(userId));
}
public void deleteUser(String userId) {
// UserEntity user = findUserById(userId);
// if (user != null) {
// List<IdentityInfoEntity> identityInfos = getDbSqlSession().selectList("selectIdentityInfoByUserId", userId);
// for (IdentityInfoEntity identityInfo : identityInfos) {
// getIdentityInfoManager().deleteIdentityInfo(identityInfo);
// }
// getDbSqlSession().delete("deleteMembershipsByUserId", userId);
// user.delete();
// }
User user = findUserById(userId);
if (user != null) {
getSystemService().deleteUser(new com.thinkgem.jeesite.modules.sys.entity.User(user.getId()));
}
}
public List<User> findUserByQueryCriteria(UserQueryImpl query, Page page) {
// return getDbSqlSession().selectList("selectUserByQueryCriteria", query, page);
throw new RuntimeException("not implement method.");
}
public long findUserCountByQueryCriteria(UserQueryImpl query) {
// return (Long) getDbSqlSession().selectOne("selectUserCountByQueryCriteria", query);
throw new RuntimeException("not implement method.");
}
public List<Group> findGroupsByUser(String userId) {
// return getDbSqlSession().selectList("selectGroupsByUserId", userId);
List<Group> list = Lists.newArrayList();
for (Role role : getSystemService().findRole(new Role(new com.thinkgem.jeesite.modules.sys.entity.User(null, userId)))){
list.add(ActUtils.toActivitiGroup(role));
}
return list;
}
public UserQuery createNewUserQuery() {
// return new UserQueryImpl(Context.getProcessEngineConfiguration().getCommandExecutorTxRequired());
throw new RuntimeException("not implement method.");
}
public IdentityInfoEntity findUserInfoByUserIdAndKey(String userId, String key) {
// Map<String, String> parameters = new HashMap<String, String>();
// parameters.put("userId", userId);
// parameters.put("key", key);
// return (IdentityInfoEntity) getDbSqlSession().selectOne("selectIdentityInfoByUserIdAndKey", parameters);
throw new RuntimeException("not implement method.");
}
public List<String> findUserInfoKeysByUserIdAndType(String userId, String type) {
// Map<String, String> parameters = new HashMap<String, String>();
// parameters.put("userId", userId);
// parameters.put("type", type);
// return (List) getDbSqlSession().getSqlSession().selectList("selectIdentityInfoKeysByUserIdAndType", parameters);
throw new RuntimeException("not implement method.");
}
public Boolean checkPassword(String userId, String password) {
// User user = findUserById(userId);
// if ((user != null) && (password != null) && (password.equals(user.getPassword()))) {
// return true;
// }
// return false;
throw new RuntimeException("not implement method.");
}
public List<User> findPotentialStarterUsers(String proceDefId) {
// Map<String, String> parameters = new HashMap<String, String>();
// parameters.put("procDefId", proceDefId);
// return (List<User>) getDbSqlSession().selectOne("selectUserByQueryCriteria", parameters);
throw new RuntimeException("not implement method.");
}
public List<User> findUsersByNativeQuery(Map<String, Object> parameterMap, int firstResult, int maxResults) {
// return getDbSqlSession().selectListWithRawParameter("selectUserByNativeQuery", parameterMap, firstResult, maxResults);
throw new RuntimeException("not implement method.");
}
public long findUserCountByNativeQuery(Map<String, Object> parameterMap) {
// return (Long) getDbSqlSession().selectOne("selectUserCountByNativeQuery", parameterMap);
throw new RuntimeException("not implement method.");
}
}