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

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

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

Query.setEntityType介绍

暂无

代码示例

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

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.setEntityType(Schema.getDefaultSchema().getEntityType(FileImport.class));
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.setEntityType( type );

代码示例来源: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.setEntityType( collection.getType() );
final Query toExecute = adjustQuery( query );
final Optional<String> queryString = query.isGraphSearch()? Optional.<String>absent(): query.getQl();

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

query.setEntityType( "user" );

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

query.setEntityType( eType );
if ( id != null ) {
  query.addIdentifier( Identifier.fromUUID( id ) );

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

query.setConnectionType( "likes" );
query.setEntityType( "user" );

相关文章