Examples of OptionsContext


Examples of org.hibernate.ogm.options.spi.OptionsContext

      return globalOptions;
    }

    @Override
    public OptionsContext getEntityOptions(Class<?> entityType) {
      OptionsContext entityOptions = entityContexts.get( entityType );

      if ( entityOptions == null ) {
        entityOptions = getAndCacheEntityOptions( entityType );
      }
View Full Code Here

Examples of org.hibernate.ogm.options.spi.OptionsContext

    }

    @Override
    public OptionsContext getPropertyOptions(Class<?> entityType, String propertyName) {
      PropertyKey key = new PropertyKey( entityType, propertyName );
      OptionsContext propertyOptions = propertyContexts.get( key );

      if ( propertyOptions == null ) {
        propertyOptions = getAndCachePropertyOptions( key );
      }
View Full Code Here

Examples of org.hibernate.ogm.options.spi.OptionsContext

      return propertyOptions;
    }

    private OptionsContext getAndCacheEntityOptions(Class<?> entityType) {
      OptionsContext entityOptions = OptionsContextImpl.forEntity( sources, entityType );

      OptionsContext cachedOptions = entityContexts.putIfAbsent( entityType, entityOptions );
      if ( cachedOptions != null ) {
        entityOptions = cachedOptions;
      }

      return entityOptions;
View Full Code Here

Examples of org.hibernate.ogm.options.spi.OptionsContext

      return entityOptions;
    }

    private OptionsContext getAndCachePropertyOptions(PropertyKey key) {
      OptionsContext propertyOptions = OptionsContextImpl.forProperty( sources, key.getEntity(), key.getProperty() );

      OptionsContext cachedOptions = propertyContexts.putIfAbsent( key, propertyOptions );
      if ( cachedOptions != null ) {
        propertyOptions = cachedOptions;
      }

      return propertyOptions;
View Full Code Here

Examples of org.hibernate.ogm.options.spi.OptionsContext

    Class<?> entityType = Foo.class;
    String propertyName = "bar";
    optionsServiceContext.addPropertyOption( entityType, propertyName, new NameExampleOption(), "foobar" );

    // when
    OptionsContext context = OptionsContextImpl.forProperty( getSources(), entityType, propertyName );

    // then
    assertThat( context.getUnique( NameExampleOption.class ) ).isEqualTo( "foobar" );
  }
View Full Code Here

Examples of org.hibernate.ogm.options.spi.OptionsContext

    String propertyName = "bar";

    optionsServiceContext.addEntityOption( entityType, new NameExampleOption(), "foobar" );

    // when
    OptionsContext context = OptionsContextImpl.forProperty( getSources(), entityType, propertyName );

    // then
    assertThat( context.getUnique( NameExampleOption.class ) ).isEqualTo( "foobar" );
  }
View Full Code Here

Examples of org.hibernate.ogm.options.spi.OptionsContext

    String propertyName = "bar";

    optionsServiceContext.addGlobalOption( new NameExampleOption(), "foobar" );

    // when
    OptionsContext context = OptionsContextImpl.forProperty( getSources(), entityType, propertyName );

    // then
    assertThat( context.getUnique( NameExampleOption.class ) ).isEqualTo( "foobar" );
  }
View Full Code Here

Examples of org.hibernate.ogm.options.spi.OptionsContext

    optionsServiceContext.addPropertyOption( entityType, propertyName, new PermissionOption( "user" ), "read" );
    optionsServiceContext.addPropertyOption( entityType, propertyName, new PermissionOption( "author" ), "read,write" );

    // when
    OptionsContext context = OptionsContextImpl.forProperty( getSources(), entityType, propertyName );

    // then
    assertThat( context.get( PermissionOption.class, "user" ) ).isEqualTo( "read" );
    assertThat( context.get( PermissionOption.class, "author" ) ).isEqualTo( "read,write" );
  }
View Full Code Here

Examples of org.hibernate.ogm.options.spi.OptionsContext

    optionsServiceContext.addPropertyOption( entityType, propertyName, new PermissionOption( "user" ), "read" );
    optionsServiceContext.addPropertyOption( entityType, propertyName, new PermissionOption( "author" ), "read,write" );

    // when
    OptionsContext context = OptionsContextImpl.forProperty( getSources(), entityType, propertyName );

    // then
    assertThat( context.getAll( PermissionOption.class ) ).
        hasSize( 2 )
        .includes(
            entry( "user", "read" ),
            entry( "author", "read,write" )
        );
View Full Code Here

Examples of org.hibernate.ogm.options.spi.OptionsContext

    optionsServiceContext.addPropertyOption( entityType, propertyName, new PermissionOption( "user" ), "read" );
    optionsServiceContext.addPropertyOption( entityType, propertyName, new PermissionOption( "author" ), "read,write" );
    optionsServiceContext.addEntityOption( entityType, new PermissionOption( "admin" ), "read,write,delete" );

    // when
    OptionsContext context = OptionsContextImpl.forProperty( getSources(), entityType, propertyName );

    // then
    assertThat( context.getAll( PermissionOption.class ) ).
        hasSize( 2 )
        .includes(
            entry( "user", "read" ),
            entry( "author", "read,write" )
        );
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.