Search in sources :

Example 1 with UnknownUserException

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;
    }
}
Also used : UnknownUser(org.ow2.petals.components.flowable.generic._1.UnknownUser) User(org.ow2.petals.components.flowable.generic._1.User) GetUser(org.ow2.petals.components.flowable.generic._1.GetUser) GetUserResponse(org.ow2.petals.components.flowable.generic._1.GetUserResponse) UserQuery(org.flowable.idm.api.UserQuery) UnknownUserException(org.ow2.petals.flowable.incoming.integration.exception.UnknownUserException)

Aggregations

UserQuery (org.flowable.idm.api.UserQuery)1 GetUser (org.ow2.petals.components.flowable.generic._1.GetUser)1 GetUserResponse (org.ow2.petals.components.flowable.generic._1.GetUserResponse)1 UnknownUser (org.ow2.petals.components.flowable.generic._1.UnknownUser)1 User (org.ow2.petals.components.flowable.generic._1.User)1 UnknownUserException (org.ow2.petals.flowable.incoming.integration.exception.UnknownUserException)1