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 final class DocumentMapping implements DocMapping { 010 011 private final String queueId; 012 private final String name; 013 private final String type; 014 private final FetchPath paths; 015 private final DocPropertyMapping properties; 016 private int shards; 017 private int replicas; 018 019 public DocumentMapping(String queueId, String name, String type, FetchPath paths, DocPropertyMapping properties, int shards, int replicas) { 020 this.queueId = queueId; 021 this.name = name; 022 this.type = type; 023 this.paths = paths; 024 this.properties = properties; 025 this.shards = shards; 026 this.replicas = replicas; 027 } 028 029 /** 030 * Visit all the properties in the document structure. 031 */ 032 public void visit(DocPropertyVisitor visitor) { 033 properties.visit(visitor); 034 } 035 036 /** 037 * Return the queueId. 038 */ 039 public String queueId() { 040 return queueId; 041 } 042 043 /** 044 * Return the name. 045 */ 046 public String name() { 047 return name; 048 } 049 050 /** 051 * Return the type. 052 */ 053 public String type() { 054 return type; 055 } 056 057 /** 058 * Return the document structure as PathProperties. 059 */ 060 public FetchPath paths() { 061 return paths; 062 } 063 064 /** 065 * Return the document structure with mapping details. 066 */ 067 public DocPropertyMapping properties() { 068 return properties; 069 } 070 071 /** 072 * Return the number of shards. 073 */ 074 public int shards() { 075 return shards; 076 } 077 078 /** 079 * Set the number of shards. 080 */ 081 public void shards(int shards) { 082 this.shards = shards; 083 } 084 085 /** 086 * Return the number of replicas. 087 */ 088 public int replicas() { 089 return replicas; 090 } 091 092 /** 093 * Set the number of replicas. 094 */ 095 public void replicas(int replicas) { 096 this.replicas = replicas; 097 } 098}