Tabnine Logo
KaaOptimisticLockingFailureException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.kaaproject.kaa.server.common.dao.exception.KaaOptimisticLockingFailureException
constructor

Best Java code snippets using org.kaaproject.kaa.server.common.dao.exception.KaaOptimisticLockingFailureException.<init> (Showing top 4 results out of 315)

origin: kaaproject/kaa

/**
 * Store an object in a database.
 *
 * @param object object to be stored
 * @return saved object
 */
public T save(T object) {
 try {
  mongoTemplate.save(object);
  return object;
 } catch (OptimisticLockingFailureException exception) {
  LOG.error("[{}] Can't update entity with version {}. Entity already changed!",
    getDocumentClass(), object.getVersion());
  throw new KaaOptimisticLockingFailureException(
    "Can't update entity with version "
      + object.getVersion()
      + ". Entity already changed!");
 } catch (DuplicateKeyException exception) {
  LOG.error("[{}] Can't insert entity. Entity already exists!", getDocumentClass());
  throw new KaaOptimisticLockingFailureException(
    "Can't insert entity. Entity already exists!");
 }
}
origin: kaaproject/kaa

    + "Endpoint profile already changed!",
  profile.getId(), profile.getVersion());
throw new KaaOptimisticLockingFailureException("Can't update endpoint profile with"
  + " version . Endpoint profile already changed!");
origin: kaaproject/kaa

private T insertLocked(T entity) {
 Insert insert = insertInto(getColumnFamilyName()).ifNotExists();
 CassandraEntityMapper<T> entityMapper = CassandraEntityMapper.getEntityMapperForClass(
   getColumnFamilyClass(), cassandraClient);
 for (String name : entityMapper.getKeyColumnNames()) {
  insert.value(name, entityMapper.getColumnValueForName(name, entity, cassandraClient));
 }
 for (String name : entityMapper.getNonKeyColumnNames()) {
  insert.value(name, entityMapper.getColumnValueForName(name, entity, cassandraClient));
 }
 insert.setConsistencyLevel(getWriteConsistencyLevel());
 ResultSet res = execute(insert);
 if (!res.wasApplied()) {
  LOG.error("[{}] Can't insert entity. Entity already exists!", getColumnFamilyClass());
  throw new KaaOptimisticLockingFailureException("Can't insert entity. Entity already exists!");
 } else {
  Clause[] whereClauses = buildKeyClauses(entityMapper, entity);
  Select.Where where = select().from(getColumnFamilyName()).where(whereClauses[0]);
  if (whereClauses.length > 1) {
   for (int i = 1; i < whereClauses.length; i++) {
    where = where.and(whereClauses[i]);
   }
  }
  return findOneByStatement(where);
 }
}
origin: kaaproject/kaa

 LOG.error("[{}] Can't update entity with version {}. Entity already changed!",
   getColumnFamilyClass(), version);
 throw new KaaOptimisticLockingFailureException("Can't update entity with version "
   + version + ". Entity already changed!");
} else {
org.kaaproject.kaa.server.common.dao.exceptionKaaOptimisticLockingFailureException<init>

Popular methods of KaaOptimisticLockingFailureException

    Popular in Java

    • Creating JSON documents from java classes using gson
    • startActivity (Activity)
    • getContentResolver (Context)
    • getResourceAsStream (ClassLoader)
    • List (java.util)
      An ordered collection (also known as a sequence). The user of this interface has precise control ove
    • NoSuchElementException (java.util)
      Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
    • StringTokenizer (java.util)
      Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
    • CountDownLatch (java.util.concurrent)
      A synchronization aid that allows one or more threads to wait until a set of operations being perfor
    • Semaphore (java.util.concurrent)
      A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
    • JButton (javax.swing)
    • Top 17 PhpStorm Plugins
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

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