本文整理了Java中org.apache.usergrid.persistence.Query.setConnectionType
方法的一些代码示例,展示了Query.setConnectionType
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setConnectionType
方法的具体详情如下:
包路径:org.apache.usergrid.persistence.Query
类名称:Query
方法名:setConnectionType
[英]Set the connection type
[中]设置连接类型
代码示例来源:origin: apache/usergrid
@Override
public Results getTargetEntities( String connectionType, String connectedEntityType, Level level )
throws Exception {
//until this is refactored properly, we will delegate to a search by query
Results raw = null;
Preconditions.checkNotNull( connectionType, "connectionType cannot be null" );
Query query = new Query();
query.setConnectionType( connectionType );
query.setEntityType( connectedEntityType );
query.setResultsLevel( level );
return searchTargetEntities( query );
}
代码示例来源:origin: apache/usergrid
@Override
public Results getFailedImportEntities(final UUID applicationId, final UUID importId, final UUID fileImportId,
@Nullable final String ql, @Nullable final String cursor) {
Preconditions.checkNotNull(applicationId, "applicationId must be specified");
Preconditions.checkNotNull(importId, "importId must be specified");
Preconditions.checkNotNull(fileImportId, "fileImportId must be specified");
try {
final EntityManager rootEm = emf.getEntityManager(emf.getManagementAppId());
final FileImport importEntity = getFileImport(applicationId, importId, fileImportId);
Query query = Query.fromQLNullSafe(ql);
query.setCursor(cursor);
query.setConnectionType(FileImportTracker.ERRORS_CONNECTION_NAME);
query.setResultsLevel(Level.ALL_PROPERTIES);
//set our entity type
query.setEntityType(Schema.getDefaultSchema().getEntityType(FailedImportEntity.class));
return rootEm.searchTargetEntities(importEntity, query);
} catch (Exception e) {
throw new RuntimeException("Unable to get import entity", e);
}
}
代码示例来源:origin: apache/usergrid
@Override
public Results getFileImports(final UUID applicationId, final UUID importId,
@Nullable final String ql, @Nullable final String cursor) {
Preconditions.checkNotNull(applicationId, "applicationId must be specified");
Preconditions.checkNotNull(importId, "importId must be specified");
try {
final EntityManager rootEm = emf.getEntityManager(emf.getManagementAppId());
final Import importEntity = getImport(applicationId, importId);
Query query = Query.fromQLNullSafe(ql);
query.setCursor(cursor);
query.setConnectionType(IMPORT_FILE_INCLUDES_CONNECTION);
query.setResultsLevel(Level.ALL_PROPERTIES);
//set our entity type
query.setEntityType(Schema.getDefaultSchema().getEntityType(FileImport.class));
return rootEm.searchTargetEntities(importEntity, query);
} catch (Exception e) {
throw new RuntimeException("Unable to get import entity", e);
}
}
代码示例来源:origin: apache/usergrid
private int getConnectionCount(final Import importRoot) {
try {
EntityManager rootEM = emf.getEntityManager(emf.getManagementAppId());
Query query = Query.fromQL("select *");
query.setEntityType("file_import");
query.setConnectionType(IMPORT_FILE_INCLUDES_CONNECTION);
query.setLimit(MAX_FILE_IMPORTS);
// TODO, this won't work with more than 100 files
Results entities = rootEM.searchTargetEntities(importRoot, query);
return entities.size();
// see ImportConnectsTest()
// Results entities = rootEM.getTargetEntities(
// importRoot, "includes", null, Level.ALL_PROPERTIES );
// PagingResultsIterator itr = new PagingResultsIterator( entities );
// int count = 0;
// while ( itr.hasNext() ) {
// itr.next();
// count++;
// }
// return count;
} catch (Exception e) {
logger.error("application doesn't exist within the current context");
throw new RuntimeException(e);
}
}
代码示例来源:origin: apache/usergrid
/**
* (non-Javadoc) @see org.apache.usergrid.persistence.query.SingleOrderByMaxLimitCollection
* .ConnectionHelper#getResults
* (org.apache.usergrid.persistence.Query)
*/
@Override
public Results getResults( Query query ) throws Exception {
query.setConnectionType( CONNECTION );
// don't set it on purpose
query.setEntityType( null );
return app.getEntityManager().searchTargetEntities(rootEntity, query);
}
}
代码示例来源:origin: apache/usergrid
query.setConnectionType(IMPORT_FILE_INCLUDES_CONNECTION);
query.setLimit(MAX_FILE_IMPORTS);
代码示例来源:origin: apache/usergrid
@Override
public Results getResults( Query query ) throws Exception {
app.waitForQueueDrainAndRefreshIndex();
query.setConnectionType( CONNECTION );
query.setEntityType( "test" );
return app.getEntityManager().searchTargetEntities(rootEntity, query);
}
}
代码示例来源:origin: apache/usergrid
q.setConnectionType( connection );
代码示例来源:origin: apache/usergrid
+ ((LinkedHashMap<String, Object>) userProperties.get("location")).get("latitude")
+ ", " + ((LinkedHashMap<String, Object>)
userProperties.get("location")).get("longitude")).setConnectionType("likes"));
assertEquals(1, emSearchResults.size());
+ ((LinkedHashMap<String, Object>) userProperties.get("location")).get("latitude")
+ ", " + ((LinkedHashMap<String, Object>)
userProperties.get("location")).get("longitude")).setConnectionType("likes"));
assertEquals(0, emSearchResults.size());
代码示例来源:origin: apache/usergrid
private int getConnectionCountViaSearch( final Import importRoot ) {
try {
EntityManager emMgmtApp = setup.getEmf()
.getEntityManager(setup.getEmf().getManagementAppId() );
Query query = Query.fromQL("select *");
query.setEntityType("file_import");
query.setConnectionType("includes");
query.setLimit(10000);
Results entities = emMgmtApp.searchTargetEntities(importRoot, query);
return entities.size();
// PagingResultsIterator itr = new PagingResultsIterator( entities );
// int count = 0;
// while ( itr.hasNext() ) {
// itr.next();
// count++;
// }
// return count;
}
catch ( Exception e ) {
logger.error( "application doesn't exist within the current context" );
throw new RuntimeException( e );
}
}
}
代码示例来源:origin: apache/usergrid
query.setConnectionType( "testconnection" );
query.setEntityType( "user" );
代码示例来源:origin: apache/usergrid
query = new Query();
query.setConnectionType( cType );
query.setEntityType( eType );
if ( id != null ) {
代码示例来源:origin: apache/usergrid
private int readData( EntityManager em, String collectionName, int expectedEntities, int expectedConnections )
throws Exception {
app.waitForQueueDrainAndRefreshIndex();
Query q = Query.fromQL( "select * where key1=1000" ).withLimit( 1000 );
Results results = em.searchCollectionConsistent( em.getApplicationRef(), collectionName, q, expectedEntities );
int count = 0;
while ( true ) {
for ( Entity e : results.getEntities() ) {
assertEquals( 2000, e.getProperty( "key2" ) );
Results catResults =
em.searchTargetEntities( e, Query.fromQL( "select *" ).setConnectionType( "herds" ) );
assertEquals( expectedConnections, catResults.size() );
if ( count % 100 == 0 ) {
logger.info( "read {} entities", count );
}
count++;
}
if ( results.hasCursor() ) {
logger.info( "Counted {} : query again with cursor", count );
q.setCursor( results.getCursor() );
results = em.searchCollection( em.getApplicationRef(), collectionName, q );
}
else {
break;
}
}
return count;
}
代码示例来源:origin: apache/usergrid
query.setConnectionType( "likes" );
内容来源于网络,如有侵权,请联系作者删除!