/** * Gets the collection's partition key statistics for each physical partition in the collection. * * @return the partition key statistics for each physical partition in the collection. */ public Collection<PartitionKeyRangeStatistics> getCollectionPartitionStatistics() { if (super.has(Constants.Properties.PARTITION_KEY_RANGE_STATISTICS)) { return super.getCollection(Constants.Properties.PARTITION_KEY_RANGE_STATISTICS, PartitionKeyRangeStatistics.class); } return null; }
/** * Gets the document's time-to-live value. * * @return the document's time-to-live value in seconds. */ public Integer getTimeToLive() { if (super.has(Constants.Properties.TTL)) { return super.getInt(Constants.Properties.TTL); } return null; }
/** * Gets the collection's default time-to-live value. * * @return the the default time-to-live value in seconds. */ public Integer getDefaultTimeToLive() { if (super.has(Constants.Properties.DEFAULT_TTL)) { return super.getInt(Constants.Properties.DEFAULT_TTL); } return null; }
/** * Gets the indexing policy. * * @return the indexing policy. */ public IndexingPolicy getIndexingPolicy() { if (this.indexingPolicy == null) { if (super.has(Constants.Properties.INDEXING_POLICY)) { this.indexingPolicy = super.getObject(Constants.Properties.INDEXING_POLICY, IndexingPolicy.class); } else { this.indexingPolicy = new IndexingPolicy(); } } return this.indexingPolicy; }
/** * Sets the document's time-to-live value. * <p> * A document's time-to-live value is an optional property. If set, the document expires after the specified number * of seconds since its last write time. The value of this property should be one of the following: * <p> * null - indicates the time-to-live value for this document inherits from the parent collection's default time-to-live value. * <p> * nonzero positive integer - indicates the number of seconds before the document expires. It overrides the default time-to-live * value specified on the parent collection, unless the parent collection's default time-to-live is null. * <p> * -1 - indicates the document never expires. It overrides the default time-to-live * value specified on the parent collection, unless the parent collection's default time-to-live is null. * * @param timeToLive the document's time-to-live value in seconds. */ public void setTimeToLive(Integer timeToLive) { // a "null" value is represented as a missing element on the wire. // setting timeToLive to null should remove the property from the property bag. if (timeToLive != null) { super.set(Constants.Properties.TTL, timeToLive); } else if (super.has(Constants.Properties.TTL)) { super.remove(Constants.Properties.TTL); } } }
/** * Sets the collection's default time-to-live value. * <p> * The default time-to-live value on a collection is an optional property. If set, the documents within the collection * expires after the specified number of seconds since their last write time. The value of this property should be one of the following: * <p> * null - indicates evaluation of time-to-live is disabled and documents within the collection will never expire, regardless whether * individual documents have their time-to-live set. * <p> * nonzero positive integer - indicates the default time-to-live value for all documents within the collection. This value can be overridden * by individual documents' time-to-live value. * <p> * -1 - indicates by default all documents within the collection never expire. This value can be overridden by individual documents' * time-to-live value. * * @param timeToLive the default time-to-live value in seconds. */ public void setDefaultTimeToLive(Integer timeToLive) { // a "null" value is represented as a missing element on the wire. // setting timeToLive to null should remove the property from the property bag. if (timeToLive != null) { super.set(Constants.Properties.DEFAULT_TTL, timeToLive); } else if (super.has(Constants.Properties.DEFAULT_TTL)) { super.remove(Constants.Properties.DEFAULT_TTL); } }
/** * Gets the collection's partition key definition. * * @return the partition key definition. */ public PartitionKeyDefinition getPartitionKey() { if (super.has(Constants.Properties.PARTITION_KEY)) { return super.getObject(Constants.Properties.PARTITION_KEY, PartitionKeyDefinition.class); } this.setPartitionKey(new PartitionKeyDefinition()); return this.getPartitionKey(); }