Examples of Lockable


Examples of org.apache.jackrabbit.ocm.testmodel.Lockable


            // --------------------------------------------------------------------------------
            // Create an object which is associated to the
            // --------------------------------------------------------------------------------
            Lockable lockable = new Lockable();
            lockable.setPath("/test");
            lockable.setA1("a1");
            lockable.setA2("a2");
            ocm.insert(lockable);
            ocm.save();
           

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------          
            lockable = (Lockable) ocm.getObject("/test");
            assertNotNull("a is null", lockable);
           
            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));
            assertNull("Attribute lockowner is not null", lockable.getLockOwner());
            // --------------------------------------------------------------------------------
            // Lock the object
            // --------------------------------------------------------------------------------                      
            Lock lock = ocm.lock("/test", true, false);
           
            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertTrue("the object is not locked", ocm.isLocked("/test"));
           
            // --------------------------------------------------------------------------------
            // Unlock the object
            // --------------------------------------------------------------------------------          
            ocm.unlock("/test", lock.getLockToken());

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));


            // --------------------------------------------------------------------------------
            // Lock & update
            // --------------------------------------------------------------------------------
            lock = ocm.lock("/test", true, false);
            assertTrue("the object is not locked", ocm.isLocked("/test"));
            lockable = (Lockable) ocm.getObject("/test");
            assertNotNull("Attribute lockowner is null", lockable.getLockOwner());
            lockable.setA1("new a1 Value");
            ocm.update(lockable);
            ocm.save();
            ocm.unlock("/test", lock.getLockToken());
           
           
View Full Code Here

Examples of org.apache.jackrabbit.ocm.testmodel.Lockable


            // --------------------------------------------------------------------------------
            // Create an object which is associated to the
            // --------------------------------------------------------------------------------
            Lockable lockable = new Lockable();
            lockable.setPath("/test");
            lockable.setA1("a1");
            lockable.setA2("a2");
            ocm.insert(lockable);
            ocm.save();


            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------
            lockable = (Lockable) ocm.getObject("/test");
            assertNotNull("a is null", lockable);

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));
            assertNull("Attribute lockowner is not null", lockable.getLockOwner());
            // --------------------------------------------------------------------------------
            // Lock the object
            // --------------------------------------------------------------------------------
            Lock lock = ocm.lock("/test", true, false);

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertTrue("the object is not locked", ocm.isLocked("/test"));

            // --------------------------------------------------------------------------------
            // Unlock the object
            // --------------------------------------------------------------------------------
            ocm.unlock("/test", lock.getLockToken());

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));


            // --------------------------------------------------------------------------------
            // Lock & update
            // --------------------------------------------------------------------------------
            lock = ocm.lock("/test", true, false);
            assertTrue("the object is not locked", ocm.isLocked("/test"));
            lockable = (Lockable) ocm.getObject("/test");
            assertNotNull("Attribute lockowner is null", lockable.getLockOwner());
            lockable.setA1("new a1 Value");
            ocm.update(lockable);
            ocm.save();
            ocm.unlock("/test", lock.getLockToken());

View Full Code Here

Examples of org.apache.jackrabbit.ocm.testmodel.Lockable


            // --------------------------------------------------------------------------------
            // Create an object which is associated to the
            // --------------------------------------------------------------------------------
            Lockable lockable = new Lockable();
            lockable.setPath("/test");
            lockable.setA1("a1");
            lockable.setA2("a2");
            ocm.insert(lockable);
            ocm.save();


            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------
            lockable = (Lockable) ocm.getObject("/test");
            assertNotNull("a is null", lockable);

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));
            assertNull("Attribute lockowner is not null", lockable.getLockOwner());
            // --------------------------------------------------------------------------------
            // Lock the object
            // --------------------------------------------------------------------------------
            Lock lock = ocm.lock("/test", true, false);

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertTrue("the object is not locked", ocm.isLocked("/test"));

            // --------------------------------------------------------------------------------
            // Unlock the object
            // --------------------------------------------------------------------------------
            ocm.unlock("/test", lock.getLockToken());

            // --------------------------------------------------------------------------------
            // Check if the object is locked
            // --------------------------------------------------------------------------------
            assertFalse("the object is locked", ocm.isLocked("/test"));


            // --------------------------------------------------------------------------------
            // Lock & update
            // --------------------------------------------------------------------------------
            lock = ocm.lock("/test", true, false);
            assertTrue("the object is not locked", ocm.isLocked("/test"));
            lockable = (Lockable) ocm.getObject("/test");
            assertNotNull("Attribute lockowner is null", lockable.getLockOwner());
            lockable.setA1("new a1 Value");
            ocm.update(lockable);
            ocm.save();
            ocm.unlock("/test", lock.getLockToken());

View Full Code Here

Examples of org.hibernate.persister.entity.Lockable

    final Map keyColumnNames = dialect.forUpdateOfColumns() ? new HashMap() : null;
    final String[] drivingSqlAliases = getAliases();
    for ( int i = 0; i < drivingSqlAliases.length; i++ ) {
      final LockMode lockMode = ( LockMode ) lockModes.get( drivingSqlAliases[i] );
      if ( lockMode != null ) {
        final Lockable drivingPersister = ( Lockable ) getEntityPersisters()[i];
        final String rootSqlAlias = drivingPersister.getRootTableAlias( drivingSqlAliases[i] );
        aliasedLockModes.put( rootSqlAlias, lockMode );
        if ( keyColumnNames != null ) {
          keyColumnNames.put( rootSqlAlias, drivingPersister.getRootTableIdentifierColumnNames() );
        }
      }
    }
    return dialect.applyLocksToSql( sqlSelectString, aliasedLockModes, keyColumnNames );
  }
