okapi.coreobjects
Class OkapiNexus

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

public class OkapiNexus
extends OkapiObject

OkapiNexus is the building block for Okapi organization. OkapiNexus provides the basic building block for Okapi space. This includes departments, labs, centers, courses, sections, etc. For example, a department might have an OkapiNexus as the basic object grouping people associated with the department (faculty and students) and the essential info about the department, with a set of OkapiNexuses for the courses offered in the department. A flat organization might have one OkapiNexus for the site, with a set of OkapiNexuses for the classes being offered. A more complex organization can use the OkapiNexus in a hierarchical arrangement. The heirarchy of Nexuses is reflected in the URL used to reach that Nexus. However, the same Nexus may be reached by more than one URL. Whatever the path used to reach the Nexus, the URLs below the Nexus map to OkapiTools, which display content or perform more complex funcitons (e.g. discussion, quizzing) In an OkapiNexus is the basic OkapiObject information including Name and Description, as well as the association of URL paths with Tools. Styles, that is, preferences for the appearance of web pages, may be set in a Nexus and influence the appearance of pages in itself and all it's descendent Nexuses. OkapiNexus may be subclassed to classes better describing e.g. Subjects, Organizations, Student groups, or owned by individuals.

Version:
$Revision: 31305 $, $Date: 2008-11-19 15:44:19 -0500 (Wed, 19 Nov 2008) $
Author:
MIT Stellar team
See Also:
Serialized Form

Field Summary
static int ARCHIVED
           
static java.util.HashMap BASIC_WITH_ATTRIBUTES
          Options constant for getAsXml methods indicating basic info and attributes.
static int CURENT_SUBSECTION
           
static int CURRENT
           
static int DEACTIVATED_SUBSECTION
           
static int DELETED
           
static int ERROR
           
static int HIERARCHICAL
           
static int PAST
           
static int PAST_SUBSECTION
           
static int PAST_UNLISTED
           
 
Fields inherited from class okapi.coreobjects.OkapiObject
createdBy, createdDate, description, lastModifiedBy, lastModifiedDate, longName, name, objectID, status
 
Constructor Summary
OkapiNexus()
          Create a new empty Nexus.
OkapiNexus(int nexusCode)
          Return new Nexus object with settings for this nexusCode compare and contrast with getNexus(int nexusCode)
 
Method Summary
 void addArc(java.lang.String path, OkapiArc arc)
          Add Arc to Nexus at a specified path from the Nexus.
 void addGroup(OkapiGroup group, OkapiRole role)
          Add Groups associated with this Nexus.
 void addNexus(java.lang.String path, OkapiNexus child)
          Add a child Nexus and add self as parent to child
 void addParent(java.lang.String path, OkapiNexus parent)
          Add nexus as parent of current.
 void addTool(java.lang.String path, OkapiToolController tool)
          Add tool to Nexus at a specified path from the Nexus.
 void addToolView(OkapiToolController tool, OkapiView view)
          Add a View for a Tool
 void addUser(OkapiUser user)
          Add User to this Nexus if not already there
 void addUserAttribute(OkapiUser user, java.lang.String key, java.lang.String value)
          Add attribute for this User within this Nexus.
static int cacheCheck()
          Method cacheCheck
 boolean checkAuthorization(OkapiUser user, OkapiOperation operation)
          Checks to see if the specified user is authorized to perform the specified operation on this object.
static int countOfNexusesForGroup(int groupCode)
          Returns the number of nexuses associated with a specified group.
 void descend(java.util.List pathVector, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext context, java.util.List nexusHistory)
          Process the path from this Nexus.
 boolean equals(java.lang.Object o)
          override Object equals method to compare two nexuses
 java.util.Map getArcs()
          Return all Arcs
 java.lang.String getAsXml(java.util.Map options, java.lang.String tag, int indent)
          Overrides the method in OkapiObject to add Nexus specific information.
 java.lang.Object getAttributeByKey(java.lang.Object key)
          Return an attribute for this Nexus.
 java.util.Map getAttributes()
          Return the attributes Hashtable for this Nexus.
 java.util.Map getGroups()
          Return all Groups associated with this Nexus.
static OkapiNexus getNexus(int nexusCode)
          Get a nexus from the cache if cached, instantiate and add to cache if not.
static OkapiNexus getNexus(java.lang.String siteHandle)
          Returns the nexus by objectId
 int getNexusCode()
          Return nexusCode of this Nexus
 java.util.Map getNexuses()
          Return all child nexuses
 java.util.Map getParents()
          Return all parent nexuses
 java.lang.String getPath()
          Find and return the path of this nexus.
 OkapiNexus getPrimaryParentNexus()
          Return primary parent Nexus, if any, of this Nexus.
 java.util.Map getTools()
          Return all tools
 java.util.Map getToolViews()
          Return all toolViews.
 java.util.List getToolViews(OkapiToolController tool)
          Return all toolViews for a tool.
 java.lang.Object getUserAttribute(OkapiUser user, java.lang.Object key)
          Get attribute for the User within this Nexus.
 java.util.Map getUserAttributes(OkapiUser user)
          Get all attributes for the User within this Nexus.
 java.util.Map getUsers()
          Return all Users associated with this nexus.
 int hashCode()
          override hashCode to use the database table sequence number
