01: /**********************************************************************************
02: * $URL:https://source.sakaiproject.org/svn/osp/trunk/portal/tool/src/java/org/theospi/portfolio/portal/tool/SiteTypeTool.java $
03: * $Id:SiteTypeTool.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2006 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.theospi.portfolio.portal.tool;
21:
22: import org.sakaiproject.site.api.SiteService;
23: import org.theospi.portfolio.portal.intf.PortalManager;
24: import org.theospi.portfolio.shared.tool.HelperToolBase;
25: import org.theospi.portfolio.shared.tool.PagingList;
26:
27: import java.util.List;
28:
29: /**
30: * Created by IntelliJ IDEA.
31: * User: John Ellis
32: * Date: Feb 16, 2006
33: * Time: 10:01:00 AM
34: * To change this template use File | Settings | File Templates.
35: */
36: public class SiteTypeTool extends HelperToolBase {
37:
38: private PortalManager portalManager;
39:
40: private PagingList sites = null;
41:
42: public PagingList getSites() {
43: if (getAttribute(PortalManager.RELOAD_SITES) != null) {
44: List sitesBase = getPortalManager()
45: .getSitesForType(getSiteType(),
46: SiteService.SortType.TITLE_ASC, null);
47: if (sites != null) {
48: sites.setWholeList(sitesBase);
49: } else {
50: setSites(new PagingList(sitesBase));
51: }
52: removeAttribute(PortalManager.RELOAD_SITES);
53: }
54:
55: return sites;
56: }
57:
58: public String getSiteType() {
59: return (String) getAttribute(PortalManager.SITE_TYPE);
60: }
61:
62: public String getSiteTypeClass() {
63: return getSiteType().replace('.', '_');
64: }
65:
66: public void setSites(PagingList sites) {
67: this .sites = sites;
68: }
69:
70: public PortalManager getPortalManager() {
71: return portalManager;
72: }
73:
74: public void setPortalManager(PortalManager portalManager) {
75: this.portalManager = portalManager;
76: }
77:
78: }
|