001: /**********************************************************************************
002: * $URL:https://source.sakaiproject.org/svn/osp/trunk/presentation/api/src/java/org/theospi/portfolio/presentation/model/Presentation.java $
003: * $Id:Presentation.java 9134 2006-05-08 20:28:42Z chmaurer@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 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.theospi.portfolio.presentation.model;
021:
022: import java.util.Collection;
023: import java.util.Date;
024: import java.util.HashSet;
025: import java.util.List;
026: import java.util.Map;
027: import java.util.Set;
028:
029: import org.sakaiproject.component.cover.ServerConfigurationService;
030: import org.sakaiproject.metaobj.shared.model.Agent;
031: import org.sakaiproject.metaobj.shared.model.ElementBean;
032: import org.sakaiproject.metaobj.shared.model.Id;
033: import org.sakaiproject.metaobj.shared.model.IdImpl;
034: import org.sakaiproject.metaobj.shared.model.IdentifiableObject;
035: import org.sakaiproject.tool.api.Tool;
036: import org.theospi.portfolio.shared.model.DateBean;
037: import org.theospi.portfolio.style.model.Style;
038:
039: public class Presentation extends IdentifiableObject {
040: private String name;
041: private String description;
042: private Agent owner;
043: private PresentationTemplate template;
044: private Set items = new HashSet();
045: private Collection viewers = new HashSet();
046: private Date expiresOn;
047: private boolean isPublic;
048: private boolean isDefault;
049: private Date created;
050: private Date modified;
051: private ElementBean properties;
052: private String toolId;
053: private DateBean expiresOnBean = new DateBean();
054: private Map authz;
055: private String presentationType = TEMPLATE_TYPE;
056: private String secretExportKey;
057: private List pages;
058: private String siteId;
059: private boolean newObject = false;
060: private boolean advancedNavigation = false;
061: private Style style;
062: private String styleName;
063: private boolean allowComments = false;
064: private Id propertyForm;
065: private boolean preview = false;
066:
067: public final static String FREEFORM_TYPE = "osp.presentation.type.freeForm";
068: public final static String TEMPLATE_TYPE = "osp.presentation.type.template";
069: public static final Id FREEFORM_TEMPLATE_ID = new IdImpl(
070: "freeFormTemplate", null);
071:
072: public String getToolId() {
073: return toolId;
074: }
075:
076: public void setToolId(String toolId) {
077: this .toolId = toolId;
078: }
079:
080: public Agent getOwner() {
081: return owner;
082: }
083:
084: public PresentationTemplate getTemplate() {
085: return template;
086: }
087:
088: public Collection getPresentationItems() {
089: return getItems();
090: }
091:
092: public void setOwner(Agent owner) {
093: this .owner = owner;
094: }
095:
096: public void setTemplate(PresentationTemplate template) {
097: this .template = template;
098: }
099:
100: public Set getItems() {
101: if (items == null) {
102: setItems(new HashSet());
103: }
104: return items;
105: }
106:
107: public void setItems(Set items) {
108: this .items = items;
109: }
110:
111: public void setViewers(Collection viewers) {
112: this .viewers = viewers;
113: }
114:
115: public Collection getViewers() {
116: return viewers;
117: }
118:
119: public String getName() {
120: return name;
121: }
122:
123: public void setName(String name) {
124: this .name = name;
125: }
126:
127: public String getDescription() {
128: return description;
129: }
130:
131: public void setDescription(String description) {
132: this .description = description;
133: }
134:
135: public Date getExpiresOn() {
136: return expiresOn;
137: }
138:
139: public void setExpiresOn(Date expiresOn) {
140: this .expiresOnBean = new DateBean(expiresOn);
141: this .expiresOn = expiresOn;
142: }
143:
144: public boolean getIsPublic() {
145: return isPublic;
146: }
147:
148: public void setIsPublic(boolean aPublic) {
149: isPublic = aPublic;
150: }
151:
152: public boolean getIsDefault() {
153: return isDefault;
154: }
155:
156: public void setIsDefault(boolean aDefault) {
157: isDefault = aDefault;
158: }
159:
160: public Date getCreated() {
161: return created;
162: }
163:
164: public void setCreated(Date created) {
165: this .created = created;
166: }
167:
168: public Date getModified() {
169: return modified;
170: }
171:
172: public void setModified(Date modified) {
173: this .modified = modified;
174: }
175:
176: public ElementBean getProperties() {
177: return properties;
178: }
179:
180: public void setProperties(ElementBean properties) {
181: this .properties = properties;
182: }
183:
184: public DateBean getExpiresOnBean() {
185: return expiresOnBean;
186: }
187:
188: public void setExpiresOnBean(DateBean expiresOnBean) {
189: this .expiresOnBean = expiresOnBean;
190: }
191:
192: public Map getAuthz() {
193: return authz;
194: }
195:
196: public void setAuthz(Map authz) {
197: this .authz = authz;
198: }
199:
200: public boolean isExpired() {
201: if (getExpiresOn() == null) {
202: return false;
203: }
204: return getExpiresOn().getTime() < System.currentTimeMillis();
205: }
206:
207: public String getExternalUri() {
208: String uri = ServerConfigurationService.getServerUrl();
209: uri += "/osp-presentation-tool/viewPresentation.osp?panel=presentation&id="
210: + getId().getValue();
211: uri += "&" + Tool.PLACEMENT_ID + "=" + getToolId();
212: return uri;
213: }
214:
215: public String getPresentationType() {
216: return presentationType;
217: }
218:
219: public void setPresentationType(String presentationType) {
220: this .presentationType = presentationType;
221: }
222:
223: public String getSecretExportKey() {
224: return secretExportKey;
225: }
226:
227: public void setSecretExportKey(String secretExportKey) {
228: this .secretExportKey = secretExportKey;
229: }
230:
231: public List getPages() {
232: return pages;
233: }
234:
235: public void setPages(List pages) {
236: this .pages = pages;
237: }
238:
239: public String getSiteId() {
240: return siteId;
241: }
242:
243: public void setSiteId(String siteId) {
244: this .siteId = siteId;
245: }
246:
247: public boolean isNewObject() {
248: return newObject;
249: }
250:
251: public void setNewObject(boolean newObject) {
252: this .newObject = newObject;
253: }
254:
255: public boolean isAdvancedNavigation() {
256: return advancedNavigation;
257: }
258:
259: public void setAdvancedNavigation(boolean advancedNavigation) {
260: this .advancedNavigation = advancedNavigation;
261: }
262:
263: public Style getStyle() {
264: return style;
265: }
266:
267: public void setStyle(Style style) {
268: this .style = style;
269: }
270:
271: public String getStyleName() {
272: if (getStyle() != null) {
273: return getStyle().getName();
274: }
275: return null;
276: }
277:
278: public boolean isAllowComments() {
279: return allowComments;
280: }
281:
282: public void setAllowComments(boolean allowComments) {
283: this .allowComments = allowComments;
284: }
285:
286: /**
287: * @return the propertyForm
288: */
289: public Id getPropertyForm() {
290: return propertyForm;
291: }
292:
293: /**
294: * @param propertyForm the propertyForm to set
295: */
296: public void setPropertyForm(Id propertyForm) {
297: this .propertyForm = propertyForm;
298: }
299:
300: public void setIsPreview(boolean preview) {
301: this .preview = preview;
302: }
303:
304: public boolean isPreview() {
305: return preview;
306: }
307:
308: }
|