Search in sources :

Example 6 with UserComment

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);
}
Also used : UserComment(org.jbei.ice.lib.dto.comment.UserComment)

Example 7 with UserComment

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;
}
Also used : UserComment(org.jbei.ice.lib.dto.comment.UserComment)

Aggregations

UserComment (org.jbei.ice.lib.dto.comment.UserComment)7 PartSample (org.jbei.ice.lib.dto.sample.PartSample)3 StorageLocation (org.jbei.ice.lib.dto.StorageLocation)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 HasEntry (org.jbei.ice.lib.entry.HasEntry)1 Account (org.jbei.ice.storage.model.Account)1 Strain (org.jbei.ice.storage.model.Strain)1 Test (org.junit.Test)1