use of org.modelmapper.ModelMapper in project catalogo-strumenti by istat-methodology.
the class Translators method translate.
public static UsersEntity translate(CreateUserRequest x) {
final ModelMapper modelMapper = new ModelMapper();
final UsersEntity user = modelMapper.map(x, UsersEntity.class);
return user;
}
use of org.modelmapper.ModelMapper in project catalogo-strumenti by istat-methodology.
the class Translators method translate.
public static UsersDto translate(Optional<UsersEntity> optional) {
final ModelMapper modelMapper = new ModelMapper();
final UsersDto dTO = modelMapper.map(optional, UsersDto.class);
return dTO;
}
use of org.modelmapper.ModelMapper in project spring-boot-backend-template by paakmau.
the class BookServiceTests method initAll.
@BeforeAll
static void initAll() {
ModelMapper modelMapper = new ModelMapper();
books = Arrays.asList(new Book(1L, "Book 1", "Author 1"), new Book(2L, "Book 2", "Author 2"), new Book(3L, "Book 3", "Author 3"));
bookDtos = books.stream().map(b -> modelMapper.map(b, BookDto.class)).collect(Collectors.toList());
}
use of org.modelmapper.ModelMapper in project paascloud-master by paascloud.
the class UacLogServiceImpl method saveOperationLog.
@Override
public Integer saveOperationLog(OperationLogDto operationLogDto) {
// 根据uri 查询url对应的权限
UacAction uacAction = uacActionService.matchesByUrl(operationLogDto.getRequestUrl());
if (uacAction != null) {
operationLogDto.setActionCode(uacAction.getActionCode());
operationLogDto.setActionName(uacAction.getActionName());
operationLogDto.setActionId(uacAction.getId());
}
ModelMapper modelMapper = new ModelMapper();
UacLog uacLog = modelMapper.map(operationLogDto, UacLog.class);
uacLog.setId(generateId());
// 获取操作位置
String locationById = opcRpcService.getLocationById(operationLogDto.getIp());
uacLog.setLocation(locationById);
return uacLogMapper.insertSelective(uacLog);
}
use of org.modelmapper.ModelMapper in project paascloud-master by paascloud.
the class UacUserTokenServiceImpl method updateUacUserToken.
@Override
public void updateUacUserToken(UserTokenDto tokenDto, LoginAuthDto loginAuthDto) {
UacUserToken uacUserToken = new ModelMapper().map(tokenDto, UacUserToken.class);
uacUserToken.setUpdateInfo(loginAuthDto);
uacUserTokenMapper.updateByPrimaryKeySelective(uacUserToken);
OAuth2ClientProperties[] clients = securityProperties.getOauth2().getClients();
int accessTokenValidateSeconds = clients[0].getAccessTokenValidateSeconds();
updateRedisUserToken(uacUserToken.getAccessToken(), accessTokenValidateSeconds, tokenDto);
}
Aggregations