1 /** 2 * Copyright 2011-2013 The Kuali Foundation Licensed under the 3 * Educational Community License, Version 2.0 (the "License"); you may 4 * not use this file except in compliance with the License. You may 5 * obtain a copy of the License at 6 * 7 * http://www.osedu.org/licenses/ECL-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, 10 * software distributed under the License is distributed on an "AS IS" 11 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 12 * or implied. See the License for the specific language governing 13 * permissions and limitations under the License. 14 */ 15 16 package org.kuali.mobility.writer.dao; 17 18 import java.util.List; 19 20 import org.kuali.mobility.writer.entity.Article; 21 import org.kuali.mobility.writer.entity.ArticleRejection; 22 23 /** 24 * Article Data Access Object 25 * @author Kuali Mobility Team (mobility.collab@kuali.org) 26 * @since 3.0.0 27 */ 28 public interface ArticleDao { 29 /** 30 * Gets a specific article. 31 * @param articleId Id if the article to get 32 * @return The article 33 */ 34 public Article getArticle(long articleId); 35 36 /** 37 * Updates the article to persistence. 38 * @param article Article to update. 39 */ 40 public Article maintainArticle(Article article); 41 42 /** 43 * Gets the list of articles that are currently rejected for the specified user. 44 * @param userId 45 * @return 46 */ 47 public List<Article> getRejectedArticles(String tool, String userId); 48 49 /** 50 * Gets the number of rejected articles for the user on the specific tool 51 * instance 52 * @param tool name of the tool instance. 53 * @param userId Id of the user 54 * @return 55 */ 56 public long getNumberRejectedArticles(String tool, String userId); 57 58 /** 59 * Gets the list of articles that are currently saved by the specified user. 60 * @param userId 61 * @return 62 */ 63 public List<Article> getSavedArticles(String tool, String userId, boolean isEditor); 64 65 /** 66 * 67 * Gets the number of saved articles for the user 68 * @param instance 69 * @param userId 70 * @param isEditor 71 * @return 72 */ 73 public long getNumberSavedArticles(String instance, String userId, boolean isEditor); 74 75 /** 76 * Gets the list of articles that are currently submitted. 77 * @param userId 78 * @return 79 */ 80 public List<Article> getSubmittedArticles(String instance); 81 82 /** 83 * Gets the number of submitted articles. 84 * @param instance name of the tool instance 85 * @return 86 */ 87 public long getNumberSubmittedArticles(String instance); 88 89 /** 90 * Gets the rejection for the specified rejection id 91 * @param rejectionId 92 * @return 93 */ 94 public ArticleRejection getArticleRejection(long rejectionId); 95 96 public long getNumArticles(String tool, long topicId); 97 98 public List<Article> getArticles(String tool, long topicId, int from, int fetchSize); 99 100 /** 101 * Searches for articles 102 * @param searchText Text to search 103 * @param from Starting row of resultset 104 * @param fetchSize Number of articles to retrieve 105 * @return 106 */ 107 public abstract List<Article> searchArticles(String tool, String searchText, int from, int fetchSize); 108 109 /** 110 * Returns the number of search results 111 * @param searchText 112 * @return 113 */ 114 public abstract long searchArticlesCount(String tool, String searchText); 115 }