001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/entity/tags/sakai_2-4-1/entity-api/api/src/java/org/sakaiproject/entity/api/ResourceProperties.java $
003: * $Id: ResourceProperties.java 18590 2006-12-01 14:34:38Z jimeng@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.entity.api;
021:
022: import java.io.Serializable;
023: import java.util.Iterator;
024: import java.util.List;
025: import java.util.Properties;
026: import java.util.Stack;
027:
028: import org.sakaiproject.time.api.Time;
029: import org.w3c.dom.Document;
030: import org.w3c.dom.Element;
031:
032: /**
033: * <p>
034: * ResourceProperties models the open-ended propeties of a Sakai Entity.
035: * </p>
036: */
037: public interface ResourceProperties extends Serializable {
038: /** Property for resource creator (uploader) (automatic). [user id string] */
039: static final String PROP_CREATOR = "CHEF:creator";
040:
041: /** Property for resource last one to modify (automatic). [user id string] */
042: static final String PROP_MODIFIED_BY = "CHEF:modifiedby";
043:
044: /** Property for creation (upload) date (live, from DAV:). [Time] */
045: static final String PROP_CREATION_DATE = "DAV:creationdate";
046:
047: /** Property for the display name (description) (dead, from DAV:). [String] */
048: static final String PROP_DISPLAY_NAME = "DAV:displayname";
049:
050: /** Property for the original filename (automatic). [String] */
051: static final String PROP_ORIGINAL_FILENAME = "CHEF:originalfilename";
052:
053: /** Property for the copyright attribution (user settable). [String] */
054: static final String PROP_COPYRIGHT = "CHEF:copyright";
055:
056: /** Property for the copyright choice attribution (user settable). [String] */
057: static final String PROP_COPYRIGHT_CHOICE = "CHEF:copyrightchoice";
058:
059: /** Property for the copyright alert attribution (user settable). [String] */
060: static final String PROP_COPYRIGHT_ALERT = "CHEF:copyrightalert";
061:
062: /** Property for the content length (live, from DAV:). [Long] */
063: static final String PROP_CONTENT_LENGTH = "DAV:getcontentlength";
064:
065: /** Property for the content type (live, from DAV:). [MIME type string] */
066: static final String PROP_CONTENT_TYPE = "DAV:getcontenttype";
067:
068: /** Property for the last modified date (live, from DAV:, set when anything changes). [Time] */
069: static final String PROP_MODIFIED_DATE = "DAV:getlastmodified";
070:
071: /** Property that distinguishes a collection from a non-collection resource (automatic). [Boolean] */
072: static final String PROP_IS_COLLECTION = "CHEF:is-collection";
073:
074: /** Property that holds a ContentHosting collection body bytes quota, in K (user settable). [long] */
075: static final String PROP_COLLECTION_BODY_QUOTA = "CHEF:collection-body-quota";
076:
077: /** Property to associate a chat message with a chat room (user settable). [String] */
078: static final String PROP_CHAT_ROOM = "CHEF:chat-room";
079:
080: /** Property to target a message to a specific user (user settable). [User] */
081: static final String PROP_TO = "CHEF:to";
082:
083: /** Property for long open description (user settable). [String] */
084: static final String PROP_DESCRIPTION = "CHEF:description";
085:
086: /** Property for calendar event types (user settable). [String] */
087: static final String PROP_CALENDAR_TYPE = "CHEF:calendar-type";
088:
089: /** Property for calendar event location (user settable). [String] */
090: static final String PROP_CALENDAR_LOCATION = "CHEF:calendar-location";
091:
092: /** Property for the channel to categories names inside a discussion channel (user settable). [String] */
093: static final String PROP_DISCUSSION_CATEGORIES = "CHEF:discussion-categories";
094:
095: /** Property that discussion reply message style is star or thread (automatic) [String] */
096: static final String PROP_REPLY_STYLE = "CHEF:discussion-reply-style";
097:
098: /** Property for a message channel indicating if the channel is 'enabled' (user settable) [Boolean] */
099: static final String PROP_CHANNEL_ENABLED = "CHEF:channel-enabled";
100:
101: /** Property for a message channel indicating if the channel is 'enabled' (user settable) [Boolean] */
102: static final String PROP_MAIL_CHANNEL_OPEN = "CHEF:mail-channel-open";
103:
104: /** Property for a site storing the email notification id associated with the site's mailbox (user settable) [String] */
105: static final String PROP_SITE_EMAIL_NOTIFICATION_ID = "CHEF:site-email-notification-id";
106:
107: /** Property for a site indicating if email archiveing is enabled for the site (user settable) [Boolean] */
108: static final String PROP_SITE_EMAIL_ARCHIVE = "CHEF:site-email-archive";
109:
110: /** Property for a ToolRegistration, the title of the tool (user settable) [String] */
111: static final String PROP_TOOL_TITLE = "CHEF:tool-title";
112:
113: /** Property for a ToolRegistration, description of the tool (user settable) [String] */
114: static final String PROP_TOOL_DESCRIPTION = "CHEF:tool-description";
115:
116: /** Property for a ToolRegistration, category of the tool (user settable) [String] %%% list desired -ggolden */
117: static final String PROP_TOOL_CATEGORY = "CHEF:tool-category";
118:
119: /** Property for calendar event extra fields (user settable). [String] */
120: static final String PROP_CALENDAR_EVENT_FIELDS = "CHEF:calendar-fields";
121:
122: /** Property for whether an assignment's open date will be announced (user settable). [String] */
123: static final String NEW_ASSIGNMENT_CHECK_AUTO_ANNOUNCE = "new_assignment_check_auto_announce";
124:
125: /** Property for whether an assignment's due date will be added into schedule as an event(user settable). [String] */
126: static final String NEW_ASSIGNMENT_CHECK_ADD_DUE_DATE = "new_assignment_check_add_due_date";
127:
128: /** Property for calendar event associated with an assignment's due date (user settable). [String] */
129: static final String PROP_ASSIGNMENT_DUEDATE_CALENDAR_EVENT_ID = "CHEF:assignment_duedate_calender_event_id";
130:
131: /** Property for announcement message id associated with an assignment's open date (user settable). [String] */
132: static final String PROP_ASSIGNMENT_OPENDATE_ANNOUNCEMENT_MESSAGE_ID = "CHEF:assignment_opendate_announcement_message_id";
133:
134: /** Property for assignment submission's previous grade (user settable). [String] */
135: static final String PROP_SUBMISSION_PREVIOUS_GRADES = "CHEF:submission_previous_grades";
136:
137: /** Property for assignment submission's scaled previous grade (user settable). [String] */
138: static final String PROP_SUBMISSION_SCALED_PREVIOUS_GRADES = "CHEF:submission_scaled_previous_grades";
139:
140: /** Property for assignment submission's previous inline feedback text (user settable). [String] */
141: static final String PROP_SUBMISSION_PREVIOUS_FEEDBACK_TEXT = "CHEF:submission_previous_feedback_text";
142:
143: /** Property for assignment submission's previous feedback comment (user settable). [String] */
144: static final String PROP_SUBMISSION_PREVIOUS_FEEDBACK_COMMENT = "CHEF:submission_previous_feedback_comment";
145:
146: /** Property for assignment been deleted status(user settable) [String] */
147: static final String PROP_ASSIGNMENT_DELETED = "CHEF:assignment_deleted";
148:
149: /** Property indicating viewable (manual). [Boolean] */
150: static final String PROP_PUBVIEW = "SAKAI:pubview";
151:
152: /** URL MIME type */
153: static final String TYPE_URL = "text/url";
154:
155: /** The encoding of the resource - UTF-8 or ISO-8559-1 for example */
156: static final String PROP_CONTENT_ENCODING = "encoding";
157:
158: /** Property for "object type" of a structured artifact */
159: static final String PROP_STRUCTOBJ_TYPE = "SAKAI:structobj_type";
160:
161: /** Used to find non structured object ContentResources (files, url's, etc.) */
162: static final String FILE_TYPE = "fileResource";
163:
164: /** Property name on a ContentEntity indicating its rank if a custom priority sort is used. */
165: static final String PROP_CONTENT_PRIORITY = "SAKAI:content_priority";
166:
167: /** Property name on a ContentCollection indicating that a custom priority sort is to be used. */
168: public static final String PROP_HAS_CUSTOM_SORT = "SAKAI:has_custom_sort";
169:
170: /** Property name on a ContentEntity indicating the ResourceType that defines its properties. */
171: static final String PROP_RESOURCE_TYPE = "SAKAI:resource_type";
172:
173: /**
174: * Access an iterator on the names of the defined properties (Strings).
175: *
176: * @return An iterator on the names of the defined properties (Strings) (may be empty).
177: */
178: Iterator getPropertyNames();
179:
180: /**
181: * Access a named property as a string (won't find multi-valued ones.)
182: *
183: * @param name
184: * The property name.
185: * @return the property value, or null if not found.
186: */
187: String getProperty(String name);
188:
189: /**
190: * Access a named property as a List of (String), good for single or multi-valued properties.
191: *
192: * @param name
193: * The property name.
194: * @return the property value, or null if not found.
195: */
196: List getPropertyList(String name);
197:
198: /**
199: * Access a named property; as a String if it's single valued, or a List of (String) if it's multi-valued (or null if it's not defined).
200: *
201: * @param name
202: * The property name.
203: * @return the property value, or null if not found.
204: */
205: Object get(String name);
206:
207: /**
208: * Access a named property as a properly formatted string.
209: *
210: * @param name
211: * The property name.
212: * @return the property value, or an empty string if not found.
213: */
214: String getPropertyFormatted(String name);
215:
216: /**
217: * Check if a named property is a live one (auto updated).
218: *
219: * @param name
220: * The property name.
221: * @return True if the property is a live one, false if not.
222: */
223: boolean isLiveProperty(String name);
224:
225: /**
226: * Access a named property as a boolean.
227: *
228: * @param name
229: * The property name.
230: * @return the property value.
231: * @exception EntityPropertyNotDefinedException
232: * if not found.
233: * @exception EntityPropertyTypeException
234: * if the property is found but not a boolean.
235: */
236: boolean getBooleanProperty(String name)
237: throws EntityPropertyNotDefinedException,
238: EntityPropertyTypeException;
239:
240: /**
241: * Access a named property as a long.
242: *
243: * @param name
244: * The property name.
245: * @return the property value.
246: * @exception EntityPropertyNotDefinedException
247: * if not found.
248: * @exception EntityPropertyTypeException
249: * if the property is found but not a long.
250: */
251: long getLongProperty(String name)
252: throws EntityPropertyNotDefinedException,
253: EntityPropertyTypeException;
254:
255: /**
256: * Access a named property as a Time.
257: *
258: * @param name
259: * The property name.
260: * @return the property value
261: * @exception EntityPropertyNotDefinedException
262: * if not found.
263: * @exception EntityPropertyTypeException
264: * if the property is found but not a Time.
265: */
266: Time getTimeProperty(String name)
267: throws EntityPropertyNotDefinedException,
268: EntityPropertyTypeException;
269:
270: /**
271: * Access a named property as a User.
272: *
273: * @param name
274: * The property name.
275: * @return the property value
276: * @exception EntityPropertyNotDefinedException
277: * if not found.
278: * @exception EntityPropertyTypeException
279: * if the property is found but not a User.
280: */
281: // TODO: -ggolden User getUserProperty(String name) throws EntityPropertyNotDefinedException, EntityPropertyTypeException;
282: /**
283: * Get the static String of PROP_CREATOR
284: *
285: * @return The static String of PROP_CREATOR
286: */
287: String getNamePropCreator();
288:
289: /**
290: * Get the static String of PROP_MODIFIED_BY
291: *
292: * @return The static String of PROP_MODIFIED_BY
293: */
294: String getNamePropModifiedBy();
295:
296: /**
297: * Get the static String of PROP_CREATION_DATE
298: *
299: * @return The static String of PROP_CREATION_DATE
300: */
301: String getNamePropCreationDate();
302:
303: /**
304: * Get the static String of PROP_DISPLAY_NAME
305: *
306: * @return The static String of PROP_DISPLAY_NAME
307: */
308: String getNamePropDisplayName();
309:
310: /**
311: * Get the static String of PROP_COPYRIGHT_CHOICE
312: *
313: * @return The static String of PROP_COPYRIGHT_CHOICE
314: */
315: String getNamePropCopyrightChoice();
316:
317: /**
318: * Get the static String of PROP_COPYRIGHT_ALERT
319: *
320: * @return The static String of PROP_COPYRIGHT_ALERT
321: */
322: String getNamePropCopyrightAlert();
323:
324: /**
325: * Get the static String of PROP_COPYRIGHT
326: *
327: * @return The static String of PROP_COPYRIGHT
328: */
329: String getNamePropCopyright();
330:
331: /**
332: * Get the static String of PROP_CONTENT_LENGTH
333: *
334: * @return The static String of PROP_CONTENT_LENGTH
335: */
336: String getNamePropContentLength();
337:
338: /**
339: * Get the static String of PROP_CONTENT_TYPE
340: *
341: * @return The static String of PROP_CONTENT_TYPE
342: */
343: String getNamePropContentType();
344:
345: /**
346: * Get the static String of PROP_MODIFIED_DATE
347: *
348: * @return The static String of PROP_MODIFIED_DATE
349: */
350: String getNamePropModifiedDate();
351:
352: /**
353: * Get the static String of PROP_IS_COLLECTION
354: *
355: * @return The static String of PROP_IS_COLLECTION
356: */
357: String getNamePropIsCollection();
358:
359: /**
360: * Get the static String of PROP_COLLECTION_BODY_QUOTA
361: *
362: * @return The static String of PROP_COLLECTION_BODY_QUOTA
363: */
364: String getNamePropCollectionBodyQuota();
365:
366: /**
367: * Get the static String of PROP_CHAT_ROOM
368: *
369: * @return The static String of PROP_CHAT_ROOM
370: */
371: String getNamePropChatRoom();
372:
373: /**
374: * Get the static String of PROP_TO
375: *
376: * @return The static String of PROP_TO
377: */
378: String getNamePropTo();
379:
380: /**
381: * Get the static String of PROP_DESCRIPTION
382: *
383: * @return The static String of PROP_DESCRIPTION
384: */
385: String getNamePropDescription();
386:
387: /**
388: * Get the static String of PROP_CALENDAR_TYPE
389: *
390: * @return The static String of PROP_CALENDAR_TYPE
391: */
392: String getNamePropCalendarType();
393:
394: /**
395: * Get the static String of PROP_CALENDAR_LOCATION
396: *
397: * @return The static String of PROP_CALENDAR_LOCATION
398: */
399: String getNamePropCalendarLocation();
400:
401: /**
402: * Get the static String of PROP_REPLY_STYLE
403: *
404: * @return The static String of PROP_REPLY_STYLE
405: */
406: String getNamePropReplyStyle();
407:
408: /**
409: * Get the static String of NEW_ASSIGNMENT_CHECK_ADD_DUE_DATE
410: *
411: * @return The static String of NEW_ASSIGNMENT_CHECK_ADD_DUE_DATE
412: */
413: String getNamePropNewAssignmentCheckAddDueDate();
414:
415: /**
416: * Get the static String of NEW_ASSIGNMENT_CHECK_AUTO_ANNOUNCE
417: *
418: * @return The static String of NEW_ASSIGNMENT_CHECK_AUTO_ANNOUNCE
419: */
420: String getNamePropNewAssignmentCheckAutoAnnounce();
421:
422: /**
423: * Get the static String of PROP_SUBMISSION_PREVIOUS_GRADES
424: *
425: * @return The static String of PROP_SUBMISSION_PREVIOUS_GRADES
426: */
427: String getNamePropSubmissionPreviousGrades();
428:
429: /**
430: * Get the static String of PROP_SUBMISSION_SCALED_PREVIOUS_GRADES
431: *
432: * @return The static String of PROP_SUBMISSION_SCALED_PREVIOUS_GRADES
433: */
434: String getNamePropSubmissionScaledPreviousGrades();
435:
436: /**
437: * Get the static String of PROP_SUBMISSION_PREVIOUS_FEEDBACK_TEXT
438: *
439: * @return The static String of PROP_SUBMISSION_PREVIOUS_FEEDBACK_TEXT
440: */
441: String getNamePropSubmissionPreviousFeedbackText();
442:
443: /**
444: * Get the static String of PROP_SUBMISSION_PREVIOUS_FEEDBACK_COMMENT
445: *
446: * @return The static String of PROP_SUBMISSION_PREVIOUS_FEEDBACK_COMMENT
447: */
448: String getNamePropSubmissionPreviousFeedbackComment();
449:
450: /**
451: * Get the static String of PROP_ASSIGNMENT_DELETED
452: *
453: * @return The static String of PROP_ASSIGNMENT_DELETED
454: */
455: String getNamePropAssignmentDeleted();
456:
457: /**
458: * Get the static String of PROP_STRUCTOBJ_TYPE
459: *
460: * @return The static String of PROP_STRUCTOBJ_TYPE
461: */
462: String getNamePropStructObjType();
463:
464: /**
465: * Get the static String of TYPE_URL
466: *
467: * @return The static String of TYPE_URL
468: */
469: String getTypeUrl();
470:
471: /**
472: * Serialize the resource into XML, adding an element to the doc under the top of the stack element.
473: *
474: * @param doc
475: * The DOM doc to contain the XML (or null for a string return).
476: * @param stack
477: * The DOM elements, the top of which is the containing element of the new "resource" element.
478: * @return The newly added element.
479: */
480: Element toXml(Document doc, Stack stack);
481:
482: /**
483: * Add a single valued property.
484: *
485: * @param name
486: * The property name.
487: * @param value
488: * The property value.
489: */
490: void addProperty(String name, String value);
491:
492: /**
493: * Add a value to a multi-valued property.
494: *
495: * @param name
496: * The property name.
497: * @param value
498: * The property value.
499: */
500: void addPropertyToList(String name, String value);
501:
502: /**
503: * Add all the properties from the other ResourceProperties object.
504: *
505: * @param other
506: * The ResourceProperties to add.
507: */
508: void addAll(ResourceProperties other);
509:
510: /**
511: * Add all the properties from the Properties object.
512: *
513: * @param props
514: * The Properties to add.
515: */
516: void addAll(Properties props);
517:
518: /**
519: * Remove all properties.
520: */
521: void clear();
522:
523: /**
524: * Remove a property.
525: *
526: * @param name
527: * The property name.
528: */
529: void removeProperty(String name);
530:
531: /**
532: * Take all values from this object.
533: *
534: * @param other
535: * The ResourceProperties object to take values from.
536: */
537: void set(ResourceProperties other);
538: }
|