Tabnine Logo
AbstractMongoRepository.collectionWithWriteTimeout
Code IndexAdd Tabnine to your IDE (free)

How to use
collectionWithWriteTimeout
method
in
de.otto.edison.mongo.AbstractMongoRepository

Best Java code snippets using de.otto.edison.mongo.AbstractMongoRepository.collectionWithWriteTimeout (Showing top 14 results out of 315)

origin: otto-de/edison-microservice

/**
 * Deletes all documents from this repository.
 *
 * @param maxTime  max time for the operation
 * @param timeUnit the time unit for the maxTime value
 */
public void deleteAll(final long maxTime, final TimeUnit timeUnit) {
  collectionWithWriteTimeout(maxTime, timeUnit).deleteMany(matchAll());
}
origin: de.otto.edison/edison-mongo

/**
 * Deletes the document identified by key.
 *
 * @param key      the identifier of the deleted document
 * @param maxTime  max time for the operation
 * @param timeUnit the time unit for the maxTime value
 */
public void delete(final K key, final long maxTime, final TimeUnit timeUnit) {
  collectionWithWriteTimeout(maxTime, timeUnit).deleteOne(byId(key));
}
origin: otto-de/edison-microservice

/**
 * Deletes the document identified by key.
 *
 * @param key      the identifier of the deleted document
 * @param maxTime  max time for the operation
 * @param timeUnit the time unit for the maxTime value
 */
public void delete(final K key, final long maxTime, final TimeUnit timeUnit) {
  collectionWithWriteTimeout(maxTime, timeUnit).deleteOne(byId(key));
}
origin: de.otto.edison/edison-mongo

/**
 * Deletes all documents from this repository.
 * @param maxTime  max time for the operation
 * @param timeUnit the time unit for the maxTime value
 */
public void deleteAll(final long maxTime, final TimeUnit timeUnit) {
  collectionWithWriteTimeout(maxTime, timeUnit).deleteMany(matchAll());
}
origin: de.otto.edison/edison-mongo

public void createOrUpdateBulk(final Collection<V> values, final long maxTime, final TimeUnit timeUnit) {
  if (values.isEmpty()) {
    return;
  }
  final List<ReplaceOneModel<Document>> bulkOperations = values.stream()
      .map(value -> new ReplaceOneModel<>(
          eq(ID, keyOf(value)),
          encode(value),
          BULK_UPSERT_OPERATION))
      .collect(toList());
  collectionWithWriteTimeout(maxTime, timeUnit)
      .bulkWrite(bulkOperations, BULK_WRITE_OPTIONS);
}
origin: otto-de/edison-microservice

public void createOrUpdateBulk(final Collection<V> values, final long maxTime, final TimeUnit timeUnit) {
  if (values.isEmpty()) {
    return;
  }
  final List<ReplaceOneModel<Document>> bulkOperations = values.stream()
      .map(value -> new ReplaceOneModel<>(
          eq(ID, keyOf(value)),
          encode(value),
          BULK_UPSERT_OPERATION))
      .collect(toList());
  collectionWithWriteTimeout(maxTime, timeUnit)
      .bulkWrite(bulkOperations, BULK_WRITE_OPTIONS);
}
origin: de.otto.edison/edison-mongo

public V create(final V value, final long maxTime, final TimeUnit timeUnit) {
  final K key = keyOf(value);
  if (key != null) {
    final Document doc = encode(value);
    collectionWithWriteTimeout(maxTime, timeUnit).insertOne(doc);
    return decode(doc);
  } else {
    throw new NullPointerException("Key must not be null");
  }
}
origin: otto-de/edison-microservice

public V create(final V value, final long maxTime, final TimeUnit timeUnit) {
  final K key = keyOf(value);
  if (key != null) {
    final Document doc = encode(value);
    collectionWithWriteTimeout(maxTime, timeUnit).insertOne(doc);
    return decode(doc);
  } else {
    throw new NullPointerException("Key must not be null");
  }
}
origin: de.otto.edison/edison-mongo

