diff --git a/source/java/org/alfresco/repo/wiki/WikiPageInfoImpl.java b/source/java/org/alfresco/repo/wiki/WikiPageInfoImpl.java new file mode 100644 index 0000000000..89b0de9cdc --- /dev/null +++ b/source/java/org/alfresco/repo/wiki/WikiPageInfoImpl.java @@ -0,0 +1,160 @@ +/* + * 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.repo.wiki; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.wiki.WikiPageInfo; + +/** + * An implementation of {@link WikiPageInfo} + * + * @author Nick Burch (based on existing webscript controllers in the REST API) + * @since 4.0 + */ +public class WikiPageInfoImpl implements WikiPageInfo +{ + private NodeRef nodeRef; + private NodeRef containerNodeRef; + private String systemName; + private String title; + private String contents; + private String creator; + private String modifier; + private Date createdAt; + private Date modifiedAt; + private List tags = new ArrayList(); + + /** + * Creates a new, empty WikiPageInfo + */ + public WikiPageInfoImpl() + { + } + + /** + * Create a WikiPageInfo object from an existing node + */ + public WikiPageInfoImpl(NodeRef nodeRef, NodeRef containerNodeRef, String systemName) + { + this.nodeRef = nodeRef; + this.containerNodeRef = containerNodeRef; + this.systemName = systemName; + } + + @Override + public NodeRef getContainerNodeRef() + { + return containerNodeRef; + } + + @Override + public NodeRef getNodeRef() + { + return nodeRef; + } + + @Override + public String getSystemName() + { + return systemName; + } + + @Override + public String getTitle() + { + return title; + } + + @Override + public String getContents() + { + return contents; + } + + @Override + public String getCreator() + { + return creator; + } + + @Override + public String getModifier() + { + return modifier; + } + + @Override + public Date getCreatedAt() + { + return createdAt; + } + + @Override + public Date getModifiedAt() + { + return modifiedAt; + } + + @Override + public List getTags() + { + return tags; + } + + @Override + public void setTitle(String title) + { + this.title = title; + } + + @Override + public void setContents(String contents) + { + this.contents = contents; + } + + public void setCreator(String creator) + { + this.creator = creator; + } + + public void setModifier(String modifier) + { + this.modifier = modifier; + } + + public void setCreatedAt(Date createdAt) + { + this.createdAt = createdAt; + } + + public void setModifiedAt(Date modifiedAt) + { + this.modifiedAt = modifiedAt; + } + + public void setTags(List tags) + { + this.tags = tags; + } +} diff --git a/source/java/org/alfresco/service/cmr/wiki/WikiPageInfo.java b/source/java/org/alfresco/service/cmr/wiki/WikiPageInfo.java new file mode 100644 index 0000000000..dbc67f38a5 --- /dev/null +++ b/source/java/org/alfresco/service/cmr/wiki/WikiPageInfo.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.wiki; + +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 Wiki Paeg in a site + * + * @author Nick Burch + * @since 4.0 + */ +public interface WikiPageInfo extends Serializable, PermissionCheckValue { + /** + * @return the NodeRef of the underlying wiki page + */ + NodeRef getNodeRef(); + + /** + * @return the NodeRef of the site container this belongs to + */ + NodeRef getContainerNodeRef(); + + /** + * @return the name of the wiki page + */ + String getSystemName(); + + /** + * @return the Title of the wiki page + */ + String getTitle(); + + /** + * Sets the Title of the wiki page + */ + void setTitle(String title); + + /** + * @return the HTML Content of the wiki page + */ + String getContents(); + + /** + * Sets the (HTML) Content of the wiki page + */ + void setContents(String contentHTML); + + /** + * @return the creator of the wiki page + */ + String getCreator(); + + /** + * @return the modifier of the wiki page + */ + String getModifier(); + + /** + * @return the creation date and time + */ + Date getCreatedAt(); + + /** + * @return the modification date and time + */ + Date getModifiedAt(); + + /** + * @return the Tags associated with the wiki page + */ + List getTags(); +} diff --git a/source/java/org/alfresco/service/cmr/wiki/WikiPageService.java b/source/java/org/alfresco/service/cmr/wiki/WikiPageService.java new file mode 100644 index 0000000000..0a5fd3468c --- /dev/null +++ b/source/java/org/alfresco/service/cmr/wiki/WikiPageService.java @@ -0,0 +1,91 @@ +/* + * 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.wiki; + +import java.util.Date; + +import org.alfresco.query.PagingRequest; +import org.alfresco.query.PagingResults; +import org.alfresco.service.NotAuditable; + +/** + * The Wiki Page service. + * + * @author Nick Burch + * @since 4.0 + */ +public interface WikiPageService { + /** + * Creates a new {@link WikiPageInfo} in the given site, with the + * specified contents + * + * @return The newly created {@link WikiPageInfo} + */ + @NotAuditable + WikiPageInfo createWikiPage(String siteShortName, String title, + String contents); + + /** + * Updates an existing {@link WikiPageInfo} in the repository. + * + * @return The updated {@link WikiPageInfo} + */ + @NotAuditable + WikiPageInfo updateWikiPage(WikiPageInfo wikiPage); + + /** + * Deletes an existing {@link WikiPageInfo} from the repository + */ + @NotAuditable + void deleteWikiPage(WikiPageInfo wikiPage); + + /** + * Retrieves an existing {@link WikiPageInfo} from the repository + */ + @NotAuditable + WikiPageInfo getWikiPage(String siteShortName, String pageTitle); + + /** + * Retrieves all {@link WikiPageInfo} instances in the repository + * for the given site. + */ + @NotAuditable + PagingResults listWikiPages(String siteShortName, PagingRequest paging); + + /** + * Retrieves all {@link WikiPageInfo} instances in the repository + * for the given site and the specified user. + */ + @NotAuditable + PagingResults listWikiPages(String siteShortName, String user, PagingRequest paging); + + /** + * Retrieves all {@link WikiPageInfo} instances in the repository + * for the given site, created in the specified date range + */ + @NotAuditable + PagingResults listWikiPagesByCreated(String siteShortName, Date from, Date to, PagingRequest paging); + + /** + * Retrieves all {@link WikiPageInfo} instances in the repository + * for the given site, modified in the specified date range + */ + @NotAuditable + PagingResults listWikiPagesByModified(String siteShortName, Date from, Date to, PagingRequest paging); +}