static java.util.List nexusesForArc(int arcCode)
          Return a List of all Nexuses the Arc is in.
static java.util.List nexusesForArc(OkapiArc arc)
          Return a List of all Nexuses the Arc is in.
static java.util.Map nexusesForGroup(int groupCode)
          Return a Map of all Nexuses the Group is in and the Roles of the Group in them.
static java.util.Map nexusesForGroup(OkapiGroup group)
          Return a Map of all Nexuses the Group is in and the Roles of the Group in them.
 void refreshFromDB()
          Refresh this object with the data currently stored in the DB.
 void removeArc(java.lang.String path, OkapiArc arc)
          Remove Arc from Nexus
 void removeAttribute(java.lang.String key)
          Remove an attribute from this Nexus.
 void removeGroup(OkapiGroup group)
          Remove Group from this Nexus.
 void removeNexus(java.lang.String path, OkapiNexus child)
          Remove nexus and remove self from child
 void removeParent(java.lang.String path, OkapiNexus parent)
          Remove parent
 void removeTool(java.lang.String path, OkapiToolController tool)
          Remove tool from Nexus
 void removeToolView(OkapiToolController tool, OkapiView view)
          Remove a View for a Tool
 void removeUser(OkapiUser user)
          Remove User from this Nexus
 void removeUserAttribute(OkapiUser user, java.lang.Object key)
          Remove attribute for the User within this Nexus.
 void setAttribute(java.lang.String key, java.lang.String value)
          Set an attribute for this Nexus.
 void setDataSource(javax.sql.DataSource dataSource)
          Set the dataSource to be used for data access.
 void setDescription(java.lang.String newDescription)
          Method setDescription
 void setLongName(java.lang.String newLongName)
          Method setLongName
 void setName(java.lang.String newName)
          Method setName
 void setPrimaryParentNexus(OkapiNexus primaryParentNexus)
          Set Nexus as primary parent of this Nexus
 void setStatus(int newStatus)
          Method setStatus
 void setToolViews(java.util.Map toolViews)
          Set all toolViews.
 void updateDB()
          Update the database record for this object.
 
Methods inherited from class okapi.coreobjects.OkapiObject
currentDateTimeOracle, getAsXml, getAsXml, getAsXml, getCreatedBy, getCreatedDate, getDescription, getLastModifiedBy, getLastModifiedDate, getLongName, getName, getObjectID, getStatus, isEncryptionRequired, setAuthorization, setCreatedBy, setCreatedDate, setLastModifiedBy, setLastModifiedBy, setLastModifiedDate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR

public static final int ERROR
See Also:
Constant Field Values

CURRENT

public static final int CURRENT
See Also:
Constant Field Values

PAST

public static final int PAST
See Also:
Constant Field Values

ARCHIVED

public static final int ARCHIVED
See Also:
Constant Field Values

PAST_UNLISTED

public static final int PAST_UNLISTED
See Also:
Constant Field Values

CURENT_SUBSECTION

public static final int CURENT_SUBSECTION
See Also:
Constant Field Values

PAST_SUBSECTION

public static final int PAST_SUBSECTION
See Also:
Constant Field Values

DEACTIVATED_SUBSECTION

public static final int DEACTIVATED_SUBSECTION
See Also:
Constant Field Values

HIERARCHICAL

public static final int HIERARCHICAL
See Also:
Constant Field Values

DELETED

public static final int DELETED
See Also:
Constant Field Values

BASIC_WITH_ATTRIBUTES

public static final java.util.HashMap BASIC_WITH_ATTRIBUTES
Options constant for getAsXml methods indicating basic info and attributes.

Constructor Detail

OkapiNexus

public OkapiNexus()
Create a new empty Nexus.


OkapiNexus

public OkapiNexus(int nexusCode)
Return new Nexus object with settings for this nexusCode compare and contrast with getNexus(int nexusCode)

Method Detail

cacheCheck

public static int cacheCheck()
Method cacheCheck

Returns:
int

getNexus

public static OkapiNexus getNexus(int nexusCode)
Get a nexus from the cache if cached, instantiate and add to cache if not.


getNexusCode

public int getNexusCode()
Return nexusCode of this Nexus


equals

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

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

addToolView

public void addToolView(OkapiToolController tool,
                        OkapiView view)
Add a View for a Tool


removeToolView

public void removeToolView(OkapiToolController tool,
                           OkapiView view)
Remove a View for a Tool


getToolViews

public java.util.Map getToolViews()
Return all toolViews.


getToolViews

public java.util.List getToolViews(OkapiToolController tool)
Return all toolViews for a tool.


setToolViews

public void setToolViews(java.util.Map toolViews)
Set all toolViews.


addNexus

public void addNexus(java.lang.String path,
                     OkapiNexus child)
Add a child Nexus and add self as parent to child


removeNexus

public void removeNexus(java.lang.String path,
                        OkapiNexus child)
