diff --git a/source/java/org/alfresco/service/cmr/discussion/DiscussionService.java b/source/java/org/alfresco/service/cmr/discussion/DiscussionService.java new file mode 100644 index 0000000000..0b29a380bf --- /dev/null +++ b/source/java/org/alfresco/service/cmr/discussion/DiscussionService.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.service.cmr.discussion; + +import org.alfresco.query.PagingRequest; +import org.alfresco.query.PagingResults; +import org.alfresco.service.NotAuditable; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * The Discussions service. + * + * @author Nick Burch + * @since 4.0 + */ +public interface DiscussionService { + /** + * Creates a new {@link ForumPostInfo} in the given topic, + * specified settings + * + * @return The newly created {@link ForumPostInfo} + */ + @NotAuditable + ForumPostInfo createForumPost(ForumTopicInfo topic, String title, + String contents); + + /** + * Creates a new {@link ForumTopicInfo} in the given site + */ + @NotAuditable + ForumTopicInfo createForumTopic(String siteShortName); + + /** + * Creates a new {@link ForumTopicInfo} attached to the + * specified Node + */ + @NotAuditable + ForumTopicInfo createForumTopic(NodeRef nodeRef); + + /** + * Updates an existing {@link ForumPostInfo} in the repository. + * + * @return The updated {@link ForumPostInfo} + */ + @NotAuditable + ForumPostInfo updateForumPost(ForumPostInfo post); + + /** + * Deletes an existing {@link ForumPostInfo} from the repository + */ + @NotAuditable + void deleteForumPost(ForumPostInfo post); + + /** + * Deletes an existing {@link ForumTopicInfo} from the repository + */ + @NotAuditable + void deleteForumTopic(ForumTopicInfo topic); + + /** + * Retrieves an existing {@link ForumPostInfo} from the repository + */ + @NotAuditable + ForumPostInfo getForumPost(ForumTopicInfo topic, String linkName); + + /** + * Retrieves an existing {@link ForumTopicInfo} from the repository, + * which is within a site + */ + @NotAuditable + ForumTopicInfo getForumTopic(String siteShortName, String linkName); + + /** + * Retrieves an existing {@link ForumTopicInfo} from the repository, + * which is attached to the specified Node + */ + @NotAuditable + ForumTopicInfo getForumTopic(NodeRef nodeRef, String linkName); + + // TODO Decide about the primary post on a topic + + + /** + * Retrieves all replies on a Topic + */ + @NotAuditable + PagingResults listForumPostReplies(ForumTopicInfo forum, int levels, PagingRequest paging); + + /** + * Retrieves all replies to a Post + */ + @NotAuditable + PagingResults listForumPostReplies(ForumPostInfo primaryPost, int levels, PagingRequest paging); + + /** + * Retrieves all posts in a site + */ + @NotAuditable + PagingResults listForumPosts(String siteShortName, PagingRequest paging); + + /** + * Retrieves all posts attached to the specified Node + */ + @NotAuditable + PagingResults listForumPosts(NodeRef nodeRef, PagingRequest paging); + + // TODO Hot, New and Mine listing support +} diff --git a/source/java/org/alfresco/service/cmr/discussion/ForumPostInfo.java b/source/java/org/alfresco/service/cmr/discussion/ForumPostInfo.java new file mode 100644 index 0000000000..daa82a450d --- /dev/null +++ b/source/java/org/alfresco/service/cmr/discussion/ForumPostInfo.java @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.service.cmr.discussion; + +import java.io.Serializable; +import java.util.Date; + +import org.alfresco.repo.security.permissions.PermissionCheckValue; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * This class represents a Post in a Forum Topic + * + * @author Nick Burch + * @since 4.0 + */ +public interface ForumPostInfo extends Serializable, PermissionCheckValue { + /** + * @return the NodeRef of the underlying post + */ + NodeRef getNodeRef(); + + /** + * @return the NodeRef of the topic this belongs to + */ + NodeRef getTopicNodeRef(); + + /** + * @return the System generated name for the post + */ + String getSystemName(); + + /** + * @return the Title of the post + */ + String getTitle(); + + /** + * Sets the Title of the post + */ + void setTitle(String title); + + /** + * @return the HTML Content of the post + */ + String getContents(); + + /** + * Sets the (HTML) Content of the post + */ + void setContents(String contentHTML); + + /** + * @return the creator of the post + */ + String getCreator(); + + /** + * @return the modifier of the post + */ + String getModifier(); + + /** + * @return the creation date and time + */ + Date getCreatedAt(); + + /** + * @return the modification date and time + */ + Date getModifiedAt(); + +// /** +// * @return the Tags associated with the post +// * TODO Are posts ever tagged, or only ever topics? +// */ +// List getTags(); +} diff --git a/source/java/org/alfresco/service/cmr/discussion/ForumTopicInfo.java b/source/java/org/alfresco/service/cmr/discussion/ForumTopicInfo.java new file mode 100644 index 0000000000..731fee6e5f --- /dev/null +++ b/source/java/org/alfresco/service/cmr/discussion/ForumTopicInfo.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.service.cmr.discussion; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.alfresco.repo.security.permissions.PermissionCheckValue; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * This class represents a Topic in a forum + * + * TODO Decide about the primary post on a topic + * + * @author Nick Burch + * @since 4.0 + */ +public interface ForumTopicInfo extends Serializable, PermissionCheckValue { + /** + * @return the NodeRef of the underlying topic + */ + NodeRef getNodeRef(); + + /** + * @return the NodeRef of the container this belongs to (Site or Otherwise) + */ + NodeRef getContainerNodeRef(); + + /** + * @return the System generated name for the topic + */ + String getSystemName(); + + /** + * @return the creator of the topic + */ + String getCreator(); + + /** + * @return the creation date and time + */ + Date getCreatedAt(); + + /** + * @return the modification date and time + */ + Date getModifiedAt(); + + /** + * @return the Tags associated with the topic + */ + List getTags(); +}