View Javadoc

1   package org.unitedfront2.dao;
2   
3   import java.util.List;
4   
5   import org.unitedfront2.domain.communication.Blog;
6   import org.unitedfront2.domain.communication.BlogEntry;
7   import org.unitedfront2.domain.communication.Comment;
8   
9   /**
10   * ブログのデータアクセスインターフェースです。
11   *
12   * @author kurokkie
13   *
14   */
15  public interface BlogDao extends Registerable<Blog>, SimpleFindable<Blog>,
16          Updatable<Blog>, SimpleDeletable, Dao {
17  
18      /**
19       * 指定したブログに指定した記事を登録します。
20       *
21       * @param blogId ブログ ID
22       * @param entryId ブログ記事 ID (メッセージ ID)
23       */
24      void registerBlogEntry(int blogId, int entryId);
25  
26      /**
27       * 指定した記事にコメントを登録します。
28       *
29       * @param entryId ブログ記事 ID (メッセージ ID)
30       * @param commentId コメント ID
31       */
32      void registerComment(int entryId, int commentId);
33  
34      /**
35       * コードを指定してブログを取得します。
36       *
37       * @param code コード
38       * @return ブログ、見つからなければ <code>null</code>
39       */
40      Blog findByCode(String code);
41  
42      /**
43       * 指定した所有者のブログリストを取得します。
44       *
45       * @param ownerId 所有者のユーザ ID
46       * @return ブログリスト
47       */
48      List<Blog> findByOwnerId(int ownerId);
49  
50      /**
51       * 匿名ユーザに公開しているブログを取得します。返り値のリストは登録日の降順。
52       *
53       * @return ブログリスト
54       */
55      List<Blog> findPublicBlogs();
56  
57      /**
58       * 匿名ユーザに公開しているブログを取得します。
59       *
60       * @param max 最大件数
61       * @return ブログリスト
62       */
63      List<Blog> findPublicBlogsRandomly(int max);
64  
65      /**
66       * @require ブログが記事を一つも持っていない
67       * @ensure ブログに関連するオブジェクトも削除される
68       */
69      @Override
70      void delete(int blogId);
71  
72      /**
73       * ブログが持つブログ記事の数を取得します。
74       *
75       * @param blogId ブログ ID
76       * @return ブログ記事数
77       */
78      int countBlogEntry(int blogId);
79  
80      /**
81       * ブログ記事が持つコメント数を取得します。
82       *
83       * @param blogEntryId ブログ記事 ID
84       * @return コメント数
85       */
86      int countComment(int blogEntryId);
87  
88      /**
89       * 指定した範囲のブログ記事を取得します。記事番号は0から始まる整数で、ID の降順になります。
90       *
91       * @param blogId ブログ ID
92       * @param no 開始点となる記事番号
93       * @param num 件数
94       * @return ブログ記事リスト
95       */
96      List<BlogEntry> findBlogEntries(int blogId, int no, int num);
97  
98      /**
99       * 指定したブログ記事のコメントを取得します。
100      *
101      * @param entryId ブログ記事 ID (メッセージ ID)
102      * @return コメントリスト
103      */
104     List<Comment> findComments(int entryId);
105 
106     /**
107      * 指定したブログ記事を削除します。ブログ記事に付属するコメントも削除されます。
108      *
109      * @param entryId ブログ記事 ID
110      */
111     void deleteBlogEntry(int entryId);
112 }