本文整理汇总了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;
}
示例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));
}
}
示例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;
}
}