本文整理汇总了Java中com.box.boxjavalibv2.dao.BoxComment类的典型用法代码示例。如果您正苦于以下问题:Java BoxComment类的具体用法?Java BoxComment怎么用?Java BoxComment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BoxComment类属于com.box.boxjavalibv2.dao包,在下文中一共展示了BoxComment类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAddComment1
import com.box.boxjavalibv2.dao.BoxComment; //导入依赖的package包/类
@Test
public void testAddComment1() throws Exception {
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
headers.put("CamelBox.commentedItemId", testFileId);
// parameter type is com.box.boxjavalibv2.dao.IBoxType
headers.put("CamelBox.commentedItemType", BoxResourceType.FILE);
// parameter type is String
headers.put("CamelBox.message", "Camel was here!");
BoxComment result = requestBodyAndHeaders("direct://ADDCOMMENT_1", null, headers);
assertNotNull("addComment result", result);
LOG.debug("addComment: " + result);
deleteComment(result.getId());
}
示例2: testGetComment
import com.box.boxjavalibv2.dao.BoxComment; //导入依赖的package包/类
@Test
public void testGetComment() throws Exception {
final BoxComment comment = addComment();
try {
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
headers.put("CamelBox.commentId", comment.getId());
// parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject
// headers.put("CamelBox.defaultRequest", null);
BoxComment result = requestBodyAndHeaders("direct://GETCOMMENT", null, headers);
LOG.debug("getComment: " + result);
} finally {
deleteComment(comment.getId());
}
}
示例3: testUpdateComment
import com.box.boxjavalibv2.dao.BoxComment; //导入依赖的package包/类
@Test
public void testUpdateComment() throws Exception {
final BoxComment comment = addComment();
try {
final Map<String, Object> headers = new HashMap<String, Object>();
// parameter type is String
headers.put("CamelBox.commentId", comment.getId());
// parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxCommentRequestObject
final BoxCommentRequestObject requestObject =
BoxCommentRequestObject.updateCommentRequestObject("Camel was here, again!");
headers.put("CamelBox.commentRequest", requestObject);
BoxComment result = requestBodyAndHeaders("direct://UPDATECOMMENT", null, headers);
LOG.debug("updateComment: " + result);
} finally {
deleteComment(comment.getId());
}
}
示例4: addComment
import com.box.boxjavalibv2.dao.BoxComment; //导入依赖的package包/类
private BoxComment addComment() throws InterruptedException {
final BoxCommentRequestObject requestObject =
BoxCommentRequestObject.addCommentRequestObject(BoxResourceType.FILE, testFileId, "Camel was here!");
BoxComment result = requestBody("direct://ADDCOMMENT", requestObject);
assertNotNull("addComment result", result);
Thread.sleep(2000);
return result;
}
示例5: getComments
import com.box.boxjavalibv2.dao.BoxComment; //导入依赖的package包/类
/**
* Get comments from a collection.
*
* @param collection
* collection
* @return comments
*/
public static List<BoxComment> getComments(BoxCollection collection) {
List<BoxComment> comments = new ArrayList<BoxComment>();
List<BoxTypedObject> list = collection.getEntries();
for (BoxTypedObject object : list) {
if (object instanceof BoxComment) {
comments.add((BoxComment) object);
}
}
return comments;
}
示例6: getClass
import com.box.boxjavalibv2.dao.BoxComment; //导入依赖的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;
}
}
示例7: addComment
import com.box.boxjavalibv2.dao.BoxComment; //导入依赖的package包/类
/**
* Add a comment to an item.
*
* @param requestObject
* comment request object.
* @throws BoxRestException
* exception
* @throws BoxServerException
* exception
* @throws AuthFatalFailureException
* exception indicating authentication totally failed
*/
public BoxComment addComment(final BoxCommentRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException {
CreateCommentRequest request = new CreateCommentRequest(getConfig(), getObjectMapper(), requestObject);
return (BoxComment) getResponseAndParseAndTryCast(request, BoxResourceType.COMMENT, getObjectMapper());
}
示例8: getComment
import com.box.boxjavalibv2.dao.BoxComment; //导入依赖的package包/类
/**
* Get a comment, given a comment id.
*
* @param commentId
* id of the comment
* @param requestObject
* object that goes into request.
* @return comment
* @throws BoxRestException
* exception
* @throws BoxServerException
* exception
* @throws AuthFatalFailureException
* exception indicating authentication totally failed
*/
public BoxComment getComment(final String commentId, BoxDefaultRequestObject requestObject) throws BoxRestException, BoxServerException,
AuthFatalFailureException {
GetCommentRequest request = new GetCommentRequest(getConfig(), getObjectMapper(), commentId, requestObject);
return (BoxComment) getResponseAndParseAndTryCast(request, BoxResourceType.COMMENT, getObjectMapper());
}
示例9: updateComment
import com.box.boxjavalibv2.dao.BoxComment; //导入依赖的package包/类
/**
* Update a comment.
*
* @param commentId
* id of the comment
* @param requestObject
* comment request object.s
* @return comment
* @throws BoxRestException
* exception
* @throws BoxServerException
* exception
* @throws AuthFatalFailureException
* exception indicating authentication totally failed
*/
public BoxComment updateComment(final String commentId, final BoxCommentRequestObject requestObject) throws BoxRestException, BoxServerException,
AuthFatalFailureException {
UpdateCommentRequest request = new UpdateCommentRequest(getConfig(), getObjectMapper(), commentId, requestObject);
return (BoxComment) getResponseAndParseAndTryCast(request, BoxResourceType.COMMENT, getObjectMapper());
}
示例10: setItem
import com.box.boxjavalibv2.dao.BoxComment; //导入依赖的package包/类
/**
* Set the item to be commented.
*
* @param type
* type of the item
* @param itemId
* id of the item
* @return BoxCommentRequestObject
*/
public BoxCommentRequestObject setItem(final BoxResourceType type, final String itemId) {
put(BoxComment.FIELD_ITEM, getItemEntity(type, itemId));
return this;
}