View Full Code Here

Examples of org.hibernate.persister.entity.Lockable

      // (necessarily) the table against which we want to apply locks.  Mainly,
      // the exception case here is joined-subclass hierarchies where we instead
      // want to apply the lock against the root table (for all other strategies,
      // it just happens that driving and root are the same).
      final QueryNode select = ( QueryNode ) queryTranslator.getSqlAST();
      final Lockable drivingPersister = ( Lockable ) select.getFromClause().getFromElement( userAlias ).getQueryable();
      final String sqlAlias = drivingPersister.getRootTableAlias( drivingSqlAlias );
      aliasedLockModes.put( sqlAlias, me.getValue() );
      if ( keyColumnNames != null ) {
        keyColumnNames.put( sqlAlias, drivingPersister.getRootTableIdentifierColumnNames() );
      }
    }
    return dialect.applyLocksToSql( sql, aliasedLockModes, keyColumnNames );
  }
View Full Code Here

Examples of org.hibernate.persister.entity.Lockable

    final Map keyColumnNames = dialect.forUpdateOfColumns() ? new HashMap() : null;
    final String[] drivingSqlAliases = getAliases();
    for ( int i = 0; i < drivingSqlAliases.length; i++ ) {
      final LockMode lockMode = ( LockMode ) lockModes.get( drivingSqlAliases[i] );
      if ( lockMode != null ) {
        final Lockable drivingPersister = ( Lockable ) getEntityPersisters()[i];
        final String rootSqlAlias = drivingPersister.getRootTableAlias( drivingSqlAliases[i] );
        aliasedLockModes.put( rootSqlAlias, lockMode );
        if ( keyColumnNames != null ) {
          keyColumnNames.put( rootSqlAlias, drivingPersister.getRootTableIdentifierColumnNames() );
        }
      }
    }
    return dialect.applyLocksToSql( sqlSelectString, aliasedLockModes, keyColumnNames );
  }
View Full Code Here

Examples of org.hibernate.persister.entity.Lockable

      // (necessarily) the table against which we want to apply locks.  Mainly,
      // the exception case here is joined-subclass hierarchies where we instead
      // want to apply the lock against the root table (for all other strategies,
      // it just happens that driving and root are the same).
      final QueryNode select = ( QueryNode ) queryTranslator.getSqlAST();
      final Lockable drivingPersister = ( Lockable ) select.getFromClause().getFromElement( userAlias ).getQueryable();
      final String sqlAlias = drivingPersister.getRootTableAlias( drivingSqlAlias );
      aliasedLockModes.put( sqlAlias, me.getValue() );
      if ( keyColumnNames != null ) {
        keyColumnNames.put( sqlAlias, drivingPersister.getRootTableIdentifierColumnNames() );
      }
    }
    return dialect.applyLocksToSql( sql, aliasedLockModes, keyColumnNames );
  }
View Full Code Here

Examples of org.hibernate.persister.entity.Lockable

    final Map keyColumnNames = dialect.forUpdateOfColumns() ? new HashMap() : null;
    final String[] drivingSqlAliases = getAliases();
    for ( int i = 0; i < drivingSqlAliases.length; i++ ) {
      final LockMode lockMode = lockOptions.getAliasSpecificLockMode( drivingSqlAliases[i] );
      if ( lockMode != null ) {
        final Lockable drivingPersister = ( Lockable ) getEntityPersisters()[i];
        final String rootSqlAlias = drivingPersister.getRootTableAlias( drivingSqlAliases[i] );
        locks.setAliasSpecificLockMode( rootSqlAlias, lockMode );
        if ( keyColumnNames != null ) {
          keyColumnNames.put( rootSqlAlias, drivingPersister.getRootTableIdentifierColumnNames() );
        }
      }
    }
    return dialect.applyLocksToSql( sql, locks, keyColumnNames );
  }
View Full Code Here

Examples of org.hibernate.persister.entity.Lockable

      // (necessarily) the table against which we want to apply locks.  Mainly,
      // the exception case here is joined-subclass hierarchies where we instead
      // want to apply the lock against the root table (for all other strategies,
      // it just happens that driving and root are the same).
      final QueryNode select = ( QueryNode ) queryTranslator.getSqlAST();
      final Lockable drivingPersister = ( Lockable ) select.getFromClause().getFromElement( userAlias ).getQueryable();
      final String sqlAlias = drivingPersister.getRootTableAlias( drivingSqlAlias );
      aliasedLockModes.put( sqlAlias, me.getValue() );
      if ( keyColumnNames != null ) {
        keyColumnNames.put( sqlAlias, drivingPersister.getRootTableIdentifierColumnNames() );
      }
    }
    return dialect.applyLocksToSql( sql, aliasedLockModes, keyColumnNames );
  }
View Full Code Here

Examples of org.hibernate.persister.entity.Lockable

      // (necessarily) the table against which we want to apply locks.  Mainly,
      // the exception case here is joined-subclass hierarchies where we instead
      // want to apply the lock against the root table (for all other strategies,
      // it just happens that driving and root are the same).
      final QueryNode select = ( QueryNode ) queryTranslator.getSqlAST();
      final Lockable drivingPersister = ( Lockable ) select.getFromClause().getFromElement( userAlias ).getQueryable();
      final String sqlAlias = drivingPersister.getRootTableAlias( drivingSqlAlias );
      aliasedLockModes.put( sqlAlias, me.getValue() );
      if ( keyColumnNames != null ) {
        keyColumnNames.put( sqlAlias, drivingPersister.getRootTableIdentifierColumnNames() );
      }
    }
    return dialect.applyLocksToSql( sql, aliasedLockModes, keyColumnNames );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.