use of org.usermanagement.dao.entity.UserEntity in project open-kilda by telstra.
the class UserConversionUtil method toUserEntity.
/**
* To user entity.
*
* @param userInfo the user info
* @param roleEntities the role entities
* @return the user entity
*/
public static UserEntity toUserEntity(final UserInfo userInfo, final Set<RoleEntity> roleEntities) {
UserEntity userEntity = new UserEntity();
userEntity.setUsername(userInfo.getUsername().toLowerCase());
userEntity.setPassword(StringUtil.encodeString(password));
userEntity.setEmail(userInfo.getEmail().toLowerCase());
userEntity.setName(userInfo.getName());
userEntity.setRoles(roleEntities);
userEntity.setActiveFlag(true);
userEntity.setLoginTime(new Timestamp(System.currentTimeMillis()));
userEntity.setLogoutTime(new Timestamp(System.currentTimeMillis()));
userEntity.setIsAuthorized(true);
userEntity.setIs2FaEnabled(true);
userEntity.setIs2FaConfigured(false);
StatusEntity statusEntity = Status.ACTIVE.getStatusEntity();
userEntity.setStatusEntity(statusEntity);
return userEntity;
}
Aggregations