001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/site/tags/sakai_2-4-1/site-api/api/src/java/org/sakaiproject/site/api/Site.java $
003: * $Id: Site.java 19627 2006-12-16 02:38:02Z ggolden@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.site.api;
021:
022: import java.io.Serializable;
023: import java.util.Collection;
024: import java.util.List;
025:
026: import org.sakaiproject.authz.api.AuthzGroup;
027: import org.sakaiproject.entity.api.Edit;
028: import org.sakaiproject.time.api.Time;
029: import org.sakaiproject.user.api.User;
030:
031: /**
032: * <p>
033: * Site is the object that knows the information, tools and layouts for a Sakai Site.
034: * </p>
035: */
036: public interface Site extends Edit, Comparable, Serializable,
037: AuthzGroup {
038: /**
039: * @return the user who created this.
040: */
041: User getCreatedBy();
042:
043: /**
044: * @return the user who last modified this.
045: */
046: User getModifiedBy();
047:
048: /**
049: * @return the time created.
050: */
051: Time getCreatedTime();
052:
053: /**
054: * @return the time last modified.
055: */
056: Time getModifiedTime();
057:
058: /** @return The human readable Title of the site. */
059: String getTitle();
060:
061: /** @return A short text Description of the site. */
062: String getShortDescription();
063:
064: /** @return A longer text Description of the site. */
065: String getDescription();
066:
067: /** @return The Site's icon URL. */
068: String getIconUrl();
069:
070: /** @return The Site's icon URL as a full URL. */
071: String getIconUrlFull();
072:
073: /** @return The Site's info display URL. */
074: String getInfoUrl();
075:
076: /** @return The Site's info display URL as a full URL. */
077: String getInfoUrlFull();
078:
079: /** @return true if this Site can be joined by anyone, false if not. */
080: boolean isJoinable();
081:
082: /** @return the role name given to users who join a joinable site. */
083: String getJoinerRole();
084:
085: /** @return the skin to use for this site. */
086: String getSkin();
087:
088: /** @return the List (SitePage) of Site Pages. */
089: List getPages();
090:
091: /**
092: * Make sure pages and tools, groups and properties are loaded, not lazy
093: */
094: void loadAll();
095:
096: /** @return The pages ordered by the tool order constraint for this site's type (as tool category), or the site's pages in defined order if the site is set to have a custom page order. */
097: List getOrderedPages();
098:
099: /** @return true if the site is published, false if not. */
100: boolean isPublished();
101:
102: /**
103: * Access the SitePage that has this id, if one is defined, else return null.
104: *
105: * @param id
106: * The id of the SitePage.
107: * @return The SitePage that has this id, if one is defined, else return null.
108: */
109: SitePage getPage(String id);
110:
111: /**
112: * Access the ToolConfiguration that has this id, if one is defined, else return null. The tool may be on any SitePage in the site.
113: *
114: * @param id
115: * The id of the tool.
116: * @return The ToolConfiguration that has this id, if one is defined, else return null.
117: */
118: ToolConfiguration getTool(String id);
119:
120: /**
121: * Get all the tools placed in the site on any page that are of any of these tool ids.
122: *
123: * @param toolIds
124: * The tool id array (String, such as sakai.chat, not a tool configuration / placement uuid) to search for.
125: * @return A Collection (ToolConfiguration) of all the tools placed in the site on any page that are of this tool id (may be empty).
126: */
127: Collection getTools(String[] toolIds);
128:
129: /**
130: * Get all the tools placed in the site on any page for a particular common Tool Id.
131: *
132: * @param commonToolId
133: * The tool id (String, such as sakai.chat, not a tool configuration / placement uuid) to search for.
134: * @return A Collection (ToolConfiguration) of all the tools placed in the site on any page that are of this tool id (may be empty).
135: */
136: Collection getTools(String commonToolId);
137:
138: /**
139: * Get the first tool placed on the site on any page with the specified common Tool id (such as sakai.chat)
140: *
141: * @param commonToolId
142: * The common ToolID to search for (i.e. sakai.chat)
143: * @return ToolConfiguration for the tool which has the ID (if any) or null if no tools match.
144: */
145: ToolConfiguration getToolForCommonId(String commonToolId);
146:
147: /**
148: * Access the site type.
149: *
150: * @return The site type.
151: */
152: String getType();
153:
154: /**
155: * Test if the site is of this type. It is if the param is null.
156: *
157: * @param type
158: * A String type to match, or a String[], List or Set of Strings, any of which can match.
159: * @return true if the site is of the type(s) specified, false if not.
160: */
161: boolean isType(Object type);
162:
163: /**
164: * Check if the site is marked for viewing.
165: *
166: * @return True if the site is marked for viewing, false if not
167: */
168: boolean isPubView();
169:
170: /**
171: * Get a site group
172: *
173: * @param id
174: * The group id (or reference).
175: * @return The Group object if found, or null if not found.
176: */
177: Group getGroup(String id);
178:
179: /**
180: * Get a collection of the groups in a Site.
181: *
182: * @return A collection (Group) of groups defined in the site, empty if there are none.
183: */
184: Collection getGroups();
185:
186: /**
187: * Get a collection of the groups in a Site that have this user as a member.
188: *
189: * @param userId
190: * The user id.
191: * @return A collection (Group) of groups defined in the site that have this user as a member, empty if there are none.
192: */
193: Collection getGroupsWithMember(String userId);
194:
195: /**
196: * Get a collection of the groups in a Site that have this user as a member with this role.
197: *
198: * @param userId
199: * The user id.
200: * @param role
201: * The role.
202: * @return A collection (Group) of groups defined in the site that have this user as a member with this role, empty if there are none.
203: */
204: Collection getGroupsWithMemberHasRole(String userId, String role);
205:
206: /**
207: * Does the site have any groups defined?
208: *
209: * @return true if the site and has any groups, false if not.
210: */
211: boolean hasGroups();
212:
213: /**
214: * Set the human readable Title of the site.
215: *
216: * @param title
217: * the new title.
218: */
219: void setTitle(String title);
220:
221: /**
222: * Set the url of an icon for the site.
223: *
224: * @param url
225: * The new icon's url.
226: */
227: void setIconUrl(String url);
228:
229: /**
230: * Set the url for information about the site.
231: *
232: * @param url
233: * The new information url.
234: */
235: void setInfoUrl(String url);
236:
237: /**
238: * Set the joinable status of the site.
239: *
240: * @param joinable
241: * represents whether the site is joinable (true) or not (false).
242: */
243: void setJoinable(boolean joinable);
244:
245: /**
246: * Set the joiner role for a site.
247: *
248: * @param role
249: * the joiner role for a site.
250: */
251: void setJoinerRole(String role);
252:
253: /**
254: * Set the short Description of the site. Used to give a short text description of the site.
255: *
256: * @param description
257: * The new short description.
258: */
259: void setShortDescription(String description);
260:
261: /**
262: * Set the Description of the site. Used to give a longer text description of the site.
263: *
264: * @param description
265: * The new description.
266: */
267: void setDescription(String description);
268:
269: /**
270: * Set the published state of this site.
271: *
272: * @param status
273: * The published state of the site.
274: */
275: void setPublished(boolean published);
276:
277: /**
278: * Set the skin to use for this site.
279: *
280: * @param skin
281: * The skin to use for this site.
282: */
283: void setSkin(String skin);
284:
285: /**
286: * Create a new site page and add it to this site.
287: *
288: * @return The SitePage object for the new site page.
289: */
290: SitePage addPage();
291:
292: /**
293: * Remove a site page from this site.
294: *
295: * @param page
296: * The SitePage to remove.
297: */
298: void removePage(SitePage page);
299:
300: /**
301: * Generate a new set of pages and tools that have new, unique ids. Good if the site had non-unique-system-wide ids for pages and tools. The Site Id does not change.
302: */
303: void regenerateIds();
304:
305: /**
306: * Set the site type.
307: *
308: * @param type
309: * The site type.
310: */
311: void setType(String type);
312:
313: /**
314: * Set the site view.
315: *
316: * @param pubView
317: * The site view setting.
318: */
319: void setPubView(boolean pubView);
320:
321: /**
322: * Add a new group. The Id is generated, the rest of the fields can be set using calls to the Group object returned.
323: */
324: Group addGroup();
325:
326: /**
327: * Remove this group from the groups for this site.
328: *
329: * @param group
330: * The group to remove.
331: */
332: void removeGroup(Group group);
333:
334: /**
335: * Check if the site has a custom page order
336: *
337: * @return true if the site has a custom page order, false if not.
338: */
339: boolean isCustomPageOrdered();
340:
341: /**
342: * Set the site's custom page order flag.
343: *
344: * @param custom
345: * true if the site has a custom page ordering, false if not.
346: */
347: void setCustomPageOrdered(boolean custom);
348: }
|