1 16 package org.outerj.daisy.repository.commonimpl.comment; 17 18 import org.outerj.daisy.repository.comment.Comment; 19 import org.outerj.daisy.repository.comment.CommentVisibility; 20 import org.outerx.daisy.x10.CommentDocument; 21 22 import java.util.Date ; 23 import java.util.GregorianCalendar ; 24 25 public class CommentImpl implements Comment { 26 private long ownerDocumentId; 27 private long ownerBranchId; 28 private long ownerLanguageId; 29 private long id; 30 private String text; 31 private CommentVisibility visibility; 32 private Date createdOn; 33 private long createdBy; 34 35 public CommentImpl(long ownerDocumentId, long ownerBranchId, long ownerLanguageId, long id, String text, CommentVisibility visibility, Date createdOn, long createdBy) { 36 this.ownerDocumentId = ownerDocumentId; 37 this.ownerBranchId = ownerBranchId; 38 this.ownerLanguageId = ownerLanguageId; 39 this.id = id; 40 this.text = text; 41 this.visibility = visibility; 42 this.createdOn = createdOn; 43 this.createdBy = createdBy; 44 } 45 46 public String getText() { 47 return text; 48 } 49 50 public long getId() { 51 return id; 52 } 53 54 public long getOwnerDocumentId() { 55 return ownerDocumentId; 56 } 57 58 public long getOwnerBranchId() { 59 return ownerBranchId; 60 } 61 62 public long getOwnerLanguageId() { 63 return ownerLanguageId; 64 } 65 66 public CommentVisibility getVisibility() { 67 return visibility; 68 } 69 70 public long getCreatedBy() { 71 return createdBy; 72 } 73 74 public Date getCreatedOn() { 75 return (Date )createdOn.clone(); 76 } 77 78 public CommentDocument getXml() { 79 CommentDocument commentDocument = CommentDocument.Factory.newInstance(); 80 CommentDocument.Comment commentXml = commentDocument.addNewComment(); 81 commentXml.setContent(text); 82 commentXml.setId(id); 83 commentXml.setVisibility(CommentDocument.Comment.Visibility.Enum.forString(visibility.toString())); 84 commentXml.setCreatedBy(createdBy); 85 commentXml.setDocumentId(ownerDocumentId); 86 commentXml.setBranchId(ownerBranchId); 87 commentXml.setLanguageId(ownerLanguageId); 88 GregorianCalendar createdOnCalendar = new GregorianCalendar (); 89 createdOnCalendar.setTime(createdOn); 90 commentXml.setCreatedOn(createdOnCalendar); 91 return commentDocument; 92 } 93 } 94 | Popular Tags |