package
org.projectapollo.demo.Session.HoldingData;
import apollo.*;
import apollo.Log.*;
import apollo.Template.*;
import apollo.Storable.*;
import apollo.Session.*;
import
org.projectapollo.demo.Storable.*;
import java.util.*;
public class
HoldingDataBroker extends
PageBroker {
private
Vector AS;
private
AcceptClause normalEntry;
private
AcceptClause setSessionObjects;
public
HoldingDataBroker(ManagerTracker MT, String fquid, PageBroker PB) throws
TemplatePageException {
super(MT,fquid,PB);
MT.getPM().registerTemplatePage(FQUID, new
TemplatePage(MT,this));
AS = new
Vector();
normalEntry= new
AcceptClause("NormalEntry");
setSessionObjects = new
AcceptClause("Set
Session Objects");
setSessionObjects.addAcceptClause(AcceptClause.STRING, "SetSessionObjects",
AcceptClause.REQUIRED);
setSessionObjects.addAcceptClause(AcceptClause.STRING, "DataA",
AcceptClause.REQUIRED);
setSessionObjects.addAcceptClause(AcceptClause.STRING, "DataB",
AcceptClause.REQUIRED);
setSessionObjects.addAcceptClause(AcceptClause.INT, "DataC",
AcceptClause.REQUIRED);
AS.addElement(setSessionObjects);
AS.addElement(normalEntry);
}
public
HTTPResponse render(TransactionTracker TT, HTTPRequest req, WebSession
thisSession) throws
ApolloException {
EntryAssertionManager EAM = new
EntryAssertionManager(MT, AS);
EAM.evaluate(req);
if
(EAM.isAccept(setSessionObjects)) {
thisSession.setValue("DataA",
EAM.getString("DataA"));
thisSession.setValue("DataB",
EAM.getString("DataB"));
switch
(EAM.getInt("DataC")){
 
case
1:
{
thisSession.setValue("DataC",
new
Date());
break;
}
case
2:
{
thisSession.setValue("DataC",
thisSession.getValue("User"));
break;
}
case
3:
{
thisSession.setValue("DataC",
new
GregorianCalendar());
break;
}
case
4:
{
thisSession.setValue("DataC",
new
Vector());
}
}
}
Hashtable RT = new
Hashtable();
if
(thisSession.hasValue("DataA"))
{
RT.put("DataA",
thisSession.getValue("DataA"));
} else
{
RT.put("DataA",
"-null-");
}
if
(thisSession.hasValue("DataA"))
{
RT.put("DataB",
thisSession.getValue("DataB"));
} else
{
RT.put("DataB",
"-null-");
}
if
(thisSession.hasValue("DataA"))
{
RT.put("DataCValue",
thisSession.getValue("DataC"));
} else
{
RT.put("DataCValue",
"-null-");
}
SelectObject soDataC = new
SelectObject();
soDataC.addOption("Date
Object", "1");
soDataC.addOption("User
Object", "2");
soDataC.addOption("GregorianCalendar
Object", "3");
soDataC.addOption("Vector
Object", "4");
if
(req.hasValue("DataC"))
{
soDataC.setChoice(req.getValue("DataC"));
}
RT.put("DataC",
soDataC);
return
MT.getPM().getPage(FQUID).render(RT,thisSession);
}// end render
}