001package io.ebeanservice.docstore.api.mapping;
002
003import io.ebean.FetchPath;
004import io.ebean.docstore.DocMapping;
005
006/**
007 * Mapping for a document stored in a doc store (like ElasticSearch).
008 */
009public class DocumentMapping implements DocMapping {
010
011  protected final String queueId;
012
013  protected final String name;
014
015  protected final String type;
016
017  protected final FetchPath paths;
018
019  protected final DocPropertyMapping properties;
020
021  protected int shards;
022
023  protected int replicas;
024
025  public DocumentMapping(String queueId, String name, String type, FetchPath paths, DocPropertyMapping properties, int shards, int replicas) {
026    this.queueId = queueId;
027    this.name = name;
028    this.type = type;
029    this.paths = paths;
030    this.properties = properties;
031    this.shards = shards;
032    this.replicas = replicas;
033  }
034
035  /**
036   * Visit all the properties in the document structure.
037   */
038  public void visit(DocPropertyVisitor visitor) {
039    properties.visit(visitor);
040  }
041
042  /**
043   * Return the queueId.
044   */
045  public String getQueueId() {
046    return queueId;
047  }
048
049  /**
050   * Return the name.
051   */
052  public String getName() {
053    return name;
054  }
055
056  /**
057   * Return the type.
058   */
059  public String getType() {
060    return type;
061  }
062
063  /**
064   * Return the document structure as PathProperties.
065   */
066  public FetchPath getPaths() {
067    return paths;
068  }
069
070  /**
071   * Return the document structure with mapping details.
072   */
073  public DocPropertyMapping getProperties() {
074    return properties;
075  }
076
077  /**
078   * Return the number of shards.
079   */
080  public int getShards() {
081    return shards;
082  }
083
084  /**
085   * Set the number of shards.
086   */
087  public void setShards(int shards) {
088    this.shards = shards;
089  }
090
091  /**
092   * Return the number of replicas.
093   */
094  public int getReplicas() {
095    return replicas;
096  }
097
098  /**
099   * Set the number of replicas.
100   */
101  public void setReplicas(int replicas) {
102    this.replicas = replicas;
103  }
104}