Search in sources :

Example 1 with JaxbComment

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);
}
Also used : JaxbComment(org.jbpm.services.task.impl.model.xml.JaxbComment) Comment(org.kie.api.task.model.Comment) InternalComment(org.kie.internal.task.api.model.InternalComment) User(org.kie.api.task.model.User) InternalComment(org.kie.internal.task.api.model.InternalComment)

Example 2 with JaxbComment

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);
}
Also used : UserImpl(org.jbpm.services.task.impl.model.UserImpl) CommentImpl(org.jbpm.services.task.impl.model.CommentImpl) JaxbComment(org.jbpm.services.task.impl.model.xml.JaxbComment) Date(java.util.Date) Test(org.junit.Test)

Aggregations

JaxbComment (org.jbpm.services.task.impl.model.xml.JaxbComment)2 Date (java.util.Date)1 CommentImpl (org.jbpm.services.task.impl.model.CommentImpl)1 UserImpl (org.jbpm.services.task.impl.model.UserImpl)1 Test (org.junit.Test)1 Comment (org.kie.api.task.model.Comment)1 User (org.kie.api.task.model.User)1 InternalComment (org.kie.internal.task.api.model.InternalComment)1