org.apache.usergrid.persistence.Query.setCursor()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(278)

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

Query.setCursor介绍

暂无

代码示例

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

public Query withCursor( String cursor ) {
  setCursor( cursor );
  return this;
}

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

@Override
public Results getImports(final UUID applicationId, @Nullable final String ql, @Nullable final String cursor) {
  Preconditions.checkNotNull(applicationId, "applicationId must be specified");
  try {
    final EntityManager rootEm = emf.getEntityManager(emf.getManagementAppId());
    final Entity appInfo = getApplicationInfoEntity(rootEm, applicationId);
    Query query = Query.fromQLNullSafe(ql);
    query.setCursor(cursor);
    //set our entity type
    query.setEntityType(Schema.getDefaultSchema().getEntityType(Import.class));
    return rootEm.searchCollection(appInfo, APP_IMPORT_CONNECTION, query);
  } catch (Exception e) {
    throw new RuntimeException("Unable to get import entity", e);
  }
}

代码示例来源: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

query.setCursor( results.getCursor() );

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

query.setCursor( results.getCursor() );

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

query.setCursor( results.getCursor() );

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

query.setCursor( results.getCursor() );

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

query.setCursor( results.getCursor() );

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

query.setCursor( results.getCursor() );

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

query.setCursor( results.getCursor() );

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

query.setCursor(r.getCursor());

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

query.setCursor( r.getCursor() );

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

query.setCursor( r.getCursor() );

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

query.setCursor( r.getCursor() );

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

private int countEntities( EntityManager em, String collectionName, int expectedEntities)
    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 ) {
      count += results.size();
      if ( results.hasCursor() ) {
        logger.info( "Counted {} : query again with cursor", count );
        q.setCursor( results.getCursor() );
        results = em.searchCollection( em.getApplicationRef(), collectionName, q );
      }
      else {
        break;
      }
    }
    assertEquals( "Did not get expected entities", expectedEntities, count );
    return count;
  }

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

private int countEntities( EntityManager em, String collectionName, int expectedEntities)
    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 ) {
      count += results.size();
      if ( results.hasCursor() ) {
        logger.info( "Counted {} : query again with cursor", count );
        q.setCursor( results.getCursor() );
        results = em.searchCollection( em.getApplicationRef(), collectionName, q );
      }
      else {
        break;
      }
    }
    assertEquals( "Did not get expected entities", expectedEntities, count );
    return count;
  }

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

query.setCursor(results.getCursor());

代码示例来源: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.setCursor(result.getCursor());
result = app.testRequest(ServiceAction.GET,1,"users","conn-user1","connecting","likes",query);
String enityName2 = result.getEntity().getProperty("email").toString();
query.setCursor(result.getCursor());
result = app.testRequest(ServiceAction.GET,0,"users","conn-user1","connecting","likes",query);

相关文章