Remove nexus and remove self from child


getNexuses

public java.util.Map getNexuses()
Return all child nexuses


addParent

public void addParent(java.lang.String path,
                      OkapiNexus parent)
Add nexus as parent of current.


removeParent

public void removeParent(java.lang.String path,
                         OkapiNexus parent)
Remove parent


getParents

public java.util.Map getParents()
Return all parent nexuses


setPrimaryParentNexus

public void setPrimaryParentNexus(OkapiNexus primaryParentNexus)
Set Nexus as primary parent of this Nexus


getPrimaryParentNexus

public OkapiNexus getPrimaryParentNexus()
Return primary parent Nexus, if any, of this Nexus.


getPath

public java.lang.String getPath()
Find and return the path of this nexus. synchronized since otherwise multiple threads accessing this may wind up with duplicated path segments.

Returns:
String path

addTool

public void addTool(java.lang.String path,
                    OkapiToolController tool)
Add tool to Nexus at a specified path from the Nexus.


removeTool

public void removeTool(java.lang.String path,
                       OkapiToolController tool)
Remove tool from Nexus


getTools

public java.util.Map getTools()
Return all tools


addArc

public void addArc(java.lang.String path,
                   OkapiArc arc)
Add Arc to Nexus at a specified path from the Nexus.


removeArc

public void removeArc(java.lang.String path,
                      OkapiArc arc)
Remove Arc from Nexus


getArcs

public java.util.Map getArcs()
Return all Arcs


addUser

public void addUser(OkapiUser user)
Add User to this Nexus if not already there


removeUser

public void removeUser(OkapiUser user)
Remove User from this Nexus


getUsers

public java.util.Map getUsers()
Return all Users associated with this nexus.


addUserAttribute

public void addUserAttribute(OkapiUser user,
                             java.lang.String key,
                             java.lang.String value)
Add attribute for this User within this Nexus. E.g. position within nexus, office hours.


removeUserAttribute

public void removeUserAttribute(OkapiUser user,
                                java.lang.Object key)
Remove attribute for the User within this Nexus.


getUserAttribute

public java.lang.Object getUserAttribute(OkapiUser user,
                                         java.lang.Object key)
Get attribute for the User within this Nexus.


getUserAttributes

public java.util.Map getUserAttributes(OkapiUser user)
Get all attributes for the User within this Nexus.


addGroup

public void addGroup(OkapiGroup group,
                     OkapiRole role)
Add Groups associated with this Nexus.


removeGroup

public void removeGroup(OkapiGroup group)
Remove Group from this Nexus.


getAttributes

public java.util.Map getAttributes()
Return the attributes Hashtable for this Nexus.


removeAttribute

public void removeAttribute(java.lang.String key)
Remove an attribute from this Nexus.


setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.String value)
Set an attribute for this Nexus.


getAttributeByKey

public java.lang.Object getAttributeByKey(java.lang.Object key)
Return an attribute for this Nexus.

Parameters:
key -
Returns:
Object matching key

getGroups

public java.util.Map getGroups()
Return all Groups associated with this Nexus.


descend

public void descend(java.util.List pathVector,
                    javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response,
                    javax.servlet.ServletContext context,
                    java.util.List nexusHistory)
             throws java.io.IOException,
                    javax.servlet.ServletException
Process the path from this Nexus. Either find a child nexus or a child tool.

Throws:
java.io.IOException
javax.servlet.ServletException

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

nexusesForGroup

public static java.util.Map nexusesForGroup(int groupCode)
Return a Map of all Nexuses the Group is in and the Roles of the Group in them. The key is the NexusCode, the value is the Role the Group has in that Nexus.


nexusesForArc

public static java.util.List nexusesForArc(int arcCode)
Return a List of all Nexuses the Arc is in.


nexusesForGroup

public static java.util.Map nexusesForGroup(OkapiGroup group)
Return a Map of all Nexuses the Group is in and the Roles of the Group in them. The key is the NexusCode, the value is the Role the Group has in that Nexus.


nexusesForArc

public static java.util.List nexusesForArc(OkapiArc arc)
Return a List of all Nexuses the Arc is in.


checkAuthorization

public boolean checkAuthorization(OkapiUser user,
                                  OkapiOperation operation)
Checks to see if the specified user is authorized to perform the specified operation on this object.

Overrides:
checkAuthorization in class OkapiObject

setStatus

public void setStatus(int newStatus)
Method setStatus

Overrides:
setStatus in class OkapiObject
Parameters:
newStatus -

setName

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

Overrides:
setName in class OkapiObject
Parameters:
newName -

setLongName

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

Overrides:
setLongName in class OkapiObject
Parameters:
newLongName -

setDescription

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

Overrides:
setDescription in class OkapiObject
Parameters:
newDescription -

getAsXml

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

Overrides:
getAsXml in class OkapiObject

countOfNexusesForGroup

public static int countOfNexusesForGroup(int groupCode)
Returns the number of nexuses associated with a specified group.


getNexus

public static OkapiNexus getNexus(java.lang.String siteHandle)
Returns the nexus by objectId


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.