org.apache.usergrid.persistence.model.util.UUIDGenerator类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中org.apache.usergrid.persistence.model.util.UUIDGenerator类的一些代码示例,展示了UUIDGenerator类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UUIDGenerator类的具体详情如下:
包路径:org.apache.usergrid.persistence.model.util.UUIDGenerator
类名称:UUIDGenerator

UUIDGenerator介绍

[英]TODO replace this with the Astyanax generator libs
[中]TODO将其替换为Astyanax生成器libs

代码示例

代码示例来源:origin: apache/usergrid

/**
 * Create a new ID.  Should only be used for new entities
 * @param type
 */
public SimpleId( final String type ){
  this(UUIDGenerator.newTimeUUID(), type);
}

代码示例来源:origin: apache/usergrid

@Override
  public UUID newTimeUUID() {
    return UUIDGenerator.newTimeUUID();
  }
}

代码示例来源:origin: apache/usergrid

/**
   * Generate a new UUID, and remove all the '-' characters from the resulting string.
   * @return
   */
  public static String newUUIDString() {
    return UUIDGenerator.newTimeUUID().toString().replace( "-", "" );
  }
}

代码示例来源:origin: apache/usergrid

/**
 * When marking nodes for deletion we must use the same unit of measure as the edge timestamps
 * @return
 */
public static long createGraphOperationTimestamp(){
  return UUIDGenerator.newTimeUUID().timestamp();
}

代码示例来源:origin: apache/usergrid

@Override
public Optional<MvccEntity> load( final ApplicationScope scope, final Id entityId ) {
  final EntitySet results = load( scope, Collections.singleton( entityId ), UUIDGenerator.newTimeUUID() );
  return Optional.fromNullable( results.getEntity( entityId ));
}

代码示例来源:origin: apache/usergrid

@Override
public Optional<MvccEntity> load( final ApplicationScope scope, final Id entityId ) {
  final EntitySet results = load( scope, Collections.singleton( entityId ), UUIDGenerator.newTimeUUID() );
  return Optional.fromNullable( results.getEntity( entityId ));
}

代码示例来源:origin: apache/usergrid

@Override
public Observable<MarkedEdge> compactNode( final Id inputNode ) {
  final UUID startTime = UUIDGenerator.newTimeUUID();
  final Observable<MarkedEdge> nodeObservable =
    Observable.just( inputNode )
      .map( node -> nodeSerialization.getMaxVersion( scope, node ) )
      //.doOnNext(maxTimestamp -> logger.info("compactNode maxTimestamp={}", maxTimestamp.toString()))
      .takeWhile(maxTimestamp -> maxTimestamp.isPresent() )
      //map our delete listener
      .flatMap( timestamp -> nodeDeleteListener.receive( scope, inputNode, startTime ) );
  return ObservableTimer.time( nodeObservable, this.deleteNodeTimer );
}

代码示例来源:origin: apache/usergrid

/**
 * Create the id
 */
public static Id createId( String type ) {
  return createId( UUIDGenerator.newTimeUUID(), type );
}

代码示例来源:origin: apache/usergrid

protected ElasticsearchIndexEvent getESIndexEvent(final IndexOperationMessage indexOperationMessage) {
  final String jsonValue = ObjectJsonSerializer.INSTANCE.toString( indexOperationMessage );
  final UUID newMessageId = UUIDGenerator.newTimeUUID();
  final int expirationTimeInSeconds =
    ( int ) TimeUnit.MILLISECONDS.toSeconds( indexProcessorFig.getIndexMessageTtl() );
  //write to the map in ES
  esMapPersistence.putString( newMessageId.toString(), jsonValue, expirationTimeInSeconds );
  return new ElasticsearchIndexEvent(queueFig.getPrimaryRegion(), newMessageId );
}

代码示例来源:origin: apache/usergrid

/**
   * Null entity type
   */
  private static Id nullEntityType() {
    final Id entityId = mock( Id.class );
    when( entityId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
    when( entityId.getType() ).thenReturn( null );
    return entityId;
  }
}

