use of org.ow2.petals.flowable.incoming.integration.exception.UnknownUserException in project petals-se-flowable by petalslink.
the class GetUserOperation method doExecute.
@Override
public GetUserResponse doExecute(final GetUser incomingObject) throws Exception {
final UserQuery userQuery = this.identityService.createUserQuery();
userQuery.userId(incomingObject.getId());
final List<org.flowable.idm.api.User> users = userQuery.list();
if (users.isEmpty()) {
throw new UnknownUserException(incomingObject.getId());
} else {
final org.flowable.idm.api.User foundUser = users.get(0);
final User user = new User();
user.setId(foundUser.getId());
user.setFirstName(foundUser.getFirstName());
user.setLastName(foundUser.getLastName());
user.setEmail(foundUser.getEmail());
final GetUserResponse response = new GetUserResponse();
response.setUser(user);
return response;
}
}
Aggregations