01: /**********************************************************************************
02: * $URL: $
03: * $Id: $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2006,2007 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.poll.logic;
21:
22: import java.util.List;
23: import org.sakaiproject.exception.PermissionException;
24: import org.sakaiproject.entity.api.EntityProducer;
25: import org.sakaiproject.poll.model.Option;
26: import org.sakaiproject.poll.model.Poll;
27:
28: /**
29: * This is the interface for the Manager for our poll tool,
30: * it handles the data access functionality of the tool, we currently
31: * have 2 implementations (memory and hibernate)
32: * @author DH
33: *
34: */
35: public interface PollListManager extends EntityProducer {
36:
37: // the permissions
38:
39: public static final String PERMISSION_VOTE = "poll.vote";
40: public static final String PERMISSION_ADD = "poll.add";
41: public static final String PERMISSION_DELETE_OWN = "poll.deleteOwn";
42: public static final String PERMISSION_DELETE_ANY = "poll.deleteAny";
43: public static final String PERMISSION_EDIT_ANY = "poll.editAny";
44: public static final String PERMISSION_EDIT_OWN = "poll.editOwn";
45:
46: /**
47: * Save a poll
48: * @param t - the poll object to save
49: * @return - true for success, false if failure
50: */
51: public boolean savePoll(Poll t);
52:
53: /**
54: * Delete a poll
55: * @param t - the poll object to remove
56: * @return - true for success, false if failure
57: */
58: public boolean deletePoll(Poll t) throws PermissionException;
59:
60: public boolean saveOption(Option t);
61:
62: /**
63: * Gets all the task objects for the site
64: * @param siteId - the siteId of the site
65: * @return - a collection of task objects (empty collection if none found)
66: */
67: public List findAllPolls(String siteId);
68:
69: /**
70: * Retrieve a specific poll
71: * @param pollId
72: * @return a single poll object
73: */
74: public Poll getPollById(Long pollId);
75:
76: /**
77: * Get a specific poll with all its votes
78: * @param pollId
79: * @return a poll object
80: */
81: public Poll getPollWithVotes(Long pollId);
82:
83: /**
84: * Get a specific option by its id
85: */
86: public Option getOptionById(Long optionId);
87:
88: public void deleteOption(Option option);
89: }
|