use of org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity in project incubator-inlong by apache.
the class HiveStreamSinkOperation method getById.
@Override
public SinkResponse getById(@NotNull String sinkType, @NotNull Integer id) {
StreamSinkEntity entity = sinkMapper.selectByPrimaryKey(id);
Preconditions.checkNotNull(entity, ErrorCodeEnum.SINK_INFO_NOT_FOUND.getMessage());
String existType = entity.getSinkType();
Preconditions.checkTrue(Constant.SINK_HIVE.equals(existType), String.format(Constant.SINK_TYPE_NOT_SAME, Constant.SINK_HIVE, existType));
SinkResponse response = this.getFromEntity(entity, HiveSinkResponse::new);
List<StreamSinkFieldEntity> entities = sinkFieldMapper.selectBySinkId(id);
List<SinkFieldResponse> infos = CommonBeanUtils.copyListProperties(entities, SinkFieldResponse::new);
response.setFieldList(infos);
return response;
}
use of org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity in project incubator-inlong by apache.
the class HiveStreamSinkOperation method saveFieldOpt.
@Override
public void saveFieldOpt(SinkRequest request) {
List<SinkFieldRequest> fieldList = request.getFieldList();
LOGGER.info("begin to save field={}", fieldList);
if (CollectionUtils.isEmpty(fieldList)) {
return;
}
int size = fieldList.size();
List<StreamSinkFieldEntity> entityList = new ArrayList<>(size);
String groupId = request.getInlongGroupId();
String streamId = request.getInlongStreamId();
String sinkType = request.getSinkType();
Integer sinkId = request.getId();
for (SinkFieldRequest fieldInfo : fieldList) {
StreamSinkFieldEntity fieldEntity = CommonBeanUtils.copyProperties(fieldInfo, StreamSinkFieldEntity::new);
if (StringUtils.isEmpty(fieldEntity.getFieldComment())) {
fieldEntity.setFieldComment(fieldEntity.getFieldName());
}
fieldEntity.setInlongGroupId(groupId);
fieldEntity.setInlongStreamId(streamId);
fieldEntity.setSinkType(sinkType);
fieldEntity.setSinkId(sinkId);
fieldEntity.setIsDeleted(EntityStatus.UN_DELETED.getCode());
entityList.add(fieldEntity);
}
sinkFieldMapper.insertAll(entityList);
LOGGER.info("success to save hive field");
}
use of org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity in project incubator-inlong by apache.
the class IcebergStreamSinkOperation method getById.
@Override
public SinkResponse getById(String sinkType, Integer id) {
StreamSinkEntity entity = sinkMapper.selectByPrimaryKey(id);
Preconditions.checkNotNull(entity, ErrorCodeEnum.SINK_INFO_NOT_FOUND.getMessage());
String existType = entity.getSinkType();
Preconditions.checkTrue(Constant.SINK_ICEBERG.equals(existType), String.format(Constant.SINK_TYPE_NOT_SAME, Constant.SINK_ICEBERG, existType));
SinkResponse response = this.getFromEntity(entity, IcebergSinkResponse::new);
List<StreamSinkFieldEntity> entities = sinkFieldMapper.selectBySinkId(id);
List<SinkFieldResponse> infos = CommonBeanUtils.copyListProperties(entities, SinkFieldResponse::new);
response.setFieldList(infos);
return response;
}
use of org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity in project incubator-inlong by apache.
the class KafkaStreamSinkOperation method saveFieldOpt.
@Override
public void saveFieldOpt(SinkRequest request) {
List<SinkFieldRequest> fieldList = request.getFieldList();
LOGGER.info("begin to save field={}", fieldList);
if (CollectionUtils.isEmpty(fieldList)) {
return;
}
int size = fieldList.size();
List<StreamSinkFieldEntity> entityList = new ArrayList<>(size);
String groupId = request.getInlongGroupId();
String streamId = request.getInlongStreamId();
String sinkType = request.getSinkType();
Integer sinkId = request.getId();
for (SinkFieldRequest fieldInfo : fieldList) {
StreamSinkFieldEntity fieldEntity = CommonBeanUtils.copyProperties(fieldInfo, StreamSinkFieldEntity::new);
if (StringUtils.isEmpty(fieldEntity.getFieldComment())) {
fieldEntity.setFieldComment(fieldEntity.getFieldName());
}
fieldEntity.setInlongGroupId(groupId);
fieldEntity.setInlongStreamId(streamId);
fieldEntity.setSinkType(sinkType);
fieldEntity.setSinkId(sinkId);
fieldEntity.setIsDeleted(EntityStatus.UN_DELETED.getCode());
entityList.add(fieldEntity);
}
sinkFieldMapper.insertAll(entityList);
LOGGER.info("success to save field");
}
use of org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity in project incubator-inlong by apache.
the class IcebergStreamSinkOperation method saveFieldOpt.
@Override
public void saveFieldOpt(SinkRequest request) {
List<SinkFieldRequest> fieldList = request.getFieldList();
LOGGER.info("begin to save field={}", fieldList);
if (CollectionUtils.isEmpty(fieldList)) {
return;
}
int size = fieldList.size();
List<StreamSinkFieldEntity> entityList = new ArrayList<>(size);
String groupId = request.getInlongGroupId();
String streamId = request.getInlongStreamId();
String sinkType = request.getSinkType();
Integer sinkId = request.getId();
for (SinkFieldRequest fieldInfo : fieldList) {
StreamSinkFieldEntity fieldEntity = CommonBeanUtils.copyProperties(fieldInfo, StreamSinkFieldEntity::new);
if (StringUtils.isEmpty(fieldEntity.getFieldComment())) {
fieldEntity.setFieldComment(fieldEntity.getFieldName());
}
fieldEntity.setInlongGroupId(groupId);
fieldEntity.setInlongStreamId(streamId);
fieldEntity.setSinkType(sinkType);
fieldEntity.setSinkId(sinkId);
fieldEntity.setIsDeleted(EntityStatus.UN_DELETED.getCode());
entityList.add(fieldEntity);
}
sinkFieldMapper.insertAll(entityList);
LOGGER.info("success to save hive field");
}
Aggregations