healchow commented on code in PR #4694: URL: https://github.com/apache/incubator-inlong/pull/4694#discussion_r900688236
########## inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/sink/AbstractSinkOperator.java: ########## @@ -0,0 +1,170 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.inlong.manager.service.sink; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.inlong.manager.common.enums.ErrorCodeEnum; +import org.apache.inlong.manager.common.enums.GlobalConstants; +import org.apache.inlong.manager.common.enums.SinkStatus; +import org.apache.inlong.manager.common.exceptions.BusinessException; +import org.apache.inlong.manager.common.pojo.sink.SinkField; +import org.apache.inlong.manager.common.pojo.sink.SinkRequest; +import org.apache.inlong.manager.common.pojo.sink.StreamSink; +import org.apache.inlong.manager.common.util.CommonBeanUtils; +import org.apache.inlong.manager.common.util.Preconditions; +import org.apache.inlong.manager.dao.entity.StreamSinkEntity; +import org.apache.inlong.manager.dao.entity.StreamSinkFieldEntity; +import org.apache.inlong.manager.dao.mapper.StreamSinkEntityMapper; +import org.apache.inlong.manager.dao.mapper.StreamSinkFieldEntityMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * Default operation of stream sink. + */ +public abstract class AbstractSinkOperator implements StreamSinkOperation { + + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractSinkOperator.class); + + @Autowired + protected ObjectMapper objectMapper; + @Autowired + protected StreamSinkEntityMapper sinkMapper; + @Autowired + protected StreamSinkFieldEntityMapper sinkFieldMapper; + + /** + * Setting the parameters of the latest entity. + * + * @param request sink request + * @param targetEntity entity object which will set the new parameters. + */ + protected abstract void setTargetEntity(SinkRequest request, StreamSinkEntity targetEntity); + + /** + * Getting the sink type. + * + * @return sink type string. + */ + protected abstract String getSinkType(); + + /** + * Creating sink object. + * + * @return sink object + */ + protected abstract StreamSink getSink(); + + public Integer saveOpt(SinkRequest request, String operator) { Review Comment: Please add `@Override` annotation for those implement methods. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
