com.mentata.sg8
Class SG8Object

java.lang.Object
  extended bycom.mentata.l3d.L3DObject
      extended bycom.mentata.sg8.SG8Object
All Implemented Interfaces:
Comparator
Direct Known Subclasses:
account, applicationentity, applicationprocess, country, dcobject, device, dmd, document, documentseries, domain, groupofnames, locality, organization, organizationalrole, organizationalunit, person, room, top

public class SG8Object
extends L3DObject

An L3D object for use with the SG8 gateway display features. This subclass of L3DObject has methods for constructing servlet hyperlinks, controlling the use of formats and actions, and associating display characteristics like a stylesheet, header, footer, custom JSP, or maximum HTML form element row size. Subclasses can also be configured to allow the retrieval of all corresponding entries through glob (i.e. *) identifiers, or to localize labelling based on the language preference of the client's browser.

Since:
0.7
Author:
Jon Roberts

Field Summary
 
Fields inherited from class com.mentata.l3d.L3DObject
MULTIVALUE, ONE, OPTIONAL, REQUIRED, SINGLEVALUE, SUBTREE
 
Constructor Summary
SG8Object(L3DContext context)
          Constructs an empty object with base attributes compatible with SG8.
 
Method Summary
 boolean allowsServlet(String servlet)
          Indicates if the object can be used with the named servlet.
 int getBatch()
          Returns the batch size for use in search results pagination.
 String getFooter()
          Returns the HTML footer to use in dynamic output.
 String[] getFormats()
          Returns the output formats permitted by the object.
 String getHeader()
          Returns the HTML header to use in dynamic output.
 String getHyperlink()
          Returns the html for a hyperlink to the object via the given servlet.
 String getHyperlink(String servlet)
          Returns the html for a hyperlink to the object via the named servlet.
 String getHyperlink(String servlet, String text)
          Returns the html for a servlet hyperlink to the object with given text.
 String getHyperlink(String servlet, String text, String target)
          Returns the html for a servlet hyperlink to the object using the given target window.
 String getHyperlink(String servlet, String text, String target, String attribute)
          Returns the html for a servlet hyperlink to the named attribute for this object.
 String getJSP(String page)
          Returns the path for the named JSP as used with the object.
 String[] getMailTo()
          Returns a list of destination email addresses representing the entry.
 L3DPath getPath()
          Returns a path bean describing the object.
 L3DPath getPath(String attribute)
          Returns a path bean describing the a named attribute of the object.
 SG8Attribute getSG8Attribute(String name)
          Returns a named SG8 attribute from the object.
protected  SG8Context getSG8Context()
          Returns the containing SG8 context for the object.
 String getStylesheet()
          Returns the CSS stylesheet to use in dynamic HTML output.
 int getTextColumns()
          Returns the maximum text entry column width for object attributes.
 boolean isGlob()
          Indicates if the object permits globbed identifiers in relevant requests.
 boolean isLocal()
          Indicates if the object should adopt the preferred locale of clients.
 void postCreate()
          Does nothing unless overridden.
 void postDelete()
          Does nothing unless overridden.
 void postUpdate()
          Does nothing unless overridden.
 void preCreate()
          Does nothing unless overridden.
 void preDelete()
          Does nothing unless overridden.
 String[] preUpdate()
          Does nothing unless overridden.
 void setBatch(int batch)
          Sets a batch size to use in search results pagination.
 void setFooter(String footer)
          Sets a footer file to use in dynamic HTML output.
protected  void setFormats()
          Permits the object to be retrieved in all available formats.
protected  void setFormats(String[] formats)
          Permits the object to be retrieved in the named formats.
protected  void setGlob()
          Allows the object to accept globbed identifiers in relevant requests.
 void setHeader(String header)
          Sets a header file to use in dynamic HTML output.
protected  void setLocal()
          Configures the object to adopt the preferred locale of clients.
 void setStylesheet(String stylesheet)
          Sets a CSS stylesheet to use in dynamic HTML output.
 void setTextColumns(int columns)
          Sets the maximum text entry column width for object attributes.
protected  void useJSP(String[] pages)
          Configures the object to use custom JSP for the named pages.
protected  void useServlets(String[] servlets)
          Permits the object to be used with the named servlets.
 
