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