当前位置: 首页>>代码示例>>Java>>正文


Java LightblueDataResponse类代码示例

本文整理汇总了Java中com.redhat.lightblue.client.response.LightblueDataResponse的典型用法代码示例。如果您正苦于以下问题:Java LightblueDataResponse类的具体用法?Java LightblueDataResponse怎么用?Java LightblueDataResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LightblueDataResponse类属于com.redhat.lightblue.client.response包,在下文中一共展示了LightblueDataResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fromClientResponse

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
/**
 * Wraps a response from the lightblue client library which may or may not be successful in a
 * type which allows easily querying whether or not the response was successful and getting at
 * the right type of response.
 */
static LightblueResponse fromClientResponse(
        com.redhat.lightblue.client.response.LightblueResponse response) {
    if (response instanceof LightblueErrorResponse) {
        LightblueErrorResponse errorResponse = (LightblueErrorResponse) response;

        DataError[] dataErrors = Optional.ofNullable(errorResponse.getDataErrors())
                .orElse(new DataError[0]);
        Error[] lightblueErrors = Optional.ofNullable(errorResponse.getLightblueErrors())
                .orElse(new Error[0]);

        if (dataErrors.length + lightblueErrors.length > 0) {
            return new FailedLightblueResponse(errorResponse, dataErrors, lightblueErrors);
        }
    }

    if (response instanceof LightblueDataResponse) {
        return new SuccessLightblueResponse((LightblueDataResponse) response);
    }

    throw new IllegalArgumentException("LightblueResponse was neither a data response nor an " +
            "error response.");
}
 
开发者ID:esbtools,项目名称:event-handler,代码行数:28,代码来源:LightblueResponse.java

示例2: configure

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
@Override
public void configure() throws Exception {
    from("timer:" + deleterLockResourceId + "?period=" + deleteInterval.toMillis())
    .routeId(deleterLockResourceId)
    .routePolicy(new LockingRoutePolicy(deleterLockResourceId, lockStrategy))
    .process(exchange -> {
        Instant tooOld = clock.instant().minus(deleteOlderThan);

        log.debug("Deleting {} entities with {} before {}", entityName, entityDateField, tooOld);

        DataDeleteRequest deleteRequest = new DataDeleteRequest(entityName, entityVersion);
        deleteRequest.where(Query.withValue(entityDateField, Query.BinOp.lt, Date.from(tooOld)));

        LightblueDataResponse response = client.data(deleteRequest);

        log.info("Deleted {} {} entities with {} before {}",
                response.parseModifiedCount(), entityName, entityDateField, tooOld);
    });
}
 
开发者ID:esbtools,项目名称:event-handler,代码行数:20,代码来源:PeriodicDeleteOldEntitiesRoute.java

