|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.EventObject | +--com.sssw.srv.busobj.AgoBusinessObjectEvent
Base class of all business object event objects
Fields inherited from class java.util.EventObject |
source |
Constructor Summary | |
AgoBusinessObjectEvent()
|
Method Summary | |
AgaData |
getAgaData(String name)
Returns the named AgaData. |
AgiDatabase |
getDatabase()
Returns the AgiDatabase object which contains this business object. |
URL |
getDatabaseURL()
Returns the URL of the database the business object is in. |
AgiServer |
getServer()
Returns an object implementing the AgiServer interface providing access to other parts of the server. |
HttpSession |
getSession()
Returns the session of this event. |
String |
getUser()
Returns the name of the user associated with the event's session. |
void |
runAgData(AgiDataRunner r,
AgiRowCursor agData)
Walks through an AgaData calling a method before the rows are processed; a method for each row of the AgaData and a method after all rows have been processed |
void |
updateTransactionally(AgaData[] dataObjects)
Updates two or more AgaData objects in a single transaction. |
boolean |
userInGroup(String groupName)
Test whether the current user is in the specified group. |
Methods inherited from class java.util.EventObject |
getSource,
toString |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public AgoBusinessObjectEvent()
Method Detail |
public void runAgData(AgiDataRunner r, AgiRowCursor agData) throws AgoSecurityException, AgoTransientSystemException, AgoUnrecoverableSystemException
r
- the AgiDataRunner to be called.agData
- the agData to run.This method is typically used by business objects which were upgraded from version 1.X agents. It merely provides a simple looping mechanism to walk through an AgaData calling a method for each row of data. It is useful when executing the same code over several different AgaDatas. That code can be encapsulated in an object and this method called mulitiple times with different AgaDatas, avoiding the needto write the loop multiple times.
AgiDataRunner
,
AgiRowCursor
,
AgoSecurityException
,
AgoTransientSystemException
,
AgoUnrecoverableSystemException
public String getUser()
This example illustrates how to obtain the current user.
String user = ControlName1.getUser();
AgoBusinessObjectEvent.userInGroup(String groupName)
public HttpSession getSession()
In SilverStream 3.0 this method changed to return an HttpSession instead of an AgiSession, to be conformant with the Servlet 2.1 specification.
Typically the session is used to store data for the user for the life of
the session, using the methods putValue()
and getValue()
on the Session object.
An example of incrementing an integer counter stored with the session:
HttpSession sess = evt.getSession(); Integer i = (Integer)sess.getValue("counter"); int value = i.intValue(); sess.putValue("counter", new Integer(value+1));
AgiSession
public AgiServer getServer()
The AgiServer object is usually used to get a list of databases on the server or access to AgiDatabases objects which allow other business objects to be invoked, servlet URLs to be created and deleted, etc.
AgiServer srv = evt.getServer();
AgiServer
public AgiDatabase getDatabase()
This is equivalent to calling
evt.getServer().getDatabase("dbName")
but doesn't require
the name of the database to be hardcoded. As such it is the preferable
way of getting the current database. This way the business object will continue to work properly
when published to another database.
AgiDatabase db = evt.getDatabase();
public boolean userInGroup(String groupName)
groupName
- name of the group to test inclusion for.This example checks if the user is an administrator.
boolean admin = evt.userInGroup("Administrators"); if (admin) { // do whatever }
public void updateTransactionally(AgaData[] dataObjects) throws AgoSecurityException, AgoTransientSystemException, AgoUnrecoverableSystemException, AgoInvalidDataException, AgoMissingDataException, AgoDataConcurrencyException
dataObjects
- an array of all the AgaData objects to be updated in the single transaction.AgaData
,
AgoSecurityException
,
AgoTransientSystemException
,
AgoUnrecoverableSystemException
,
AgoInvalidDataException
,
AgoMissingDataException
,
AgoDataConcurrencyException
public URL getDatabaseURL()
Use this URL to build absolute URLs on the fly.
public AgaData getAgaData(String name)
name
- the name of the AgaData to obtain. This must be the
same as the name specified in the Property Inspector.It is not necessary to instantiate the AgaData object, but it must be declared. The AgaData must be navigated using the navigation and dataset management methods available through the AgiRowSetManager, and AgiRowCursor interfaces.
Note that this works for all AgaDatas but that Table Listeners principally use AgaRowDatas and have their own methods for getting at them. See the event objects: AgoRowInsertedEvent, AgoRowDeletedEvent, and AgoRowModifiedEvent for details.
This example from an Invoked business object illustrates how to
declare the AgaData called myData
. This code would appear
in the invoked event.
AgaData myData=evt.getAgaData("AgaData1");
AgaData
,
AgiRowSetManager
,
AgiRowCursor
,
AgoRowInsertEvent
,
AgoRowDeleteEvent
,
AgoRowModifyEvent
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |