KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > blandware > atleap > service > news > NewsManager


1 /*
2  * Copyright 2004 Blandware (http://www.blandware.com)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package com.blandware.atleap.service.news;
17
18 import com.blandware.atleap.common.util.PartialCollection;
19 import com.blandware.atleap.common.util.QueryInfo;
20 import com.blandware.atleap.model.news.NewsItem;
21 import com.blandware.atleap.persistence.exception.DeleteException;
22 import com.blandware.atleap.service.core.PageManager;
23 import com.blandware.atleap.service.exception.BeanAlreadyExistsException;
24 import com.blandware.atleap.service.exception.BeanNotFoundException;
25
26 import java.util.Map JavaDoc;
27 import java.util.List JavaDoc;
28
29 /**
30  * <p>Business Delegate (Proxy) Interface to handle communication between web and
31  * persistence layer.
32  * </p>
33  * <p><a HREF="NewsManager.java.htm"><i>View Source</i></a>
34  * </p>
35  *
36  * @author Sergey Zubtcovskii <a HREF="mailto:sergey.zubtcovskii@blandware.com">&lt;sergey.zubtcovskii@blandware.com&gt;</a>
37  * @version $Revision: 1.7 $ $Date: 2005/08/02 14:53:42 $
38  */

39 public interface NewsManager extends PageManager {
40
41     //~ CRUD Methods ================================================================
42

43     /**
44      * Creates a news item
45      *
46      * @param newsItem News item to create
47      * @param linkedObjects Map of pairs <code>uri -&gt; object<code>, which link URI in the annotation or body to
48      * corresponding object (resource or page) if it exists
49      * @return ID of created news item
50      * @throws com.blandware.atleap.service.exception.BeanAlreadyExistsException
51      * if linkable item with same URI already exists
52      */

53     public Long JavaDoc createNewsItem(NewsItem newsItem, Map JavaDoc linkedObjects) throws BeanAlreadyExistsException;
54
55     /**
56      * Retrieves news item with specified ID
57      *
58      * @param newsItemId The ID of news item to retrieve
59      * @return News item or null if no news item with specified ID exists in database
60      */

61     public NewsItem retrieveNewsItem(Long JavaDoc newsItemId);
62
63     /**
64      * Retrieves lite version (with empty 'title', 'annotation' and 'body' maps) of news item with specified ID
65      *
66      * @param newsItemId ID to search by
67      * @return News item with specified ID or null if no news item with specified ID exists in database
68      */

69     public NewsItem retrieveNewsItemLite(Long JavaDoc newsItemId);
70
71     /**
72      * Updates news item
73      *
74      * @param newsItem News item to update
75      * @param linkedObjects Map of pairs <code>uri -&gt; object<code>, which link URI in the annotation or body to
76      * corresponding object (resource or page) if it exists
77      * @throws com.blandware.atleap.service.exception.BeanAlreadyExistsException
78      * if page (no matter content or action) with same URI already exists
79      */

80     public void updateNewsItem(NewsItem newsItem, Map JavaDoc linkedObjects) throws BeanAlreadyExistsException;
81
82     /**
83      * Updates news item without changing links to pages or resources from internal content field values
84      *
85      * @param newsItem News item to update
86      * @throws com.blandware.atleap.service.exception.BeanAlreadyExistsException
87      * if page (no matter content or action) with same URI already exists
88      */

89     public void updateNewsItem(NewsItem newsItem) throws BeanAlreadyExistsException;
90
91     /**
92      * Removes news item
93      *
94      * @param newsItemId ID of news item to remove
95      * @throws com.blandware.atleap.persistence.exception.DeleteException
96      * if news item cannot be deleted
97      * @throws BeanNotFoundException if news item with specified ID was not found
98      */

99     public void deleteNewsItem(Long JavaDoc newsItemId) throws DeleteException, BeanNotFoundException;
100
101     // ~ Additional methods ================================================================
102

103     /**
104      * Retrieves filtered/sorted collection of news items
105      *
106      * @param queryInfo Object that contains information about how to filter and sort data
107      * @return Collection of news items
108      */

109     public PartialCollection listNewsItems(QueryInfo queryInfo);
110
111     /**
112      * Retrieves no more than number of elements, specified in queryInfo's <code>limit</code> field
113      * that are allowed to view to given roles
114      *
115      * @param queryInfo Object that contains list of user roles, number of elements to return and identifier of locale
116      * @return List of news items
117      */

118     public List JavaDoc getLastNews(QueryInfo queryInfo);
119
120     /**
121      * Performs activation check, i.e. sets news active or inactive according to their publication and expiration date
122      * and current activity
123      */

124     public void performActivityCheck();
125
126 }
127
Popular Tags