代码示例来源:origin: apache/usergrid

/** Incorrect fields */
private static MvccEntity wrongUuidType() {
  final Id id = mock( Id.class );
  when( id.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
  when( id.getType() ).thenReturn( "test" );
  final MvccEntity entity = mock( MvccEntity.class );
  when( entity.getId() ).thenReturn( id );
  when( entity.getVersion() ).thenReturn( UUID.randomUUID() );
  return entity;
}

代码示例来源:origin: apache/usergrid

private static MvccEntity invalidId() {
  final Id id = mock( Id.class );
  when( id.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
  when( id.getType() ).thenReturn( "" );
  final MvccEntity entity = mock( MvccEntity.class );
  when( entity.getId() ).thenReturn( id );
  when( entity.getVersion() ).thenReturn( UUID.randomUUID() );
  return entity;
}

代码示例来源:origin: apache/usergrid

@Before
public void setup() {
  scope = mock( ApplicationScope.class );
  Id orgId = mock( Id.class );
  when( orgId.getType() ).thenReturn( "organization" );
  when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
  when( scope.getApplication() ).thenReturn( orgId );
}

代码示例来源:origin: apache/usergrid

@Before
public void setup() {
  scope = mock( ApplicationScope.class );
  Id orgId = mock( Id.class );
  when( orgId.getType() ).thenReturn( "organization" );
  when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
  when( scope.getApplication() ).thenReturn( orgId );
}

代码示例来源:origin: apache/usergrid

@Before
public void mockApp() {
  this.scope = mock( ApplicationScope.class );
  Id orgId = mock( Id.class );
  when( orgId.getType() ).thenReturn( "organization" );
  when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
  when( this.scope.getApplication() ).thenReturn( orgId );
}

代码示例来源:origin: apache/usergrid

@Before
public void setup() {
  scope = mock( ApplicationScope.class );
  Id orgId = mock( Id.class );
  when( orgId.getType() ).thenReturn( "organization" );
  when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
  when( scope.getApplication() ).thenReturn( orgId );
}

代码示例来源:origin: apache/usergrid

@Before
public void setup() {
  scope = mock( ApplicationScope.class );
  Id orgId = mock( Id.class );
  when( orgId.getType() ).thenReturn( "organization" );
  when( orgId.getUuid() ).thenReturn( UUIDGenerator.newTimeUUID() );
  when( scope.getApplication() ).thenReturn( orgId );
  serialization = getSerializationImpl();
}

代码示例来源:origin: apache/usergrid

@Test( expected = UnsupportedOperationException.class )
public void loadAscendingHistory() throws ConnectionException {
  final Id applicationId = new SimpleId( "application" );
  final String name = "test";
  ApplicationScope context = new ApplicationScopeImpl( applicationId );
  final Id entityId = new SimpleId( UUIDGenerator.newTimeUUID(), name );
  final UUID version1 = UUIDGenerator.newTimeUUID();
  serializationStrategy.loadAscendingHistory( context, entityId, version1, 20 );
}

代码示例来源:origin: apache/usergrid

@Test( expected = UnsupportedOperationException.class )
  public void loadDescendingHistory() throws ConnectionException {

    final String name = "test";

    final Id applicationId = new SimpleId( "application" );

    ApplicationScope context = new ApplicationScopeImpl( applicationId );

    final Id entityId = new SimpleId( UUIDGenerator.newTimeUUID(), name );
    final UUID version1 = UUIDGenerator.newTimeUUID();

    serializationStrategy.loadDescendingHistory( context, entityId, version1, 20 );
  }
}

代码示例来源:origin: apache/usergrid

@Test
public void multiReadNoKey() {
  MapManager mm = mmf.createMapManager( this.scope );
  final String key = UUIDGenerator.newTimeUUID().toString();
  final Map<String, String> results = mm.getStrings( Collections.singleton( key ) );
  assertNotNull( results );
  final String shouldBeMissing = results.get( key );
  assertNull( shouldBeMissing );
}

相关文章

微信公众号

最新文章

更多

UUIDGenerator类方法