use of org.jbei.ice.lib.dto.comment.UserComment in project ice by JBEI.
the class PartResource method createComment.
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("/{id}/comments")
public Response createComment(@PathParam("id") final long partId, final UserComment userComment) {
final String userId = getUserId();
log(userId, "adding comment to entry " + partId);
final UserComment comment = controller.createEntryComment(userId, partId, userComment);
return respond(comment);
}
use of org.jbei.ice.lib.dto.comment.UserComment in project ice by JBEI.
the class Comment method toDataTransferObject.
@Override
public UserComment toDataTransferObject() {
UserComment userComment = new UserComment();
userComment.setId(this.id);
userComment.setCommentDate(this.creationTime.getTime());
if (modificationTime != null) {
userComment.setModified(this.modificationTime.getTime());
}
userComment.setMessage(getBody());
userComment.setAccountTransfer(getAccount().toDataTransferObject());
userComment.setEntryId(getEntry().getId());
if (this.samples != null) {
for (Sample sample : this.samples) {
userComment.getSamples().add(sample.toDataTransferObject());
}
}
return userComment;
}
Aggregations