Common 先期知識
- 如何取得Organization中的成員
- 使用 identityAPI
- 如何使用Email寄信
Code 程式碼
可能會用到的import
import org.bonitasoft.engine.api.IdentityAPI
import org.bonitasoft.engine.identity.Group
import org.bonitasoft.engine.identity.User
import org.bonitasoft.engine.identity.UserCriterion
取出Group中所有成員的email,同理,可以應用在Role
- 複數email必須用" , "分開,才會符合寄信時email的格式
- sb.delete()用來刪除最後一個多餘的" , "
IdentityAPI identityAPI = apiAccessor.getIdentityAPI()
List<User> userList = null
Group group = null
StringBuilder sb = new StringBuilder()
group = identityAPI.getGroupByPath('/ManagementDepartment')
userList = identityAPI.getUsersInGroup(group.getId(), 0, Integer.MAX_VALUE, UserCriterion.USER_NAME_ASC)
for(User user : userList) {
sb.append(identityAPI.getUserContactData(user.getId(), false).getEmail() + ",")
}
sb.delete(sb.length()-1, sb.length())
return sb.toString()
沒有留言:
張貼留言