[Yanel-commits] rev 57248 - public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable
michi at wyona.com
michi at wyona.com
Thu Mar 10 10:21:49 CET 2011
Author: michi
Date: 2011-03-10 10:21:48 +0100 (Thu, 10 Mar 2011)
New Revision: 57248
Added:
public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentStatusV1.java
public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentV1.java
public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentsV1.java
Modified:
public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentManagerV1.java
Log:
more interfaces re commenting added
Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentManagerV1.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentManagerV1.java 2011-03-10 09:19:55 UTC (rev 57247)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentManagerV1.java 2011-03-10 09:21:48 UTC (rev 57248)
@@ -1,5 +1,7 @@
package org.wyona.yanel.core.attributes.commentable;
+import org.wyona.yanel.core.map.Realm;
+
/**
* Comment manager providing methods to set, get, etc. comments
*/
@@ -10,5 +12,30 @@
* @param path Resource path
* @return true if resource is commentable and has comments
*/
- public boolean hasComment(String path) throws Exception;
+ public boolean hasComments(Realm realm, String path) throws Exception; // TODO: Different between public and non-public comments
+
+ /**
+ * Get all comments of a certain document referenced by path (e.g. absolute Yarep Path)
+ * @param path Absolute yarep path
+ * @return comments
+ * @throws Exception
+ */
+ public CommentsV1 getAllComments(Realm realm, String path) throws Exception;
+
+ /**
+ * Get public comments only of a certain document referenced by path (e.g. absolute Yarep Path)
+ * @param path Absolute yarep path
+ * @return comments
+ * @throws Exception
+ */
+ public CommentsV1 getPublicComments(Realm realm, String path) throws Exception;
+
+ /**
+ * Add a new Comment (newComment) for a given document (path)
+ * @param path Resource path (e.g. absolute Yarep Path)
+ * @param newComment new comment to be added to the document referenced by path
+ * @return true if comment could be added
+ * @throws Exception
+ */
+ public boolean addComment(Realm realm, String path, CommentV1 newComment) throws Exception;
}
Added: public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentStatusV1.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentStatusV1.java (rev 0)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentStatusV1.java 2011-03-10 09:21:48 UTC (rev 57248)
@@ -0,0 +1,32 @@
+package org.wyona.yanel.core.attributes.commentable;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+
+ at XmlEnum
+public enum CommentStatusV1 {
+
+ @XmlEnumValue("DRAFT")
+ DRAFT("Draft"),
+
+ @XmlEnumValue("PUBLIC")
+ PUBLIC("Public"),
+
+ @XmlEnumValue("INVISIBLE")
+ INVISIBLE("Invisible");
+
+ private String label = null; // this won't get marshalled into the XML, only needed for ui.
+
+ private CommentStatusV1(String label) {
+ this.label = label;
+
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+}
Added: public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentV1.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentV1.java (rev 0)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentV1.java 2011-03-10 09:21:48 UTC (rev 57248)
@@ -0,0 +1,96 @@
+package org.wyona.yanel.core.attributes.commentable;
+
+import java.util.Date;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+
+import org.wyona.yanel.core.YanelNamespaces;
+
+ at XmlAccessorType(XmlAccessType.FIELD)
+public class CommentV1 {
+
+ @XmlElement(name="text", namespace=YanelNamespaces.YANEL_NS)
+ private String commentText = null;
+
+ @XmlElement(name="title", namespace=YanelNamespaces.YANEL_NS)
+ private String title = null;
+
+ @XmlElement(name="authorName", namespace=YanelNamespaces.YANEL_NS)
+ private String authorName = null;
+
+ @XmlElement(name="authorMail", namespace=YanelNamespaces.YANEL_NS)
+ private String authorMail = null;
+
+ @XmlElement(name="created", namespace=YanelNamespaces.YANEL_NS)
+ private Date commentCreateDate = new Date();
+
+ @XmlElement(name="modified", namespace=YanelNamespaces.YANEL_NS)
+ private Date commentLastModifiedDate = new Date();
+
+ @XmlElement(name="status", namespace=YanelNamespaces.YANEL_NS)
+ private CommentStatusV1 commentStatus = CommentStatusV1.DRAFT;
+
+ public String getCommentText() {
+ return commentText;
+ }
+
+ public void setCommentText(String commentText) {
+ this.commentText = commentText;
+ }
+
+ /**
+ * Get title of comment
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Set title of comment
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getAuthorName() {
+ return authorName;
+ }
+
+ public void setAuthorName(String authorName) {
+ this.authorName = authorName;
+ }
+
+ public String getAuthorMail() {
+ return authorMail;
+ }
+
+ public void setAuthorMail(String authorMail) {
+ this.authorMail = authorMail;
+ }
+
+ public Date getCommentCreateDate() {
+ return commentCreateDate;
+ }
+
+ public void setCommentCreateDate(Date commentCreateDate) {
+ this.commentCreateDate = commentCreateDate;
+ }
+
+ public Date getCommentLastModifiedDate() {
+ return commentLastModifiedDate;
+ }
+
+ public void setCommentLastModifiedDate(Date commentLastModifiedDate) {
+ this.commentLastModifiedDate = commentLastModifiedDate;
+ }
+
+ public CommentStatusV1 getCommentStatus() {
+ return commentStatus;
+ }
+
+ public void setCommentStatus(CommentStatusV1 commentStatus) {
+ this.commentStatus = commentStatus;
+ }
+}
Added: public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentsV1.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentsV1.java (rev 0)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/commentable/CommentsV1.java 2011-03-10 09:21:48 UTC (rev 57248)
@@ -0,0 +1,41 @@
+package org.wyona.yanel.core.attributes.commentable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.wyona.yanel.core.YanelNamespaces;
+
+ at XmlAccessorType(XmlAccessType.FIELD)
+ at XmlRootElement(name="root", namespace=YanelNamespaces.YANEL_NS)
+public class CommentsV1 {
+
+ @XmlElement(name="referencedPath", namespace=YanelNamespaces.YANEL_NS)
+ private String referencedPath = null; //
+
+ @XmlElementWrapper(name="comments", namespace=YanelNamespaces.YANEL_NS)
+ @XmlElement(name="comment", namespace=YanelNamespaces.YANEL_NS)
+ private List<CommentV1> comments = new ArrayList<CommentV1>();
+
+ public List<CommentV1> getComments() {
+ return comments;
+ }
+
+ public void setComments(List<CommentV1> comments) {
+ this.comments = comments;
+ }
+
+ public String getReferencedPath() {
+ return referencedPath;
+ }
+
+ public void setReferencedPath(String referencedPath) {
+ this.referencedPath = referencedPath;
+ }
+
+}
More information about the Yanel-commits
mailing list