okapi.coreobjects
Class OkapiObject

java.lang.Object
  extended by okapi.coreobjects.OkapiObject
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
OkapiArc, OkapiContent, OkapiGroup, OkapiMeasure, OkapiNexus, OkapiSite, OkapiToolController, OkapiUser

public class OkapiObject
extends java.lang.Object
implements java.io.Serializable

Base class for all Okapi fundamental objects. Base class for which are access controlled, are stored persistently in the database, and have some or all of: name, long name, description, ID, and last modified date. It contains methods for checking authorization on the pair {user, operation}, checking whether the object must only be sent over a secure communications channel, updating to and refreshing from the database, and fields common to all objects.

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
protected  java.lang.String createdBy
          User or entity responsible for creation of this object.
protected  java.util.Date createdDate
          Date of creation of this object.
protected  java.lang.String description
          description of the entity represented by this object.
protected  java.lang.String lastModifiedBy
          User or entity responsible for latest modification of this object.
protected  java.util.Date lastModifiedDate
          Date of latest modification of this object.
protected  java.lang.String longName
          Long-form name for the entity represented by this object.
protected  java.lang.String name
          Short, single word name for the entity represented by this object.
protected  OkapiObjectID objectID
          Identifier for this object, usually globally unique.
protected  int status
          Number encoding status: active, inactive, etc.
 
Constructor Summary
  OkapiObject()
          Creates an object setting objectID to GUID and modified date to now.
protected OkapiObject(OkapiObjectID objectID)
          Creates an object with the specified objectID.
  OkapiObject(OkapiUser user)
          Creates an object setting objectID to GUID, modified date to now, and modified by user.
  OkapiObject(OkapiUser user, java.lang.String stringID)
          Creates an object with a fixed objectID, sets modified date to now, and modified by user.
protected OkapiObject(java.lang.String stringID)
          Creates an object with a fixed objectID.
 
