@Override public boolean equals( final Object o ) { if ( this == o ) { return true; } if ( !( o instanceof ApplicationScope ) ) { return false; } final ApplicationScope that = ( ApplicationScope ) o; if ( !application.equals( that.getApplication() ) ) { return false; } return true; }
/** * Get the application scope from the given uuid * * @param applicationId The applicationId */ public static ApplicationScope getApplicationScope( UUID applicationId ) { // We can always generate a scope, it doesn't matter if the application exists yet or not. return new ApplicationScopeImpl( generateApplicationId( applicationId ) ); }
/** * Validate the organization scope */ public static void validateApplicationScope( final ApplicationScope scope ) { Preconditions.checkNotNull( scope, "organization scope is required" ); verifyIdentity( scope.getApplication() ); }
@Test( expected = NullPointerException.class ) public void orgIdrequired() { new ApplicationScopeImpl( null); }
public static String getType( ApplicationScope applicationScope, String type ) { StringBuilder sb = new StringBuilder(); idString( sb, APPID_NAME, applicationScope.getApplication() ); sb.append( FIELD_SEPERATOR ); sb.append( ENTITY_TYPE_NAME).append("(" ).append( type ).append( ")" ); return sb.toString(); }
@Override public Health getEntityStoreHealth() { // could use any collection scope here, does not matter EntityCollectionManager ecm = managerCache.getEntityCollectionManager( new ApplicationScopeImpl( new SimpleId( CpNamingUtils.MANAGEMENT_APPLICATION_ID, "application" ) ) ); return ecm.getHealth(); }
/** * * @param indexFig config * @param aliasPrefix alias prefix, e.g. app_id etc.. */ public ApplicationIndexAlias(IndexFig indexFig, ApplicationScope applicationScope, String aliasPrefix) { this.writeAlias = aliasPrefix + "_" + applicationScope.getApplication().getUuid() + "_write_" + indexFig.getAliasPostfix(); this.readAlias = aliasPrefix + "_" + applicationScope.getApplication().getUuid() + "_read_" + indexFig.getAliasPostfix(); }
@Before public void setup() { this.scope = new ApplicationScopeImpl( createId( "application" ) ); }
public int getBucket(ApplicationScope applicationScope){ //potentially add offset to remove old buckets //if set is 1-5 then +5 would change range to 6-10 return indexBucketOffset + bucketLocator.getCurrentBucket(applicationScope.getApplication().getUuid().toString()); } }
@Before public void mockApp() { this.scope = new ApplicationScopeImpl( createId( "application" ) ); }
@Override public long getCollectionSize(final ApplicationScope applicationScope, final String collectionName) { return getSize(applicationScope, CpNamingUtils.createCollectionSearchEdge(applicationScope.getApplication(), collectionName)); }
@Test( expected = NullPointerException.class ) public void loadListParamVersion() throws ConnectionException { logEntryStrategy .load( new ApplicationScopeImpl( new SimpleId( "organization" ) ), new SimpleId( "test" ), null, 1 ); }
@Override void writeEdge( final MutationBatch batch, final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily, final ApplicationScope scope, final RowKey rowKey, final DirectedEdge edge, final Shard shard, final boolean isDeleted ) { batch.withRow( columnFamily, ScopedRowKey.fromKey( scope.getApplication(), rowKey ) ).putColumn( edge, isDeleted ); } }.createBatch( scope, shards, timestamp );
@Test(expected = NullPointerException.class) public void loadListParamVersion() throws ConnectionException { serializationStrategy .loadDescendingHistory( new ApplicationScopeImpl( new SimpleId( "organization" ) ), new SimpleId( "test" ), null, 1 ); }
@Override void writeEdge( final MutationBatch batch, final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily, final ApplicationScope scope, final RowKey rowKey, final DirectedEdge edge, final Shard shard, final boolean isDeleted ) { batch.withRow( columnFamily, ScopedRowKey.fromKey( scope.getApplication(), rowKey ) ).deleteColumn( edge ); } }.createBatch( scope, shards, timestamp );
@Test(expected = NullPointerException.class) public void deleteParamVersion() throws ConnectionException { serializationStrategy .delete( new ApplicationScopeImpl( new SimpleId( "organization" )), new SimpleId( "test" ), null ); }
@Override void writeEdge( final MutationBatch batch, final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily, final ApplicationScope scope, final RowKey rowKey, final DirectedEdge edge, final Shard shard, final boolean isDeleted ) { batch.withRow( columnFamily, ScopedRowKey.fromKey( scope.getApplication(), rowKey ) ).deleteColumn( edge ); } }.createBatch( scope, shards, timestamp );
@Override void writeEdge( final MutationBatch batch, final MultiTenantColumnFamily<ScopedRowKey<RowKey>, DirectedEdge> columnFamily, final ApplicationScope scope, final RowKey rowKey, final DirectedEdge edge, final Shard shard, final boolean isDeleted ) { batch.withRow( columnFamily, ScopedRowKey.fromKey( scope.getApplication(), rowKey ) ).putColumn( edge, isDeleted ); } }.createBatch( scope, shards, timestamp );
@Override void writeEdge( final MutationBatch batch, final MultiTenantColumnFamily<ScopedRowKey<RowKeyType>, DirectedEdge> columnFamily, final ApplicationScope scope, final RowKeyType rowKey, final DirectedEdge edge, final Shard shard, final boolean isDeleted ) { batch.withRow( columnFamily, ScopedRowKey.fromKey( scope.getApplication(), rowKey ) ).putColumn( edge, isDeleted ); } }.createBatch( scope, shards, timestamp );
@Override public long getCollectionSize(final UUID applicationId, final String collectionName) { AggregationService aggregationService = aggregationServiceFactory.getAggregationService(); ApplicationScope applicationScope =CpNamingUtils.getApplicationScope(applicationId); return aggregationService.getSize(applicationScope, CpNamingUtils.createCollectionSearchEdge(applicationScope.getApplication(), collectionName)); }