Methods inherited from class com.mentata.l3d.L3DObject
addAttribute, addAttribute, addAttribute, addAttributeList, addObjectclasses, addPrerequisite, addPrerequisite, applyLabels, applyLabels, compare, create, create, delete, delete, empty, extend, extend, getAttribute, getAttributeList, getAttributeList, getBind, getClassName, getContext, getContextName, getDatestamp, getDN, getDN, getIdentifier, getIdentifierAttribute, getIncrementEntry, getIncrementEntry, getLabel, getLabel, getLimit, getLocale, getName, getNameAttribute, getObject, getObjectclasses, getPrerequisites, getTimestamp, hasMatch, hasMatch, isBound, isIncremental, mergeAttributeLists, mergeAttributeLists, minimizeScope, onList, populate, populate, populate, prependBase, search, search, search, search, search, setBind, setFilter, setIncremental, setLabel, setLabel, setLimit, setLocale, setSorting, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

SG8Object

public SG8Object(L3DContext context)
          throws L3DException
Constructs an empty object with base attributes compatible with SG8.

Parameters:
context - a containing L3D context
Method Detail

getSG8Context

protected SG8Context getSG8Context()
                            throws SG8Exception
Returns the containing SG8 context for the object.

Returns:
the containing SG8 context
Throws:
SG8Exception - if the containing context is improperly defined

getSG8Attribute

public SG8Attribute getSG8Attribute(String name)
                             throws SG8Exception
Returns a named SG8 attribute from the object.

Returns:
the named SG8 attribute
Throws:
SG8Exception - if the named attribute is nonexistent or improperly defined

setFormats

protected final void setFormats()
Permits the object to be retrieved in all available formats.

Formats include html, tabtext, ldif, or dsml.


setFormats

protected final void setFormats(String[] formats)
Permits the object to be retrieved in the named formats.

Formats include html, tabtext, ldif, or dsml.

Parameters:
formats - the names of permitted formats

getFormats

public final String[] getFormats()
Returns the output formats permitted by the object.

Formats include html, tabtext, ldif, or dsml.

Returns:
the names of permitted formats

useServlets

protected final void useServlets(String[] servlets)
Permits the object to be used with the named servlets.

Parameters:
servlets - the names of permitted servlets

Servlets include retrieve, create, delete, update, or link.


allowsServlet

public final boolean allowsServlet(String servlet)
Indicates if the object can be used with the named servlet.

Parameters:
servlet - a servlet name to check
Returns:
whether the object allows use with the servlet

useJSP

protected final void useJSP(String[] pages)
Configures the object to use custom JSP for the named pages.

Parameters:
pages - the names of pages to customize

getJSP

public final String getJSP(String page)
                    throws SG8Exception
Returns the path for the named JSP as used with the object.

Parameters:
page - the name of the page
Returns:
an application-relative path for the JSP
Throws:
SG8Exception - if the containing context is improperly defined

setBatch

public final void setBatch(int batch)
Sets a batch size to use in search results pagination.

Parameters:
batch - a maximum number of entries per page

getBatch

public int getBatch()
Returns the batch size for use in search results pagination.

Returns:
the size for a page or results or 0 if no restriction

setStylesheet

public final void setStylesheet(String stylesheet)
Sets a CSS stylesheet to use in dynamic HTML output.

Parameters:
stylesheet - an URL for a CSS stylesheet

getStylesheet

public String getStylesheet()
                     throws SG8Exception
Returns the CSS stylesheet to use in dynamic HTML output.

Returns:
the path for the assigned CSS stylesheet or null
Throws:
SG8Exception - if the containing context is improperly defined

setHeader

public final void setHeader(String header)
Sets a header file to use in dynamic HTML output.

Parameters:
header - a file name for header HTML

getHeader

public String getHeader()
                 throws SG8Exception
Returns the HTML header to use in dynamic output.

Returns:
the application relative path for the assigned header or null
Throws:
SG8Exception - if the containing context is improperly defined

setFooter

public final void setFooter(String footer)
Sets a footer file to use in dynamic HTML output.

Parameters:
footer - a file name for a footer HTML

getFooter

public String getFooter()
                 throws SG8Exception
Returns the HTML footer to use in dynamic output.

Returns:
the application relative path for the assigned footer or null
Throws:
SG8Exception - if the containing context is improperly defined