Method Summary
 boolean checkAuthorization(OkapiUser user, OkapiOperation operation)
          Checks to see if the specified user is authorized to perform the specified operation on this object.
 java.lang.String currentDateTimeOracle(java.util.Date date)
          Method currentDateTimeOracle
 java.lang.String getAsXml(java.util.Map options)
          Method getAsXml
 java.lang.String getAsXml(java.util.Map options, int indent)
          Method getAsXml
 java.lang.String getAsXml(java.util.Map options, java.lang.String tag)
          Method getAsXml
 java.lang.String getAsXml(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.
 java.lang.String getCreatedBy()
          Method getCreatedBy
 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.lang.String getName()
          Method getName
 OkapiObjectID getObjectID()
          Method getObjectID
 int getStatus()
          Method getStatus
 boolean isEncryptionRequired(OkapiUser user, OkapiOperation operation)
          Checks to see if this object should only be provided over encrypted channels.
 void refreshFromDB()
          Refresh this object with the data currently stored in the DB.
 void setAuthorization(OkapiUser user, OkapiOperation operation)
          Sets the authorization on this object for the specified user and operation, not restricted by date range.
protected  void setCreatedBy(java.lang.String newCreatedBy)
           
protected  void setCreatedDate(java.util.Date newCreatedDate)
           
 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
protected  void setStatus(int newStatus)
           
 void updateDB()
          Update the database record for this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
Short, single word name for the entity represented by this object.


longName

protected java.lang.String longName
Long-form name for the entity represented by this object.


description

protected java.lang.String description
description of the entity represented by this object.


objectID

protected OkapiObjectID objectID
Identifier for this object, usually globally unique.


status

protected int status
Number encoding status: active, inactive, etc.


createdDate

protected java.util.Date createdDate
Date of creation of this object.


createdBy

protected java.lang.String createdBy
User or entity responsible for creation of this object.


lastModifiedDate

protected java.util.Date lastModifiedDate
Date of latest modification of this object.


lastModifiedBy

protected java.lang.String lastModifiedBy
User or entity responsible for latest modification of this object.

Constructor Detail

OkapiObject

public OkapiObject()
Creates an object setting objectID to GUID and modified date to now.


OkapiObject

public OkapiObject(OkapiUser user)
Creates an object setting objectID to GUID, modified date to now, and modified by user.


OkapiObject

protected OkapiObject(java.lang.String stringID)
Creates an object with a fixed objectID. This is used only for objects for which only minimal data need be kept and the overhead of a GUID is not needed


OkapiObject

protected OkapiObject(OkapiObjectID objectID)
Creates an object with the specified objectID. This is used to set the object ID, to be followed by a call to refreshFromDB, to set the object's variables.


OkapiObject

public OkapiObject(OkapiUser user,
                   java.lang.String stringID)
Creates an object with a fixed objectID, sets modified date to now, and modified by user.

Method Detail

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.


setAuthorization

public void setAuthorization(OkapiUser user,
                             OkapiOperation operation)
Sets the authorization on this object for the specified user and operation, not restricted by date range.


isEncryptionRequired

public boolean isEncryptionRequired(OkapiUser user,
                                    OkapiOperation operation)
Checks to see if this object should only be provided over encrypted channels. user and operation are unlikely to affect the answer, but are provided in case a situation arises requiring them.


updateDB

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


refreshFromDB

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


setName

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

Parameters:
newName -

getName

public java.lang.String getName()
Method getName

Returns:
String

setLongName

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

Parameters:
newLongName -

getLongName

public java.lang.String getLongName()
Method getLongName

Returns:
String

setDescription

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

Parameters:
newDescription -

getDescription

public java.lang.String getDescription()
Method getDescription

Returns:
String

getObjectID

public OkapiObjectID getObjectID()
Method getObjectID

Returns:
OkapiObjectID

setStatus

protected void setStatus(int newStatus)

getStatus

public int getStatus()
Method getStatus

Returns:
int

setCreatedDate

protected void setCreatedDate(java.util.Date newCreatedDate)

getCreatedDate

public java.util.Date getCreatedDate()
Method getCreatedDate

Returns:
java.util.Date

setLastModifiedDate

protected void setLastModifiedDate(java.util.Date newLastModifiedDate)

getLastModifiedDate

public java.util.Date getLastModifiedDate()
Method getLastModifiedDate

Returns:
java.util.Date

setLastModifiedBy

protected void setLastModifiedBy(OkapiUser newLastModifiedBy)

setLastModifiedBy

protected void setLastModifiedBy(java.lang.String newLastModifiedBy)

getLastModifiedBy

public java.lang.String getLastModifiedBy()
Method getLastModifiedBy

Returns:
String

setCreatedBy

protected void setCreatedBy(java.lang.String newCreatedBy)

getCreatedBy

public java.lang.String getCreatedBy()
Method getCreatedBy

Returns:
String

currentDateTimeOracle

public java.lang.String currentDateTimeOracle(java.util.Date date)
Method currentDateTimeOracle

Parameters:
date -
Returns:
java.lang.String

getAsXml

public java.lang.String getAsXml(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. The options Map specifies which information to include. A pairing in the map between the option name and the string "true" indicated that the option should be included. Any other pairing or no pairing at all indiciates that the option should not be included. When no options are specified, only the same of the object is included. The same options are used in all of the coreobjects to allow a single map to be used to define the xml for the requested object and to be passed along to define the xml for any children objects - eg. a nexus can use its own options map to format its arc children. Any options which do not apply to the specific object being exported are ignored. To simplify usage, each coreobject contains a number of predefined static Map constants which give common sets of options. It is highly recommended that these be used instead of specifying custom options Maps. If an appropriate constant does not exist and the set of options being requested might be useful in another place, a new constant should be added. The following options are available: arc_basic: in an arc, include basic information arc_children: in an arc, include arc children arc_contents: in an arc, include contents arc_meta: in an arc, include metadata atom_text: in a content atom, include any short text files content_atoms: in a content, include content atoms content_basic: in a content, include basic information group_allmembers: in a group, recursively include a list of all members overrides group_members group_basic: in a group, include basic information group_members: in a group, include a list of members (not recursively) nexus_arcs: in a nexus, include arc children nexus_attributes: in a nexus, include attributes nexus_basic: in a nexus, include basic information nexus_children: in a nexus, include nexus children nexus_groups: in a nexus, include groups nexus_tools: in a nexus, include tools nexus_users: in a nexus, include users role_basic: in a role, include basic information tool_basic: in a tool, include basic information user_basic: in a user, include basic information user_personal: in a user, include personal information user_attributes: in a user, include attributes view_basic: in a view, include basic information


getAsXml

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

Parameters:
options -
tag -
Returns:
String

getAsXml

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

Parameters:
options -
indent -
Returns:
String

getAsXml

public java.lang.String getAsXml(java.util.Map options)
Method getAsXml

Parameters:
options -
Returns:
String


Copyright ? 2001-2009 MIT. All Rights Reserved.