All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openmetadata.service.search.models.IndexMapping Maven / Gradle / Ivy

There is a newer version: 1.5.11
Show newest version
package org.openmetadata.service.search.models;

import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;
import lombok.Builder;
import lombok.Getter;
import lombok.extern.jackson.Jacksonized;

@JsonInclude(JsonInclude.Include.NON_NULL)
@Jacksonized
@Getter
@Builder
public class IndexMapping {
  String indexName;
  String indexMappingFile;
  String alias;
  List parentAliases;
  List childAliases;
  public static final String indexNameSeparator = "_";

  public String getIndexName(String clusterAlias) {
    return clusterAlias != null && !clusterAlias.isEmpty()
        ? clusterAlias + indexNameSeparator + indexName
        : indexName;
  }

  public String getAlias(String clusterAlias) {
    return clusterAlias != null && !clusterAlias.isEmpty()
        ? clusterAlias + indexNameSeparator + alias
        : alias;
  }

  public List getParentAliases(String clusterAlias) {
    return clusterAlias != null && !clusterAlias.isEmpty()
        ? parentAliases.stream().map(alias -> clusterAlias + indexNameSeparator + alias).toList()
        : parentAliases;
  }

  public List getChildAliases(String clusterAlias) {
    return clusterAlias != null && !clusterAlias.isEmpty()
        ? childAliases.stream().map(alias -> clusterAlias + indexNameSeparator + alias).toList()
        : childAliases;
  }

  private String getIndexName() {
    return indexName;
  }

  private String getAlias() {
    return alias;
  }

  private List getParentAliases() {
    return parentAliases;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy