okapi.coreobjects
Class OkapiContent

java.lang.Object
  extended by okapi.coreobjects.OkapiObject
      extended by okapi.coreobjects.OkapiContent
All Implemented Interfaces:
java.io.Serializable

public class OkapiContent
extends OkapiObject

A Content is a reusable unit of prepared material, from a single image to a complex learning object. It is composed of ContentAtom objects which are the basic elements (e.g. an HTML file or an image), combined with basic information about the Content as a whole, and a number of Metadata objects describing the content. A Content may have structure, containing other Contents or multple ContentAtoms. The contained Contents may in turn have structure. But a Content may also contain a single ContentAtom. Contents are associated with paths or path segments; ContentAtoms are associated with paths. e.g.: "index.html" : "index.html" -> ContentAtom "LN2.pdf" : "LN2.pdf" -> ContentAtom "LN3/index.html" : "LN3" -> Content for LN3 within that, "index.html" -> ContentAtom "LN4/index.html" : "LN4/index.html" -> ContentAtom (ln4 has only one html file. This is construct is allowed technically but should probably be avoided to avoid confusion.)

Version:
$Revision: 31044 $, $Date: 2008-09-02 17:08:01 -0400 (Tue, 02 Sep 2008) $
Author:
MIT Stellar team
See Also:
Serialized Form

Field Summary
static int CONTENT
           
static int ERROR
           
static int STORE
          type of content.
static int URI
           
 
Fields inherited from class okapi.coreobjects.OkapiObject
createdBy, createdDate, description, lastModifiedBy, lastModifiedDate, longName, name, objectID, status
 
Constructor Summary
OkapiContent()
          Creates an empty Content.
OkapiContent(int contentCode)
          Instantiate the Content object for this contentCode
 
Method Summary
 void addAtom(java.lang.String filePath, okapi.coreobjects.OkapiContentAtom atom)
          Add content of type ContentAtom and add it to the end of the ordering.
 void addAtom(java.lang.String filePath, OkapiStore store)
          Create Content Atom and add it, also adding it to the end of the ordering.
 void addAtom(java.lang.String link, java.lang.String uri)
          Create URI Content Atom and add it.
 void addAtomUnordered(java.lang.String filePath, okapi.coreobjects.OkapiContentAtom atom)
          Deprecated. not used
 void addAtomUnordered(java.lang.String filePath, OkapiStore store)
          Deprecated. not used
 void addAtomUnordered(java.lang.String link, java.lang.String uri)
          Deprecated. not used
 void addContent(java.lang.String filePath, OkapiContent content)
          Add content of type Content and add it to the end of the ordering.
 void addContentUnordered(java.lang.String filePath, OkapiContent content)
          Deprecated. not used
 void addMetadata(java.lang.String key, OkapiMetadata metadata)
          Deprecated. not used
 void addMetadataKeyValue(java.lang.String key, java.lang.Object value)
          Add metadata key/value pairs about the Arc.
 void addMetadataKeyValue(java.lang.String key, java.lang.String value)
          Add metadata key/value pairs about the Arc.
 void atomOrderAdd(java.lang.String path)
          Put atomChild which is at path putPath at end of ordering in the atom child ordering.
 void atomOrderAddAfter(java.lang.String putPath, java.lang.String afterThisPath)
          Deprecated. not used
 void atomOrderAddBefore(java.lang.String putPath, java.lang.String beforeThisPath)
          Deprecated. not used
 void atomOrderAlphabetical()
          Deprecated. not used
 int atomOrderMove(java.lang.String path, int n)
          Move atomChild by n positions up or down in the atom child ordering.
 void atomOrderRemove(java.lang.String path)
          Remove all occurances of path from order
 void contentOrderAdd(java.lang.String putPath)
          Put contentChild which is at path putPath at end of ordering in the content child ordering.
 void contentOrderAddAfter(java.lang.String putPath, java.lang.String afterThisPath)
          Deprecated. not used
 void contentOrderAddBefore(java.lang.String putPath, java.lang.String beforeThisPath)
          Deprecated. not used
 void contentOrderAlphabetical()
          Deprecated. not used
 int contentOrderMove(java.lang.String path, int n)
          Move contentChild by n positions up or down in the content child ordering.
 void contentOrderRemove(java.lang.String path)
          Remove all occurances of path from order
 boolean equals(java.lang.Object o)
          override Object equals method to compare two contents
 java.lang.String getAsXml(java.util.Map options, java.lang.String tag, int indent)
          Overrides the method in OkapiObject to add Content specific information.
 java.lang.String getAtomAsXml(java.lang.String key, java.util.Map options)
          Method getAtomAsXml
 java.lang.String getAtomAsXml(java.lang.String key, java.util.Map options, int indent)
          Method getAtomAsXml
 java.lang.String getAtomAsXml(java.lang.String key, java.util.Map options, java.lang.String tag)
          Method getAtomAsXml
 java.lang.String getAtomAsXml(java.lang.String key, java.util.Map options, java.lang.String tag, int indent)
          Returns an xml representation of this object, with the options defined by the options map, an element of type tag surrounding the xml, and the first line indented indent times, or null if there is no atom at key.
 java.util.Map getAtomChildren()
          Return vector of all children of type ContentAtom.
 java.util.List getAtomOrder()
          Return order of atom children
 java.util.Map getChildren()
          Return vector of all children of any type.
 OkapiContent getContent(java.util.List filePathVector)
          Return a OkapiContent for the specified path, or null.
 OkapiContent getContent(java.util.List filePathVector, OkapiUser user)
          Return a OkapiContent for the specified path, or null, or throw a okapi.util.OkapiPermissionDenied exception.
 OkapiContent getContent(java.lang.String filePath)
          Return a OkapiContent for the specified path, or null.
 java.util.Map getContentChildren()
          Return vector of all children of type Content.
 int getContentCode()
          Return contentCode of this Content
 java.util.List getContentOrder()
          Return order of content children
 java.util.Date getCreatedDate()
          Method getCreatedDate
 java.lang.String getDescription()
          Method getDescription
 java.lang.String getLastModifiedBy()
          Method getLastModifiedBy
 java.util.Date getLastModifiedDate()
          Method getLastModifiedDate
 java.lang.String getLongName()
          Method getLongName
 java.util.Map getMetadata()
          Deprecated. not used
 java.lang.Object getMetadataKeyValue(java.lang.String key)
          Get Content metadata value by key.
 java.lang.String getName()
          Method getName
 OkapiStore getStore(java.util.List filePathVector)
          Return a OkapiStore for the specified path, or null.
 OkapiStore getStore(java.util.List filePathVector, OkapiUser user)
          Return a OkapiStore for the specified path, or null, or throw a okapi.util.OkapiPermissionDenied exception.
 OkapiStore getStore(java.lang.String filePath)
          Return a OkapiStore for the specified path, or null.
 int getType(java.lang.String key)
          Return a type of Atom for the specified path, or 0.
 java.lang.String getURI(java.lang.String link)
          Return a URI for the specified path, or null.
 int hashCode()
          override hashCode to use the database table sequence number
 void refreshFromDB()
          Refresh this object with the data currently stored in the DB.
static void releaseAccordingToReleaseDate()
           
 void removeAtom(java.lang.String filePath)
          Remove atom.
 void removeContent(java.lang.String filePath)
          Remove a Content.
 void removeMetadata(java.lang.String key)
          Deprecated. not used
 void removeMetadataKeyValue(java.lang.Object key)
          Remove for labeled with this key from metadata key/value pairs about the Arc.
 void setDataSource(javax.sql.DataSource dataSource)
          Set the dataSource to be used for data access.
 void setDescription(java.lang.String newDescription)
          Method setDescription
protected  void setLastModifiedBy(OkapiUser newLastModifiedBy)
           
protected  void setLastModifiedBy(java.lang.String newLastModifiedBy)
           
protected  void setLastModifiedDate(java.util.Date newLastModifiedDate)
           
 void setLongName(java.lang.String newLongName)
          Method setLongName
 void setName(java.lang.String newName)
          Method setName
 void updateDB()
          Update the database record for this object.
 
Methods inherited from class okapi.coreobjects.OkapiObject
checkAuthorization, currentDateTimeOracle, getAsXml, getAsXml, getAsXml, getCreatedBy, getObjectID, getStatus, isEncryptionRequired, setAuthorization, setCreatedBy, setCreatedDate, setStatus
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STORE

public static int STORE
type of content.


URI

public static int URI

CONTENT

public static int CONTENT

ERROR

public static int ERROR
Constructor Detail

OkapiContent

public OkapiContent()
Creates an empty Content.


OkapiContent

public OkapiContent(int contentCode)
Instantiate the Content object for this contentCode

Method Detail

getAtomOrder

public java.util.List getAtomOrder()
Return order of atom children


getContentOrder

public java.util.List getContentOrder()
Return order of content children


atomOrderAlphabetical

public void atomOrderAlphabetical()
Deprecated. not used

Order all atom children alphabetically by path


atomOrderMove

public int atomOrderMove(java.lang.String path,
                         int n)
Move atomChild by n positions up or down in the atom child ordering.
Return the actual change in position.


atomOrderAddAfter

public void atomOrderAddAfter(java.lang.String putPath,
                              java.lang.String afterThisPath)
Deprecated. not used

Put atomChild which is at path putPath after afterThisPath in the atom child ordering.


atomOrderAddBefore

public void atomOrderAddBefore(java.lang.String putPath,
                               java.lang.String beforeThisPath)
Deprecated. not used

Put atomChild which is at path putPath before beforeThisPath in the atom child ordering.


atomOrderRemove

public void atomOrderRemove(java.lang.String path)
Remove all occurances of path from order


atomOrderAdd

public void atomOrderAdd(java.lang.String path)
Put atomChild which is at path putPath at end of ordering in the atom child ordering.


contentOrderAlphabetical

public void contentOrderAlphabetical()
Deprecated. not used

Order all content children alphabetically by path


contentOrderMove

public int contentOrderMove(java.lang.String path,
                            int n)
Move contentChild by n positions up or down in the content child ordering.
Return the actual change in position.


contentOrderAddAfter

public void contentOrderAddAfter(java.lang.String putPath,
                                 java.lang.String afterThisPath)
Deprecated. not used

Put contentChild which is at path putPath after afterThisPath in the content child ordering.


contentOrderAddBefore

public void contentOrderAddBefore(java.lang.String putPath,
                                  java.lang.String beforeThisPath)
Deprecated. not used

Put contentChild which is at path putPath before beforeThisPath in the content child ordering.


contentOrderRemove

public void contentOrderRemove(java.lang.String path)
Remove all occurances of path from order


contentOrderAdd

public void contentOrderAdd(java.lang.String putPath)
Put contentChild which is at path putPath at end of ordering in the content child ordering.


getContentCode

public int getContentCode()
Return contentCode of this Content


equals

public boolean equals(java.lang.Object o)
override Object equals method to compare two contents

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
override hashCode to use the database table sequence number

Overrides:
hashCode in class java.lang.Object

addAtomUnordered

public void addAtomUnordered(java.lang.String filePath,
                             OkapiStore store)
Deprecated. not used

Create Content Atom and add it


addAtomUnordered

public void addAtomUnordered(java.lang.String filePath,
                             okapi.coreobjects.OkapiContentAtom atom)
Deprecated. not used

Add content of type ContentAtom.


addAtomUnordered

public void addAtomUnordered(java.lang.String link,
                             java.lang.String uri)
Deprecated. not used

Create URI Content Atom and add it without adding it to the ordering.


addAtom

public void addAtom(java.lang.String filePath,
                    OkapiStore store)
Create Content Atom and add it, also adding it to the end of the ordering.


addAtom

public void addAtom(java.lang.String filePath,
                    okapi.coreobjects.OkapiContentAtom atom)
Add content of type ContentAtom and add it to the end of the ordering.


addAtom

public void addAtom(java.lang.String link,
                    java.lang.String uri)
Create URI Content Atom and add it.


removeAtom

public void removeAtom(java.lang.String filePath)
Remove atom.


addContentUnordered

public void addContentUnordered(java.lang.String filePath,
                                OkapiContent content)
Deprecated. not used

Add content of type Content without adding it to the ordering.


addContent

public void addContent(java.lang.String filePath,
                       OkapiContent content)
Add content of type Content and add it to the end of the ordering.


removeContent

public void removeContent(java.lang.String filePath)
Remove a Content.


addMetadata

public void addMetadata(java.lang.String key,
                        OkapiMetadata metadata)
Deprecated. not used

Add metadata about the Arc. May replace earlier metadata with the same key. Not implemented for June.


removeMetadata

public void removeMetadata(java.lang.String key)
Deprecated. not used

Remove metadata labeled with this key. Not implemented for June.


getMetadata

public java.util.Map getMetadata()
Deprecated. not used

Return hashtable of metadata tables. Not implemented for June.


addMetadataKeyValue

public void addMetadataKeyValue(java.lang.String key,
                                java.lang.String value)
Add metadata key/value pairs about the Arc. May replace earlier metadata with the same key.


addMetadataKeyValue

public void addMetadataKeyValue(java.lang.String key,
                                java.lang.Object value)
Add metadata key/value pairs about the Arc. May replace earlier metadata with the same key.


getMetadataKeyValue

public java.lang.Object getMetadataKeyValue(java.lang.String key)
Get Content metadata value by key.


removeMetadataKeyValue

public void removeMetadataKeyValue(java.lang.Object key)
Remove for labeled with this key from metadata key/value pairs about the Arc. May replace earlier metadata with the same key.


getAtomChildren

public java.util.Map getAtomChildren()
Return vector of all children of type ContentAtom.


getContentChildren

public java.util.Map getContentChildren()
Return vector of all children of type Content.


getChildren

public java.util.Map getChildren()
Return vector of all children of any type.


getType

public int getType(java.lang.String key)
Return a type of Atom for the specified path, or 0.


getURI

public java.lang.String getURI(java.lang.String link)
Return a URI for the specified path, or null.


getStore

