001: /**********************************************************************************
002: * $URL: $
003: * $Id: $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2006, 2007 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.content.api;
021:
022: import java.util.List;
023: import java.util.Set;
024:
025: import org.sakaiproject.entity.api.Reference;
026: import org.sakaiproject.user.api.User;
027:
028: /**
029: *
030: *
031: */
032: public interface ResourceType {
033: public static final String TYPE_TEXT = "org.sakaiproject.content.types.TextDocumentType";
034: public static final String TYPE_HTML = "org.sakaiproject.content.types.HtmlDocumentType";
035: public static final String TYPE_URL = "org.sakaiproject.content.types.urlResource";
036: public static final String TYPE_UPLOAD = "org.sakaiproject.content.types.fileUpload";
037: public static final String TYPE_FOLDER = "org.sakaiproject.content.types.folder";
038: public static final String TYPE_METAOBJ = "org.sakaiproject.metaobj.shared.FormHelper";
039:
040: public static final String MIME_TYPE_TEXT = "text/plain";
041: public static final String MIME_TYPE_HTML = "text/html";
042: public static final String MIME_TYPE_METAOBJ = "application/x-osp";
043: public static final String MIME_TYPE_URL = "text/url";
044:
045: /**
046: * Access the action specified by the parameter. If the action is defined for this resource type,
047: * it is returned. Otherwise, the method returns null.
048: * @param type
049: * @return
050: */
051: public List<ResourceToolAction> getActions(
052: ResourceToolAction.ActionType type);
053:
054: /**
055: * Access an ordered list of actions specified by the parameter. The actions are added to the list
056: * in the order specified by the parametric list. If none of the action types specified in the list
057: * are defined for this resource type, the returned list will be empty.
058: * @param types
059: * @return
060: */
061: public List<ResourceToolAction> getActions(
062: List<ResourceToolAction.ActionType> types);
063:
064: /**
065: * @param actionId
066: * @return
067: */
068: public ResourceToolAction getAction(String actionId);
069:
070: /**
071: * Retrieve a reference for the location of the icon for this type. This should
072: * be relative to the image library in "/reference/library/src/webapp/image/".
073: * For example, the plain-text image is "sakai/text.gif";
074: * If null, the mimetype of the resource or other info may be used to find an icon.
075: * @param entity The entity for which the icon is needed, or null, especially in
076: * cases where a specific entity has not yet been created.
077: * @return A path to the icon relative to the root of the image library in
078: * "/reference/library/src/webapp/image/", or null
079: */
080: public String getIconLocation(ContentEntity entity);
081:
082: // TODO: types should be able to opt-out of some "properties"
083: // "property" categories: title (always required), description, copyright/licensing, access (groups, public), email-notification, availability
084: /**
085: * Access the identifier for this type (which must be unique within the registry and must be limited to alphnumeric characters).
086: * @return
087: */
088: public String getId();
089:
090: /**
091: * @return
092: */
093: public String getLabel();
094:
095: /**
096: * Access a text string suitable for use as a very brief description of a particular resource.
097: * If the string is more than about 40 or 50 characters, it may be truncated at an arbitrary
098: * length. The string may identify the type of this resource or more specific information.
099: * If the entity parameter is null, the method should return a more general description of
100: * the the entity (suitable for a new entity during creation dialogs). The string should be
101: * localized. If no return value is supplied, a default hover-string will be used.
102: * @param entity The resource that's being displayed, or null indicating that the entity might
103: * not yet exist.
104: * @return
105: */
106: public String getLocalizedHoverText(ContentEntity entity);
107:
108: /**
109: * Should the Resources tool support hiding and scheduled release and/or retraction for items of this type?
110: * @return true if availability is included among the resource properties in the UI, false otherwise.
111: */
112: public boolean hasAvailabilityDialog();
113:
114: /**
115: * Should the Resources tool elicit a description for items of this type?
116: * @return true if a description is included among the resource properties in the UI, false otherwise.
117: */
118: public boolean hasDescription();
119:
120: /**
121: * Should the Resources tool support access by groups for items of this type?
122: * @return true if access by groups is included among the resource properties in the UI, false otherwise.
123: */
124: public boolean hasGroupsDialog();
125:
126: /**
127: * Should the Resources tool support optional email notification for items of this type?
128: * @return true if email-notification is included among the resource properties in the UI, false otherwise.
129: */
130: public boolean hasNotificationDialog();
131:
132: /**
133: * Should the Resources tool allow specification of "optional properties" (usually Dublin Core tags) for items of this type?
134: * @return true if optional properties form is included among the resource properties in the UI, false otherwise.
135: */
136: public boolean hasOptionalPropertiesDialog();
137:
138: /**
139: * Should the Resources tool support making items of this type public?
140: * @return true if public access is included among the resource properties in the UI, false otherwise.
141: */
142: public boolean hasPublicDialog();
143:
144: /**
145: * Should the Resources tool elicit copyright/licensing for items of this type?
146: * @return true if the copyright/licensing dialog is included among the resource properties in the UI, false otherwise.
147: */
148: public boolean hasRightsDialog();
149:
150: }
|