setTextColumns

public final void setTextColumns(int columns)
Sets the maximum text entry column width for object attributes.

Parameters:
columns - a maximum number of columns for HTML text entry elements

getTextColumns

public int getTextColumns()
                   throws SG8Exception
Returns the maximum text entry column width for object attributes.

Returns:
the maximum number of columns for HTML text entry elements
Throws:
SG8Exception - if the containing context is improperly defined

setGlob

protected final void setGlob()
Allows the object to accept globbed identifiers in relevant requests.


isGlob

public boolean isGlob()
Indicates if the object permits globbed identifiers in relevant requests.

A globbed identifier is one containing the character *.

Returns:
whether globbed identifiers are permitted

getPath

public L3DPath getPath()
                throws L3DException
Returns a path bean describing the object.

Overrides:
getPath in class L3DObject
Returns:
the populated path bean
Throws:
L3DException - if no identifier attribute is defined

getPath

public L3DPath getPath(String attribute)
                throws L3DException
Returns a path bean describing the a named attribute of the object.

Overrides:
getPath in class L3DObject
Parameters:
attribute - an attribute name
Returns:
the populated path bean
Throws:
L3DException - if no identifier attribute is defined

getHyperlink

public String getHyperlink()
                    throws SG8Exception
Returns the html for a hyperlink to the object via the given servlet.

The link will use the object's name for text and will open in the same window.

Returns:
a hyperlink to the object via the given servlet
Throws:
SG8Exception - if the object is improperly configured

getHyperlink

public String getHyperlink(String servlet)
                    throws SG8Exception
Returns the html for a hyperlink to the object via the named servlet.

The link will use the object's name for text and will open in the same window.

Parameters:
servlet - an SG8 servlet name
Returns:
the hyperlink to the object via the given servlet
Throws:
SG8Exception - if the object is improperly configured

getHyperlink

public String getHyperlink(String servlet,
                           String text)
                    throws SG8Exception
Returns the html for a servlet hyperlink to the object with given text.

The link will open in the same window.

Parameters:
servlet - an SG8 servlet name
text - text to use in the visible link
Returns:
the hyperlink to the object via the given servlet
Throws:
SG8Exception - if the object is improperly configured

getHyperlink

public String getHyperlink(String servlet,
                           String text,
                           String target)
                    throws SG8Exception
Returns the html for a servlet hyperlink to the object using the given target window.

Parameters:
servlet - an SG8 servlet name
text - text to use in the visible link
target - an href target to use in the hyperlink
Returns:
the hyperlink to the object via the given servlet
Throws:
SG8Exception - if the object is improperly configured

getHyperlink

public String getHyperlink(String servlet,
                           String text,
                           String target,
                           String attribute)
                    throws SG8Exception
Returns the html for a servlet hyperlink to the named attribute for this object.

Parameters:
servlet - an SG8 servlet name
text - text to use in the visible link
target - an href target to use in the hyperlink
attribute - an attribute name to specify in the link
Returns:
the hyperlink to the attribute for the object via the given servlet
Throws:
SG8Exception - if the object is improperly configured

setLocal

protected final void setLocal()
Configures the object to adopt the preferred locale of clients.


isLocal

public boolean isLocal()
Indicates if the object should adopt the preferred locale of clients.

Returns:
whether the object should use client locales

getMailTo

public String[] getMailTo()
                   throws SG8Exception
Returns a list of destination email addresses representing the entry.

Returns:
the email addresses for the entry
Throws:
SG8Exception - if the addresses cannot be determined

preCreate

public void preCreate()
               throws SG8Exception
Does nothing unless overridden.

Throws:
SG8Exception

postCreate

public void postCreate()
                throws SG8Exception
Does nothing unless overridden.

Throws:
SG8Exception

preDelete

public void preDelete()
               throws SG8Exception
Does nothing unless overridden.

Throws:
SG8Exception

postDelete

public void postDelete()
                throws SG8Exception
Does nothing unless overridden.

Throws:
SG8Exception

preUpdate

public String[] preUpdate()
                   throws SG8Exception
Does nothing unless overridden.

Returns:
null
Throws:
SG8Exception

postUpdate

public void postUpdate()
                throws SG8Exception
Does nothing unless overridden.

Throws:
SG8Exception