示例3: testBulkData

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
@Test
public void testBulkData() throws Exception {
    DataBulkRequest request = new DataBulkRequest();

    for (int x = 0; x < 100; x++) {
        DataInsertRequest insert = new DataInsertRequest(Country.objectType, Country.objectVersion);
        insert.create(new Country(String.valueOf(x), "123" + x, "456" + x, null));
        insert.returns(Projection.includeField("name"));

        request.add(insert);
    }

    DefaultLightblueBulkDataResponse bulkResp = getLightblueClient().bulkData(request);

    assertNotNull(bulkResp);

    //Responses should be in the same order.
    int n = 0;
    for (LightblueDataResponse response : bulkResp.getResponses()) {
        assertNotNull(response);
        assertEquals(String.valueOf(n), response.parseProcessed(Country.class).getName());
        n++;
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:25,代码来源:BulkDataTest.java

示例4: testWithIdentityManager

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
@Test
public void testWithIdentityManager() throws Exception {
    lightblue.changeIdentityManager(
            new FakeIdentityManager().add("fakeuser", "fakepassword"));

    Country c = new Country();
    c.setName("Poland");
    c.setIso2Code("PL");
    c.setIso3Code("POL");

    DataInsertRequest insert = new DataInsertRequest(Country.objectType, Country.objectVersion);
    insert.create(c);
    insert.returns(Projection.includeFieldRecursively("*"));

    LightblueDataResponse insertResponse = lightblue.getLightblueClient("fakeuser", "fakepassword").data(insert);

    assertEquals(1, insertResponse.parseModifiedCount());
}
 
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:19,代码来源:TestLightblueExternalResource.java

示例5: migrationJobsExist

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
private boolean migrationJobsExist() {
    LOGGER.debug("Checking if there are migration jobs for {}", migrationConfiguration.getConfigurationName());
    DataFindRequest req = new DataFindRequest("migrationJob", null);
    req.where(Query.and(Query.withValue("configurationName", Query.eq, migrationConfiguration.getConfigurationName()),
            Query.withValue("generated", Query.eq, false),
            Query.withValue("status", Query.eq, MigrationJob.STATE_AVAILABLE)));
    req.select(Projection.includeField("_id"));
    req.range(1, 1);
    try {
        LightblueDataResponse resp = lbClient.data(req);
        return resp.parseMatchCount() > 0;
    } catch (Exception e) {
        LOGGER.error("Cannot query migration jobs:{}", e, e);
        return true;
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-migrator,代码行数:17,代码来源:ConsistencyCheckerController.java

示例6: data

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
@Override
public <T> T data(LightblueDataRequest lightblueRequest, Class<T> type)
        throws LightblueParseException, LightblueResponseException, LightblueHttpClientException, LightblueException {
    LightblueDataResponse response = data(lightblueRequest);

    return response.parseProcessed(type);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:8,代码来源:LightblueHttpClient.java

示例7: testBulkFind

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
@Test
public void testBulkFind() throws LightblueException, LightblueParseException {
    Country country = insertPL();

    DataFindRequest request = new DataFindRequest(Country.objectType, Country.objectVersion);
    request.select(Projection.includeField("*"));
    request.where(Query.withValue("iso2Code", Query.eq, "PL"));

    DataFindRequest request2 = new DataFindRequest(Country.objectType, Country.objectVersion);
    request2.select(Projection.includeField("*"));
    request2.where(Query.withValue("name", Query.eq, "Poland"));

    DataFindRequest request3 = new DataFindRequest(Country.objectType, Country.objectVersion);
    request3.select(Projection.includeField("*"));
    request3.where(Query.withValue("name", Query.eq, "Russia"));

    DataBulkRequest bulkRequest = new DataBulkRequest();
    bulkRequest.add(request);
    bulkRequest.add(request2);
    bulkRequest.add(request3);
    System.out.println(bulkRequest);
    LightblueBulkDataResponse bulkResponse = client.bulkData(bulkRequest);
    List<LightblueDataResponse> responses = bulkResponse.getResponses();

    assertEquals(3, responses.size());
    assertEquals(1, responses.get(0).parseMatchCount());
    assertEquals(1, responses.get(1).parseMatchCount());
    assertEquals(0, responses.get(2).parseMatchCount());

    Country c1 = responses.get(0).parseProcessed(Country.class);
    Country c2 = responses.get(1).parseProcessed(Country.class);

    assertEquals("PL", c1.getIso2Code());
    assertEquals("PL", c2.getIso2Code());

    assertEquals(responses.get(0), bulkResponse.getResponse(request));
}
 
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:38,代码来源:CountryDAOTest.java

示例8: test

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
@Test
public void test() throws Exception {
    Country c = new Country();
    c.setName("Poland");
    c.setIso2Code("PL");
    c.setIso3Code("POL");

    DataInsertRequest insert = new DataInsertRequest(Country.objectType, Country.objectVersion);
    insert.create(c);
    insert.returns(Projection.includeFieldRecursively("*"));

    LightblueDataResponse insertResponse = lightblue.getLightblueClient().data(insert);

    assertEquals(1, insertResponse.parseModifiedCount());
}
 
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:16,代码来源:TestLightblueExternalResource.java

示例9: countMigrationJobs

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
private int countMigrationJobs(String configurationName, Date startDate, Date endDate) throws LightblueException {
    DataFindRequest findJobs = new DataFindRequest(MigrationJob.ENTITY_NAME);
    findJobs.where(
        Query.and(
            Query.withValue("configurationName", Query.eq, configurationName),
            Query.withValue("scheduledDate", Query.gte, startDate),
            Query.withValue("scheduledDate", Query.lte, endDate)
        )
    );
    findJobs.select(new Projection[]{Projection.excludeFieldRecursively("*")}, 0, 0);

    LightblueDataResponse response = lightblueClient.data(findJobs);
    return response.parseMatchCount();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-migrator,代码行数:15,代码来源:NMPMonitor.java

示例10: getSuccess

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
@Override
public LightblueDataResponse getSuccess() {
    // TODO: maybe dif exception?
    throw new LightblueResponseException(errors);
}
 
开发者ID:esbtools,项目名称:event-handler,代码行数:6,代码来源:FailedLightblueResponse.java

示例11: SuccessLightblueResponse

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
SuccessLightblueResponse(LightblueDataResponse response) {
    this.response = response;
}
 
开发者ID:esbtools,项目名称:event-handler,代码行数:4,代码来源:SuccessLightblueResponse.java

示例12: getSuccess

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
@Override
public LightblueDataResponse getSuccess() {
    return response;
}
 
开发者ID:esbtools,项目名称:event-handler,代码行数:5,代码来源:SuccessLightblueResponse.java

示例13: BulkDataResponses

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
BulkDataResponses(Map<CRUDRequest, LightblueDataResponse> responseMap) {
    super(responseMap);
}
 
开发者ID:esbtools,项目名称:event-handler,代码行数:4,代码来源:BulkLightblueRequester.java

示例14: data

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
@Override
public LightblueDataResponse data(LightblueDataRequest request) throws LightblueException {
    return responseOnceFlushedOrLightblueException(() -> delegate.data(request));
}
 
开发者ID:esbtools,项目名称:event-handler,代码行数:5,代码来源:SlowDataLightblueClient.java

示例15: run

import com.redhat.lightblue.client.response.LightblueDataResponse; //导入依赖的package包/类
@Override
protected LightblueDataResponse run() throws Exception {
    return client.data(request);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-client,代码行数:5,代码来源:LightblueHystrixClient.java


注:本文中的com.redhat.lightblue.client.response.LightblueDataResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。