Skip to content

[API] Creating an Instance and adding New Comment

Jinyoung Jang edited this page Apr 30, 2017 · 3 revisions
CommentWorkItem commentWorkItem = new CommentWorkItem();
commentWorkItem.setTitle("Message");
commentWorkItem.setWriter(session.getUser());
//commentWorkItem.setInstId(new Long(instanceId));  // if instanceId is not provided, create a new instance.


MetaworksRemoteService.autowire(commentWorkItem);

try {
	commentWorkItem.add();
} catch (Exception e) {
	throw new RuntimeException(e);
}

if you want to add comment by System operator, use SystemComment instead.

SystemWorkItem comment = new SystemWorkItem();
MetaworksRemoteService.autowire(comment);

comment.getMetaworksContext().setWhen(MetaworksContext.WHEN_NEW);
if(MetaworksContext.WHEN_NEW.equals(this.getMetaworksContext().getWhen()))
	comment.setSystemMessage(session.getUser().getName() + "님이 주제 " + this.getTopicTitle() + "를 등록하였습니다.");
else{
	comment.setSystemMessage(session.getUser().getName() + "님이 주제 " + this.getTopicTitle() + "로 변경하였습니다.");
}
		
		
comment.add();

Clone this wiki locally