content: /*
   * Copyright 2021-2022 Alibaba Group Holding Ltd.
   *
   *    Licensed 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 com.aliyun.fastmodel.transform.hologres.context;
  
  import com.aliyun.fastmodel.transform.api.context.TransformContext;
  import lombok.Getter;
  import lombok.Setter;
  
  /**
   * builder
   *
   * @author panguanjing
   * @date 2021/3/7
   */
  @Getter
  @Setter
  public class HologresTransformContext extends TransformContext {
  
      public static final String COLUMN = "column";
  
      public static final long DEFAULT_SECONDS = 3153600000L;
  
      private String orientation = COLUMN;
  
      private Long timeToLiveInSeconds = DEFAULT_SECONDS;
  
      private boolean caseSensitive;
  
      /**
       * 使用set语句代替call set table_property
       */
      private boolean useAlterTableSetSentence;
  
      public HologresTransformContext(TransformContext context) {
          super(context);
          if (context instanceof HologresTransformContext) {
              HologresTransformContext hologresTransformContext = (HologresTransformContext)context;
              orientation = hologresTransformContext.getOrientation();
              timeToLiveInSeconds = hologresTransformContext.getTimeToLiveInSeconds();
              caseSensitive = hologresTransformContext.isCaseSensitive();
              useAlterTableSetSentence = hologresTransformContext.isUseAlterTableSetSentence();
          }
      }
  
      public HologresTransformContext(Builder builder) {
          super(builder);
          orientation = builder.getOrientation();
          timeToLiveInSeconds = builder.getTimeToLiveInSeconds();
          caseSensitive = builder.isCaseSensitive();
          useAlterTableSetSentence = builder.isUseAlterTableSetSentence();
      }
  
      public static Builder builder() {
          return new Builder();
      }
  
      @Getter
      public static class Builder extends TransformContext.Builder<Builder> {
  
          private String orientation = COLUMN;
  
          private Long timeToLiveInSeconds = DEFAULT_SECONDS;
  
          private boolean caseSensitive;
  
          private boolean useAlterTableSetSentence;
  
          @Override
          public HologresTransformContext build() {
              return new HologresTransformContext(this);
          }
  
          public Builder orientation(String orientation) {
              this.orientation = orientation;
              return this;
          }
  
          public Builder timeToLiveInSeconds(Long timeToLiveInSeconds) {
              this.timeToLiveInSeconds = timeToLiveInSeconds;
              return this;
          }
  
          public Builder caseSensitive(boolean caseSensitive) {
              this.caseSensitive = caseSensitive;
              return this;
          }
  
          public Builder useAlterTableSetSentence(boolean useAlterTableSetSentence) {
              this.useAlterTableSetSentence = useAlterTableSetSentence;
              return this;
          }
  
      }
  }
  