public OkapiStore getStore(java.lang.String filePath)
Return a OkapiStore for the specified path, or null.


getStore

public OkapiStore getStore(java.util.List filePathVector)
Return a OkapiStore for the specified path, or null. Does not check access rights of user, always returns a Store if it is found.


getStore

public OkapiStore getStore(java.util.List filePathVector,
                           OkapiUser user)
                    throws OkapiPermissionDeniedException
Return a OkapiStore for the specified path, or null, or throw a okapi.util.OkapiPermissionDenied exception.

Throws:
OkapiPermissionDeniedException

getContent

public OkapiContent getContent(java.lang.String filePath)
Return a OkapiContent for the specified path, or null.


getContent

public OkapiContent getContent(java.util.List filePathVector)
Return a OkapiContent for the specified path, or null. Does not check access rights of user, always returns a Content if it is found.


getContent

public OkapiContent getContent(java.util.List filePathVector,
                               OkapiUser user)
                        throws OkapiPermissionDeniedException
Return a OkapiContent for the specified path, or null, or throw a okapi.util.OkapiPermissionDenied exception.

Throws:
OkapiPermissionDeniedException

updateDB

public void updateDB()
Update the database record for this object.

Overrides:
updateDB in class OkapiObject

refreshFromDB

public void refreshFromDB()
Refresh this object with the data currently stored in the DB.

Overrides:
refreshFromDB in class OkapiObject

setName

public void setName(java.lang.String newName)
Method setName

Overrides:
setName in class OkapiObject
Parameters:
newName -

getName

public java.lang.String getName()
Method getName

Overrides:
getName in class OkapiObject
Returns:
String

setLongName

public void setLongName(java.lang.String newLongName)
Method setLongName

Overrides:
setLongName in class OkapiObject
Parameters:
newLongName -

getLongName

public java.lang.String getLongName()
Method getLongName

Overrides:
getLongName in class OkapiObject
Returns:
String

setDescription

public void setDescription(java.lang.String newDescription)
Method setDescription

Overrides:
setDescription in class OkapiObject
Parameters:
newDescription -

getDescription

public java.lang.String getDescription()
Method getDescription

Overrides:
getDescription in class OkapiObject
Returns:
String

setLastModifiedDate

protected void setLastModifiedDate(java.util.Date newLastModifiedDate)
Overrides:
setLastModifiedDate in class OkapiObject

getLastModifiedDate

public java.util.Date getLastModifiedDate()
Method getLastModifiedDate

Overrides:
getLastModifiedDate in class OkapiObject
Returns:
java.util.Date

setLastModifiedBy

protected void setLastModifiedBy(OkapiUser newLastModifiedBy)
Overrides:
setLastModifiedBy in class OkapiObject

setLastModifiedBy

protected void setLastModifiedBy(java.lang.String newLastModifiedBy)
Overrides:
setLastModifiedBy in class OkapiObject

getLastModifiedBy

public java.lang.String getLastModifiedBy()
Method getLastModifiedBy

Overrides:
getLastModifiedBy in class OkapiObject
Returns:
String

getCreatedDate

public java.util.Date getCreatedDate()
Method getCreatedDate

Overrides:
getCreatedDate in class OkapiObject
Returns:
java.util.Date

getAsXml

public java.lang.String getAsXml(java.util.Map options,
                                 java.lang.String tag,
                                 int indent)
Overrides the method in OkapiObject to add Content specific information. See OkapiObject.getAsXml(String tag, int indent) for more information about using the getAsXml methods.

Overrides:
getAsXml in class OkapiObject

getAtomAsXml

public java.lang.String getAtomAsXml(java.lang.String key,
                                     java.util.Map options,
                                     java.lang.String tag,
                                     int indent)
Returns an xml representation of this object, with the options defined by the options map, an element of type tag surrounding the xml, and the first line indented indent times, or null if there is no atom at key.


getAtomAsXml

public java.lang.String getAtomAsXml(java.lang.String key,
                                     java.util.Map options)
Method getAtomAsXml

Parameters:
key -
options -
Returns:
String

getAtomAsXml

public java.lang.String getAtomAsXml(java.lang.String key,
                                     java.util.Map options,
                                     int indent)
Method getAtomAsXml

Parameters:
key -
options -
indent -
Returns:
String

getAtomAsXml

public java.lang.String getAtomAsXml(java.lang.String key,
                                     java.util.Map options,
                                     java.lang.String tag)
Method getAtomAsXml

Parameters:
key -
options -
tag -
Returns:
String

releaseAccordingToReleaseDate

public static void releaseAccordingToReleaseDate()

setDataSource

public void setDataSource(javax.sql.DataSource dataSource)
Set the dataSource to be used for data access.

Parameters:
dataSource -


Copyright ? 2001-2009 MIT. All Rights Reserved.