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


Java BoxEvent类代码示例

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


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

示例1: getEvents

import com.box.boxjavalibv2.dao.BoxEvent; //导入依赖的package包/类
/**
 * Get comments from a collection.
 * 
 * @param collection
 *            collection
 * @return comments
 */
public static List<BoxEvent> getEvents(BoxCollection collection) {
    List<BoxEvent> events = new ArrayList<BoxEvent>();
    List<BoxTypedObject> list = collection.getEntries();
    for (BoxTypedObject object : list) {
        if (object instanceof BoxEvent) {
            events.add((BoxEvent) object);
        }
    }
    return events;
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:18,代码来源:BoxEventsManager.java

示例2: testPoll

import com.box.boxjavalibv2.dao.BoxEvent; //导入依赖的package包/类
@Test
public void testPoll() throws Exception {

    // generate file copy event
    final Map<String, Object> headers = new HashMap<String, Object>();
    headers.put("CamelBox.fileId", testFileId);
    final BoxItemCopyRequestObject requestObject = BoxItemCopyRequestObject.copyItemRequestObject("0");
    requestObject.setName(CAMEL_TEST_FILE);
    headers.put("CamelBox.itemCopyRequest", requestObject);

    BoxFile result = requestBodyAndHeaders("direct://COPYFILE", null, headers);

    assertNotNull("copyFile result", result);
    LOG.debug("copyFile: " + result);

    // generate file delete event
    headers.clear();
    headers.put("CamelBox.fileId", result.getId());
    headers.put("CamelBox.defaultRequest", null);
    requestBodyAndHeaders("direct://DELETEFILE", null, headers);

    MockEndpoint mockEndpoint = getMockEndpoint("mock:boxEvents");
    mockEndpoint.expectedMinimumMessageCount(2);
    mockEndpoint.setResultWaitTime(TimeUnit.MILLISECONDS.convert(30, TimeUnit.SECONDS));
    mockEndpoint.assertIsSatisfied();

    final List<Exchange> exchanges = mockEndpoint.getExchanges();
    assertNotNull("poll result", exchanges);
    assertFalse("poll result", exchanges.isEmpty());
    LOG.debug("poll result: " + exchanges);

    for (Exchange exchange : exchanges) {

        assertNotNull("poll result " + BoxConstants.CHUNK_SIZE_PROPERTY,
                exchange.getIn().getHeader(BoxConstants.CHUNK_SIZE_PROPERTY));
        assertNotNull("poll result " + BoxConstants.NEXT_STREAM_POSITION_PROPERTY,
                exchange.getIn().getHeader(BoxConstants.NEXT_STREAM_POSITION_PROPERTY));

        final Object body = exchange.getIn().getBody();
        assertNotNull("poll result body", body);
        assertEquals("poll result body type", BoxEvent.class, body.getClass());

        final String eventType = ((BoxEvent) body).getEventType();
        assertTrue("poll result type",
                BoxEvent.EVENT_TYPE_ITEM_COPY.equals(eventType) || BoxEvent.EVENT_TYPE_ITEM_TRASH.equals(eventType));
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:48,代码来源:LongPollingEventsManagerIntegrationTest.java

示例3: getClass

import com.box.boxjavalibv2.dao.BoxEvent; //导入依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
public Class getClass(BoxResourceType type) {
    switch (type) {
        case FILE:
            return BoxFile.class;
        case PREVIEW:
            return BoxPreview.class;
        case FOLDER:
            return BoxFolder.class;
        case WEB_LINK:
            return BoxWebLink.class;
        case USER:
            return BoxUser.class;
        case FILE_VERSION:
            return BoxFileVersion.class;
        case ITEM:
            return BoxItem.class;
        case COMMENT:
            return BoxComment.class;
        case COLLABORATION:
            return BoxCollaboration.class;
        case EMAIL_ALIAS:
            return BoxEmailAlias.class;
        case OAUTH_DATA:
            return BoxOAuthToken.class;
        case EVENT:
            return BoxEvent.class;
        case REALTIME_SERVER:
            return BoxRealTimeServer.class;
        case LOCK:
            return BoxLock.class;
        case ERROR:
            return BoxServerError.class;
        case ITEMS:
        case FILES:
        case USERS:
        case COMMENTS:
        case FILE_VERSIONS:
        case COLLABORATIONS:
        case EMAIL_ALIASES:
            return BoxCollection.class;
        default:
            return BoxTypedObject.class;
    }
}
 
开发者ID:mobilesystems,项目名称:box-java-sdk-v2,代码行数:47,代码来源:BoxResourceHub.java


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