use of org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceDTO in project incubator-inlong by apache.
the class BinlogStreamSourceOperation method getFromEntity.
@Override
public <T> T getFromEntity(StreamSourceEntity entity, Supplier<T> target) {
T result = target.get();
if (entity == null) {
return result;
}
String existType = entity.getSourceType();
Preconditions.checkTrue(getSourceType().equals(existType), String.format(Constant.SOURCE_TYPE_NOT_SAME, getSourceType(), existType));
BinlogSourceDTO dto = BinlogSourceDTO.getFromJson(entity.getExtParams());
CommonBeanUtils.copyProperties(entity, result, true);
CommonBeanUtils.copyProperties(dto, result, true);
return result;
}
use of org.apache.inlong.manager.common.pojo.source.binlog.BinlogSourceDTO in project incubator-inlong by apache.
the class BinlogStreamSourceOperation method setTargetEntity.
@Override
protected void setTargetEntity(SourceRequest request, StreamSourceEntity targetEntity) {
BinlogSourceRequest sourceRequest = (BinlogSourceRequest) request;
CommonBeanUtils.copyProperties(sourceRequest, targetEntity, true);
try {
BinlogSourceDTO dto = BinlogSourceDTO.getFromRequest(sourceRequest);
targetEntity.setExtParams(objectMapper.writeValueAsString(dto));
} catch (Exception e) {
throw new BusinessException(ErrorCodeEnum.SOURCE_INFO_INCORRECT.getMessage());
}
}
Aggregations