/**
 * Updates the document if it is already present in the repository.
 *
 * @param value    the new value
 * @param maxTime  max time for the update
 * @param timeUnit the time unit for the maxTime value
 * @return true, if the document was updated, false otherwise.
 */
public boolean update(final V value, final long maxTime, final TimeUnit timeUnit) {
  final K key = keyOf(value);
  if (key != null) {
    return collectionWithWriteTimeout(maxTime, timeUnit)
        .replaceOne(byId(key), encode(value))
        .getModifiedCount() == 1;
  } else {
    throw new IllegalArgumentException("Key must not be null");
  }
}
origin: otto-de/edison-microservice

/**
 * Updates the document if it is already present in the repository.
 *
 * @param value    the new value
 * @param maxTime  max time for the update
 * @param timeUnit the time unit for the maxTime value
 * @return true, if the document was updated, false otherwise.
 */
public boolean update(final V value, final long maxTime, final TimeUnit timeUnit) {
  final K key = keyOf(value);
  if (key != null) {
    return collectionWithWriteTimeout(maxTime, timeUnit)
        .replaceOne(byId(key), encode(value))
        .getModifiedCount() == 1;
  } else {
    throw new IllegalArgumentException("Key must not be null");
  }
}
origin: de.otto.edison/edison-mongo

public V createOrUpdate(final V value, final long maxTime, final TimeUnit timeUnit) {
  final Document doc = encode(value);
  collectionWithWriteTimeout(maxTime, timeUnit)
      .replaceOne(byId(keyOf(value)), doc, new UpdateOptions().upsert(true));
  return decode(doc);
}
origin: otto-de/edison-microservice

public V createOrUpdate(final V value, final long maxTime, final TimeUnit timeUnit) {
  final Document doc = encode(value);
  collectionWithWriteTimeout(maxTime, timeUnit)
      .replaceOne(byId(keyOf(value)), doc, new ReplaceOptions().upsert(true));
  return decode(doc);
}
origin: de.otto.edison/edison-mongo

final Bson query = and(eq(AbstractMongoRepository.ID, key), eq(ETAG, eTag));
final Document updatedETaggable = collectionWithWriteTimeout(maxTime, timeUnit).findOneAndReplace(query, encode(value), new FindOneAndReplaceOptions().returnDocument(AFTER));
if (isNull(updatedETaggable)) {
  final boolean documentExists = collection()
origin: otto-de/edison-microservice

final Bson query = and(eq(AbstractMongoRepository.ID, key), eq(ETAG, eTag));
final Document updatedETaggable = collectionWithWriteTimeout(maxTime, timeUnit).findOneAndReplace(query, encode(value), new FindOneAndReplaceOptions().returnDocument(AFTER));
if (isNull(updatedETaggable)) {
  final boolean documentExists = collection()
de.otto.edison.mongoAbstractMongoRepositorycollectionWithWriteTimeout

Popular methods of AbstractMongoRepository

  • byId
    Returns a query that is selecting documents by ID.
  • collection
  • decode
    Decode a MongoDB Document into a value.
  • encode
    Encode a value into a MongoDB Document.
  • findOne
    Find a single value with the specified key, if existing.
  • keyOf
    Returns the key / identifier from the given value. The key of a document must never be null.
  • matchAll
    Returns a query that is selecting all documents.
  • create
  • createOrUpdate
  • createOrUpdateBulk
  • delete
    Deletes the document identified by key.
  • deleteAll
    Deletes all documents from this repository.
  • delete,
  • deleteAll,
  • ensureIndexes,
  • findAll,
  • findAllAsStream,
  • getFindIterable,
  • size,
  • toStream,
  • update

Popular in Java

  • Reading from database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onRequestPermissionsResult (Fragment)
  • putExtra (Intent)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now