use of org.jbpm.services.task.impl.model.xml.JaxbComment in project jbpm by kiegroup.
the class AddCommentCommand method execute.
public Long execute(Context cntxt) {
TaskContext context = (TaskContext) cntxt;
Comment cmdComent = comment;
if (cmdComent == null) {
cmdComent = jaxbComment;
}
InternalComment commentImpl = (InternalComment) TaskModelProvider.getFactory().newComment();
commentImpl.setAddedAt(cmdComent.getAddedAt());
User cmdAddedBy = cmdComent.getAddedBy();
User addedBy = TaskModelProvider.getFactory().newUser(cmdAddedBy.getId());
commentImpl.setAddedBy(addedBy);
commentImpl.setText(cmdComent.getText());
doCallbackOperationForComment(commentImpl, context);
return context.getTaskCommentService().addComment(taskId, commentImpl);
}
use of org.jbpm.services.task.impl.model.xml.JaxbComment in project jbpm by kiegroup.
the class AbstractTaskSerializationTest method jaxbCommentTest.
@Test
public void jaxbCommentTest() throws Exception {
Assume.assumeFalse(getType().equals(TestType.YAML));
CommentImpl comment = new CommentImpl();
comment.setAddedAt(new Date());
comment.setAddedBy(new UserImpl("user"));
comment.setId(23l);
comment.setText("ILLUMINATI!");
JaxbComment jaxbComment = new JaxbComment(comment);
assertEquals("added at", comment.getAddedAt(), jaxbComment.getAddedAt());
assertEquals("added by", comment.getAddedBy().getId(), jaxbComment.getAddedById());
assertEquals("added by", comment.getAddedBy().getId(), jaxbComment.getAddedBy().getId());
assertEquals("id", comment.getId(), jaxbComment.getId());
assertEquals("text", comment.getText(), jaxbComment.getText());
JaxbComment copyJaxbComment = testRoundTrip(jaxbComment);
Assertions.assertThat(jaxbComment).isEqualToComparingFieldByFieldRecursively(copyJaxbComment);
}
Aggregations